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
crodrigues
Posts: 37
Hi all,

Airbus has manage and selected speed.
If the aircraft is manage speed mode, the display module should display 3 dashes like this: "- - -".
And if the speed is in selected mode it should display IAS speed.

In the offsets of my aircraft I have an offset 5632 means: 0=speed in managed; 1=speed is selected

What I need is something like this:
if offset(5632=0) then
display="- - -"
else
display=process offset(07E2)
end if


How can we do this with Mobiflighgt?

Thanks
Carlos
[Last edited by crodrigues, 2018-01-31 01:54]
2018-01-31 01:37
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Yes This is possible....

At the moment we need to do a little difficult workflow for that cause it´s not direct possible to make a IF ELSE in the value itself. ( We plan for that in one of next releases to make this much more comfortable to the users)

So at the moment you need the "precondition" Tab and some double configs !

Basic logic:
A Display must be controlled at ALL TIME by a Config .... And it should be never controlled by multible Configs if they show different Data ( Cause then it flickering and try to show both values same time)

In your case you need 2 Configs that both controll the Diggits of this Display.... ( Device is the same Display/Diggits in both Output Configs)
Config 1 Will work if Speedmode is "selected" and simply show IAS from Offset 07E2
Config 2 Will work if Speedmode is "managed" and show - - - at all times.
Additional you need a 3rd Config ( without Device ) that Read out the Offset 5632 ... This config we use as "indicator" for our Preconditions !

How to do:
1. Create the Readout Config on 5632 ... Call it for Example "Speedmode"
2. Open your existing Speed DisplayConfig that work with Offset 07E2
3. Add a PRecondition in this Config like.... Only Work if "Speedmode" = 1
4. Create a NEW Output Config with Device the SAME Display and Diggits like in the Other Speeddisplay Config
5. Offset is no matter here.... You can use 0000 or you use for example 07E2. Thats no matter
6. Activate the Compare and say If Value =1 Then --- (3 time the - symbol) ELSE --- (3 time the - symbol) . So Whatever the Offsetvalue is it will always result in - - -
7. At last add a Precondition in this Config, too.... Here you say ... Only Work if "Speedmode" = 0

Thats it !
(By the Way.... i Know this can be done without the Readout config in a other way.... But thats much hard to explane and result is the same. So simply try this! )
Good Luck !
2018-01-31 10:00
Avatar
crodrigues
Posts: 37
Thanks pizzman,

I will try to do this an I will post the result here.

Thanks.
Carlos
2018-01-31 11:23
Avatar
crodrigues
Posts: 37
Hi,
How can I create a Readout? Is the same procedure as create an output in Mobilifht?
[Last edited by crodrigues, 2018-02-01 00:00]
2018-01-31 22:54
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Yes

Sorry i used maby wrong term.... Myselfi just called it "readout" when i use a confug value only for preconditioning.

Basicly THIS is a Output config like all others.... Only difference you not use a device ( like LED) Cause you only use this config for the procondition in the other Config.
To get a tidy system i name those Configs simply xxxxxReadout so i know this is not a device controlling config !

Just to protect for future problems.... You can use for precondition EVERY Output config... Also a Config that have a device, too.... If you for example have a Config that controll a LED you can use THIS Config again for a precondition ! You not must duplicate it in that case !
Good Luck !
2018-02-01 12:12
Avatar
crodrigues
Posts: 37
Thanks again pizzman,

It works smooth!
I needed to install the FSUIPC Exporter from Eric because I am using A330 from Wilco.
Anyway it works like a charme!

Thanks very much.

P.S.1 - It would be cool to have some sort of pre-conditions in a future version like:

...
If (%5632=1)
result= true
else
result = false
...

This is something like "user code"... really don´t know if will give lots os work...
Where "result" would be the value where the mobiflight would display or not the value.

Anyway with this system it works also.

P.S. 2
Another cool stuff would be some "Global variables" that this "user code" could use.

You may change to (SOLVED) issue !!!

Thanks a lot,
Carlos
2018-02-01 18:18
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
:w00t: Your can read my minds !

Exact THIS is my planing for the future and i still requested to Sebastian.

I thought a lot of time about that problem....
We need a better way in Mobiflight to handle the values... And a much deeper plattform like the current Preconditions
Specialy that we can change the Config Value in case of a condition and not only say Config Enable or Disable like now.


About your 2 examples....
The first part i not understand......
Please make a better example to tell me WHAT you like to do.
At the moment we can use a little owncode already by the expressions ( for example in transform field) And with combination of Preconditions we can build lots of stuff ( whatever in a verry difficult way until now)
So explane me what you like to rebuild.... Maby it´s possible and i can give you a guide how to set it right now!

***
The Second part about the "Global Variables"
Here i think we need to make a compromise.
Define Variables need a complete new Grafic Overlay.... and the System is limmited also for variables.... BUT there is a way i already figure out with Sebastian.....

Please look at the LCD Display function.
There you can define "placehodlers" and mask them with the value of a existing config ! Like you say " Value of COM1 Config should be Placeholder § " In Display you write for example "Test §§§.§§" and Mobiflight show "Test 123,45" on the Display cause it read the value of that config and show it instead of the § Symbol.

THAT function we can use for our variables..... We plan to implement that Tab in all configs (Optional) so we can define 4 ( or maby more) OTHER Configs and there Value is now available in form of placehodlers (like $%&? ) in the expressions.

For Example: we Define Config A as "§" Config B as ? .... Additional the config we build at the moment got it´s own value (always $ like today)

