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
okansacli
Posts: 12
Hello,

I have tried many options but could not succeed. I am trying to program a logic saying that

If the value of offset 5528 > 0 then set bit0 of offset 3340 to 1
else set bit0 of offset 3340 to 0

is this possible somehow ? I am stuck

Thanks

OKan Sacli
2019-11-10 19:39
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
This is NOT possible with Mobiflight ( But no problem with own code )

Mobiflight have a complete splitted system between INPUT and OUTPUT.

You can READ Offset 5528 ( Don´t know what this is.... Pretty sure a AddOn Aircraft Data) by a OUTPUT Config.
This Data can be show on Displays, by LED, can controll a Motor or finaly can be used as Precondition.

For INPUTS Mobiflight reqire always a physical Input by the User..... Mean you need to press a Button or move a switch or turning a Encoder.
So in simple words.... a INPUT will only executed if YOU activate a Device by hand.

What you request is a INPUT that is done automaticly in case of a Status from a Output Value..... And thats is not possible with MF.

**************

2 Solutions for you.

What you basicly need is a own written Code that run in a LOOP.
Means you Read the Offset 5528 ..... And if it Change from 0 to >0 OR if it Change from >0 back to 0 it should Write your virtual Joystickbutton.
More profitable is maby you directly write the function that you like to controll with this virtual Joystickbutton.....
Why you like to make this bypass to Joystickbutton that finaly do what you need ?


With Mobiflight you can NOT do this automaticly..... BUT you can do this by hand ( if that function is not needed evertime)
You can build a Config that say.....
If you press a Button THEN Mobiflight Check if Offset 5528 is Zero or not...... And then it execute the needed 3340 Bit to 1/0 whatever the Read Value was.
BUT as i said..... It will only be done if you press the button Youreself..... and it will do this only 1 time.

************************

Maby i can help you better if you tell me WHAT you like to do..... Maby i have a better idea how we can solve this more logical !
Good Luck !
2019-11-11 16:03
Avatar
okansacli
Posts: 12
Thank you Pizman :)

Another way for me is to run SIOC together with MF and make the logic work via SIOC such that

Var 0001, name 5528, Link FSUIPC_INOUT, Offset $5528, Length 1
{
IF &5528 > 0
{
&3340 = SETBIT 0
}
ELSE
{
&3340 = CLEARBIT 0
}
}

My project is I have 4 microphones and 4 Push to talk switches. All microphones are routed to a single microphone connector (via relays) . THe idea is only one microphone PTT can be pressed at a time (pressing other three ptts will not have any effects on the relays)

so my inputs (PTT buttons B1,B2, B3 and B4 ) are via MEGA2560 and MF.

I decided to use a useless project magena offset the 5528 and my buttons are acting like

B1 pressed sets Bit0 of 5528 to 1, releasing B1 sets Bit0 of 5528 to 0
B2 pressed sets Bit1 of 5528 to 1, releasing B2 sets Bit1 of 5528 to 0
B3 pressed sets Bit2 of 5528 to 1, releasing B3 sets Bit2 of 5528 to 0 and
B4 pressed sets Bit3 of 5528 to 1, releasing B4 sets Bit3 of 5528 to 0 all these are fine

My OUTPUTS are as follows

OUT1 looks at Bit0 of 5528 and linked to a physical led/display output which is connected to a relay
OUT2 looks at Bit1 of 5528 and linked to a physical led/display output which is connected to a relay
OUT3 looks at Bit2 of 5528 and linked to a physical led/display output which is connected to a relay
OUT4 looks at Bit3 of 5528 and linked to a physical led/display output which is connected to a relay

All OUTs are reversed with compare function such that if cuırrent value = 0 set to 1 else set to 0 (this is needed for relays to remain unpowered during normal conditions)

All outs have preconditions such that

OUT1 preconditions is OUT2 and OUT3 and OUT4 =1
OUT 2 preconditions is OUT1 and OUT3 and OUT4=1
OUT 3 preconditions is OUT1 and OUT2 and OUT4=1
OUT 4 preconditions is OUT1 and OUT2 and OUT3=1

are your following me so far ? :)

So all I need now is if 5528>0 set bit0 of 3340 to 1 else set bit0 of 3340 to 0 (which is the offset for button input in FSUIPC, which is linked to a key which is linked to Vatsim software)

So said in the very beginning I am running a sioc script next to MF for the logic of 3340 and seems to work ok.

I hope to have clarified all :)

Best Regards from Istanbul

MFG

OKan Sacli
www.okansacli.com
2019-11-11 19:38
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
OK.... Now i can understand a bit what you need.....


On first view.....

Why do you need FOUR Microphone ???
Normaly 2 are in use..... Pretty sure you not simulate a Cockpit with 2 Backseat places..... And if Yes then the Backseats will not have a PTT for Radios :confused:

Basicly a fact.....

For a Good Radio System some weeks ago a other user ask for..... And a short Google search show me "perfect" Solutions ( External Hardware) .
This Panels allow to set 2 Headsets and they support "intercom" and also handle individual PTT Buttons( for each side) for Transmit to Vatsim etc.


If you like a self build solution .......
I think we have a lot of posible ways to solve this.

We can think about a double config..... For you its just important that only ONE Microphone is active ( Closed Relais) at a time ........ But its not important WHAT Microphone Button startup the "transmission". So if MicA is talking a.t.m. then its no matter if MicB is pressed and also "write 3340" that time cause its still "pressed" by MicA.

Simply Try the follow..... Set for All 4 INpout Buttons each a SECOND Config below that use same Buttons..... All 4 Inputs will write Offset 3140 bit to "1"
When you now press your Button then it controll the specific relais and "kill" the other 3...... And it startup transmission by button Press.
If another Button is pressed now then THAT ralais will NOT work cause the precondition in Relais Outputs Block this ( Cause MIC1 is still active) ..... Sure this button will also write now the Virtual Joystickbutton to "1" but thats no matter cause it is still "1" by the other mic. We not need to care about.

I think this is already a working idea..... If not we can think about a INPUT by Relais..... So the closed relais will controll the Mic Conection and ALSO will set a Mega Pin to "ground" (Maby by a second relais) ..... Then the Action of Relais will "simulate" a Button Press to the Arduino.... the MEga not see if the Input come from your finger or from the relais.
With this logic we can say "If Relais is Working then it will Press a virtual Button on Pin X" And in Mobiflight you write a simple Input for that Pin Button that controll 3340.

Again another idea is using a DualPole Button..... So Channel 1 controll your relais ( Electrical directly without Mobiflight including) and Channel 2 controll "PTT" .

You see..... Lots of ideas.... You can start to test.
Please Report experience!
Good Luck !
2019-11-11 22:35
icon