Sign in to follow this  
Cool

FA50 - Linda: actions.lua file

Recommended Posts

Hi

Here is mine if you would be interested to program your Saitek swtich panel / Saitek autopilot / Warthog throttle for instance

just copy and paste in your actions.lua file and feel free to adapt

************************************************

-- FA50 from FLYSIMWARE --
-- LINDA Action file from Pascal Paillart/Cool --
-- version 1.0  January 18th 2019  --

-- ## System functions ##

function InitVars ()

     OnGround = ipc.readUW("0366")   -- plane on ground?
     ipc.sleep(3000)
     if OnGround == 1 then --Airplane parked, no pilots
      ipc.writeLvar("CABIN_DOOR1",1)
      ipc.writeLvar("pilotswitch",1)
      ipc.writeLvar("pilot2switch",0)
      ipc.writeLvar("parked",1)
      ipc.writeLvar("chocks",1)
      ipc.writeLvar("headsetswitch",0)
      ipc.writeLvar("shadesswitch",0)
      ipc.writeLvar("WINDSHIELD_SHADES",1)     -- Windshield shades on
      ipc.writeLvar("FALCON_SHUTOFF1",1)      -- cutoff engine1
      ipc.writeLvar("FALCON_SHUTOFF2",1)     -- cutoff engine2
      ipc.writeLvar("FALCON_SHUTOFF3",1)    -- cutoff engine3
      ipc.writeLvar("SPEED_KNOB",110)      -- set vspeed to 110 kts
      ipc.writeLvar("XMLSND111_VOL",0)      -- trim sound set to 4000
     end  
-----------------------------------------------------------------------------------

end

-- ## Electric ###############

function Batt_on ()
      ipc.writeLvar("SW_BATT1",1)
      ipc.writeLvar("SW_BATT2",1)
      ipc.writeLvar("CABIN_DOOR1",1)
      ipc.writeLvar("pilotswitch",0)
      ipc.writeLvar("pilot2switch",1)
      ipc.writeLvar("parked",0)
      ipc.writeLvar("chocks",0)
      ipc.writeLvar("headsetswitch",1)
      ipc.writeLvar("shadesswitch",1)
      ipc.writeLvar("WINDSHIELD_SHADES",0)
end

function Batt_off ()
      ipc.writeLvar("SW_BATT1",0)
      ipc.writeLvar("SW_BATT2",0)
-- I use the battery off to park the plane just add -- in front the next lines if you do not want to have it parked      
      ipc.writeLvar("CABIN_DOOR1",0)
      ipc.writeLvar("pilotswitch",1)
      ipc.writeLvar("pilot2switch",0)
      ipc.writeLvar("parked",1)
      ipc.writeLvar("chocks",1)
      ipc.writeLvar("headsetswitch",0)
      ipc.writeLvar("shadesswitch",0)
      ipc.writeLvar("WINDSHIELD_SHADES",1)
end

function GPS_on ()
      ipc.writeLvar("GPS_POWER_BUTTON",1)
      ipc.writeLvar("mfdbrt_GPS",7)
end

function GPS_off ()
      ipc.writeLvar("GPS_POWER_BUTTON",0)
      ipc.writeLvar("mfdbrt_GPS",0)
end      
      

-- ## Anti_ice ###############

function Anti_ice_on ()
      ipc.writeLvar("SW_ICE_ENG1",1)
      ipc.writeLvar("SW_ICE_ENG2",1)
      ipc.writeLvar("SW_ICE_ENG3",1)
      ipc.writeLvar("SW_ICE_AIRFRAME",1)
end

function Anti_ice_off ()
      ipc.writeLvar("SW_ICE_ENG1",0)
      ipc.writeLvar("SW_ICE_ENG2",0)
      ipc.writeLvar("SW_ICE_ENG3",0)
      ipc.writeLvar("SW_ICE_AIRFRAME",0)
end

