-- Liste des LVars à forcer à 0
local lvarsToInit = {
-- Chiffres
'L:GNLU910_L_FMS_0',
'L:GNLU910_L_FMS_1',
'L:GNLU910_L_FMS_2',
'L:GNLU910_L_FMS_3',
'L:GNLU910_L_FMS_4',
'L:GNLU910_L_FMS_5',
'L:GNLU910_L_FMS_6',
'L:GNLU910_L_FMS_7',
'L:GNLU910_L_FMS_8',
'L:GNLU910_L_FMS_9',
-- Signes
'L:GNLU910_L_FMS_Dot',
'L:GNLU910_L_FMS_Div',
'L:GNLU910_L_FMS_PlusMinus',
'L:GNLU910_L_FMS_Del',
'L:GNLU910_L_FMS_Clr',
'L:GNLU910_L_FMS_Sp',
-- Lettres
'L:GNLU910_L_FMS_A',
'L:GNLU910_L_FMS_B',
'L:GNLU910_L_FMS_C',
'L:GNLU910_L_FMS_D',
'L:GNLU910_L_FMS_E',
'L:GNLU910_L_FMS_F',
'L:GNLU910_L_FMS_G',
'L:GNLU910_L_FMS_H',
'L:GNLU910_L_FMS_I',
'L:GNLU910_L_FMS_J',
'L:GNLU910_L_FMS_K',
'L:GNLU910_L_FMS_L',
'L:GNLU910_L_FMS_M',
'L:GNLU910_L_FMS_N',
'L:GNLU910_L_FMS_O',
'L:GNLU910_L_FMS_P',
'L:GNLU910_L_FMS_Q',
'L:GNLU910_L_FMS_R',
'L:GNLU910_L_FMS_S',
'L:GNLU910_L_FMS_T',
'L:GNLU910_L_FMS_U',
'L:GNLU910_L_FMS_V',
'L:GNLU910_L_FMS_W',
'L:GNLU910_L_FMS_X',
'L:GNLU910_L_FMS_Y',
'L:GNLU910_L_FMS_Z',
-- Menus / Fonctions
'L:GNLU910_L_FMS_Menu',
'L:GNLU910_L_FMS_InitRef',
'L:GNLU910_L_FMS_Rte',
'L:GNLU910_L_FMS_Vnav',
'L:GNLU910_L_FMS_Legs',
'L:GNLU910_L_FMS_Prog',
'L:GNLU910_L_FMS_Atc',
'L:GNLU910_L_FMS_Fix',
'L:GNLU910_L_FMS_DepArr',
'L:GNLU910_L_FMS_Hold',
'L:GNLU910_L_FMS_Exec',
'L:GNLU910_L_FMS_PrvNxt',
-- LSK Left
'L:GNLU910_L_FMS_Lsk_1L',
'L:GNLU910_L_FMS_Lsk_2L',
'L:GNLU910_L_FMS_Lsk_3L',
'L:GNLU910_L_FMS_Lsk_4L',
'L:GNLU910_L_FMS_Lsk_5L',
'L:GNLU910_L_FMS_Lsk_6L',
-- LSK Right
'L:GNLU910_L_FMS_Lsk_1R',
'L:GNLU910_L_FMS_Lsk_2R',
'L:GNLU910_L_FMS_Lsk_3R',
'L:GNLU910_L_FMS_Lsk_4R',
'L:GNLU910_L_FMS_Lsk_5R',
'L:GNLU910_L_FMS_Lsk_6R'
}
-- On initialise toutes les LVars à 0 si la touche = 19
print("Initialisation des LVAR")
for _, lvarName in ipairs(lvarsToInit) do
ipc.writeLvar(lvarName .. '_ANIM', 0)
--ipc.sleep(50)
ipc.writeLvar(lvarName, 0)
end
print("LVars initialisées")
function FMC_KEY(offset, value)
local key = value -- On récupère la valeur de la touche
if key == 0 then
-- Pas de touche réelle appuyée, on ignore
return
end
print("Appui détecté : key =", key)
if key == 1 then
ipc.writeLvar('L:GNLU910_L_FMS_Lsk_1L', 1)
elseif key == 2 then
ipc.writeLvar('L:GNLU910_L_FMS_Lsk_2L', 1)
elseif key == 3 then
ipc.writeLvar('L:GNLU910_L_FMS_Lsk_3L', 1)
elseif key == 4 then
ipc.writeLvar('L:GNLU910_L_FMS_Lsk_4L', 1)
elseif key == 5 then
ipc.writeLvar('L:GNLU910_L_FMS_Lsk_5L', 1)
elseif key == 6 then
ipc.writeLvar('L:GNLU910_L_FMS_Lsk_6L', 1)
elseif key == 7 then
ipc.writeLvar('L:GNLU910_L_FMS_Lsk_1R', 1)
elseif key == 8 then
ipc.writeLvar('L:GNLU910_L_FMS_Lsk_2R', 1)
elseif key == 9 then
ipc.writeLvar('L:GNLU910_L_FMS_Lsk_3R', 1)
elseif key == 10 then
ipc.writeLvar('L:GNLU910_L_FMS_Lsk_4R', 1)
elseif key == 11 then
ipc.writeLvar('L:GNLU910_L_FMS_Lsk_5R', 1)
elseif key == 12 then
ipc.writeLvar('L:GNLU910_L_FMS_Lsk_6R', 1)
elseif key == 13 then
ipc.writeLvar('L:GNLU910_L_FMS_Menu', 1)
elseif key == 14 then
ipc.writeLvar('L:GNLU910_L_FMS_InitRef', 1)
elseif key == 15 then
ipc.writeLvar('L:GNLU910_L_FMS_Rte', 1)
elseif key == 16 then
ipc.writeLvar('L:GNLU910_L_FMS_Vnav', 1)
elseif key == 17 then
ipc.writeLvar('L:GNLU910_L_FMS_Legs', 1)
elseif key == 18 then
ipc.writeLvar('L:GNLU910_L_FMS_Prog', 1)
elseif key == 19 then
ipc.writeLvar('L:GNLU910_L_FMS_Atc', 1)
elseif key == 20 then
ipc.writeLvar('L:GNLU910_L_FMS_Fix', 1)
elseif key == 21 then
ipc.writeLvar('L:GNLU910_L_FMS_Vnav', 1)
elseif key == 22 then
ipc.writeLvar('L:GNLU910_L_FMS_Vnav', 1)
elseif key == 23 then
ipc.writeLvar('L:GNLU910_L_FMS_DepArr', 1)
elseif key == 24 then
ipc.writeLvar('L:GNLU910_L_FMS_Hold', 1)
elseif key == 25 then
ipc.writeLvar('L:GNLU910_L_FMS_Exec', 1)
elseif key == 26 then
ipc.writeLvar('L:GNLU910_L_FMS_PrvNxt', 0)
elseif key == 27 then
ipc.writeLvar('L:GNLU910_L_FMS_PrvNxt', 2)
elseif key >= 28 and key <= 37 then
local digit = key - 28
ipc.writeLvar('L:GNLU910_L_FMS_' .. tostring(digit), 1)
elseif key == 38 then
ipc.writeLvar('L:GNLU910_L_FMS_Dot', 1)
elseif key == 39 then
ipc.writeLvar('L:GNLU910_L_FMS_Div', 1)
elseif key == 40 then
ipc.writeLvar('L:GNLU910_L_FMS_PlusMinus', 1)
elseif key == 41 then
ipc.writeLvar('L:GNLU910_L_FMS_Del', 1)
elseif key == 42 then
ipc.writeLvar('L:GNLU910_L_FMS_Clr', 1)
elseif key == 43 then
ipc.writeLvar('L:GNLU910_L_FMS_Sp', 1)
elseif key == 44 then
ipc.writeLvar('L:GNLU910_L_FMS_A', 1)
elseif key == 45 then
ipc.writeLvar('L:GNLU910_L_FMS_B', 1)
elseif key == 46 then
ipc.writeLvar('L:GNLU910_L_FMS_C', 1)
elseif key == 47 then
ipc.writeLvar('L:GNLU910_L_FMS_D', 1)
elseif key == 48 then
ipc.writeLvar('L:GNLU910_L_FMS_E', 1)
elseif key == 49 then
ipc.writeLvar('L:GNLU910_L_FMS_F', 1)
elseif key == 50 then
ipc.writeLvar('L:GNLU910_L_FMS_G', 1)
elseif key == 51 then
ipc.writeLvar('L:GNLU910_L_FMS_H', 1)
elseif key == 52 then
ipc.writeLvar('L:GNLU910_L_FMS_I', 1)
elseif key == 53 then
ipc.writeLvar('L:GNLU910_L_FMS_J', 1)
elseif key == 54 then
ipc.writeLvar('L:GNLU910_L_FMS_K', 1)
elseif key == 55 then
ipc.writeLvar('L:GNLU910_L_FMS_L', 1)
elseif key == 56 then
ipc.writeLvar('L:GNLU910_L_FMS_M', 1)
elseif key == 57 then
ipc.writeLvar('L:GNLU910_L_FMS_N', 1)
elseif key == 58 then
ipc.writeLvar('L:GNLU910_L_FMS_O', 1)
elseif key == 59 then
ipc.writeLvar('L:GNLU910_L_FMS_P', 1)
elseif key == 60 then
ipc.writeLvar('L:GNLU910_L_FMS_Q', 1)
elseif key == 61 then
ipc.writeLvar('L:GNLU910_L_FMS_R', 1)
elseif key == 62 then
ipc.writeLvar('L:GNLU910_L_FMS_S', 1)
elseif key == 63 then
ipc.writeLvar('L:GNLU910_L_FMS_T', 1)
elseif key == 64 then
ipc.writeLvar('L:GNLU910_L_FMS_U', 1)
elseif key == 65 then
ipc.writeLvar('L:GNLU910_L_FMS_V', 1)
elseif key == 66 then
ipc.writeLvar('L:GNLU910_L_FMS_W', 1)
elseif key == 67 then
ipc.writeLvar('L:GNLU910_L_FMS_X', 1)
elseif key == 68 then
ipc.writeLvar('L:GNLU910_L_FMS_Y', 1)
elseif key == 69 then
ipc.writeLvar('L:GNLU910_L_FMS_Z', 1)
else
print("Touche non reconnue", key)
end
ipc.sleep(10) -- Petite pause pour éviter tout conflit
ipc.writeUB(0x66C0, 0) -- On remet la variable à 0
end
print("Initialisation MCDU...")
event.offset(0x66C0, "UB", "FMC_KEY")