Thanks for the profile. I've already created something similar, with a bit of lua editing as well, but I'm happy to use some of your setup!
However, my real question is how to figure out in the lua files which of the planes toggle switches or rotary dials can be properly mapped to their multiple states, meaning that they have either multiple Command values, or different value_down and value_up settings, or both.
Examples of this working:
The A-10C EAC Arm/Off toggle has two separate command values. So you can map your physical (single-throw) toggle switch in the lua with:
down = iCommandPlane_EAC_ARM,
up = iCommandPlane_EAC_OFF,
The A-10C Anti-Collicion Lights switch has both different command values and different value_up and value_down:
down = 3010,
up = 3011,
value_down = 1,
value_up = -1,
As I said, with some experimentation, I determined that the P-51D Rear Warning Radar also works like this, with:
down = 3002,
up = 3001,
value_down = 1,
value_up = 0,
This means, that even if my toggle is out of sync with the plane's toggle, going back and forth with it will get it in sync. Note that neither the up= or the value_up= were documented.
The problem is that some things, like the P-51D Fuel Booster, seem to only have a single iCommand value, and though I can set value_down = 1 and value_up = 0 for it, setting EITHER value just toggles the state of plane's toggle to it's opposite state. Thus, if my toggle switch is set to OFF, and the planes starts out as ON, then turning my toggle ON turns the plane's toggle OFF...
The "Synchronize with HOTAS" option doesn't fix this. Instead, it (sometimes, but not always??) will see that my physical toggle switch is ON, and will take that to mean that it should turn the plane's toggles switch OFF!
The best way I could work with this would be if there was a list of the controls per plane that specified if the control could only work as a toggle (like the Fuel Booster) and if it could work as more than that, specified the valid values (and their function) for:
up
down
value_up
value_down
Note that the A-10C lua files seem to be pretty fully specified, with actual iCommand names for most up and down values, making this much easier. It's the P-51D and UH-1H that are, um, rather difficult to interpret.
These have got to be documented somewhere. Here's hoping the documentation comes to light!