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
axm823
Posts: 5
Hi, everyone .
I have a question about MCP in xplane11 with zibo737

I used the config input for zibo 738 by Banzai.

example
#MCP SPEED switch
Command 0x6522 UINT8 1 0 laminar/B738/autopilot/speed_press _
0 0 laminar/B738/autopilot/speed_press

I used a tactile switches as input which in mobi pin #6 and a led as output which in mobi pin#7

the setup of tactile switche is
On Press
offset 0x6522
Int 1 bytes
value if($=1,0,1)
On Release none

When I first press, the plane mcp speed switch down , my mcp speed led bright

second press, the plane mcp speed switch up and light bright, my mcp speed led dark --> b737 speed action

third press , the plane mcp speed switch down and light bright, my mcp speed led bright

fourth press, the plane mcp speed switch up and light dark, my mcp speed led dark --> B737 speed inaction

I should press 4 times for speed action and inaction.

But in normal, only press 2 times for speed action and inaction.

Are there any error in my mobi setup ?
2021-02-15 13:20
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi

You give just the half information.....

What you show us is the config for the Switch.... And if i unserstand you the switch do what it should do ( Toggle the System on every usage from ON-OFF or from OFF-ON )

So what Offset do you use for the Output Config ? Do you use the same Offset ???

From my point of view these typ of Code you show is is the section to make "Inputs" via Internal Controll Events. ( A Verry Special System that is used for some Addons)
THIS Typ of Offsets are NOT used to read a information !

So i think for a Output Config you need another Offset ( and so another code line in the XPUIPC File) that finaly read the "LED Information" from the correct Xplane Dataref (Zibo Section) and support it to another free Offset!

I not own the File from Banzai.... But if he build it in a professional way he pretty sure also build the Output Offsets !



EDIT: After read the Text again.... Is it correct that also the Input is not work as expected ?..... Means a Single Press not toggle between the ON-OFF and it means you also neet to press it twice to execute a "momentary" press in the sim ..... means it need TWO Commands to get ON and another 2 to get OFF.
If this is correct then your Mobiflight Button also need a RELEASE with the Same Input Offset and Formula.
Means... If you press the Buttton momentary it send 2 Commands that represent the Press and Release of the Virtual Button in one sequence !
[Last edited by pizman82, 2021-02-16 07:43]
Good Luck !
2021-02-16 07:33
Avatar
Banzai
From: France
Posts: 90
Hi

For the switch in Mobiflight you need to put
on press value 0
on release value 1
with the same offset number 1byte int

and for the led output you need another number offset who is read by Xpuipc with a different syntax like this example :

#MCP SPEED LED
Dataref SPEEDLED laminar/B738/autopilot/speed_status1 int
Offset 0x6511 UINT8 1 r $SPEEDLED
iconNote:

you ca find the dataref list for the output in the folder of Zibo 738



create an output config in mobi with this offset 1byte int and the pin #7
this work also whit 7seg display!
2021-02-16 19:48
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Thanks Banzai.

And sorry i not understand this master logic of the Input myself ( I thought you recommend this if($=1,0,1) yourself in case "axm823" try to use it.)

Sure.... Press 1 and Release 0 is much more logical and comfortable to use as my first aid solution to use the IF Statement for Press and release 2 times.
I´m a bit sad i not see this myself directly. :blush:
Good Luck !
2021-02-17 03:56
Avatar
axm823
Posts: 5
Thanks banzai and pizman82’s reply, and I’ll test tonight.
2021-02-17 11:52
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
@ Banzai
A Additional Question/Idea.
Basicly not needed..... Just to optimize the code and reduce traffic.


The whole logic at the moment is executing the same command.... Whatever Offset swap from 0 to 1 or from 1 to 0.

iconCode:
#MCP SPEED switch
Command 0x6522 UINT8 1 0 laminar/B738/autopilot/speed_press _
0 0 laminar/B738/autopilot/speed_press 


If i understand right the problem is that there must be 2 commands to execute a virtual momentary action.... the first Press ( and hold) the button..... the second release it.
So Mobiflight need to send it 2 times ( In our case a 1 for press and a 0 fro release.)

**************
Question.... Is there a more effective way ?

Idea 1 Does there exist a alternate Event ?
You use "laminar/B738/autopilot/speed_press" ..... Is there also something like "laminar/B738/autopilot/speed_toggle"
So a event that execute the whole process in one command..... Means the Button get pressed and shortly behind released within one command !


Idea 2 Is it posible to line up 2 Commands within one condition ?
Something like ...
iconCode:
#MCP SPEED switch
Command 0x6522 UINT8 1 0 laminar/B738/autopilot/speed_press ; laminar/B738/autopilot/speed_press 
0 0 laminar/B738/autopilot/speed_press ; laminar/B738/autopilot/speed_press 


In that case Mobiflight would need to send only ON PRESS the Value if($=1,0,1) . And no release is needed in case this one command execute TWO TIMES the Zibo Command.
Good Luck !
2021-02-17 12:38
Avatar
axm823
Posts: 5
OK, Thanks Banzai & pizman82 's suggest.

That is what I test

#MCP SPEED switch
Command 0x6522 UINT8 1 0 laminar/B738/autopilot/speed_press _
0 0 laminar/B738/autopilot/speed_press

#MCP SPEED LED
Dataref SPEEDLED laminar/B738/autopilot/speed_status1 int
Offset 0x6511 UINT8 1 r $SPEEDLED

It work fine.

And I used a toggle for switch.
on press value if($=0,1,0)
on release value none
But pizman82's suggest 1 replace press by toggle is nothing when I press.
2021-02-17 15:18
icon