Dear fellow users.
I've been spending a huge time -still do- for integrating MobiFlight and XP-11. I came such a long way and below, I'll share my findings.
- For Dataref's (Output's mostly) you use such a command,
Dataref <identifier> <dataref name> <type>
Offset <number> <type> <priority> <access> <conversion expression>
1- "Identifier" is just a name, let's say "yawdamperled" ,
2- "Dataref name" is the unique Dataref of this annunciator in XP-11 (note that it tends to change for 3rd party planes) lets's say "laminar/B738/annunciator/yaw_damp"
3- Type is the section i suck most, it's either int, float or array, but mostly int or float is used. int for "on-off" s, float is for numbers, digits simply.
4- "Number" is the offset number you'll give via Mobiflight. 0x6000 and above is free to use.
5- "Type" is for two things, a) bit size, b) signed & unsigned condition. For simple on-off switches and led's i use 8 bit (1byte), for encoders and digits i use 16 bit (2 bytes) and Float 32 bits (4 bytes) just go for UINT- ones.
6- Prio doesn't do anything tbh, set it to 1 for all
7- Access is the same with Identifier actually, just add "$" in front the identifier and copy here like "$yawdamperled". Don't forget to add "rw" before that.
So, the final appearance is like this;
Dataref yawdamperled laminar/B738/annunciator/yaw_damp int
Offset 0x6510 UINT8 1 rw $yawdamperled
With this, you'll create the fundamental of xpuipc coding. Rest is easy, just create an output config in mobi, use the same offset with 1 byte int and voila.
For Commands, it's kind of more complicated, as there are different type of commands you need to somehow integrate and it's quite different than EventID system.
Command <offset number> <offset type> [ ]
1- Again, you assign a free Offset number,
2- Determine the offset type which is mostly UINT8 for switches, but UINT16 for encoders (its Unsigned as there's no "-" value going on)
3- If the toggle parameter is 1, the command is 'clicked' whenever the offset changes to the given value, i.e fired once. If the toggle parameter is 0, the command is 'held down' as long as the offset has the given value, i.e. fired continuously until the offset change to a different value.
4- Mostly 0 for off and 1 for on, as the structure of Commands are based on momentary actions, like "Autobrake Right", let's say. If you click once, AB turns 1 step right. There's not a separate command to determine its physical position. Actually you can do it via Dataref's but (for Zibo at least) they are non-writable for now.
5- Same rule, hard-coded commands of XP-11
Some examples I use shall be like;
This one is for Left Aft Fuel Pump, just on and off,
Command 0x683B UINT8 1 0 laminar/B738/toggle_switch/fuel_pump_lft1 _
1 1 laminar/B738/toggle_switch/fuel_pump_lft1
This one is for Apu Gen 1, notice that for being momentary, i introduced the values differently,
Command 0x6837 UINT8 1 0 laminar/B738/toggle_switch/apu_gen1_dn _
0 1 laminar/B738/toggle_switch/apu_gen1_dn
This one is for APU itself, notice that there are two separate commands,
Command 0x6833 UINT8 1 0 laminar/B738/spring_toggle_switch/APU_start_pos_dn _
1 1 laminar/B738/spring_toggle_switch/APU_start_pos_up
due to the nature for command code, i need to use it twice to step down twice.
Command 0x6834 UINT8 1 0 laminar/B738/spring_toggle_switch/APU_start_pos_dn _
1 1 laminar/B738/spring_toggle_switch/APU_start_pos_dn _
0 2 laminar/B738/spring_toggle_switch/APU_start_pos_dn
This one is used for momentary commands like MCP buttons etc, notice the values.
Command 0x680E UINT8 0 0 laminar/B738/autopilot/vnav_press _
0 0 laminar/B738/autopilot/vnav_press
This one is used for encoders, but you need to add if($=1,0,1) to the value section in MobiFlight. (credits go to pizman)
Command 0x680A UINT8 1 1 laminar/B738/autopilot/altitude_up _
Command 0x680A UINT8 1 0 laminar/B738/autopilot/altitude_up
Command 0x680B UINT8 1 1 laminar/B738/autopilot/altitude_dn _
Command 0x680B UINT8 1 0 laminar/B738/autopilot/altitude_dn
This one is used for 3-way switches, however in Mobiflight configs, you need to give values to 684B as 0 on press and 1 on release, and to 684C as 1 on press and 0 on release consecutively, or vice versa.
Command 0x684B UINT8 1 0 laminar/B738/toggle_switch/l_pack_dn _
1 1 laminar/B738/toggle_switch/l_pack_up
Command 0x684C UINT8 1 0 laminar/B738/toggle_switch/l_pack_dn _
1 1 laminar/B738/toggle_switch/l_pack_up
For further questions, please don't hesitate to ask. For rotary switches, i still couldn't find a decent solution, once i do, i'll share that as well along with my config.
Cheers