MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

icon
Avatar
sisoffi
Posts: 84
Hi at all,
I'm trying to interface Leonardo's Maddog with prepar3D and my home cockpit.
With Event ID is relative simple to interface buttons, switch encoers, but now I'm doing the guidance but,
although the list of events has been released and even the IPC for the LUA displays,
are a little short on notions and difficult for me on how to proceed.

I followed the post where there was probably the same kind of problem but could not do anything:
https://www.mobiflight.com/forum/topic/140.html

problems:
1. i tried to open Lua log window via fsuipc to monitored the event but even in cold and dark the plane sends events and it is difficult to read the contents.

2. even if I could read the topic above, I wouldn't even know how to formulate a sort of LUA to send to mobiflight.
Where should the texts be entered as in the topic?

For the moment this, i hope to start something with your help.

Simone
2019-04-17 15:15
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 3862
Supporter
Hi.

Do you have a registred FSUIPC (Payware) ?

I´m not sure (Maby somebody can confirm) but i think Running Lua scripts is not possible in the Freeware Version isn´t it ?
Good Luck !
2019-04-17 18:02
Avatar
sisoffi
Posts: 84
Hi,
thank you for your reply.
Yes i have a fuispc registered version.

thank you
2019-04-17 19:01
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 3862
Supporter
Then you need to research in the madog forums if there are "lists" with available Offsets, events or variables.

Offsets (Outputs) and Events (Inputs) work directly.
If it use Lvars then you need to build a script ( Here i can´t help you cause i never do this myself. Also my knowledge of programming is poor)
Maby a Forum search helps you.... Keyword "LVAR"

