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
AndrewZAP1977
Posts: 8
Hi all!
I am sorry about my English!
I am new to Mobiflight and started learning it just recently!
But I already understand that this is a very powerful and flexible tool for connecting devices. I was very impressed with the ability to get feedback from the sim and appliances (I mean turn on/off LEDs, displays, etc.)!
To the authors - many thanks for the work done!

Now I'm trying to figure out the internal variables of Mobiflight.
And I had this question:
After running Mobiflight, all the MF internal variables assigned by me, have the value "0". Is it possible to force a value to be assigned to a variable? For example, what would after the running of the Mobiflight, this MF internal variable would have the value "1", "2" or "3" ...?

Sorry for the noob question, but I couldn't find a similar question and answer on this forum!

With all respect, Andrew!
2022-10-14 19:11
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi

The MF Variables ( same like Custom FSUIPC Offsets in the past) are initialised with "Zero" at Startup.
Old FSUIPC Offsets remain there Value aslong Sim was running..... MF Variables remain there Value just aslong Mobiflight is in RUN Mode....

So whatever you "store" in a MF Variable is gone when you STOP Mobiflight..... And it is reset to "0" when you press RUN again.

For our point of view this is the most logical way to handle them!

IN theory there exist ways (provisional) to change this behavior, but normaly this is not needed or logical.


Please tell me a specific example where you want to SET a MF Variable automatically at Startup.....
Then i can guide you in the right direction how "I am " would do it.
OR
If its really a sensefully usecase we can think about a new feature/option to allow this in the future.
Good Luck !
2022-10-15 01:47
Avatar
AndrewZAP1977
Posts: 8
pizman82, Thanks for the quick response!

Yes. Maybe I'm not doing it logically in Mobiflight programming. I just started learning about this wonderful product and don't know much yet!
Mmmm... Well, here's my example:
On the autopilot TBM 930 (GMC 710) there is an XFR button (as far as I understand, it has no actual use in the simulator), which alternately switches the triangular LEDs located to the right and left of it. Moreover, the left LED turns on immediately after turning on the on-board power of the aircraft. Then, after pressing the XFR button, the right LED lights up. Press again - the left one lights up again and so on.
That's why I wanted to use the internal variable MF with a start value of "1" to create the condition for the initial turn on of the left LED.

For example:
if master battery switch = on, "1" and
if MF variable for left led = true, "1"
then the condition for its inclusion is fulfilled and it glows.
After that, I will use the button to change the MF variables for the left and right LED and set them to the desired values ​​depending on when the button is pressed.

And I am sure that this switching can be arranged very simply! But I tried to do it in different ways (as long as my knowledge about the work of Mobiflight is enough) and so far all my attempts are VERY CUMBLING and I don’t have a positive result!
I would really appreciate it if you could point me in the right direction!!!

With all respect, Andrew!
2022-10-15 07:21
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Yeah.

Thats a good example.... We call this "Provisional Stuff". cause you like to show something that is not exist in real.... Or better you like to show something where you not be able to Read out the needed Informations.

Most easy way would be if the Sim (Aircraft) give us the needed Data.... So if we have a Lvar ( Or offset in older sims) that tell us what LED is ON.
This can be a single Variable that is e.g. 0 for LEft and 1 for Right ..... Or it can be build by 2 Variables... One for each LED .... So we have a clean 1/0 State if its on or not.

So first step.... Find out if this exist.... If yes we not need to build a difficult logic.

If NOT....

Then your on the right way... BUT You think to Difficult.
As i say and you still find out.... A Own Variable is always set to "0" at startup.
So logical we always use the "0" Situation for the same behavior we need to have at Startup.... Cause so we automatically get sync by itself.

Means .... You build a logic with one Variable.
Value 0 means Left LED is ON ..... Value 1 means Right LED is on .....
And we simply "toggle" this Variable by press a button ( that use here the non simulated XFR switch)

Overall you need....
1x Input Config ( The real XFR Button as Device) Target = Mobiflight Variable Lets call it "XFRvar".
On Press we say if($=1,0,1)
So every press swap the Value 0-->1 or 1-->0 .

Then we need two Output Configs
Config 1 use as Device the Left LED .... As Data Source it use the MF Variable "XFRvar"
And in compare we say IF Value = 0 Then 1 ELSE 0
Means we say LED should always light if Variable is currently 0

Config 2 is use the Other right LED and again the same Variable.
Here we not need a Compare cause we still can use it as it is.... Right LED should light if 1 and should be off if 0 .
So its still correct.

For sure you could now also readout the master Bat switch and include this into the logic.
So you use that Config as a Refference/Placeholder ... e.g. symbol #

