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! 

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!

See you on our MobiFlight Community Discord server.

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.

icon
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi Comunity.

Today we proudly present the new "Variable Tool" comming live with 7.6.0 !

Pretty sure a lot of questions occure in the future about this and i try to make a tutorial when i startup working with that new feature.....
For now i will give you a short overview about the System to help you with the first steps..... More Guides in work !

********************

1. What is the new Tool doing....
From now we be able to define the Value of an existing OUTPUT Config as a "Placeholder" that can be used in a OTHER Config for Expression Calculation.



2. Why do we need this.....
Basicly 98% of the new posibilitys was already possible in former Mobiflight Versions..... But in a more difficult way and mostly with some tricky technics needed.
The big benefit is that we can now save a lot of configs, whatever we got the same (or better) result.
So if your System do what it should do you must NOT rework your configs. But if you make a new Project ( Or like to optimize) you can now work with that variables.
The other 2% is a real new posibility..... To Calculate a complete indipendend Value by using 2(or more) Single Configs ( For example needed for MagneticHeading, TAS, Altitude above Ground or some Solenoid Systems) . In Case this is verry specific i will not talk about that now.



3. Where can we find the new tool.....
We moved the "Placeholder" GUI, you still know from the LCD Displays to the FSUIPC Tab in Output Configs.... Additional we increase the number of Placeholders from 4 to 6.
NOTE The GUI is show at beginning NO Placeholders aslong a minimum of 2 Output Configs exist in the MCC File.... Then it will increase up to 6n Placeholders on the 7th. Config.
So not scarred if you not see the new feature after startup a new Project.
Also note that the old "PlaceholderGUI" in the LCD Display Tab is no longer available..... But the Function is still the same if you use the GUI in the FSUIPC Tab. Additional older Configs with already used LCD Configs will work 1:1 with same settings..... Just the GUI is also moved in that case.
Finaly the Tool itself is not visible in the GUI cause its a part of the "Expressions" ... So the little code you can enter in the Transform Field like "If($=1,2,3)"



4. How to SET a Placeholder
Here the GUI is simmular to the alredy known LCD System..... And the GUI is also used for BOTH systems same time.
In a LCD Config you define for example as Placeholder 1 the Output Config "Com1 Atctive Frequency" and use "#" Symbol. Then you can write the "#" in the Text field to show it on your LCD.
For the new tool its nearly the same with one little difference.....
In LCD you will write for a 4 Digit Output in the Text field "# # # #" .... For the Math Calculation it is used only ONE TIME..... So "#" in that case include the whole value like "12150" for example if you set the Emergency frequency on Com1.
Summary.... Setup the Placeholder is the SAME like in the past ..... Just the usage of it in the follow steps got this little difference.



5. Using a Placeholder in a Transform ..... Simple Example.
Lets say we like to Show the Status of Flightdirector on a LED .... BUT the LED should only light up aslong Master Battery switch is ON.
Till now we have to create 2 Configs and a precondition to make this working ( One that read Flightdirector and a other that was transformed to Zero to deactivate the LED)
NOW we do this in One Config.
At first we need a "Readout" Config that give us the Status of Master Battery Switch ( Like in the past, too) . We create a output Config that read this Offset and not use a Device.
Lets called it BATTERY in that example . ( Like in the past this config is "Global" and will be used for all LED in the System same way)

Now we create a Config that reads "Flightdirector Offset" .
In the past we now create also the "OFF Config" for that LED and must make each a precondition. With new tool we define now a Placeholder in that Config and use "BATTERY" as Value .... As Symbol lets say we use the character "A".
So..... Now "A" is represent now mathematical the value of the Battery Offset .... 1= ON 0 = OFF .
Finaly we write our transform ..... And say " if(A=0,0,$) " Means.... Aslong "A" (Battery Offset) is 0-OFF THEN show Zero .... IF NOT (ELSE) show $ (Value of FD)
Result: We got now a LED that include the Battery Offset Logic ..... But need only ONE Config instead of TWO in the Past.



5. Advanced Example.
Lets say we like also inclide a Lighttest ( What need in tha past a additional 3rd. Config for each LED)
We again make a global Readout for the Lighttest switch (Called it LIGHT ) (Value 0=OFF 1= ON)
Now we define in the Flightdirector Config a second Placeholder that use LIGHT as Value und use Character "B"

Here our logic say.... LED should be always OFF if Battery is OFF (Same like in example 4) but it should be now always ON if Lighttest is ON else it should show the FD Status.
here the right transform would be .... if(A=0,0,if(B=1,1,$))
This simple Line in Transformfield do the SAME like 3 Configs and 6 Preconditions in the Past ! AND its the SAME line for every LED Output in the Cockpit.... So you can simply "duplicate" it and just rename it and change Offset..... The whole technic for Battery and Lighttest is still working correct.
That save you hours of Config writing and save Mobiflight hundrets of unneeded Configs !




6. Problems
At the first release we NOT support "Strings" So you NOT be able to execute a tring value like "Space Space Space" by the Transform.
BUT i already figure out a good system to also do this ( by Compare Tab) ..... So from now also 7 Segment Configs NOT need a "Blank" Config. We can include it !