In easy words.... Inputs are mostly done here via Joystickbuttons or Keysends ( Mostly those AddOn aircrafts allow us to set the internal functions on "Keys" or "Buttons".
For Output the solution is a Lua Script. This script read all needed Data from the specific Lvars and "transfer" it to a Free FSUIPC Offset. Mobiflight itself do nothing else like in a standard Aircraft... It just read the Information then not from the Standard Offset..... It now use the offsets you choose for in your script !
Good Luck !
2019-04-17 19:22
Avatar
sisoffi
Posts: 84
yes i have all in my hands. offsets event ID. An example:

....
Flap lever
MD_KEY_FLAP_LEVER_SET EVENTID 70002 EXADECIMAL 0x11172
...
IPC (LVAR)
Radios IPC
md_ipc_com1_active_freq_mhz
md_ipc_com1_stby_freq_mhz
...
Guidance IPC
md_ipc_ap_spd
md_ipc_ap_hdg
md_ipc_ap_alt
md_ipc_ap_vs
md_ipc_ap_spd (ias or mac as in guidance set)
md_ipc_ap_vs (ias or pitch as in guidance set)

now for the switch or buttons, there is no problems. I see with event id that i can easily interface them.
About LVAR i have a big problem because display 7 led segment show me only a list of default Fsuipc i think offsets.
I need to use the Lvar mentioned above like "md_ipc_ap_alt" . So you said to me:

"For Output, the solution is a Lua Script. This script read all needed Data from the specific Lvars and "transfer" it to a Free FSUIPC Offset. Mobiflight itself does nothing else like in a standard Aircraft... It just read the Information then not from the Standard Offset..... It now uses the offsets you choose for in your script !"

it is these passages that I do not understand:
1. how to make a correct script.
2. where it should be inserted in mobiflight
3. how it is read and interpreted in mobiflight.

many thanks
Simone
2019-04-17 21:55
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 3862
Supporter
Hi again.

The script is NOT implement in Mobiflight !

Mobiflight simply read a OFFSET of FSUIPC and can show the data for example a value on a 7Seg Display.
Mobiflight itself can not read Lvars or also can not do any scripts .... Mobiflight simply is a "reader" for FSUIPC Offsets.
Your Problem is.... Instead of famous AddOns like ProSim,Magenta, PMDG and so on ... YOUR Maddog support its values NOT to FSUIPC (whatever why)
So regulary Mobiflight can not show your Data ( cause as i said before Mobiflights ONE AND ONLY comunication posibility is FSUIPC !)


The Key to work with non compatible AddOns like yours is you need to build a "compiler". A EXTERNAL Programm that read Lvar Values directly in the Sim and then write the data on a free FSUIPC Offset (that is not in use at the moment) . THEN Mobiflight can show your Data on a display... cause NOW the Data is again on a FSUIPC Offset.

This compiler can be a self running Programm.... For example the IFLY B737 got a programm that will run in backround and will "output" the Data to FSUIPC.
I don´t know if a programm like this is existing for your Maddog. that would be the most easy and fast way. Ask for that in the Maddog Support Forums !

If NOT you must build a script that will run INSIDE of FSUIPC.... And Thats something like this..... https://www.mobiflight.com/forum/message/1947.html
You need as i said above a script that read a couple of Lvars and write it to some Offsets at all time.

Again sorry but my knowledge in LUA or C# scripting is still poor. I can´t help you here. Maby you find somebody who can guide you or you go the "hard" but more profitable way and learn programming yoreself !
A good hint is to goolge for "LUA Programming guide" or you search for "LUA + Maddog + FSUIPC"

******************
@ Advanced Users here. SOME of you still have those scripts working. Maby you can guide him ! Get in Contact please !







*****
Good Luck !
2019-04-17 22:41
Avatar
sisoffi
Posts: 84
thank you very much to effort to help me.
If i open a log fsupc i see continuos log running :

1223703 WRITElua 68F0, 4 bytes: 00 00 00 00 ....
1223703 WRITElua 68F4, 4 bytes: 00 00 00 00 ....
1223703 WRITElua 68F8, 4 bytes: 00 00 00 00 ....
1223703 WRITElua 68FC, 4 bytes: 00 00 00 00 ....
1223719 WRITElua 6900, 4 bytes: 00 00 00 00 ....
1223719 WRITElua 6750, 4 bytes: 00 00 00 00 ....
1223719 WRITElua 6754, 4 bytes: 31 00 00 00 1...
1223719 WRITElua 68E8, 4 bytes: FA 00 00 00 ....
1223719 WRITElua 68EC, 4 bytes: 00 00 00 00 ....
1223719 WRITElua 68F0, 4 bytes: 00 00 00 00 ....
1223719 WRITElua 68F4, 4 bytes: 00 00 00 00 ....

are not offset them?
thanks
2019-04-17 22:58
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 3862
Supporter
Looks like "somebody" tell your FSUIPC it should write something on that offsets !

I can´t know "WHO" is that. If you still experiment with the scripts maby thats the result of "your" work. Or maby your Maddog do that.... or maby a complete different Programm ( Like a Wether AddOn or a Flightplanning software.)
Without see your system and your installed software (and know what you do in the past) i can not tell you WHAT is happen there.


Basicly you must know (or find out) whats the origin of that writes. Maby test with another aircraft if they are gone... Then you knwo thats Maddog for example.
Good Luck !
2019-04-17 23:11
Avatar
sisoffi
Posts: 84
then in the past I worked with the script that created skalarki with its boards via a lua file.
Through what is going automatically we can read all the outputs. This is some passages of lua inside modules is like this:

- MD80 Interface BY sKALARKI
- LUA Script V 1.0
- 20.10.2011

function setAirplane (offset, value)

  acftname = ipc.readSTR (0x3D00, 35)
  ipc.log ("Lua script started for Aircraft:" .. acftname .. ":")
  handleName = "Error"
end


- call the function on startup of Lua
setAirplane (0x3D00, "")


while 1 do

ovhd_a1 = ipc.readLvar ("L: ovhd_eoap_a1_adv1")
ipc.writeUD (0x66F0, ovhd_a1)

ovhd_a2 = ipc.readLvar ("L: ovhd_eoap_a2_adv1")
ipc.writeUD (0x66F4, ovhd_a2)

ovhd_a3 = ipc.readLvar ("L: ovhd_eoap_a3_adv1")
ipc.writeUD (0x66F8, ovhd_a3)

ovhd_a4 = ipc.readLvar ("L: ovhd_eoap_a4_adv1")
ipc.writeUD (0x66FC, ovhd_a4)

ovhd_a5 = ipc.readLvar ("L: ovhd_eoap_a5_adv1")
ipc.writeUD (0x6700, ovhd_a5)

ovhd_a6 = ipc.readLvar ("L: ovhd_eoap_a6_adv1")
ipc.writeUD (0x6704, ovhd_a6)

ovhd_a7 = ipc.readLvar ("L: ovhd_eoap_a7_adv1")
ipc.writeUD (0x6708, ovhd_a7)

ovhd_b1 = ipc.readLvar ("L: ovhd_eoap_b1_adv1")
ipc.writeUD (0x670c, ovhd_b1)

ovhd_b2 = ipc.readLvar ("L: ovhd_eoap_b2_adv1")
ipc.writeUD (0x6710, ovhd_b2)

ovhd_b3 = ipc.readLvar ("L: ovhd_eoap_b3_adv1")
ipc.writeUD (0x6714, ovhd_b3)

ovhd_b4 = ipc.readLvar ("L: ovhd_eoap_b4_adv1")
ipc.writeUD (0x6718, ovhd_b4)

ovhd_b5 = ipc.readLvar ("L: ovhd_eoap_b5_adv1")
ipc.writeUD (0x671C, ovhd_b5)

ovhd_b6 = ipc.readLvar ("L: ovhd_eoap_b6_adv1")
ipc.writeUD (0x6720, ovhd_b6)

ovhd_b7 = ipc.readLvar ("L: ovhd_eoap_b7_adv1")
ipc.writeUD (0x6724, ovhd_b7)

ovhd_c1 = ipc.readLvar ("L: ovhd_eoap_c1_adv1")
ipc.writeUD (0x6728, ovhd_c1)

ovhd_c2 = ipc.readLvar ("L: ovhd_eoap_c2_adv1")
ipc.writeUD (0x672c, ovhd_c2)

ovhd_c3 = ipc.readLvar ("L: ovhd_eoap_c3_adv1")
ipc.writeUD (0x6730, ovhd_c3)

ovhd_c4 = ipc.readLvar ("L: ovhd_eoap_c4_adv1")
ipc.writeUD (0x6734, ovhd_c4)

ovhd_c5 = ipc.readLvar ("L: ovhd_eoap_c5_adv1")
ipc.writeUD (0x6738, ovhd_c5)

ovhd_c6 = ipc.readLvar ("L: ovhd_eoap_c6_adv1")
ipc.writeUD (0x673C, ovhd_c6)

ovhd_c7 = ipc.readLvar ("L: ovhd_eoap_c7_adv1")
ipc.writeUD (0x6740, ovhd_c7)

emer_pwr = ipc.readLvar ("L: ovhd_emerg_pwr_adv1")
ipc.writeUD (0x6744, emer_pwr)

master_warn = ipc.readLvar ("L: masterwarn_adv1")
ipc.writeUD (0x6748, master_warn)

master_caut = ipc.readLvar ("L: mastercaut_adv1")
ipc.writeUD (0x674C, master_caut)

eoap_ctrl = ipc.readLvar ("L: ovhd_eoap_ctrl_adv1")
ipc.writeUD (0x6758, eoap_ctrl)

eoap_door = ipc.readLvar ("L: ovhd_eoap_door_adv1")
ipc.writeUD (0x675C, eoap_door)

ovhd_apu_bus = ipc.readLvar ("L: ovhd_apu_bus_adv1")
ipc.writeUD (0x6760, ovhd_apu_bus)

Now i try to understand, these offsets how to put inside mobiflight? there is a step guide?
2019-04-17 23:17
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 3862
Supporter
Looks like you have a thinking blockade ! :w00t:

This script READ all the stuff (looks like these are Announciator Status Data for LED of Overhead Panel) and WRITE it to the specific free FSUIPC Offsets.

For example

iconCode:
ovhd_a1 = ipc.readLvar ("L: ovhd_eoap_a1_adv1")
ipc.writeUD (0x66F0, ovhd_a1)


Here the script READ the Lvar "L: ovhd_eoap_a1_adv1" (Sorry i don´t know what this is exactly without using the aircraft)
Then it put the data temporarly in the Variable "ovhd_a1"
The second line now WRITE the FSUIPC Offset 66F0 with the information from temp. variable "ovhd_A1" he create before.
Summary.... The script read Lvar and write data to the Offset.... And thats all the time and for all including Elements.

*********

iconQuote:

Now i try to understand, these offsets how to put inside mobiflight? there is a step guide?



These question i not understand. You still do the "Parking Brake Tutorial". So you know how to set a Function to a LED for example.
THIS Situation is simmular. From your script you know on what Offset there is written what information....
For example the line from Above on 66F0 is the information of this EOAP-A1 . If this is a LED then make a Output Config (Like for parking Brake) but NOW use not the Parkingbrake Offset.... Now you use the Offset 66F0.


In easy words..... For Mobiflight it makes no diffference if a Offset is Original from FSUIPC or created through your script. You simply read a Adress... Define the Size and Typ of Data and show it on a device.
Good Luck !
2019-04-18 09:48
Avatar
sisoffi
Posts: 84
thank you very much for your help.
I tried some tests and everything seems to work by associating the offset or id event in mobiflight. however, I am experiencing these problems.
1. at today I can't find a console to monitor lvars slowly, in fuispc everything flows quickly and it's impossible to read values flux.
2. the autopilot displays show both in mobiflight reading and writing windows tand also in the 7 segment display, the data latency than the values indicated in the virtual cockpit.
This is due because the values are alternate with zero values.

For example the speed indicates is 250 in Vc and 7segment, I turn the encoder to bring it to 260. In the VC I have 251-252-253-254 ... in the 7segment display we have on display 251-000-252-000-253-000-254. .. creates a delay in displaying thus showing the final value 260. Even at 260 at steady speed the display alternates with 260 and 000 ...

thanks!
2019-04-22 01:48
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 3862
Supporter
Do you use the "Virtual" Encoder in the Sim or do you use a Real Encoder (set in Mobiflight) ???

If virtual Encoder then there is a Problem in the Lvar System.... Here a research is needed.

If Real Encoder via Mobiflight then we need to know "how" you set this encoder. If you for example try to Write the Same offset then this can not work. In this example thats a READ Offset system. Not a Read-Write.

For Inputs there exist another ways.... Most prfitable is to use Joystickbuttons, Keycommands, FSUIPC Macros and so on.
If you like to make the Input via your Script then you need a "logic" that compare the Offset Value and the Lvar Value. But here my knowledge is to poor. Sorry for that.
Good Luck !
2019-04-22 15:32
icon