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.

Go to page 1Go to page 012Go to page 2Go to page 2
Avatar
knowlesm@talk21.com
Posts: 14
Hi All

I am currently reworking my 737 rig transferring from SimVim to Mobiflight. I have completed the EFIS, MCP, MIP, Pedestal and Aft Overhead all successfully. However, working on the Forward Overhead I have run into a problem. There are a number of rotary switches which I am struggling to configure.

Here is an example:
The Wiper switch has four contacts. For the Left wiper the dataref is laminar/B738/switches/left_wiper_pos. Normally I would allocate this to each of the switch contacts and change the dataref value (in this case 0 to 3). However this particular dataref cannot be written to. The only thing that seems available are the commands laminar/B738/knob/left_wiper_dn, and laminar/B738/knob/left_wiper_up. This would be fine for a rotary encoder but not a switch as you cannot determine the direction of a rotary switch.

Does anyone have a solution?

Cheers Mike
2023-02-05 11:39
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi
Yes... But not sure if this can be done with the MF Tool or if you would need XPUIPC here

NOTE: Here users on our Discord (Like Samhao) are more helpfull as myself. I not use Xplane myself.

I remember a testing project where Sam do this !
Also a Input we would need a specific position (e.g. 0,1,2,3) but only with the posibility to say 1 Down or 1 Up.

Solution was to send multiple commands in a row....
E.g. for the Position position 2 he say in code....
Execute 3 times the Down Command .. Then execute 2 times the Up Command.

means.... Whatever in wich position we are ( 0,1,2,3) by sending 3 times "Down" we are sure there is Position 0 in sim.
Cause if we e.g. are still in 0 at beginning then the 3 unless commands do simply nothing.
Finally the 2 Up commands result that switch is in Position 2

***
Please join our Discord and talk to Sam himself !
Good Luck !
2023-02-06 16:43
Avatar
knowlesm@talk21.com
Posts: 14
Many thanks for your help. I have joined discord and asked the same question.

How do you send multiple commands in a row? This sounds like a very useful solution.

Cheers Mike
2023-02-06 18:20
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
In the past we use XPUIPC.
There we could create own Commands / Macros within the INI File.
So we could say there e.g.
If Offset XX change to 1 THEN
Send Command Left, Command Left, Command LEft, Command Right, Command Right.

Thats why i said "Not sure if this can be done with MF tool"

Each preset Input got a Command line ( You see by press "Show preset code" )
In theory you could try to simply copy paste the single code and enter it 4 times in a row.
If we are lucky it execute it 4 times....
So we could also build a Input with 3x Left 2 x right e.g.
If not then the MF Tool can not do this (for now).
Good Luck !
2023-02-06 22:22
Avatar
knowlesm@talk21.com
Posts: 14
I tried multiple commands but it shut down the command execution entirely. Not sure why. When I took out the duplicate commands then the original started executing correctly though of course not the way it is needed.
It would be useful in the future to be able to run multiple commands from a single input.
Many thanks for your help.
2023-02-07 11:37
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi again

Apollogy for this wrong information !

I talked to Sebastian yesterday, to confirm this....

As you already find out.... The Mobiflight Interface (New feature Xplane Support) currently NOT allow multiple commands and also not a "Hold" Function like XPUIPC do.
Not sure if this will come in the future. We work on it but sure focus is still FS2020.

Solution:

Sebastian already recommend a tool on our discord.... A External programm where users can create "Lua Code" .
In easy words... With MF we tell this Programm "Please Run Macro xxx" and in this programm we write ( In lua coding language) the needed stuff.

There we can do all coding ways we like.

E.g.
Send 3x Left and 2x Right.
or
We can say... check the virtual switch position ... If its higher then our target then turn left, if its lower then turn right..: Check again. If its equal then stop.