Please wait for a detailed guide in the next time.... or simply ask for help. Its to much to also explane all the deepness of that tool in one topic here.



****************
Summary:
The Tool give us a mighty weapon to do things that was not directly possible till now. BUT it is NOT a Must Have. So not feel threated to use it !
Enjoy it and ask if you need help !
Good Luck !
2019-09-11 19:27
Avatar
DeltaBravo
From: Schneeberg, Germany
Posts: 90
Great Tool

I have to supplement a little note.
The config within the transformfield is used, has to be below the configs within the shortcuted variables.

For pizmans example.
You first have to readout BAT and Light Test values. After this Config you can put your Led-Config within it's transform. If it's above, the variables a and b are not yet set and MF stops working.

Greetz,
Stephan
PMDG based 747 Homecockpit, 3 Beamer
P3Dv4.3 QOTSII FSUIPC 5full 6xArduinoMega CDU cpFlight 747MCP
2020-01-20 15:34
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Thanks for comment this.....

Problem troubleshooting is still in progress.... https://bitbucket.org/mobiflight/mobiflightfc/issues/235/mobiflight-stops-when-a-formula-references
Good Luck !
2020-01-20 21:21
Avatar
alpan
Posts: 15
Hello Guys,
I'm working on an AIRBUS A400M homecockpit and I have some problems with placeholder tool. On the simulator, I have an HOTAIR FAULT LED which is not only ON when BATTERY STATUS is ON but until the last BLEED AIR FAULT LED is OFF (not necessarily n°4). The engine's running sequence has no importance. There is neither OFFSET nor LVAR for this HOTAIR LED. I created many outputs:
1. BATTERY STATUS, no device as A in the config references
2. HOTAIR 1 FAULT LED
3. ENGINE 1 BLEED FAULT LED as B in the config references
4. ENGINE 2 BLEED FAULT LED as C in the config references
5. ENGINE 3 BLEED FAULT LED as D in the config references
6. ENGINE 4 BLEED FAULT LED as E in the config references
Off course, when BATTERY is OFF the HOTAIR LED will be OFF too.
So my question is, what can I write in the transform box (if(A=0,0,if......) ?

Does anybody has a solution for me? I'm sorry, but my skills in programming are poor!!!
Regards
Albert
2020-04-24 12:03
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
More details about the logic needed .....

The LED must be OFF if Battery is OFF ..... It Must be ON of BAttery is ON...AND.... What ??
I not undertand if it should light alslong one or more BleedAir Fault LED are ON OR inverted if it should go ON AFTER the last BleedAir Fault is OFF.

Basicly we have here two ways.... We can work with a Math Logic..... We need maby the AND Command ( & ) or we need the OR Command ( || )
The other way i a little trick..... Does the Engine Bleed Offsets are in a row ?
If Yes for example 4 single Bytes Boolean directly behind then we can read this 1 BYte Offsets together as a 4 Byte INT.
If we read the whole Block we can say.... If Value is "0" then all 4 Offsets must be OFF ..... If value is 1 or more then one of the 4 Offsets is on.

Note: This 2nd way only workes if offsets are in a row.


Summary:
1. Tell me exactly when LED must be ON or OFF
2. Check if the 4 Faul LED Offsets are in a row
3. Confirm how this LED Offsets work.... Are they "1" if Fault LED must be ON or inverted?

Then i can tell you correct formula !
Good Luck !
2020-04-24 18:27
Avatar
alpan
Posts: 15
Hello Pizman82,
I thank you for your reply, insomuch as it is the second time I ask you for help in short time.

1st answer:
First of all, when BATTERY SWITCH is "ON", HOTAIR 1 FAULT LED will be "ON" too. Second, suppose all engines are running, HOTAIR 1 FAULT LED is "OFF". As soon as you stop one engine, whatever this is engine 1,2,3 or 4, the relevant ENGINE BLEED FAULT LED will be "ON" in the same time HOTAIR 1 FAULT LED will be "ON" too.
The engine you stop has no importance, the result is that the HOTAIR FAULT LED will be "ON".

2nd and 3rd answers:
- BATTERY STATUS, offset 281C no device as A in the config references
- HOTAIR 1 FAULT LED no offset
- ENGINE 1 BLEED FAULT LED offset 206C, Transform: if(#=0,0,if($<1.77,1,0)) where "#" is the BATTERY STATUS
- ENGINE 2 BLEED FAULT LED offset 216C, Transform: if(#=0,0,if($<1.77,1,0)) where "#" is the BATTERY STATUS
- ENGINE 3 BLEED FAULT LED offset 226C, Transform: if(#=0,0,if($<1.77,1,0)) where "#" is the BATTERY STATUS
- ENGINE 4 BLEED FAULT LED offset 236C, Transform: if(#=0,0,if($<1.77,1,0)) where "#" is the BATTERY STATUS

I hope my answers will be helpful to you.
Best regards.
Albert
2020-04-25 10:12
icon