Now we want say.... Our Config should have it´s own value only if Config A = 1 ELSE it should show value of config B
Solution: We enter in transform field: if(§=1,$,?)

Or we want to say.... Our Config should show "1" if value of Config A and B is identical.... If Value of A and B is different it hould show Zero 0.
Solution now: if(§==?,1,0)

Bad to explane.... I Hope you understand the system! I Hope we get this in next time!
Good Luck !
2018-02-02 22:06
Avatar
crodrigues
Posts: 37
Hi Pizzman,

Thanks for your quick answer.

What I mean is the following:

Lets suppose I have offset 5632 that may take 0 or 1 as values (0 mean selected speed and 1 means managed speed). This offset 5632 is used in Wilco Aribus;
Lets suppose I have an output that will receiver the "result" of a function (my speed display module);
The problem is that the display module should display the IAS speed if the offset 5632 = 1 or the display should display "- - -" if the offset 5632 = 0.

In the Output configuration windows you could add a new tab to write some user code. Instead of preconditions.

//start of code

if (OFFSET(5632) = 1 then
return OFFSET(07E2)
else
return "- - -"

//end of code

This means the result would be the return value for this function.
In this case, the "result" or "return" of this function can take only the value of offset 07E2 (IAS speed) or the string "- - -"
That result would be sent to the display.
This way we could output a display considering a code function written by the user.

Hope it helps to understand.
Thanks,
2018-02-03 15:24
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Thats nearly simular what i mean !

At first... This is NOT possible at the moment. Only with the roundabout way i told at beginning ( 2 Config and a Read Config).
This is cause we can NOT implement a Value of another Config directly in the already existing "Code Entry Field" . ( But we can in future with that new tool)
( At the moment we can enter already verry difficult and deep If Conditions..... But Only based on ONE Value.... Not over more Offsets !)

Let me say... THIS what you explane is a "special" situation and that is problematic in the future, too :O
You like to show a value (IAS Speed) OR "- - - " in case of a condition..... BUT IAS is a decimal Value.... "- - -" is something like TEXT .

This is pretty shure not possible with a own script .... Here you must change the Output type from INT into STRG.
BUT: Here we have a backdoor and can use "Compare" function of Mobiflight again !
So we will say.... "IF Offset 5632=1 THEN Show Value of 07E2... ELSE Show a Number that never can be exist in that Range of 07E2 ... For Example "999"
In "Compare" you can say now .... If Value = 999 THEN - - - ELSE $ So it will show 999 as - - - and all other as Value !
Same is needed for example to blank Displays.... We can not enter "Space Space Space" into a script code cause again it must be a logical decicmal Value !

******
At last to your example:
I Hope you understand right... We will NOT implement a new area/tab or something.... the first planing is to use only the existing TRANSFORM field. ( And maby we will enter a 2nd or 3rd transform field optional below to make much more difficult code possible)
So your requested IF Condition must be written in the "Expression Syntax" that is already implement in Mobiflight https://archive.codeplex.com/?p=ncalc

So...
iconcrodrigues:


//start of code

if (OFFSET(5632) = 1 then
return OFFSET(07E2)
else
return "- - -"

//end of code



In our planing you must create a Output Config first for the Data Readout of Offset 5632. ( Only one time.... You can use THIS Config in multible other precondtiotns then)
Make a Output Config.... Offset 5632 ( Type, Size, Bitmask as show in the List) .... Device is NOT Needed. Call it for example "Readout Speedmode"
Then
Make your Config (Output) for the Display.
Offfset is 07E2 ( Typ Size like shown in the list) ... Device is your Display in Cockpit.
In The "NEW" Placeholder Tab you define "Config Readout Speedmode" should shown as "§" for example.
And now you enter in Transform field : if(§=1,$,999)
In words... If Variable § (means value of Offset 5632) is "1" THEN show $ (means current value of 07E2) ELSE show 999
At last you use Compare and say If 999 Then "- - -" else $

The real interesting part is... You can then make the hole thing inverted, too.
(Verry usefull to combine things if they only work in a special sequence)
In your example you can say that you Readout the IAS 07E2 in a "readout" Config without device and you can controll your Display with the Speedmode Config.
In that case you define THERE a Placeholder § for the value of IAS Readout Config.
Here Transform maby is... if($=1,§,999)
In words... If $ (current value of Speedmode 5632) is "1" THEN show § (Value of IAS) ELSE show 999.

****
Summary.... In your example the "- - -" is a bad thing. so you need a compare, too. But for all other Stuff like LED this work perfect.... Cause here you can use simply "1" for On and "0" for off....
Last example for a LED that should show Status of a function, that should be OFF if BatteryMainswitch is OFF and that should Light all time if Lighttest is ON .
You set LED to its own offset of function ( so $ means status of this function-Offset)
You define 2 Placeholders.... For example §= Batterswitch (1= ON - 0 is OFF) ... and.... ?= Lighttest ( 1=ON - 0=OFF )
Now transform is.... if(§=0,0,if(?=1,1,$))
In words... IF § (Battery) is 0 THEN set value 0 ELSEIF ? (Lighttest) is 1 THEN set value 1 ELSE show $ ( Real value of Sim function)
(Looks maby confusing... but belive me... That work !)

Have Fun !
Good Luck !
2018-02-04 08:07
Avatar
crodrigues
Posts: 37
Thanks Pizman for your explanation.

It was just an idea. For me, it is quite good as it is.

Thanks again,
Carlos
2018-02-04 22:56
icon