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!
05/03/2024 - This forum is read-only
The community support for MobiFlight has moved exclusively over to our Discord server. Register for free and enjoy more interactive functions like image and video upload, voice chat. More than 7,000 registered users around the world make it a great experience!
A HUGE Thank You to everyone who participated in the forum, especially obviously to Pizman and Stephan who did an outstanding job over so many years providing an incredible service to the MobiFlight community.
The forum is still providing a lot of good content, hence we keep this information accessible.
I working on aerosoft Airbus mcp. Able to display spd, hdg, alt, and vs by read Lvar to FSUIPC offset and put them to placeholder. Problem is in managed mode, the reading change to "_ _ _ *". I want to display either " " or "*" so I assign either character " " or "*" to a free offset and put into a placeholder. It then only display the ascii number either 32 or 42 for the character "*" or " " but not the character itself. Can someone help ? Thanks.
Sorry i not work with Airbus and can not figure out the situation in my brain
Please Tell me.... What is shown on Display ( Virtual Aircraft) in What Situation ( Normal Mode / Managed Mode )
Then Tell me... What Value have the Offsets you read out in both situations.
Then Tell me.... What is shown at the moment in your Display in Homecockpit in both situations
finaly tell me... What exactly should correctly shown on your Display in Homecockpit in both Situations
I´m Sorry but " " and " * " and " _ " is a bit confusing.... Please show me the FULL Text... If it use 5 Digits then write here " * * * * * " for example.
Also maby tell me your Setup for the Display like " Line 1: ALT %%%%% SPD §§§§ " so i can understand how you setup the Display finaly!
thank pizman, i know i can rely on you, the expert
i setup LCD as follow line1 SPD HDG
line2 ??? §§ &&& ##
placeholder1 spd as ?
placeholder2 spdmode as §
placeholder3 hdg as &
placeholder4 hdgmode as #
then set up output spd to offset 0x66C0
spdmode to offset 0x66DA
hdg to offset 0x66C8
hdgmode to offset 0x66DC
i write lua script to read correct Lvar to spd and hdg offset, spdmode and hdhmode to each variable which either 1 for managed or 0 for normal.
if spdmode variable is 1 then assign character * to spdmode offset, if not then assign character SPACE to spdmode offset. same for hdg. now i have spd offset 0x66C0 contain speed value, hdg offset 0x66C8 contain heading value and spdmode offset 0x66DA and hdgmode offset 0x66DC contain chracter * or SPACE depend on their mode.
i then run lua script and i can see my LCD change its speed and heading when i change the knobs on my virtual cockpit, but i only see either 42 or 32 in place of * or SPACE on my LCD.
i run my lua script again to get exact display on virtual cockpit, MF windows and LCD.
on normal mode. virtual cockpit show.
SPD HDG
112 328
MF windows offset value
spd 112
hdg 328
spdmode 32
hdgmode 32
LCD
SPD HDG
112 32 328 32
on managed mode by pushing speed knob and heading knob. virtual cockpit show.
SPD HDG
- - - * - - - *
MF windows offset value
spd 112
hdg 328
spdmode 42
hdgmode 42
LCD
SPD HDG
112 42 328 42
i understand spd and hdg value not changed but displayed in virtual cockpit as - - - in managed mode and i have to figure out how to do changed numbers to - - - in my LCD. but the mode string value , by using lua command ipc.writeSTR(0x66C0, "*") or ipc.writeSTR(0x66C0, " "), is displayed as the ascii number of that character, not the character itself.
in other words, placeholder can only hold numbers, not characters. am i corrected ?
by using lua command ipc.writeSTR(0x66C0, "*") or ipc.writeSTR(0x66C0, " "), is displayed as the ascii number of that character, not the character itself.
in other words, placeholder can only hold numbers, not characters. am i corrected ?
No they can also Read (and show) Characters AND Numbers.... But you must use the correct syntax !!!
I not good in LUA Programming ( try to learn it but not find time) ..... Pretty shure the "STR" in the command means you create a STRING Offset.
That mean you write TEXT instead of a Value. ( Whatever the text is internal already Binary/INTValue but that is not the fact)
To make this working with mobiflight please confirm in your READOUT Configs for the 2 Modes you also Use STRING as Type in the Mobiflight Config..... AND You define correct Substring Start/End Length Points.
For me it sound you NOT do this correctly ... Cause the result of a decimal Number (Asci Code) instead of * or Space Characters looks like you READ the Offset by Mobiflight as INT ( But you write it via LUA as STRING).
( As i told above.... Basicly the STRING Offset include just a couple of ASCI Codes... So it result in a Number for every sign 1 Byte = 1 Character)
SOLUTION for the Mode Problem.
You can try out to make the mobiflight Config reading correct STRING instead of INT ..... BUT I´m not shure if a Single "Space" can be calculated by the System. You must try out.
Last note here: You need NOT TWO Diggits to show STAR* or Blank ... One is enough. So i would reduce the §§ and ## variables to only one each !
*************
Problem 2: Missing "- - -" while Managed.
If your expanetation is correct and Value of SPD and HDG is hown whatever "Managed Mode" is on ( And value is also shown in the FSUIPC Offset as you said) then it is simply not exported by your LUA Script.
Again the Problem.... I Not see the script.... So i not know if this 2 Offsets are STRING or INT (Written by LUA and Read by Mobiflight ??)
If they are STRING you can show it directly.... but then Your AddOn (or a IF Condition in Lua script) must support the "- - - " while managed.
In Case it show a correct Value while Normal mode i will say... You use INT in Lua and INT in Mobiflight... OR You use STRING in Lua and String in Mobiflight. But i can not see what you do just with the information from last Posting!
*************
Summary...
I think the best way to make this work is a "good" Lua Script. Do you just coppy the script from somebody or do you write it youreself ??
If you have some skills in LUA i think you can make this perfect working in a much better way like at the moment !
For example if you work with Strings.... You can Include the STAR or Space Symbol direct in the String of the Heading ..... So you need just 1 Read Config in Mobiflight.
Then all the Calculation ( - - - and * while Managed Mode) is done in the LUA script.... Mobiflight just simply show the Result !
Other way is to just support INT Data to Mobiflight and make the whole calculation there.... But the mixing this occure in a problem i think.
If you like..... Give me the LUA Script ( Maby just paste here in forum the Relevant Lines for HDG,SPD, and the 2 Modes ..... The Full Parts with READ and WRITE please.
Also quote me if possible the "List" where you know what Lvar is what data and witch Syntax (String or INT) this Data is in the Lvar itself for the 4 parts !
Again im not professional in LUA.... But i think i can help you with more details and the code in my hand !
U are the man
My bad. I writeSTR to offset in lua script, but leave it as int in MF output. With correct string type, now my LCD display 112* and 328* as spd and hdg in managed mode , as 112 and 328 in normal mode. I wrote the script myself and it very simple. Now have to work to write script to convert 112* and 328* to ---* as in virtual cockpit. I will post the script soon, as well as how to. This is just a test setting and will need lots more work. So still far from perfect.
Hi again....
If you self write the code.... then you should be able to understand and build youreself the folllow.....
My theory ....
I would looking forward to include all calculations in the Lua Script .... So Mobiflight will only read a String Value (for example the HDG display) and all is done already..
So i think you should Read all Informations (LVars) that you need here.... And you write If Conditions in the LUA Script ....
For Exampel you read the HDG Lvar to Variable 1 .... And you Read the Condition when "---" is shown to variable 2
Then you Say.... IF Condition (Variable 2) say "---" should shown THEN Ipcwrite "---" to Offset X ... ELSE ( So if Condition is False and noral Value should be show) then Write Variable 1 ( The raw HDG Value) to Offset X .
I wrote about this long time ago already.
With this technic you can also include things like Lighttest and Battery Master Switch, too.
For this example you also readout the Status of Batteryswitch and Lighttest Switch .....
And now you say for example
IF Batter is OFF Then Write "SpaceSpaceSpace" to the Offset ....
ELSEIF Ligttest is Active then Write "888" to the Offset ( So it looks like in Real Airbus when all Diggits show 888)
ELSEIF ( So all situations when Battery is ON and Lighttest is OFF same time ) If Condition of "---"is true then Write "---" to Offset
ELSE ( Finaly The situation when Battery is ON .... No Lighttest in Progress ... and no --- Condition active) Write Data of Lvar Heading to offset.
***********
I hope you understand my intentions..... With this calculations in LUA Mobiflight finaly is just like a "screen" ... MF will do nothing here . Only show the "Final calculated" Value all the time.
For Standard Aircrafts and FSUIPC Compatible Aircrafts nobody make this workflow to outsourced this work.... BUT. You already need a LUA Script to get the Values from Lvars to Offsets..... So it will be the logical result (i think) to already recalculate this values in the code.
With advanced scripting skills you pretty shure can make this more easy..... For example you readout 100 Lvars for 100 Different LED ..... Here you not need to make the IF Condition for Battery Switch and Lighttest in every line.... Pretty shure you can sumup all this single scriptparts and then you say " IF Battery is OFF then All Functions Form LED 1 to LED 100 should show "0" instead of raw Lvar Vallue. Maby you should ask here a professional programmer for help !
Have Fun .... And i looking forward to see your script if it work as it should. I hope i can learn something with reading that !
u are really up to the reputation. always think way ahead.
i have same idea as well.
been playing with LCD and it fun.
let talk about spd. in normal mode. vc (virtual cockpit) show 234 and change with turning vc spd knob, LCD show same thing and change.
in managed mode. vc always show ---* . LCD show 234* and change even without touching vc speed knob. the speed change managed by the flight
computer as it should be, except now u can see the change in LCD. i think i may keep that way so i can see the actual speed managed by the flight
computer rather than just see ---* as in vc.
about your suggestion to display --- . i have same idea except one more detail.
i use offset 0x66C0, int, 2 byte for spd value and offset 0x66DA, string, 1 byte for spdmode. and it work out as above.
to display --- , i have to assign --- to 0x66C0, then i have to define 0x66C0 as string in MF.
to assign 234 back to 0x66C0 now, i have to convert 234 to the string "234" and assign to 0x66C0.
for alt, no need to do that since alt does not change to ----- at all.
what you think ?
btw, i sent you the airbus Lvar list for reference.
This is a possible way.... I will give you some other ideas !
Basicly there are more possible solutions, too.
The Question is finaly.... How should the Result should be ??
You can do this with a INT Value, too in that case !
Basicly we can make ONE Compare Also in Mobiflight with the INT Value . ( I know this is sad but Sebastian only include one Compare Tab finaly without ELSEIF Function A.t.M.)
So we can say ... If Value is a INT Number (for example 999) THEN Set Output to a STring Word like "Hello" or "---" in our case.
BUT We can not use this more then one Time..... So we can not say If Value = xxx Then set --- ELSEIF Value is yyy Then set to "Space Space Space"
So we can NOT simulate Blank AND "---" Same time with this technic.
[/b]
So Example... If you say you NOT need a the Battery OFF Blank System ( Cause you for example Disable the full LCD Display via a Relais so its dark) .....
Now we need 3 Things .....
1. Value of SPD should be shown while "Normal Mode"
2. --- should be shown while Managed Mode
3. 888 should be shown while Lighttest.
Now you can work with INT Offset already.
First you need to READ the Light Test Situation. (Var1)
Second you read the Managed Mode Situation (Var2)
Third you read the SPD Value (Var3) If Condition :
IF Lighttest (Var1) is in Progress Then WRITE to INT Offset 2 Byte "888"
ELSEIF Managed Mode (Var2) is Active Then WRITE to INT Offset 2 Byte "999"
ELSE (All other conditions means No Lighttest and not managed) then WRITE to INT Offset 2 Byte "Var3" (The SPD Value)
Now we have in all situations a INT Output on same Offset (not a String) ...... In Mobiflight the Display show Value while Normal .... Correct 888 while Lighttest
BUT it show now 999 when it should show --- ... And here you can work with te one possible Compare ..... You say in the MF Config IF Value =999 then set to --- ELSE $
You see... A Different Way without using STRING Value....
Another Trick.... Are i´m right that the " STAR * " Symbol on SPD is only active while managed Mode ON in this situation the SPD Value must be ALWAYS - - - ?
If Yes you not need a Additional config , offset and Display Placeholder for the STAR in that case.
Simply Rework the Compare from Above and Say... IF Value = 999 Then set to " - - - * " Then the STAR is shown also.
****
Finaly a other technic for the "STAR* " if you not include it in SPD like explaned above.
If i understand right you read
This look like a INT Boolean Value ( 0 = Managed .... 1= Normal)
So you not need to write this to a STRING via Lua Script.... Write it to a 1 Byte INT Offset.
In Mobiflight you read that Offset and you use compare : IF Value = 0 THEN set to " * " ELSE set to "SPACE"
****
Summary to bring this topic to a end....
You can if you understand the script write all things in there final Status to the Offsets via Your LUA Script.
If you need Characters or Signs ( all out of 1234567890 ) you need a String instead of INT.
BUT Strings need lots of Offset Space. So i would use INT if possible.
Just think if you can Compare /Rework the Value easy in Mobiflight ... If NOT get the way via String Offsets.
Last Note: Check for Lighttest how the Lvars work. "Maby" your Aerosoft Airbus will already include this.
Check if while Lighttest the Display value is already "888" without you rework it already by the system
Check also if Boolean Values of LED´s Lvars (Annuciators) are alredy "1" while Lighttest or "0" while Battery Off. "Maby" Aerosoft still do the work for you !
LCD1
line1 SPD HDG
line2 ???§ &&& #
placeholder1 choose spd as ?
placeholder2 choose spdmode as §
placeholder3 choose hdg as &
placeholder4 choose hdgmode as #
LCD2
line1 ALT V/S
line2 ?????§ &&&&& #
placeholder1 choose alt as ?
placeholder2 choose altmode as §
placeholder3 choose vss as &
placeholder4 choose vssmode as #
spd offset 0x66C0 int 2byte
hdg offset 0x66C8 int 4byte transform $*0.0054931640625
alt offset 0x66D5 int 4byte
vss offset 0x66C2 int 2byte transform $*100
spdmode offset 0x66DA string 1byte
hdgmode offset 0x66DC string 1byte
altmode offset 0x66DE string 1byte
vssmode offset 0x66E0 string 1byte
create a text file including the following script and rename to airbustest.lua
-------------
while 1 do
SpdMode = ipc.readLvar("L:AB_AP_SPDmode_set")
if SpdMode == 1 then
ipc.writeSTR(0x66DA, "*", 1)
else
ipc.writeSTR(0x66DA, " ", 1)
end
HdgMode = ipc.readLvar("L:AB_AP_HDGmode_setDisp")
if HdgMode == 1 then
ipc.writeSTR(0x66DC, "*", 1)
else
ipc.writeSTR(0x66DC, " ", 1)
end
AltMode = ipc.readLvar("L:AB_AP_ALT_Mode")
if AltMode == 1 then
ipc.writeSTR(0x66DE, "*", 1)
else
ipc.writeSTR(0x66DE, " ", 1)
end
VssMode = ipc.readLvar("L:AB_AP_KNOBALT")
if VssMode == 0 then
ipc.writeSTR(0x66E0, "*", 1)
else
ipc.writeSTR(0x66E0, " ", 1)
end
copy the lua file to your fsx/modules/ folder. you need registered fsuipc latest version installed, i believe it is now version 4.971.you need at least version 4.6 or later.
go to buttons+switches or key presses, then assign to either one button of your flight controller or combination of pressed keyboard keys to run "lua airbustest.lua" ( your lua script file name in your fsx/modules/ folder ). also assign another button or keys combination to stop" luakill airbustest.lua".
now run your fsx, load airbus plane, run MF, make sure module and fsuipc all green, press the button or keys combo to start lua script and see spd hdg alt v/s displayed on LCD. you can turn vc knob or click it to see value changed accordingly and * to indicate it in managed mode by flight computer. in managed mode the value changed by flight computer and you don't need to turn knob manually.
things to be done
display --- in managed mode instead of actual numeric value.
work on inputs with encoders and buttons.
Spd in normal mode, you can change value by turning vc knob
Hdg in managed mode, value changed by flight computer during flight but here you still can see the value
Alt and vss in normal mode, you change v/s by turning knob. * displayed here by mistake, I thought for v/s,1 for managed like the others, but it is 0
I fixed it in script but lazy to take pict again.
We can close this topic now. It is to serve as basic to use lua script to setup hardware to interface with non Fsx standard addon like aerosoft.
More work to be done and it is possible with the amazing MF. For example, spd switch to mach mode, hdg to trk, v/s to fpa under certain special condition and manually with buttons. I am much appreciated pizman for his enthusiasm and brilliant ideas. I am sure others can come up with innovative solutions as well. To say how wonderful MF is, I like to state that my mcp only cost me around $50 to build at home, and I learn a lot doing it. Having so much fun at same time. Otherwise I am not sure I would spend $500-$1000 to buy a commercial mcp. Til next time.
Better pict of my homemade mcp. Not finished yet and it is prototype, so I am sure there lots of errors, it seem to work well though.
On right side there space for another LCD and more buttons and one extra encoder for setup radio, com and nav panel.
That's all folks.
Thatchi, I appreciate that your post was over 12 months ago but I am just getting into Mobiflight! I am building a switch box and want to have the FCU displays included.
Do you use yours with the Aerosoft Airbus Pro? If so would it be possible to see the script?