Hi. I am trying to build panels for the Airfoil Labs King Air 350. For some reason, Air Manager does not read the datarefs correctly. I adapted the Air Manager example for switches, as there are commands for toggling the switches as well as datarefs showing the switch position, but somehow Air Manager reads the switch datarefs as 0 instead of whatever they are set to. The Air Manager Data Viewer shows the datarefs as 0, while DataRefTool in X-Plane shows the correct values. I already tried setting the King Air to the pre-configured states, reinstalling the King Air and reinstalling Air Manager. Anybody got an idea what the error could be?
I tried with version 3.7 as well as 4.0 Beta.
Here is the Lua code, if anyone can find an error in those few lines.
Code: Select all
backdrop = img_add_fullscreen("panel.png")
function p_auto_comm_swcb(position, direction)
xpl_command("KA350/cmd/avpanel/pAutoComm")
end
function p_auto_comm_drcb(position)
if position == 0 then
switch_set_position(p_auto_comm, 0)
else switch_set_position(p_auto_comm, 1)
end
end
p_auto_comm = switch_add("sw_down.png", "sw_up.png", 14,42,32,42,p_auto_comm_swcb)
xpl_dataref_subscribe("KA350/ianim/avpanel/pAutoComm", "INT", p_auto_comm_drcb)