-- ## ALT_SEL ###############
function ALT_inc ()
    ipc.sleep(10)
    ESel = ipc.readLvar("ALERTER_CUSTOM")
    if ESel <= 49000 then ESel = ESel + 1000
    end
    ipc.writeLvar("ALERTER_CUSTOM", ESel)
end

function ALT_dec ()
    ipc.sleep(10)
    ESel = ipc.readLvar("ALERTER_CUSTOM")
    if ESel >= 1000 then ESel = ESel - 1000
    end
    ipc.writeLvar("ALERTER_CUSTOM", ESel)
end

function ALT100_inc ()
    ipc.sleep(10)
    ESel = ipc.readLvar("ALERTER_CUSTOM")
    if ESel <= 49900 then ESel = ESel + 100
    end
    ipc.writeLvar("ALERTER_CUSTOM", ESel)
end

function ALT100_dec ()
    ipc.sleep(10)
    ESel = ipc.readLvar("ALERTER_CUSTOM")
    if ESel >= 100 then ESel = ESel - 100
    end
    ipc.writeLvar("ALERTER_CUSTOM", ESel)
end

function ALT_ALERT_PRESS ()
    if _tl("ALERT_BUTTON", 0) then
       ipc.writeLvar("ALERT_BUTTON", 1)
    else
       ipc.writeLvar("ALERT_BUTTON", 0)
    end
end

-- ## Divers ###############

function Wipers_on ()
      ipc.writeLvar("WIPER1SW",-1)
      ipc.writeLvar("WIPER2SW",-1)
end

function Wipers_off ()
      ipc.writeLvar("WIPER1SW",0)
      ipc.writeLvar("WIPER2SW",0)
end

function Wipers_park ()
      ipc.writeLvar("WIPER1SW",1)
      ipc.writeLvar("WIPER2SW",1)
end

function DoorLock_on ()
      ipc.writeLvar("SAFETY_LATCH",0)
end
function DoorLock_off ()
      ipc.writeLvar("SAFETY_LATCH",1)
end

function GPU_on ()
      ipc.writeLvar("GPU_VIS",1)
end
function GPU_off ()
      ipc.writeLvar("GPU_VIS",0)
end

function TCAS_TARA ()
      ipc.writeLvar("TCAS_MODE",1)
end

function TCAS_STBY ()
      ipc.writeLvar("TCAS_MODE",0)
end

function APMODE_COPILOT ()
      ipc.writeLvar("AP_SW_XFR",1)
end

function APMODE_PILOT ()
      ipc.writeLvar("AP_SW_XFR",0)
end

function TAXI_LIGHTS_on()
      ipc.writeLvar("SW_TAXI_LIGHTS",1)
end

function TAXI_LIGHTS_off()
      ipc.writeLvar("SW_TAXI_LIGHTS",0)
end

function FUELSELECTOR_Down ()
      ipc.writeLvar("FUEL_SEL",0)
end

function FUELSELECTOR_Up ()
      ipc.writeLvar("FUEL_SEL",1)
end

function SPEED_KNOB_inc ()  -- Vspeed increase
    ipc.sleep(10)
    SK1 = ipc.readLvar("SPEED_KNOB")
    if SK1 <= 400 then SK1 = SK1 + 1
    end
    ipc.writeLvar("SPEED_KNOB", SK1)
end

function SPEED_KNOB_dec ()   -- Vspeed decrease
    ipc.sleep(10)
    SK1 = ipc.readLvar("SPEED_KNOB")
    if SK1 >= 101 then SK1 = SK1 - 1
    end
    ipc.writeLvar("SPEED_KNOB", SK1)
end

-- ## Start ###############

function Shutoff1_on ()
      ipc.writeLvar("FALCON_SHUTOFF1",1)
end

function Shutoff13_on ()  -- specific for the Trustmaster Warthog
      ipc.writeLvar("FALCON_SHUTOFF1",1)
      ipc.writeLvar("FALCON_SHUTOFF3",1)
end

function Shutoff2_on ()
      ipc.writeLvar("FALCON_SHUTOFF2",1)
end