Then you could say in Config 1 in Compare If Value = 0 THEN 1*# ELSE 0
Means Config like to set LED to 1 but it multiply with batery status.... If Batery is ON then 1*1=1 ..... If BAtery is OFF then 1*0=0
In the other Config we can do the same .... If Value = 1 Then 1*# ELSE 0
( Then we need the compare for sure cause we need to do this additional math.

Sounds a little difficult.... There would be also other ways. thats just the most understandable one without need to build advanced formulas.
[Last edited by pizman82, 2022-10-15 16:09]
Good Luck !
2022-10-15 16:03
Avatar
AndrewZAP1977
Posts: 8
pizman82, Thanks for the quick response again!

iconQuote:

.... So if we have a Lvar ( Or offset in older sims)


Yes. I looked in developer mode in SIM. There is a variable (L:XMLVAR_PushXFR), it is it that changes from 0 to 1 when I press the XFR button on the screen in the cockpit. And when its value is 0, the left LED is on, and when it is 1, the right LED is on. But I have not yet understood how MobiFlight works with variables of this type. For me it is still difficult and I'm afraid to get confused even more! I'm trying to go from simple to complex. I study everything gradually and check everything with examples! If you don't mind, could you explain to me the use of such variables using this example? For me, this would be a clear example for understanding!
iconQuote:

Overall you need....
1x Input Config ( The real XFR Button as Device) Target = Mobiflight Variable Lets call it "XFRvar".
On Press we say if($=1,0,1)
So every press swap the Value 0-->1 or 1-->0 .


Yes. I did just that!
iconQuote:

Then we need two Output Configs
Config 1 use as Device the Left LED .... As Data Source it use the MF Variable "XFRvar"
And in compare we say IF Value = 0 Then 1 ELSE 0
Means we say LED should always light if Variable is currently 0

Config 2 is use the Other right LED and again the same Variable.
Here we not need a Compare cause we still can use it as it is.... Right LED should light if 1 and should be off if 0 .
So its still correct.


I tried to do something similar, but without using the "Compare" tab (because I don't know much yet). I got cumbersome schemes using additional variables, but they did not work!
I will take your advice and tomorrow I will definitely try to do as you wrote.
iconQuote:

So you use that Config as a Refference/Placeholder ... e.g. symbol #


I just started learning how to work with the "Refference" tab today and trying various examples of its use. Your advice is very timely! I will try to put it into practice!

Once again, thank you for your advice and very quick replies!!!

With all respect, Andrew.
2022-10-15 18:43
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Yeah

Simply do your trys... Make testings and if you struggle and need more informations.... Ask again

About the Variable....

Mostly in Cockpits we have 2 kind of Variables.... One is the Switch itself.... the other is the indicator.

Simple Example... In B737 there is a latching switch for the Flight Director.... And next to it there is a Green LED that show if Flightdirector is Master/ active.
And thats also a perfect example cause here this systems are not bind itself.
Means the LED Can not be ON when the Switch is in OFF position.... BUT it can be OFF whatever the Switch is still on ( If its in Slave Mode).

Means... For sure we can read a Switch Position and use it to controll a LED.... But we need to get sure / figure out if this is logical.....

Same example is the Fuel Pumps.... Here a LED light if Fuel Pump is OFF and it get dark if Pumps (switch) is On.... But we can NOT use this as indication..... Cause in case of low Fuel the LED comes ON again whatever the Switch is still in ON Position.

Means.... We always try to find a Variable that show the status of the Output ( LED in that case) directly. If not possible and we find a other Var ( like your switch) we need to think.....
If your right and the Left/Right LED´s are working 100% simmular to the switch Value..... Without any exception. then we can use it for sure !
In easy words.... If no perfect data is there then you must know 100% how the system workes and should act.... THEN we can think about provisional ideas to get to same result as expected.
Good Luck !
2022-10-16 00:00
Avatar
AndrewZAP1977
Posts: 8
Thank you, pizman82.
I did it! Everything turned out to be very simple!
Now on my GMC 710 the LEDs switch as expected! Now it remains to synchronize my GMC 710 with the XFR button in the cockpit using (L:XMLVAR_PushXFR).
I will study different examples and try to put it into practice!

Once again, thank you very much!

With all respect, Andrew.
2022-10-16 13:35
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
iconAndrewZAP1977:

Now it remains to synchronize my GMC 710 with the XFR button in the cockpit



You can.... But why should you do this ?

iconAndrewZAP1977:


On the autopilot TBM 930 (GMC 710) there is an XFR button (as far as I understand, it has no actual use in the simulator), which alternately switches the triangular LEDs located to the right and left of it.



If the System is not simulated and also in Sim you just toggle a immaginary LED without a real usage, then its mess of time to do this.

Same like above... You must need to know how the aircraft work and how it should be.

A good example here is the ADF2. Some Aircrafts got this.... But whatever in the Sim nor on Vatsim ( as i know) its simulated.
So sure we like to build a Panel that show 2 Frequencys.... We can turn and swap. Simply in case our cockpit should looks as real as possible.
BUT
We not need to write the virtual ADF2 if we know its just a dummy also in the sim.


So... If this XFR Switch in Sim have no fucntion and only toggle the LED.... Why care about if in Sim LED is L or R .... Then you not need to care about if your Homecockpit show R and Sim is in L Mode.... Cause ( if your right) this have finally no negative effects !
Good Luck !
2022-10-16 15:48
Avatar
AndrewZAP1977
Posts: 8
Hi, pizman82!
I made a GMC 710 replica very similar to the original (and it has LEDs like the real one) and I will be very pleased if I make it work in sync with the same one in the SIM virtual cockpit. Even if some buttons have no actual functionality (but turn on/off LEDs).:) I have already said that I was very impressed with the possibilities of Mobiflight with feedback (LEDs, etc.). Today I explored the possibilities of using Lvar variables. And having slightly changed your yesterday's example, I used all this in action !!! It turned out a little optimization!
But for me there is still a lot of incomprehensible! And if you don't mind, I'll ask for help!
In any case, thank you for your explanations and your time!

With all respect, Andrew.

2022-10-16 19:21
icon