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
theflyguy
From: ETSE, Germany
Posts: 9
I would like to reuse some more or less expensive Electronic Devices for my little VR-Cockpit. I.e. good dual Axis Encoders are quite expensive, and I would like to have a Switch that toggles the Function of such an Encoder, i.e. between Lower right Encoder of PFD and MFD Side of a Garmin G1000. Same for example with the Softkeys of a Garmin G1000. In the End I would have one G1000 Device, that I could set to PFD or MFD Mode with a single Switch.

My Idea was to have a Toggle Switch, that sets Kind of an internal Variable to some Value, that I could then use as a Precondition in my Configuration. I.e. having two Lines in my Configuration for the same Encoder, but with different Preconditions, by using the internal Variable set by my Switch. I just couldn't find an Action Type for Input Configurations that would support something like setting Variables other than FSUIPC Offsets, Event ID and so on.

Is it somehow possible to achieve what I want.
[Last edited by theflyguy, 2021-02-19 18:36]
2021-02-19 17:12
Avatar
krok
From: LFEN, France
Posts: 29
Supporter
hi,

Why you don't want to use FSUIPC free offset ? is pretty good to do that.
free offset start 0x66C0 to 0x66FF
2021-02-19 17:25
Avatar
theflyguy
From: ETSE, Germany
Posts: 9
Well, I didn't knew about this Address Range, and randomly changing Addresses seemed a bit risky ;-)

Well, if there is no other way of doing it, I will give it a try. I mean, it would be much easier to work with Integer Values that I could increment or reset by Button Pushes. I think I'll need to dig into this LUA Scrpting Stuff, haven't had a Look at that yet. I mean, LUA Scripts should be able to store and manipulate any kind of Variables.
2021-02-19 18:26
Avatar
krok
From: LFEN, France
Posts: 29
Supporter
I don't understand what you want, but if you want to manage PFD and MFD with same control and just one button to switch PFD/MFD control, just use a free offset to set MFD/PFD is select and use precon for control, is the most EZ way, no need lua for this.

Same things as -> https://www.mobiflight.com/forum/topic/652.html
2021-02-19 18:51
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi Guys.

The Link from KROK is already the correct workflow.....

@ TheFlyGuy

Your idea is 100% Correct. Using 1 Device with 2 Different States is done by Precondition. This is used also for Inputs and Outputs. E.g A Display Show COM1 or COM2 whatever your switch is selected..... OR Your Encoder turn Kh or Mh whatever mode is selected.

Your also right... A Internal Variable would be more logical. But this need additional Code in MF and also a rework of GUI.
It would need a verry deep Rework of the MF Logics..... Cause technical MF act if you do a Input.... But MF basicly not know at any time in what position your Real switch is at the moment. It detect a moving.... But not remember/store this information after execute the command.

So we decide to use the FSUIPC Free Offsets for this.

Step 1: A Input Device change a Free Offset as you need it.
Step 2: A Output Config READ this Offset ( and use no device basicly) to have a "refference" or "Indicator" we could use later.
Step 3: Your Input or Output Config use the "Readout Config" from Step 2 as a Preconditon !

**********
LAST NOTE
icontheflyguy:


I think I'll need to dig into this LUA Scrpting Stuff, haven't had a Look at that yet. I mean, LUA Scripts should be able to store and manipulate any kind of Variables.



The technic we use not need LUA. This is just a Input to a free Offset instead of a existing one. But sure. With LUA this can be done more professional. Whatever the Result and also the needed Traffic is the same. So you can use the current System without any disadvantage!
Good Luck !
2021-02-20 00:20
Avatar
theflyguy
From: ETSE, Germany
Posts: 9
Thank you very much for your detailed Answer. I've already managed to achieve what I wanted with the Explanations given here. Currently a Push Button toggles the "State" of three different LEDs, that I just use as "Mode Indicators". I then read out the State of the LEDs as Preconditions for other Inputs, like Encoders, Buttons etc., to assign different Functionalities to them.

It works, but it feels a bit "hacky" to use the Flight Simulators Memory just to store Values, that are only relevant for Configurations in MobiFlight. Also I need to sacrifice three Pins on my Board (for the LEDs) just to store the "State". But I completely understand that introducing such internal Variables to MobiFlight would be a bigger Issue.
2021-02-20 11:03
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Maybe in a future Version we find a better way to do this..... I still got a Idea and we try to implement.

But i think you got a little thinking issue already.... There is no need to use "Pins" on Mega for those storage.

Sure... If you like to use 3 LED´s in Your panel that light up if Mode A,B or C is on.... this are 3 Devices. And so they need 3 Pins.
BUT
Also if you handle the Precondition Logic with a Lua Script or with a MF Variable ( o instead of Sim Memory) ..... You still need 3 Pins for your 3 LED´s if you like them.


So please confirm you did not a Mistake and set Fake Pins e.g. for the READOUT Config. This is not needed. A Output Config not must have a Pin if it´s just for Calculation !
Good Luck !
2021-02-20 18:32
icon