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! 

From: ETSI, Germany
Posts: 2578
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.

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