function Shutoff3_on ()
      ipc.writeLvar("FALCON_SHUTOFF3",1)
end

function Shutoff1_off ()
      ipc.writeLvar("FALCON_SHUTOFF1",0)
end

function Shutoff13_off () -- specific for the Trustmaster Warthog
      ipc.writeLvar("FALCON_SHUTOFF1",0)
      ipc.writeLvar("FALCON_SHUTOFF3",0)
end

function Shutoff2_off ()
      ipc.writeLvar("FALCON_SHUTOFF2",0)
end

function Shutoff3_off ()
      ipc.writeLvar("FALCON_SHUTOFF3",0)
end

function Prestart_on ()  -- set to the Fuel pump switch of the Saitek swtich panel
      ipc.writeLvar("SW_CMPTR1",1)
      ipc.writeLvar("SW_CMPTR2",1)
      ipc.writeLvar("SW_CMPTR3",1)
      ipc.writeLvar("SW_BOOSTER1",1)
      ipc.writeLvar("SW_XFRPUMP1_SWITCH",1)
      ipc.writeLvar("SW_BOOSTER2",1)
      ipc.writeLvar("SW_XFRPUMP2_SWITCH",1)
      ipc.writeLvar("SW_BOOSTER3",1)
      ipc.writeLvar("SW_XFRPUMP3_SWITCH",1)
      ipc.writeLvar("SW_AC1",1)
      ipc.writeLvar("SW_AC2",1)
      ipc.writeLvar("SW_MACH_TRIM",1)
end

function Prestart_off ()  -- set to the Fuel pump switch of the Saitek swtich panel
      ipc.writeLvar("SW_CMPTR1",0)
      ipc.writeLvar("SW_CMPTR2",0)
      ipc.writeLvar("SW_CMPTR3",0)
      ipc.writeLvar("SW_BOOSTER1",0)
      ipc.writeLvar("SW_XFRPUMP1_SWITCH",0)
      ipc.writeLvar("SW_BOOSTER2",0)
      ipc.writeLvar("SW_XFRPUMP2_SWITCH",0)
      ipc.writeLvar("SW_BOOSTER3",0)
      ipc.writeLvar("SW_XFRPUMP3_SWITCH",0)
      ipc.writeLvar("SW_AC1",0)
      ipc.writeLvar("SW_AC2",0)
      ipc.writeLvar("SW_MACH_TRIM",0)      
end

function Starter1_on ()
      ipc.writeLvar("SW_STARTER1",1)
      ipc.writeLvar("STARTER1_MODE",1)
end

function Starter13_on ()  -- specific for the Trustmaster Warthog
      ipc.writeLvar("SW_STARTER1",1)
      ipc.writeLvar("STARTER1_MODE",1)
      ipc.writeLvar("SW_STARTER3",1)
      ipc.writeLvar("STARTER3_MODE",1)
end

function Starter2_on ()
      ipc.writeLvar("SW_STARTER2",1)
      ipc.writeLvar("STARTER2_MODE",1)
end

function Starter3_on ()
      ipc.writeLvar("SW_STARTER3",1)
      ipc.writeLvar("STARTER3_MODE",1)
end

function Starter1_off ()
      ipc.writeLvar("SW_STARTER1",0)
      ipc.writeLvar("STARTER1_MODE",0)
end


function Starter13_off ()  -- specific for the Trustmaster Warthog
      ipc.writeLvar("SW_STARTER1",0)
      ipc.writeLvar("STARTER1_MODE",0)
      ipc.writeLvar("SW_STARTER3",0)
      ipc.writeLvar("STARTER3_MODE",0)
end

function Starter2_off ()
      ipc.writeLvar("SW_STARTER2",0)
      ipc.writeLvar("STARTER2_MODE",0)
end

function Starter3_off ()
      ipc.writeLvar("SW_STARTER3",0)
      ipc.writeLvar("STARTER3_MODE",0)
end

 

Edited by Cool

Share this post


Link to post
Help AVSIM continue to serve you!
Please donate today!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this