MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

icon
Avatar
Aurelien
Posts: 5
Hi every body,
I'm Aurélien, from France, 28 years old simmer, nice to meet you on this forum.

I'm trying to make a home cockpit for A2A cessna 172. I am at the very beginning of the project! ;)

Today, i'm trying to make switch for landing light.

I managed to achieve the battery and alternator switch, with this Lua script:
iconCode:
-- test switch entrée 2 pour contact batterie

battery = ipc.readUB(0x3340)
if battery > 0 then	
ipc.writeLvar("L:Battery1Switch",1)
else
ipc.writeLvar("L:Battery1Switch",0)
end


-- test switch entrée 3 pour contact alternateur

generator = ipc.readUB(0x3344)
if generator > 0 then
ipc.writeLvar("L:Eng1_GeneratorSwitch",1)
else
ipc.writeLvar("L:Eng1_GeneratorSwitch",0)
end


and it's work very well! :w00t:

But it's not working for landing light or all of other light or fuel pomp and pitot heat...
There is many Lvar for each switch like light and fuel/pitot. However, when I switch ON the landing light for exemple, there is the Lvar "L:LightLandingSwitchSave" which passes on 1. So I tried with this code, but it does'nt work!

iconCode:
landinglight = ipc.readUB(0x3348)
if landinglight > 0 then	
ipc.writeLvar("L:LightLandingSwitchSave",1)
else
ipc.writeLvar("L:LightLandingSwitchSave",0)
end


I noticed that lvar "L:LandingLightsON" also goes to 1 so I tried with this code:
iconCode:
landinglight = ipc.readUB(0x3348)
if landinglight > 0 then
ipc.writeLvar("L:LightLandingSwitchSave",1)
ipc.writeLvar("L:LandingLightsON",1)
else
ipc.writeLvar("L:LightLandingSwitchSave",0)
ipc.writeLvar("L:LandingLightsON",0)
end


always no result... :P

Does somebody have an idea?:confused:

thank you
Aurélien
2019-01-30 12:36
icon