In easy words....
For stuff that need a deeper code instead of fire a single command or write a dataref to a hard value we currently need this "external" solution !
Good Luck !
2023-02-07 12:39
Avatar
knowlesm@talk21.com
Posts: 14
Thanks. I will give it a go.
Cheers Mike
2023-02-07 15:41
Avatar
knowlesm@talk21.com
Posts: 14
It worked. Many thanks.
2023-03-03 11:17
Avatar
Simoapple
Posts: 4
Hi, could you explain to me in detail how you did it? I'm trying to get the wipers rotary switch to work, without success. Thanks in advance
2023-12-21 11:44
Avatar
XPRoberto
From: Hungary
Posts: 65
Hi,
I did similar solution for the autobreak (where you also have up and down command + a readonly for the actual position).
I created multiple configs for each switch position.
Here is an example for switch position #2.
Precondition: actual position in sim=1, action = up => resulting a new actual position of 2
Precondition: actual position in sim=3, action = down => resulting a new actual position of 2
----------------------------------------------------------------
Do you know that you can simplify: if($=1,0,1) ?
Use simply: 1-$ :)
2023-12-25 00:45
Avatar
Simoapple
Posts: 4
HI,
Thanks for the reply but unfortunately I didn't understand anything :confused: :scared: :cry:
I should set a 4-position rotary selector.
could you post some explanatory photos here?
Like, could you post some photos of the mobiflight configurator so I can understand better and redo the same procedure on all the other selectors that have more than 3 positions?
Because inserting multiple preconditions on a 3-position rotary selector, it works. the problem comes when there are 4 positions (having only 2 datarefs to insert = position up, position down).
Thank you
2024-01-18 10:11
Avatar
Simoapple
Posts: 4
hi, could you put the link to the program here? I couldn't find anything on Discord. Thank you
2024-01-18 10:14
Avatar
XPRoberto
From: Hungary
Posts: 65
Hi,
If you are interested in my solution without LUA script.
Here is an example for 3 positions.
Assuming you have a readonly dataref: 0..1..2 and commands: up and down
Assuming you have hardware input device: 0...1...2 (e.g. a rotary switch)
you need 4 input configs
config_0-1
input device #1
precondition: current_value=0; action=command_up
config_1-2
input device #2
precondition: current_value=1; action=command_up
config: 2-1
input device #1
precondition: current_value=2; action=command_down
config: 1-0
input device #0
precondition: current_value=1; action=command_down

Please notice: for switch #1 there are 2 configs: depending on the actual (previous) state in can execute either up or down command.
If you catch the logic, you can extend this into 4 or 5 states as well.
----------------------------------------------------------------
Do you know that you can simplify: if($=1,0,1) ?
Use simply: 1-$ :)
2024-01-24 19:53
Avatar
Simoapple
Posts: 4
iconXPRoberto:

Hi,
If you are interested in my solution without LUA script.
Here is an example for 3 positions.
Assuming you have a readonly dataref: 0..1..2 and commands: up and down
Assuming you have hardware input device: 0...1...2 (e.g. a rotary switch)
you need 4 input configs
config_0-1
input device #1
precondition: current_value=0; action=command_up
config_1-2
input device #2
precondition: current_value=1; action=command_up
config: 2-1
input device #1
precondition: current_value=2; action=command_down
config: 1-0
input device #0
precondition: current_value=1; action=command_down

Please notice: for switch #1 there are 2 configs: depending on the actual (previous) state in can execute either up or down command.
If you catch the logic, you can extend this into 4 or 5 states as well.




Thank you!
I managed to get them to work! It's actually very simple, you just need to understand the logic, like you said! Thanks again!:) :) :) :)
2024-01-27 11:14
Avatar
nicolask
Posts: 4
Hi,
If you are interested in my solution without LUA script.
Here is an example for 3 positions.
Assuming you have a readonly dataref: 0..1..2 and commands: up and down
Assuming you have hardware input device: 0...1...2 (e.g. a rotary switch)
you need 4 input configs
config_0-1
input device #1
precondition: current_value=0; action=command_up
config_1-2
input device #2
precondition: current_value=1; action=command_up
config: 2-1
input device #1
precondition: current_value=2; action=command_down
config: 1-0
input device #0
precondition: current_value=1; action=command_down

Please notice: for switch #1 there are 2 configs: depending on the actual (previous) state in can execute either up or down command.
If you catch the logic, you can extend this into 4 or 5 states as well.

Hi, I am having the same issues with xplane 11 and rotary switches. I understand the logic but I am having difficuties entering the info into mobiflight. could I get step by step instructions on how to enter the input and create a precondition. do I still select xplane command under input? when I try to select a precondition there is just nothing to select. What I am doing now is wrong and I would appreciate a little coaching. Thank you
2024-02-12 18:20
Go to page 1Go to page 012Go to page 2Go to page 2