Ive read the api docs and tutorials, my switches are coded like so:
Code: Select all
function switch_battery_callback(position)
print("The battery switch got changed to position " .. position)
if position == 0 then
xpl_command("sim/electrical/battery_1_off")
elseif position == 1 then
xpl_command("sim/electrical/battery_1_on")
end
end
hw_switch_add("Battery", 2, switch_battery_callback)
http://siminnovations.com/wiki/index.ph ... n_tutorial
If i start airmanager after xplane is running it works fine, switches are synchronized. Xplane will adopt what ever position the switch is at.
However if i start first airmanager first and then xplane, when xplane loads, the switches positions are not synchronized. Meaning the physical position of the switch does not match the one in xplane.
The same happens if i change aircraft from xplane (loading a new plane), all my switches are not synchronized.
How can i force synchronization from the lua code when airmanager detects xplane is connected, or any change of situation?
Because of my sim structure airmanager lives on a separate computer that gets turned on before the main computer running xplane.
This problem is quite limiting, as not having the ability to sync switches positions defeats the purpose.
Would subscribing the callback to a dataref fix this?
Thanks