i am so lost i got mobiflight to work with pmdg but trying to figure out how to do lvars for airbus a320. all i am really needing is how to do the led for the autopilot and the 7 segment displays. I tried using the script joe wrote but nothing happened reference below. i tried doing the led for the FD. that is part of the script i used
-- lights up when FD is active
function FD_ind()
FDyn=ipc.readLvar("L:AB_MPL_FD")
ipc.writeUB(0x3341, FDyn)
end
event.Lvar("L:AB_MPL_FD",100,"FD_ind")
And then setting my mobiflight to offset 0x3341 value type INT size 1
in the fsuipc.ini I added the name of the file to the lua file
here is my whole script from joe
--Output device functions here
-- Reads Autopilot Knot setting
function AP_Speed_Setting()
Speed_Set=ipc.readLvar("L:AB_AP_SPEED_Selected")
ipc.writeUD(0x07DC, Speed_Set)
end
--Reads Autopilot Mach Setting
function AP_Mach_Setting()
Mach_Set_raw=ipc.readLvar("L:AB_AP_Mach_Select")
Mach_Set=Mach_Set_raw*100
ipc.writeUD(0x07E4, Mach_Set)
end
-- Reads autopilot heading setting
function AP_HDG_Setting()
Heading_Set=ipc.readLvar("L:AB_AP_HDG_Select")
ipc.writeUW(0x07CC, Heading_Set)
end
--Reads if the Speed/Mach button has been pushed then sets for precondition use
function SPDMACH_Toggle()
SPDMACH_on_off=ipc.readLvar("L:AB_AP_SPDMACH")
ipc.writeUB(0x66D4, SPDMACH_on_off)
end
--Reads if the HDG/TRK button has been pushed then sets for precondition use
function HDGTRK_Toggle()
HDGTRK_on_off=ipc.readLvar("L:AB_AP_HDGTRK")
ipc.writeUB(0x66D6, HDGTRK_on_off)
end
-- Reads autopilot Altitude setting
function AP_Alt_Setting()
Altitude_Set=ipc.readLvar("L:AB_AP_ALT_Select")
ipc.writeUD(0x07D4, Altitude_Set)
end
-- Reads autopilot Vertical Speed setting
function AP_VS_Setting()
VS_Set=ipc.readLvar("L:AB_AP_VS_Select2")
ipc.writeSW(0x07F2, VS_Set)
end
--Reads Autopilot FPA Setting
function AP_FPA_Setting()
FPA_Setter=ipc.readLvar("L:AB_AP_FPA_Select2")
FPA_Set=FPA_Setter*10
ipc.writeSB(0x66D7, FPA_Set)
end
-- check to see if Lvars have changed then call up the proper function
event.Lvar("L:AB_AP_TOC_SPD",100,"AP_Speed_Setting")
event.Lvar("L:AB_AP_HDG_Select",100,"AP_HDG_Setting")
event.Lvar("L:AB_AP_SPDMACH",100,"SPDMACH_Toggle")
event.Lvar("L:AB_AP_ALT_Select",100,"AP_Alt_Setting")
event.Lvar("L:AB_AP_VS_Select2",100,"AP_VS_Setting")
event.Lvar("L:AB_AP_Mach_Select",100,"AP_Mach_Setting")
event.Lvar("L:AB_AP_HDGTRK",100,"HDGTRK_Toggle")
event.Lvar("L:AB_AP_FPA_Select2",100,"AP_FPA_Setting")
--Input device functions here
--Knob setting Hdg
function HDG_SET(offset, value)
ipc.writeLvar("AB_AP_HDG_Select", value)
end
--Knob setting SPD
function SPD_SET(offset, value)
ipc.writeLvar("AB_AP_SPEED_Select", value)
end
--Knob setting MACH
function MACH_SET(offset, valueraw)
value=valueraw/100
ipc.writeLvar("AB_AP_Mach_Select", value)
end
--Toggle SPD/MACH display
function SPDMACH_SET(offset, value)
ipc.writeLvar("AB_AP_SPDMACH", value)
end
--Toggle HDG/TRK display
function HDGTRK_SET(offset, value)
ipc.writeLvar("AB_AP_HDGTRK", value)
end
--Knob setting ALT
function ALT_SET(offset, value)
ipc.writeLvar("AB_AP_ALT_Select", value)
end
--Knob setting VS
function VS_SET(offset, value)
ipc.writeLvar("AB_AP_VS_Select2", value)
end
--Toggle Metric/English display
function Metric_SET(offset, value)
ipc.writeLvar("AB_AP_Metric", value)
end
--input checks for function activation
event.offset("66E0","UD","HDG_SET")
event.offset("07DC","UD","SPD_SET")
event.offset("66D5","UB","SPDMACH_SET")
event.offset("66D6","UB","HDGTRK_SET")
event.offset("07E4","SD","MACH_SET")
event.offset("3349","UD","ALT_SET")
event.offset("334D","SD","VS_SET")
event.offset("66D8","UB","Metric_SET")
--Push/Pull switches functions
--Knob setting Spd
function SPD_pushpull(offset, value)
if (value==2) then
ipc.writeLvar("AB_AP_SPDmode", -1)
else
ipc.writeLvar("AB_AP_SPDmode", value)
end
end
--Knob setting Hdg
function HDG_pushpull(offset, value)
if (value==2) then
ipc.writeLvar("AB_AP_HDGmode", -1)
else
ipc.writeLvar("AB_AP_HDGmode", value)
end
end
--Knob setting Alt
function ALT_pushpull(offset, value)
if (value==2) then
ipc.writeLvar("AB_AP_ALTmode", -1)
ipc.writeLvar("AB_AP_KNOBALT", 0)
else
ipc.writeLvar("AB_AP_ALTmode", value)
end
end
--Knob setting VS
function VS_pushpull(offset, value)
if (value==2) then
ipc.writeLvar("AB_AP_VSAni", -1)
ipc.writeLvar("FMA_Vertmode_act", 4)
else
if (value==1) then
ipc.writeLvar("AB_AP_VSAni", value)
ipc.writeLvar("AB_AP_KNOBALT", 1)
else
ipc.writeLvar("AB_AP_VSAni", value)
end
end
end
--PUSH/PULL switches input
event.offset("66E4","SB","SPD_pushpull")
event.offset("66E5","SB","HDG_pushpull")
event.offset("66E6","SB","ALT_pushpull")
event.offset("66E7","SB","VS_pushpull")
--Button Functions(FD,LS,LOC,AP1,AP2,ATHR,APPR)
--FD status
function FD_on_off(offset, value)
ipc.writeLvar("AB_MPL_FD", value)
end
--LS status
function LS_on_off(offset, value)
ipc.writeLvar("AB_MPL_ILS", value)
end
--LOC status
function LOC_activate(offset, value)
ipc.writeLvar("AB_AP_LOC", value)
if (value==1) then
ipc.writeLvar("AB_AP_LOC2", 0)
else
end
end
--AP1 status
function AP1_toggle(offset, value)
ipc.writeLvar("AB_AP_AP1", value)
end
--ATHR status
function ATHR_on_off(offset, value)
ipc.writeLvar("AB_AP_ATHR", value)
end
--AP2 status
function AP2_toggle(offset, value)
APPR_check=ipc.readLvar("L:AB_AP_LOC2")
if (APPR_check~=1) then
if (value==1) then
ipc.writeLvar("AB_AP_AP2", 1)
ipc.writeLvar("AB_AP_AP1", 0)
else
ipc.writeLvar("AB_AP_AP2", 0)
end
else
ipc.writeLvar("AB_AP_AP2", value)
end
end
--APPR status
function APPR_activate(offset, value)
ipc.writeLvar("AB_AP_LOC2", value)
if (value==1) then
ipc.writeLvar("AB_AP_LOC", 0)
else
end
end
--Baro standard status
function STD_pressure(offset, value)
ipc.writeLvar("AB_MPL_Baro_STD", value)
end
--Buttons with lights
event.offset("3341","UB","FD_on_off")
event.offset("3342","UB","LS_on_off")
event.offset("3343","UB","LOC_activate")
event.offset("3344","UB","AP1_toggle")
event.offset("3345","UB","ATHR_on_off")
event.offset("3346","UB","AP2_toggle")
event.offset("3347","UB","APPR_activate")
event.offset("3348","UB","STD_pressure")
--AP green light indicators for FD,LS,LOC,AP1,ATHR,AP2,APPR
-- lights up when FD is active
function FD_ind()
FDyn=ipc.readLvar("L:AB_MPL_FD")
ipc.writeUB(0x3341, FDyn)
end
-- lights up when LS is active
function LS_ind()
LSyn=ipc.readLvar("L:AB_MPL_ILS")
ipc.writeUB(0x3342, LSyn)
end
-- lights up when LOC is active
function LOC_ind()
LOCyn=ipc.readLvar("L:AB_AP_LOC")
ipc.writeUB(0x3343, LOCyn)
end
-- lights up when AP1 is active
function AP1_ind()
AP1yn=ipc.readLvar("L:AB_AP_AP1")
ipc.writeUB(0x3344, AP1yn)
end
-- lights up when ATHR is active
function ATHR_ind()
ATHRyn=ipc.readLvar("L:AB_AP_ATHR")
ipc.writeUB(0x3345, ATHRyn)
end
-- lights up when AP2 is active
function AP2_ind()
AP2yn=ipc.readLvar("L:AB_AP_AP2")
ipc.writeUB(0x3346, AP2yn)
end
-- lights up when APPR is active
function APPR_ind()
APPRyn=ipc.readLvar("L:AB_AP_LOC2")
ipc.writeUB(0x3347, APPRyn)
end
-- Space holder for preconditon Barometric settings
function inHgorhPa()
HgPa=ipc.readLvar("L:AB_MPL_Baro_Unit")
ipc.writeUB(0x66D9, HgPa)
end
--Indicator light triggers for AP
event.Lvar("L:AB_MPL_FD",100,"FD_ind")
event.Lvar("L:AB_MPL_ILS",100,"LS_ind")
event.Lvar("L:AB_AP_LOC",100,"LOC_ind")
event.Lvar("L:AB_AP_AP1",100,"AP1_ind")
event.Lvar("L:AB_AP_ATHR",100,"ATHR_ind")
event.Lvar("L:AB_AP_AP2",100,"AP2_ind")
event.Lvar("L:AB_AP_LOC2",100,"APPR_ind")
event.Lvar("L:AB_MPL_Baro_Unit",100,"inHgorhPa")