Jump to content
The simFlight Network Forums

guenseli

Moderators
  • Posts

    464
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by guenseli

  1. Hello,

    first, sorry that I have to start a new topic, but I can't edit my other LUA Script post...

    I have reworked my LUA Script for the PMDG J41.

    There are some new features:

    - some new functions implemented, e.g. ice switches (except eng ice), all lights (including ice obs and consp lights)

    - all switches have their sounds now

    - all switches are animated (e.g. ALT)

    - all functions are in this LUA now - you don't need an additional Macro file!

    and the best feature:

    MCP Combo Users (using the FSUIPC VRInsight Mod) have now a synchosized Autopilot Display, means the values of the J41 Display are now also visible on the MCP Display!

    All credits go to kosta!!!

    (sometimes HDG or ALT is 1 degree or 100ft wrong, but all in all it works very good!

    Maybe ist working for other VRInsight devices too, but I don't know - try it!)

    Because of this complete new stuff, the disadvantage is, that you have to reassign your buttons.

    Old LUA assignments will not work, I'm sorry!

    Important!

    I will not explain how to use this LUA Script, or how to use the "FSUIPC VRInsight Mod".

    Everything you should need and know is in this forum here or better in the FSUIPC manuals!

    Please read and you will understand!!!

    Have fun!!!

    Günter

    Here is the list of all functions

    -- 9 ALT sel

    -- 10 ALT plus

    -- 11 ALT plus fast

    -- 12 ALT minus

    -- 13 ALT minus fast

    -- 14 ALT hold

    --

    -- 15 HDG inc

    -- 16 HDG inc fast

    -- 17 HDG dec

    -- 18 HDG dec fast

    -- 19 HDG

    -- 20 HDG bug press

    --

    -- 25 VS inc

    -- 26 VS dec

    --

    -- 30 CRS left press

    --

    -- 35 IAS Press

    -- 36 IAS plus

    -- 37 IAS plus fast

    -- 38 IAS minus

    -- 39 IAS minus fast

    --

    -- 50 NAV

    -- 51 APR

    -- 52 VS

    -- 53 BC

    -- 54 IAS

    -- 55 STBY

    --

    -- 56 AP Trim Power Switch on

    -- 57 AP Trim Power Switch off

    -- 58 AP Master

    -- 59 AP Master off

    --

    -- 70 LEFT Bearing CIRCLE Knob Minus

    -- 71 LEFT Bearing CIRCLE Knob plus

    -- 72 LEFT Bearing DIAMOND Knob Minus

    -- 73 LEFT Bearing DIAMOND Knob plus

    --

    -- 75 EFIS FULL/Map

    -- 76 EFIS TCAS

    -- 77 EFIS GSPD/TTG

    -- 78 EFIS ET

    -- 79 EFIS V/L

    -- 80 EFIS LNAV

    --

    -- 90 Pilot analog ADFVOR 1 Toggle

    -- 91 Pilot analog ADFVOR 2 Toggle

    -- 92 Pilot ADF1

    -- 93 Pilot VOR1

    -- 94 Pilot ADF2

    -- 95 Pilot VOR2

    --

    -- 100 Panel flood light on

    -- 101 Panel flood light off

    -- 102 Panel flood light toggle

    --

    -- 103 Console lights ON

    -- 104 Console lights Off

    -- 105 Console lights toggle

    --

    -- 106 flightdeck flood light toggle

    -- 107 BCN light toggle

    --

    -- 108 NAV Lights ON

    -- 109 NAV Lights Off

    -- 110 NAV Lights toggle

    --

    -- 111 STR light toggle

    -- 112 Landing lights toggle

    -- 113 Taxi light toggle

    --

    -- 114 Consp Lights ON

    -- 115 Consp Lights Off

    -- 116 Consp Lights toggle

    --

    -- 120 LEFT Battery switch TOGGLE

    -- 121 RIGHT Battery switch TOGGLE

    -- 122 BOTH Battery switch ON

    -- 123 BOTH Battery switch OFF

    --

    -- 125 Left AVIONICS SWITCh TOGGLE

    -- 126 Right AVIONICS SWITCh TOGGLE

    -- 127 both AVIONICS SWITCh on

    -- 128 both AVIONICS SWITCh off

    --

    -- 130 LEFT Generator SWITCH TOGGLE

    -- 131 RIGHT Generator SWITCH TOGGLE

    -- 132 LEFT Generator SWITCH on

    -- 133 LEFT Generator SWITCH off

    -- 134 RIGHT Generator SWITCH on

    -- 135 RIGHT Generator SWITCH off

    --

    -- 136 Left fuel Pump on

    -- 137 Left fuel Pump off

    -- 138 Right fuel Pump on

    -- 139 Right fuel Pump off

    --

    -- 140 Prop Sync Toggle

    --

    -- 145 Ground Spoiler switch on

    -- 146 Ground Spoiler switch off

    -- 147 Ground Spoiler switch toggle

    --

    -- 150 windshield deice on

    -- 151 windshield deice off

    -- 152 airdata deice on

    -- 153 airdata deice off

    -- 155 Prop deice short on

    -- 156 Prop deice short off

    -- 157 Prop deice long on

    -- 158 CCT Auto Cycle Switch

    --

    -- 160 warning mute switch toggle

    --

    -- 165 TOCW test switch on

    -- 166 TOCW test switch off

    --

    -- 170 Seatbelt on

    -- 171 Seatbelt on

    --

    -- 172 no smoking on

    -- 173 no smoking on

    --

    -- 176 engine 1 feather (LEFT)

    -- 177 no engine feather

    -- 178 engine 2 feather (RIGHT)

    --

    -- 180 select engine 1 (LEFT)

    -- 181 select engine 2 (RIGHT)

    -- 182 unselect engines

    --

    -- 185 Feathering and starting selected engine

    -- 186 abort starting sequence (stop) for selected engine

    -- 187 starting selected engine

    --

    -- 190 gust locks toggle

    -- 195 APU (ground power) connection toggle

    -- 198 yellow attention get switch

    -- 200 Anti-Skid on

    -- 201 Anti Skid off

    -- 202 Anti Skid toggle

    And here is the code (sorry, I can't attach a file here)

    -- LUA Script for the PMDG J41
    -- January, the 4th 2011
    -- made by Guenter (Guenseli) Steiner
    -- file is free for use; credits are always welcome
    -- thanks to kosta and some other guys... of course Pete Dowson
    
    
    
    -- 9 ALT sel
    -- 10 ALT plus
    -- 11 ALT plus fast
    -- 12 ALT minus
    -- 13 ALT minus fast
    -- 14 ALT hold
    --
    -- 15 HDG inc
    -- 16 HDG inc fast
    -- 17 HDG dec
    -- 18 HDG dec fast
    -- 19 HDG
    -- 20 HDG bug press
    --
    -- 25 VS inc
    -- 26 VS dec
    --
    -- 30 CRS left press
    --
    -- 35 IAS Press
    -- 36 IAS plus
    -- 37 IAS plus fast
    -- 38 IAS minus
    -- 39 IAS minus fast
    --
    -- 50 NAV
    -- 51 APR
    -- 52 VS
    -- 53 BC
    -- 54 IAS
    -- 55 STBY
    --
    -- 56 AP Trim Power Switch on
    -- 57 AP Trim Power Switch off
    -- 58 AP Master
    -- 59 AP Master off
    --
    -- 70 LEFT Bearing CIRCLE Knob Minus
    -- 71 LEFT Bearing CIRCLE Knob plus
    -- 72 LEFT Bearing DIAMOND Knob Minus
    -- 73 LEFT Bearing DIAMOND Knob plus
    --
    -- 75 EFIS FULL/Map
    -- 76 EFIS TCAS
    -- 77 EFIS GSPD/TTG
    -- 78 EFIS ET
    -- 79 EFIS V/L
    -- 80 EFIS LNAV
    --
    -- 90 Pilot analog ADFVOR 1 Toggle
    -- 91 Pilot analog ADFVOR 2 Toggle
    -- 92 Pilot ADF1
    -- 93 Pilot VOR1
    -- 94 Pilot ADF2
    -- 95 Pilot VOR2
    --
    -- 100 Panel flood light on
    -- 101 Panel flood light off
    -- 102 Panel flood light toggle
    --
    -- 103 Console lights ON
    -- 104 Console lights Off
    -- 105 Console lights toggle
    --
    -- 106 flightdeck flood light toggle
    -- 107 BCN light toggle
    --
    -- 108 NAV Lights ON
    -- 109 NAV Lights Off
    -- 110 NAV Lights toggle
    --
    -- 111 STR light toggle
    -- 112 Landing lights toggle
    -- 113 Taxi light toggle
    --
    -- 114 Consp Lights ON
    -- 115 Consp Lights Off
    -- 116 Consp Lights toggle
    --
    -- 120 LEFT Battery switch TOGGLE
    -- 121 RIGHT Battery switch TOGGLE
    -- 122 BOTH Battery switch ON
    -- 123 BOTH Battery switch OFF
    --
    -- 125 Left AVIONICS SWITCh TOGGLE
    -- 126 Right AVIONICS SWITCh TOGGLE
    -- 127 both AVIONICS SWITCh on
    -- 128 both AVIONICS SWITCh off
    --
    -- 130 LEFT Generator SWITCH TOGGLE
    -- 131 RIGHT Generator SWITCH TOGGLE
    -- 132 LEFT Generator SWITCH on
    -- 133 LEFT Generator SWITCH off
    -- 134 RIGHT Generator SWITCH on
    -- 135 RIGHT Generator SWITCH off
    --
    -- 136 Left fuel Pump on
    -- 137 Left fuel Pump off
    -- 138 Right fuel Pump on
    -- 139 Right fuel Pump off
    --
    -- 140 Prop Sync Toggle
    --
    -- 145 Ground Spoiler switch on
    -- 146 Ground Spoiler switch off
    -- 147 Ground Spoiler switch toggle
    --
    -- 150 windshield deice on
    -- 151 windshield deice off
    -- 152 airdata deice on
    -- 153 airdata deice off
    -- 155 Prop deice short on
    -- 156 Prop deice short off
    -- 157 Prop deice long on
    -- 158 CCT Auto Cycle Switch
    --
    -- 160 warning mute switch toggle
    --
    -- 165 TOCW test switch on
    -- 166 TOCW test switch off
    --
    -- 170 Seatbelt on
    -- 171 Seatbelt on
    --
    -- 172 no smoking on
    -- 173 no smoking on
    --
    -- 176 engine 1 feather (LEFT)
    -- 177 no engine feather
    -- 178 engine 2 feather (RIGHT)
    --
    -- 180 select engine 1 (LEFT)
    -- 181 select engine 2 (RIGHT)
    -- 182 unselect engines
    --
    -- 185 Feathering and starting selected engine
    -- 186 abort starting sequence (stop) for selected engine
    -- 187 starting selected engine
    --
    -- 190 gust locks toggle
    -- 195 APU (ground power) connection toggle
    -- 198 yellow attention get switch
    -- 200 Anti-Skid on
    -- 201 Anti Skid off
    -- 202 Anti Skid toggle
    
    
    -------------------------------------------------------------------------------
    -- you should delete this part BELOW the lines if you don't use a VRInsight device
    -------------------------------------------------------------------------------
    
    if VRImodel == nil then
      VRIdevice = "COM3" 
      VRIdriver = "COM2"
    end
    
    
    speed = 115200 
    handshake = 0  
    minsize = 8
    maxsize = 8     
    
    
    dev = com.open(VRIdevice, speed, handshake)
    
    if dev == 0 then
       ipc.log("Could not open VRIdevice port")
            ipc.display("Could not open VRIdevice port")
            ipc.sleep(1000)
    end
    
    -------------------------------------------------------------------------------
    -- you should delete this part ABOVE the lines if you don't use a VRInsight device
    -------------------------------------------------------------------------------
    
    
    --ipc.display("test start")
    --ipc.sleep(100)
    
    --ipc.display("VRIdevice COM".. VRIdevice.. "\nVRIdriver COM".. VRIdriver.. "\nipcPARAM".. ipcPARAM)
    --ipc.sleep(1000)
    
    
    
    
    
    
    
    ------------------------------------------------------------AP ALT
    
    -- ALT sel
    
    if ipcPARAM == 9 then
    
                    ipc.writeLvar("L:FdModeselAltselSwitch", 1)
                    ipc.control(66587,282)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.writeLvar("L:FdModeselAltselSwitch", 0)
                    ipc.control(66587,8031)
    
    
    -- ALT plus
    
    elseif ipcPARAM == 10 then
    
                    Var = ipc.readLvar("IrcAltSelKnob")
                    if Var >= 100 then 
                    Var = 1
                    end
                    ipc.writeLvar("IrcAltSelKnob", Var+1)
    
                    ipc.control(66587,3921)
    
                    ipc.control(66587,8031)
    
    
    
    -- ALT plus fast
    elseif ipcPARAM == 11 then
    
                    Var = ipc.readLvar("IrcAltSelKnob")
                    if Var >= 100 then 
                    Var = 1
                    end
                    ipc.writeLvar("IrcAltSelKnob", Var+5)
    
    
                    for n=1, 10, 1 do
                    ipc.control(66587,3921)
                    end
                    ipc.control(66587,8031)
    
    
    
    
    -- ALT minus
    
    elseif ipcPARAM == 12 then
    
    
    
                    Var = ipc.readLvar("IrcAltSelKnob")
                    if Var <= 1 then 
                    Var = 100
                    end
                    ipc.writeLvar("IrcAltSelKnob", Var-1)
    
                    ipc.control(66587,3920)
                    ipc.control(66587,8031)
    
    
    
    
    -- ALT minus fast
    
    elseif ipcPARAM == 13 then
    
                    Var = ipc.readLvar("IrcAltSelKnob")
                    if Var <= 1 then 
                    Var = 100
                    end
                    ipc.writeLvar("IrcAltSelKnob", Var-5)
    
                    for n=1, 10, 1 do
                    ipc.control(66587,3920)
                    end
                    ipc.control(66587,8031)
    
    
    -- ALT hold
    
    elseif ipcPARAM == 14 then
    
                    ipc.writeLvar("L:FdModeselAltSwitch", 1)
                    ipc.control(66587,281)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.writeLvar("L:FdModeselAltSwitch", 0)
                    ipc.control(66587,8031)
    
    ------------------------------------------------------------AP HDG
    -- HDG plus
    
    elseif ipcPARAM == 15 then
    
    
                    ipc.control(66587,26902)
    
                    ipc.control(66587,8031)
    
    
    
    
    -- HDG plus fast
    
    elseif ipcPARAM == 16 then
    
                    for n=1, 10, 1 do
                    ipc.control(66587,26902)
                    end
    
                    ipc.control(66587,8031)
    
    
    
    -- HDG minus
    
    elseif ipcPARAM == 17 then
    
    
                    ipc.control(66587,26901)
    
                    ipc.control(66587,8031)
    
    
    
    -- HDG minus fast
    
    elseif ipcPARAM == 18 then
    
                    for n=1, 10, 1 do
                    ipc.control(66587,26901)
                    end
    
                    ipc.control(66587,8031)
    
    
    
    -- HDG 
    
    elseif ipcPARAM == 19 then
    
                    ipc.writeLvar("L:FdModeselHdgSwitch", 1)
                    ipc.control(66587,277)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.writeLvar("L:FdModeselHdgSwitch", 0)
                    ipc.control(66587,8031)
    
    -- HDG bug press
    
    elseif ipcPARAM == 20 then
    
                    ipc.writeLvar("L:IrcHdgKnobPush", 1)            
                    ipc.control(66587,2691)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.writeLvar("L:IrcHdgKnobPush", 0)
                    ipc.control(66587,8031)
    
    
    ------------------------------------------------------------
    
    
    -- VS inc
    
    elseif ipcPARAM == 25 then
                    buffer = ipc.readLvar("L:VSIASTarget")
    
                    Var = ipc.readLvar("L:AP_PitchWheel")
    
    
                    ipc.writeLvar("AP_PitchWheel", Var+10)
    
    
                    ipc.writeLvar("L:VSIASTarget", buffer+100)
                    ipc.control(65894)
                    ipc.control(66587,8031)
    
    
    
    
                    buffer = ipc.readLvar("L:VSIASTarget")
    
    
                    com.write(dev, string.format("DSP_%04d", buffer), 8)
    
    
    -- VS dec
    
    elseif ipcPARAM == 26 then
                    buffer = ipc.readLvar("L:VSIASTarget")
    
                    Var = ipc.readLvar("L:AP_PitchWheel")
    
    
                    ipc.writeLvar("AP_PitchWheel", Var-10)
    
    
                    ipc.writeLvar("L:VSIASTarget", buffer-100)
                    ipc.control(65895)
                    ipc.control(66587,8031)
    
    
    
    
                    buffer = ipc.readLvar("L:VSIASTarget")
    
    
                    com.write(dev, string.format("DSP_%04d", buffer), 8)
    
    
    -- CRS press
    
    elseif ipcPARAM == 30 then
    
                    ipc.writeLvar("L:LeftIrcCrsKnobPush", 1)
                    ipc.control(66587,2671)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.writeLvar("L:LeftIrcCrsKnobPush", 0)
                    ipc.control(66587,8031)
    
    
    -- IAS knob press
    
    elseif ipcPARAM == 35 then
    
                    ipc.writeLvar("L:IrcIasKnobPush", 1)
                    ipc.control(66587,2681)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.writeLvar("L:IrcIasKnobPush", 0)
                    ipc.control(66587,8031)
    
    
    -- IAS plus 
    
    elseif ipcPARAM == 36 then
    
    
                    ipc.control(66587,26802)
    
                    ipc.control(66587,8031)
    
    -- IAS plus fast
    
    elseif ipcPARAM == 37 then
    
                    for n=1, 10, 1 do
                    ipc.control(66587,26802)
                    end
    
                    ipc.control(66587,8031)
    
    -- IAS minus
    
    elseif ipcPARAM == 38 then
    
    
                    ipc.control(66587,26801)
    
                    ipc.control(66587,8031)
    
    -- IAS minus fast
    
    elseif ipcPARAM == 39 then
    
                    for n=1, 10, 1 do
                    ipc.control(66587,26801)
                    end
    
                    ipc.control(66587,8031)
    
    
    ------------------------------------------------------------ AP Mode select
    -- NAV 
    
    elseif ipcPARAM == 50 then
    
                    ipc.writeLvar("L:FdModeselNavSwitch", 1)
                    ipc.control(66587,278)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.writeLvar("L:FdModeselNavSwitch", 0)
                    ipc.control(66587,8031)
    
    -- APR
    
    elseif ipcPARAM == 51 then
    
                    ipc.writeLvar("L:FdModeselAprSwitch", 1)
                    ipc.control(66587,279)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.writeLvar("L:FdModeselAprSwitch", 0)
                    ipc.control(66587,8031)
    
    -- VS
    
    elseif ipcPARAM == 52 then
    
                    ipc.writeLvar("L:FdModeselVsSwitch", 1)
                    ipc.control(66587,283)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.writeLvar("L:FdModeselVsSwitch", 0)
                    ipc.control(66587,8031)
    
    -- BC
    
    elseif ipcPARAM == 53 then
    
                    ipc.writeLvar("L:FdModeselBcSwitch", 1)
                    ipc.control(66587,280)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.writeLvar("L:FdModeselBcSwitch", 0)
    
                    ipc.control(66587,8031)
    -- IAS
    
    elseif ipcPARAM == 54 then
    
                    ipc.writeLvar("L:FdModeselIasSwitch", 1)
                    ipc.control(66587,284)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.writeLvar("L:FdModeselIasSwitch", 0)
                    ipc.control(66587,8031)
    
    -- STBY
    
    elseif ipcPARAM == 55 then
    
                    ipc.writeLvar("L:FdModeselSbySwitch", 1)
                    ipc.control(66587,2851)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.writeLvar("L:FdModeselSbySwitch", 0)
                    ipc.control(66587,2850)
                    ipc.control(66587,8031)
    
    -- AP Trim Power Switch on
    elseif ipcPARAM == 56 then
    
                    ipc.writeLvar("L:ApTrimPowerSwitch", 1)
                    ipc.control(66587,8034)
    
    
    
    -- AP Trim Power Switch off
    elseif ipcPARAM == 57 then
    
                    ipc.writeLvar("L:ApTrimPowerSwitch", 0)
                    ipc.control(66587,8034)
    
    
    -- AP Master
    elseif ipcPARAM == 58 then
    
                    ipc.writeLvar("L:APEngageSwitchSelect", 1)
                    ipc.control(65580)
                    ipc.control(66587,8038)
                    ipc.sleep(200)
                    ipc.writeLvar("L:APEngageSwitchSelect", 0)
                    ipc.control(66587,8038)
    
    -- AP Master off
    elseif ipcPARAM == 59 then
    
                    ipc.writeLvar("L:APEngageSwitchSelect", 1)
                    ipc.control(65791)
                    ipc.control(66587,8038)
                    ipc.sleep(200)
                    ipc.writeLvar("L:APEngageSwitchSelect", 0)
                    ipc.control(66587,8038)
    
    
    ------------------------------------------------------------ EFIS BRG1 and BRG2
    
    -- LEFT Bearing CIRCLE Knob Minus
    elseif ipcPARAM == 70 then
    
            i = ipc.readLvar("L:LeftBearingCircleKnob")
    
            if i < 3 then
            ipc.writeLvar("L:LeftBearingCircleKnob", i+1)
            ipc.sleep(10)
            ipc.control(66587, 8031)
            end
    
            if i == 3 then
            ipc.writeLvar("L:LeftBearingCircleKnob", 3)
    
            end
    
    
    -- LEFT Bearing CIRLCE Knob Plus
    elseif ipcPARAM == 71 then
    
            i = ipc.readLvar("L:LeftBearingCircleKnob")
    
            if i > 0 then
            ipc.writeLvar("L:LeftBearingCircleKnob", i-1)
            ipc.sleep(10)
            ipc.control(66587, 8031)
            end
    
            if i == 0 then
            ipc.writeLvar("L:LeftBearingCircleKnob", 0)
    
            end
    
    
    -- LEFT Bearing DIAMOND Knob Minus
    elseif ipcPARAM == 72 then
    
            i = ipc.readLvar("L:LeftBearingDiamondKnob")
    
            if i > 0 then
            ipc.writeLvar("L:LeftBearingDiamondKnob", i-1)
            ipc.sleep(10)
            ipc.control(66587, 8031)
            end
    
            if i == 0 then
            ipc.writeLvar("L:LeftBearingDiamondKnob", 0)
    
            end     
    
    
    -- LEFT Bearing DIAMOND Knob Plus
    elseif ipcPARAM == 73 then
    
            i = ipc.readLvar("L:LeftBearingDiamondKnob")
    
            if i < 3 then
            ipc.writeLvar("L:LeftBearingDiamondKnob", i+1)
            ipc.sleep(10)
            ipc.control(66587, 8031)
            end
    
            if i == 3 then
            ipc.writeLvar("L:LeftBearingDiamondKnob", 3)
    
            end
    
    
    ------------------------------------------------------------ EFIS
    -- Full/Map 
    
    elseif ipcPARAM == 75 then
    
                    ipc.control(66587,214)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.control(66587,8031)
    
    
    -- TCAS 
    
    elseif ipcPARAM == 76 then
    
                    ipc.control(66587,215)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.control(66587,8031)
    
    
    -- GSPD/TTG 
    
    elseif ipcPARAM == 77 then
    
                    ipc.control(66587,217)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.control(66587,8031)
    
    -- ET
    
    elseif ipcPARAM == 78 then
    
                    ipc.control(66587,218)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.control(66587,8031)
    
    
    -- V/L 
    
    elseif ipcPARAM == 79 then
    
                    ipc.control(66587,21901)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.control(66587,8031)
    
    
    -- LNAV 
    
    elseif ipcPARAM == 80 then
    
                    ipc.control(66587,21910)
                    ipc.control(66587,8031)
                    ipc.sleep(200)
                    ipc.control(66587,8031)
    
    ------------------------------------------------------------ Pilot analog VOR/ADF
    
    
    -- Pilot analog ADFVOR 1 Toggle
    elseif ipcPARAM == 90 then   
    
    
            LVarSet = "L:LeftAdfVorSwitch"
            val = 1
    
            if ipc.readLvar(LVarSet) == 1  then
            val = 2
            end
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, 8024)
    
    
    
    
    
    -- Pilot analog ADFVOR 2 Toggle
    elseif ipcPARAM == 91 then
    
            LVarSet = "L:LeftVorAdfSwitch"
            val = 1
    
            if ipc.readLvar(LVarSet) == 1  then
            val = 2
            end
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, 8024)
    
    
    
    
    
    -- Pilot ADF1 
    elseif ipcPARAM == 92 then
    
            ipc.writeLvar("L:LeftAdfVorSwitch", 0)
            ipc.control(66587, 8024)
    
    
    
    
    
    -- Pilot VOR1
    elseif ipcPARAM == 93 then
    
            ipc.writeLvar("L:LeftAdfVorSwitch", 1)
            ipc.control(66587, 8024)
    
    
    
    
    
    -- Pilot ADF2
    elseif ipcPARAM == 94 then
    
            ipc.writeLvar("L:LeftVorAdfSwitch", 1)
            ipc.control(66587, 8024)
    
    
    
    
    
    -- Pilot VOR2
    elseif ipcPARAM == 95 then
    
            ipc.writeLvar("L:LeftVorAdfSwitch", 0)
            ipc.control(66587, 8024)
    
    
    ------------------------------------------------------------ Lights
    
    -- Panel flood light on
    elseif ipcPARAM == 100 then
    
            ipc.writeLvar("L:PanelFloodSW", 1)
            ipc.control(66587, 8029)
    
    
    -- Panel flood light off
    elseif ipcPARAM == 101 then
    
            ipc.writeLvar("L:PanelFloodSW", 0)
            ipc.control(66587, 8029)
    
    
    -- Panel flood light toggle
    elseif ipcPARAM == 102 then
            LVarSet = "L:PanelFloodSW"
            val = 0
    
            if ipc.readLvar(LVarSet) == 0 then
            val = 1
                    end
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, 8029)
    
    
    ----------------------------------------------
    -- Console lights ON
    elseif ipcPARAM == 103 then
    
            ipc.control(66056)
            ipc.writeLvar("L:InstrConsolesLightSwitch", 1)
            ipc.writeLvar("L:InstrRoofLightSwitch", 1)
            ipc.writeLvar("L:InstrGlareshieldLightSwitch", 1)
            ipc.control(66587, 8031)
    
    
    -- Console lights OFF
    elseif ipcPARAM == 104 then
    
            ipc.control(66057)
            ipc.writeLvar("L:InstrConsolesLightSwitch", 0)
            ipc.writeLvar("L:InstrRoofLightSwitch", 0)
            ipc.writeLvar("L:InstrGlareshieldLightSwitch", 0)
            ipc.control(66587, 8031)
    
    
    -- Console lights toggle
    elseif ipcPARAM == 105 then
    
            val = 0
            val2 = 66057
            if ipc.readLvar("L:InstrConsolesLightSwitch") == 0 then
            val = 1
            val2 = 66056
                    end
            ipc.control(val2)
            ipc.writeLvar("L:InstrConsolesLightSwitch", val)
            ipc.writeLvar("L:InstrRoofLightSwitch", val)
            ipc.writeLvar("L:InstrGlareshieldLightSwitch", val)
            ipc.control(66587, 8031)
    
    
    -- flightdeck flood light toggle
    elseif ipcPARAM == 106 then
            ipc.control(66376)
            ipc.control(66587,8027)
    
    
    -- BCN light toggle
    elseif ipcPARAM == 107 then
            ipc.control(66239)
            ipc.control(66587,8027)
    
    
    
    -- NAV Lights ON
    elseif ipcPARAM == 108 then
    
            ipc.writeLvar("L:NavLightSwitch", 2)
            ipc.control(66587, 8028)
    
    -- NAV Lights Off
    elseif ipcPARAM == 109 then
    
            ipc.writeLvar("L:NavLightSwitch", 1)
            ipc.control(66587, 8027)
    
    -- NAV light toggle
    elseif ipcPARAM == 110 then
            LVarSet = "L:NavLightSwitch"
            val = 1
            val2 = 8027
            if ipc.readLvar(LVarSet) == 1 then
            val = 2
            val2 = 8028
                    end
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, val2)
    
    
    -- STR light toggle
    elseif ipcPARAM == 111 then
            ipc.control(65560)
            ipc.control(66587,8028)
    
    
    -- Landing lights toggle
    elseif ipcPARAM == 112 then
            ipc.control(65751)
            ipc.control(66587,8027)
    
    
    -- Taxi light toggle
    elseif ipcPARAM == 113 then
            ipc.control(66240)
            ipc.control(66587,8028)
    
    
    
    -- Consp Lights ON
    elseif ipcPARAM == 114 then
    
            ipc.writeLvar("L:ConspicLight", 1)
            ipc.control(66587, 8028)
            ipc.control(66377)
    
    -- Consp Lights Off
    elseif ipcPARAM == 115 then
    
            ipc.writeLvar("L:ConspicLight", 0)
            ipc.control(66587, 8027)
            ipc.control(66377)
    
    -- Consp light toggle
    elseif ipcPARAM == 116 then
            LVarSet = "L:ConspicLight"
            val = 0
            val2 = 8027
            if ipc.readLvar(LVarSet) == 0 then
            val = 1
            val2 = 8028
                    end
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, val2)
            ipc.control(66377)
    
    ------------------------------------------------------------ Battery
    
    -- LEFT Battery switch TOGGLE
    elseif ipcPARAM == 120 then   
    
    
            LVarSet = "L:LeftBatSwitch"
            val = 0
    
            if ipc.readLvar(LVarSet) == 0  then
            val = 1
            end
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, 8028)
    
    
    -- RIGHT Battery switch TOGGLE
    elseif ipcPARAM == 121 then
    
    
            LVarSet = "L:RightBatSwitch"
            val = 0
    
            if ipc.readLvar(LVarSet) == 0  then
            val = 1
            end
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, 8028)
    
    
    
    -- BOTH Battery switch on
    elseif ipcPARAM == 122 then
    
    
            ipc.writeLvar("L:RightBatSwitch", 1)
            ipc.control(66587, 8028)
            ipc.sleep(250)
            ipc.writeLvar("L:LeftBatSwitch", 1)
            ipc.control(66587, 8028)
    
    
    -- BOTH Battery switch off
    elseif ipcPARAM == 123 then
    
    
            ipc.writeLvar("L:RightBatSwitch", 0)
            ipc.control(66587, 8027)
            ipc.sleep(250)
            ipc.writeLvar("L:LeftBatSwitch", 0)
            ipc.control(66587, 8027)
    
    
    ------------------------------------------------------------ Avionics
    
    -- Left AVIONICS SWITCh TOGGLE
    elseif ipcPARAM == 125 then
    
    
            LVarSet = "L:LeftAvionicsMaster"
            val = 0
    
            if ipc.readLvar(LVarSet) == 0  then
            val = 1
            end
    
            ipc.writeLvar("L:LeftAvionicsMasterGuard", val)
            ipc.control(66587, 8026)
            ipc.sleep(500)
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, 8027)
    
    
    
    
    -- RIGHT AVIONICS SWITCh TOGGLE
    elseif ipcPARAM == 126 then
    
    
            LVarSet = "L:RightAvionicsMaster"
            val = 0
    
            if ipc.readLvar(LVarSet) == 0  then
            val = 1
            end
    
            ipc.writeLvar("L:RightAvionicsMasterGuard", val)
            ipc.control(66587, 8026)
            ipc.sleep(500)
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, 8027)
    
    
    
    
    -- both AVIONICS SWITCh on
    elseif ipcPARAM == 127 then
    
    
            ipc.writeLvar("L:RightAvionicsMasterGuard", 1)
            ipc.control(66587, 8026)
            ipc.sleep(400)
            ipc.writeLvar("L:RightAvionicsMaster", 1)
            ipc.control(66587, 8028)
            ipc.sleep(100)
    
    
            ipc.writeLvar("L:LeftAvionicsMasterGuard", 1)
            ipc.control(66587, 8026)
            ipc.sleep(400)
            ipc.writeLvar("L:LeftAvionicsMaster", 1)
            ipc.control(66587, 8028)
    
    
    
    -- both AVIONICS SWITCh off
    elseif ipcPARAM == 128 then
    
    
            ipc.writeLvar("L:RightAvionicsMasterGuard", 0)
            ipc.control(66587, 8026)
            ipc.sleep(400)
            ipc.writeLvar("L:RightAvionicsMaster", 0)
            ipc.control(66587, 8027)
            ipc.sleep(100)
    
    
            ipc.writeLvar("L:LeftAvionicsMasterGuard", 0)
            ipc.control(66587, 8026)
            ipc.sleep(400)
            ipc.writeLvar("L:LeftAvionicsMaster", 0)
            ipc.control(66587, 8027)
    
    
    ------------------------------------------------------------ GEN
    
    -- LEFT Generator SWITCH TOGGLE
    elseif ipcPARAM == 130 then
    
    
            LVarSet = "L:LeftGenSwitch"
            val = 1
    
            if ipc.readLvar(LVarSet) == 1  then
            val = 2
            end
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, 8027)
    
    
    -- right Generator SWITCH TOGGLE
    elseif ipcPARAM == 131 then
    
    
            LVarSet = "L:RightGenSwitch"
            val = 1
    
            if ipc.readLvar(LVarSet) == 1  then
            val = 2
            end
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, 8027)
    
    
    -- left Generator SWITCH on
    elseif ipcPARAM == 132 then
    
    
            ipc.writeLvar("L:LeftGenSwitch", 2)
            ipc.control(66587, 8027)
    
    
    -- left Generator SWITCH off
    elseif ipcPARAM == 133 then
    
    
            ipc.writeLvar("L:LeftGenSwitch", 1)
            ipc.control(66587, 8028)
    
    
    
    -- right Generator SWITCH on
    elseif ipcPARAM == 134 then
    
    
            ipc.writeLvar("L:RightGenSwitch", 2)
            ipc.control(66587, 8027)
    
    
    -- right Generator SWITCH off
    elseif ipcPARAM == 135 then
    
    
            ipc.writeLvar("L:RightGenSwitch", 1)
            ipc.control(66587, 8028)
    
    
    ------------------------------------------------------------ FUEL PUMPS
    
    
    -- Left fuel Pump on
    elseif ipcPARAM == 136 then
    
            ipc.writeLvar("L:LeftStbyFuelPump", 1)
            ipc.control(66587, 8028)
    
    
    -- Left fuel Pump off
    elseif ipcPARAM == 137 then
    
            ipc.writeLvar("L:LeftStbyFuelPump", 0)
            ipc.control(66587, 8027)
    
    
    -- right fuel Pump on
    elseif ipcPARAM == 138 then
    
            ipc.writeLvar("L:RightStbyFuelPump", 1)
            ipc.control(66587, 8028)
    
    
    -- right fuel Pump off
    elseif ipcPARAM == 139 then
    
            ipc.writeLvar("L:RightStbyFuelPump", 0)
            ipc.control(66587, 8027)
    
    ------------------------------------------------------------ Prop sync
    -- prop sync toggle
    elseif ipcPARAM == 140 then   
            LVarSet = "L:PropSync"
            val = 0
            val2 = 8027
            if ipc.readLvar(LVarSet) == 0 then
            val = 1
            val2 = 8028
                    end
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, val2)
    
    
    ------------------------------------------------------------ Ground spoiler
    --  Ground Spoiler switch on
    elseif ipcPARAM == 145 then
    
                    ipc.writeLvar("L:GrndSpoilersSwitch", 1)
                    ipc.control(66587,8034)
    
    
    
    -- Ground Spoiler switch off
    elseif ipcPARAM == 146 then
    
                    ipc.writeLvar("L:GrndSpoilersSwitch", 0)
                    ipc.control(66587,8034)
    
    
    -- Ground Spoiler switch toggle
    elseif ipcPARAM == 147 then
    
            LVarSet = "L:GrndSpoilersSwitch"
            val = 0
    
            if ipc.readLvar(LVarSet) == 0 then
            val = 1
                    end
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, 8034)
    
    ------------------------------------------------------------ Ice oBS lights
    -- Ice OBS lights on
    elseif ipcPARAM == 148 then
            ipc.writeLvar("IceOBSSwitch", 2)
    
            ipc.control(66587,8027)
    
    
    -- Ice OBS lights off
    elseif ipcPARAM == 149 then
            ipc.writeLvar("IceOBSSwitch", 0)
    
            ipc.control(66587,8028)
    
    ------------------------------------------------------------ Windshield Deice
    -- windshield deice on
    elseif ipcPARAM == 150 then
            ipc.writeLvar("LeftWSAntice", 2)
            ipc.writeLvar("RightWSAntice", 1)
            ipc.control(66587,8027)
    
    
    -- windshield deice off
    elseif ipcPARAM == 151 then
            ipc.writeLvar("LeftWSAntice", 1)
            ipc.writeLvar("RightWSAntice", 0)
            ipc.control(66587,8028)
    
    ------------------------------------------------------------ Airdata Deice
    -- airdata deice on
    elseif ipcPARAM == 152 then
            ipc.writeLvar("LeftAirData", 1)
            ipc.writeLvar("RightAirData", 1)
            ipc.control(66587,8027)
    
    
    -- airdata deice off
    elseif ipcPARAM == 153 then
            ipc.writeLvar("LeftAirData", 0)
            ipc.writeLvar("RightAirData", 0)
            ipc.control(66587,8028)
    
    
    
    ------------------------------------------------------------ Prop Deice
    -- Prop deice short on
    elseif ipcPARAM == 155 then
            val = 2
            SWvar = ipc.readLvar("LeftPropDeice")
            if SWvar == 0 then
            val = 1 
            end
            ipc.writeLvar("LeftPropDeice", val)
            ipc.writeLvar("RightPropDeice", val)
            ipc.control(66587,8027)
    
    
    -- Prop deice off
    elseif ipcPARAM == 156 then
            ipc.writeLvar("LeftPropDeice", 1)
            ipc.writeLvar("RightPropDeice", 1)
            ipc.control(66587,8028)
    
    -- Prop deice long on
    elseif ipcPARAM == 157 then
    
            val = 0
            SWvar = ipc.readLvar("LeftPropDeice")
            if SWvar == 2 then
            val = 1 
            end
            ipc.writeLvar("LeftPropDeice", val)
            ipc.writeLvar("RightPropDeice", val)
            ipc.control(66587,8027)
    ------------------------------------------------------------ Deice Auto cycle
    
    -- CCT Auto Cycle Switch
    elseif ipcPARAM == 158 then
    
            ipc.writeLvar("L:AutoAnticeCycle", 2)
            ipc.control(66587, 8028)
    
            ipc.sleep(400)
            ipc.writeLvar("L:AutoAnticeCycle", 1)
            ipc.control(66587, 8027)
    
    
    ------------------------------------------------------------ warning mute
    --warning mute switch toggle
    elseif ipcPARAM == 160 then
    
            LVarSet = "L:CapMuted"
            val = 0
    
            if ipc.readLvar(LVarSet) == 0  then
            val = 1
            end
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, 8031)
            ipc.sleep(100)
            ipc.writeLvar("L:CapMuteSwitch", val)
    
            ipc.control(66587, 8031)
    
    ------------------------------------------------------------ TOCW test switch
    -- TOCW Testswitch ON
    elseif ipcPARAM == 165 then
    
            ipc.control(66587, 8021)        
            ipc.writeLvar("L:TocwTestSwitch", 1)
    
    
    -- TOCW Testswitch OFF
    elseif ipcPARAM == 166 then
    
            ipc.control(66587, 8021)        
            ipc.writeLvar("L:TocwTestSwitch", 0)
    
    
    ------------------------------------------------------------ signs
    -- Seatbelt on
    elseif ipcPARAM == 170 then
    
            ipc.writeLvar("L:FastenSeatbeltSigns", 1)
            ipc.control(66587, 8028)
            ipc.sleep(10)
            ipc.control(66587, 74)
    
    
    -- Seatbelt off
    elseif ipcPARAM == 171 then
    
            ipc.writeLvar("L:FastenSeatbeltSigns", 0)
            ipc.control(66587, 8027)
            ipc.sleep(10)
            ipc.control(66587, 74)
    
    
    -- no smoking on
    elseif ipcPARAM == 172 then
    
            ipc.writeLvar("L:NoSmokingSigns", 1)
            ipc.control(66587, 8028)
            ipc.sleep(10)
            ipc.control(66587, 74)
    
    
    -- no skmoking off
    elseif ipcPARAM == 173 then
    
            ipc.writeLvar("L:NoSmokingSigns", 0)
            ipc.control(66587, 8027)
            ipc.sleep(10)
            ipc.control(66587, 74)
    
    
    ------------------------------------------------------------ feathering
    
    -- engine 1 (LEFT)
    elseif ipcPARAM == 176 then   
    
            ipc.writeLvar("L:UnFeather", -1)
                    ipc.control(66587, 1420)
            ipc.control(66587, 8029) -- knob sound
    
    -- no engine 
    elseif ipcPARAM == 177 then   
    
            ipc.writeLvar("L:UnFeather", 0)
            ipc.control(66587, 8029) -- knob sound
    
    -- engine 2 (RIGHT)
    elseif ipcPARAM == 178 then   
    
            ipc.writeLvar("L:UnFeather", 1)
                    ipc.control(66587, 1421)
            ipc.control(66587, 8029) -- knob sound
    
    ------------------------------------------------------------ engine starting
    
    
    -- select engine 1 (LEFT)
    elseif ipcPARAM == 180 then   
    
            if ipc.readLvar("L:StartMasterKnob") == 2  then
    
                    ipc.writeLvar("L:StartMasterKnob", 1)
            ipc.display("no engine selected...")
            ipc.sleep(1000)
    
            elseif ipc.readLvar("L:StartMasterKnob") == 1  then
    
                    ipc.writeLvar("L:StartMasterKnob", 0)
            ipc.display("left engine selected...")
            ipc.sleep(1000)
            end
    
    -- select engine 2 (RIGHT)
    elseif ipcPARAM == 181 then   
    
    
            if ipc.readLvar("L:StartMasterKnob") == 0  then
    
                    ipc.writeLvar("L:StartMasterKnob", 1)
            ipc.display("no engine selected...")
            ipc.sleep(1000)
    
            elseif ipc.readLvar("L:StartMasterKnob") == 1  then
    
                    ipc.writeLvar("L:StartMasterKnob", 2)
            ipc.display("right engine selected...")
            ipc.sleep(1000)
            end
    
    
    -- unselect engines
    elseif ipcPARAM == 182 then   
    
    
                    ipc.writeLvar("L:StartMasterKnob", 1)
            ipc.display("no engine selected...")
            ipc.sleep(1000)
    
    
    -- Feathering and starting selected engine -----------------
    elseif ipcPARAM == 185 then   
    
    
    
    -- Feathering and starting left engine
    
                    if ipc.readLvar("L:StartMasterKnob") == 0  then
    
    
                    ipc.control(66587, 1420)
            ipc.control(66587, 8029) -- knob sound
            ipc.display("feathering left engine...")
    
            ipc.sleep(8000) -- waiting for feathering
    
            ipc.display("feathering left engine...\n Starting left engine")
    
    
            ipc.writeLvar("L:LeftStart", 1)
    
            ipc.writeLvar("L:StartOneToggle", 1)
            ipc.writeLvar("L:LeftStartCheck", 1)
            ipc.writeLvar("L:LeftStartTimer", 1)
    
    
            end
    
    
    
    -- Feathering and starting right engine
    
    
            if ipc.readLvar("L:StartMasterKnob") == 2  then
    
    
            ipc.control(66587, 1421)
            ipc.control(66587, 8029) -- knob sound
            ipc.display("feathering right engine...")
    
            ipc.sleep(8000) -- waiting for feathering
    
            ipc.display("feathering right engine...\n Starting right engine")
    
    
            ipc.writeLvar("L:RightStart", 1)
    
            ipc.writeLvar("L:StartTwoToggle", 1)
            ipc.writeLvar("L:RightStartCheck", 1)
            ipc.writeLvar("L:RightStartTimer", 1)
    
            end
    
    ipc.display("")
    
    
    -- abort starting sequence (stop) for selected engine -----------------
    elseif ipcPARAM == 186 then 
    
    
    -- right engine stop
    
            if ipc.readLvar("L:StartMasterKnob") == 2  then
    
            -- Open the stop switch guard
            RSG = ipc.readLvar("L:RightEngStopSwitchGuard")
            if RSG == 0 then
            ipc.writeLvar("L:RightEngStopSwitchGuard", 1)
            ipc.control(66587, 8010)
            end
    
            -- Press the stop switch
            ipc.sleep(700)
            ipc.writeLvar("L:StopTwoToggle", 1)
            ipc.control(66587, 100001)
    
            ipc.control(66587, 8042)
            ipc.control(66587, 16)
            ipc.control(66301)
    
            ipc.control(66587, 100002)
    
            ipc.sleep(200)
            ipc.writeLvar("L:StopTwoToggle", 0)
            ipc.control(66587, 8042)
    
            -- Close the stop switch guard
            ipc.sleep(200)
            ipc.writeLvar ("L:RightEngStopSwitchGuard", 0)
            ipc.control (66587, 8010)
    
            end
    
    -- left engine stop
            if ipc.readLvar("L:StartMasterKnob") == 0  then
    
     -- Open the stop switch guard
            LSG = ipc.readLvar("L:LeftEngStopSwitchGuard")
            if LSG == 0 then
            ipc.writeLvar("L:LeftEngStopSwitchGuard", 1)
            ipc.control(66587, 8010)
            end
    
            -- Press the stop switch
            ipc.sleep(700)
            ipc.writeLvar("L:StopOneToggle", 1)
            ipc.control(66587, 100001)
    
            ipc.control(66587, 8042)
            ipc.control(66587, 15)
            ipc.control(66300)
    
            ipc.control(66587, 100002)
    
            ipc.sleep(200)
            ipc.writeLvar("L:StopOneToggle", 0)
            ipc.control(66587, 8042)
    
            -- Close the stop switch guard
            ipc.sleep(200)
            ipc.writeLvar ("L:LeftEngStopSwitchGuard", 0)
            ipc.control (66587, 8010)
    
            end
    ipc.display("engine starting sequence stopped") 
    ipc.sleep(1000)
    ipc.display("")
    
    --------------------------------------------------------------
    
    -- starting selected engine -----------------
    elseif ipcPARAM == 187 then   
    
    
    
    -- starting left engine
    
                    if ipc.readLvar("L:StartMasterKnob") == 0  then
    
    
            ipc.writeLvar("L:LeftStart", 1)
    
            ipc.writeLvar("L:StartOneToggle", 1)
            ipc.writeLvar("L:LeftStartCheck", 1)
            ipc.writeLvar("L:LeftStartTimer", 1)
    
    
            end
    
    
    
    -- starting right engine
    
    
            if ipc.readLvar("L:StartMasterKnob") == 2  then
    
    
            ipc.writeLvar("L:RightStart", 1)
    
            ipc.writeLvar("L:StartTwoToggle", 1)
            ipc.writeLvar("L:RightStartCheck", 1)
            ipc.writeLvar("L:RightStartTimer", 1)
    
            end
    
    
    
    
    
    -- toggle gust locks
    elseif ipcPARAM == 190 then   
    
            LVarSet = "L:GustLocks"
            val = 0
    
            if ipc.readLvar(LVarSet) == 0  then
            val = 1
            end
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, 141)
    
    
    
    
    --Ground power switch toggle 
    elseif ipcPARAM == 195 then
    
            LVarSet = "L:GndPowerSwitch"
            LVar2Set = "L:PowerCartVis"
    
            val = 0
            val2 = 1
    
            if ipc.readLvar(LVarSet) == 0  then
            val = 1
            val2 = 0
            end
    
    
            ipc.writeLvar(LVar2Set, val2)
            ipc.sleep (300)
            ipc.writeLvar(LVarSet, val)
    
    
            ipc.control(66587, 8027)
    
    
    --------------------------------------------------------------
    -- yellow attention get switch
    elseif ipcPARAM == 198 then
    
            ipc.writeLvar("L:LeftAmberAtgetSwitch", 1)
            ipc.control(66587,2090)
            ipc.control(66587,8044)
            ipc.sleep(400)
            ipc.writeLvar("L:LeftAmberAtgetSwitch", 0)
            ipc.control(66587,2091)
            ipc.control(66587,8045)
    
    --------------------------------------------------------------
    
    --  Anti Skid on
    elseif ipcPARAM == 200 then
    
                    ipc.writeLvar("L:AntiSkid", 1)
                    ipc.control(66587,8029)
    
    
    
    --  Anti Skid off
    elseif ipcPARAM == 201 then
    
                    ipc.writeLvar("L:AntiSkid", 0)
                    ipc.control(66587,8029)
    
    
    --  Anti Skid  toggle
    elseif ipcPARAM == 202 then
    
            LVarSet = "L:AntiSkid"
            val = 0
    
            if ipc.readLvar(LVarSet) == 0 then
            val = 1
                    end
    
            ipc.writeLvar(LVarSet, val)
            ipc.control(66587, 8029)
    
    
    
    ---------------------------------------------------------------------
    end
    
    
    
    
    
    -------------------------------------------------------------------------------
    -- you can delete this part below the lines if you don't use a VRInsight device
    -------------------------------------------------------------------------------
    
    -------------------------------------
                    buffer = ipc.readLvar("L:AltSelAlt")/100
                    if buffer <= 0 then
                    buffer = 0
                    end
    
                    com.write(dev, string.format("ALT%03d", buffer), 8)
    -------------------------------------
                    buffer = ipc.readLvar("L:HDGBug")
                    com.write(dev, string.format("HDG%03d", buffer), 8)
    
    -- ipc.display(ipc.readLvar("L:AltSelAlt"))
    -- ipc.sleep(1000)

  2. Hi Pete,

    hope you have a nice christmas!

    With the help of some topics here in the forum I managed to write values in the MCP Combo Display

    As example here is the code for J41:

    buffer = ipc.readLvar("L:AltSelAlt")/100
    com.write(dev, string.format("ALT%03d", buffer), 8)

    What I wonder know is, if it is possible to read a value out of the MCP Combo display?

    Like in the example above writing to the ALT display, know reading the shown ALT out of the display...

    I made several attempts with com.read but you know that I'm no programer, so this was without success...

    Is this possible and if yes, how?

    thanks very much,

    Günter

  3. So, when changing to reverse thrust mode, send Throttle Cut and Throttle Decr, just the two. When changing back, send Throttle Cut, Throttle inc

    Hello Pete, thanks for the hint.

    But I have tried both...

    I will have a look into it again if there's time.

    MD11 was working, but A2A B377 or J41 not.

    All three work with "F2" reversers, but maybe theres a difference between jetengines and propellers?

    Maybe I will try with some propeller-offsets again...

  4. ok, just to complete this thread if anyone is interested:

    I managed to get it working.

    I could press a button and pull the throttle forward what is then acting as reverser.

    Full throttle means then about 50% N1 reverse thrust.

    Unfortunaltely I found out, that the most complex addons use some other kind of reverse thrust.

    Most work well with pressing "F2" but not then with my LUA. Don't know why. Tried several ways to get it solved.

    So I gave up, because that is really not #1 of my list :wink:

    Just wanted to try it a bit...

  5. will send you my log via mail...

    I have found this little section inside the log:

       152179 WRITElua 310A,   1 bytes: 08                                               .
       152179 Monitor IPC:310A (U8) = 8
       152179 WRITElua 310A,   1 bytes: 03                                               .
       152241 Monitor IPC:310A (U8) = 3

    does it write "8" AND "3" ???

    I have also changed my LUA to your suggestion

    ipc.writeUB(0x310A, 8)

    very interested what you can see out of my logfile...

    thanks very much,

    Günter

  6. Hi Pete,

    sorry I forgot about that thread...

    Now I jumped in again and stuck with offset 310A

    I have a simple LUA containing

    ipc.writeUB(0x310A, 8)

    and nothing else.

    This should normally disable the throttle, right?

    What happens here is, that aileron and elevator are disabled for 10 seconds, but throttle and rudder are working.

    And I have tried several values instead of the "8" and nothing changes...

    my FSUIPC version is 4.637

    thank you very much,

    Günter

  7. Good morning, Pete.

    Yes, I reset my device everytime before connecting SerialFP2. Thats a standard procedure.

    (But I'm not sure if I reset it everytime, before starting FSX or starting a flight - will take care of that)

    And yes, I have had same problems during Beta.

    But now I have a complete new system (but also Win7 64) and I have hoped, therefore the "problems" where solved.

    System is much better now and I have absolutely no problems with nearly full settings in FSX, but this little connecting problems stays...

    I have made a bunch of screenshots of my device manager and the COM settings.

    Maybe you can see if sth is didfferent to your system.

    FTDI driver is the latest

    unbenannt1e.jpg

    unbenannt5t.jpg

    unbenannt3yv.jpg

    unbenannt2x.jpg

    unbenannt4cm.jpg

    thank you very much,

    Günter

  8. Yes, but the problem is the device port, as you can see:

    VRI port 1 "COM3" failed to open

    FS will, for example, not be full closed for quite a few seconds after its Windows all disappear.

    Yes, I know that and I wait till FSX ends thouroughly, I swear :wink:

    This issue also happens if I have a freshly started Widnows, so couldn't be a FSX overlap.

    That something is using this COM port could be, but I have no idea how to check what this could be or why windows isn't it releasing?

    I have several hardware:

    X52 pro

    2 Saitek throttle quadrants

    BU836X

    and a Logitech extreme rebuilt as a little switch panel

    Everything is working fine

    Printer and Scanner is normally switched off (electricity off!) and so far no more hardware...

    Anyway it is not such a big problem as just one of 10 FSX flights is affected.

    I will google a bit around; maybe I can find out what windows does with COM ports.

    thanks, will report back if I find a solution,

    Günter

  9. ok, happened right now:

    ********* FSUIPC4, Version 4.628 by Pete Dowson *********
    Reading options from "F:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\FSUIPC4.ini"
    Trying to connect to SimConnect Acc/SP2 Oct07 ...
    User Name="Günter Steiner"
    User Addr="adress removed to get not spammed"
    FSUIPC4 Key is provided
    WIDEFS7 not user registered, or expired
    Running inside FSX on Windows 7 (using SimConnect Acc/SP2 Oct07)
    Module base=61000000
    Wind smoothing fix is fully installed
    DebugStatus=15
           78 System time = 03/11/2010 21:45:10
           94 FLT UNC path = "\\CANNELLONI-PC\Users\Cannelloni\Documents\Flight Simulator X-Dateien\"
           94 FS UNC path = "F:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\"
          936 LogOptions=80000000 00000051
          936 SimConnect_Open succeeded: waiting to check version okay
          952 VRI port 1 "COM3" failed to open
          952 VRI driver port 1 "COM2" also opened
         4680 Running in "Microsoft Flight Simulator X", Version: 10.0.61637.0 (SimConnect: 10.0.61259.0)
         4680 Initialising SimConnect data requests now
         4680 FSUIPC Menu entry added
         4712 Ready Flags: Ready-To-Fly=N, In Menu=Y, In Dlg=Y
         4727 \\CANNELLONI-PC\Users\Cannelloni\Documents\Flight Simulator X-Dateien\EDDT Standard.FLT
         4727 F:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\SimObjects\Airplanes\beech_baron_58\Beech_Baron_58.AIR
        17831 F:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\SimObjects\Airplanes\PMDG747-400F\B747-400F.AIR
        17831 Weather Mode now = Global
        17831 \\CANNELLONI-PC\Users\cannelloni\documents\flight simulator x-dateien\747.FLT
        20140 Ready Flags: Ready-To-Fly=N, In Menu=N, In Dlg=N
        20312 Ready Flags: Ready-To-Fly=N, In Menu=Y, In Dlg=Y
        57284 System time = 03/11/2010 21:46:07, Simulator time = 07:33:25 (06:33Z)
        57939 Aircraft="PMDG 747-8F Lufthansa Cargo"
        58532 Ready Flags: Ready-To-Fly=Y, In Menu=Y, In Dlg=Y
        58891 Ready Flags: Ready-To-Fly=Y, In Menu=N, In Dlg=N
        60092 Exception 15 "WEATHER_UNABLE_TO_GET_OBSERVATION", Ref 2477, Index param -1 on Weather request type 5
        62260 Advanced Weather Interface Enabled
        64476 Weather Mode now = Theme
        64585 Exception 15 "WEATHER_UNABLE_TO_GET_OBSERVATION", Ref 2481, Index param -1 on Weather request type 5
        64632 Weather Mode now = Global
       128498 Ready Flags: Ready-To-Fly=Y, In Menu=Y, In Dlg=Y
       128498 Sim stopped: average frame rate for last 70 secs = 26.3 fps
       136470 \\CANNELLONI-PC\Users\Cannelloni\AppData\Roaming\Microsoft\FSX\Vorheriger Flug.FLT
       136486 Exception 3 "UNRECOGNIZED_ID", Ref 2696, Index param -1 on unknown request!
       147265 System time = 03/11/2010 21:47:37, Simulator time = 07:33:25 (06:33Z)
       147265 *** FSUIPC log file being closed
    Average frame rate for running time of 70 secs = 26.3 fps
    Memory managed: 167 Allocs, 167 Freed
    ********* FSUIPC Log file closed ***********
    

    VSPE shows "Pair OK" as it should do, when FS is started.

    SerialFP2 is loading COM3 instead of COM4 when started (after(!) starting the flight)

    greetings,

    Günter

  10. I go to the Device Manager (via right click My computer, manage, or via control Panel, System), then expand the USB controllers list, select every USB Hub listed in turn, and for each right-click -- Properties -- Power Management Tab -- uncheck "allow computer to turn off this device".

    Ah, I haven't known about that possibility.

    I have the same number of USB stuff there and everything was unchecked.

    Maybe my way with the energy-options does the same.

    I'll wait now till the next time the issue happens and show you the log file....

  11. Have you stopped Windows doing power management on all USB hubs?

    yes, have that setting already

    made it through "advanced energy savings" (german OS maybe other naming) --> USB Settings --> deactivated

    (or is there an other setting, too?)

    Check the VSPE window anyway, see what it says when it happens.

    will do next time...

    Don't forget to first enable VRI debugging

    good point - "debug please" was added, but I have just added "LogExtras=4" now...

  12. Hello Pete,

    from time to time my "VRInsight Mod" isn't connecting thoroughly.

    Means, that I start a flight and start SerialFP2, but SerialFP2 is then connected to COM3 instead of COM4.

    Of course, the FSUIPC Mod isn't working then.

    Restarting SerialFP2 does not help

    Only solution for me is to restart FSX.

    My question is now, if it is possible to get it to work again in an other way?

    E.g a LUA which is reconnecting or whatever is neccessary... I don't know...

    Or would restarting the only solution?

    Background is, that I often forget to proof the connection immediatly after starting a flight.

    And then I setted up my flightplan, my FMC etc etc, maybe started engines and then notice that SerialFPs isn't connected to COM4.

    All "work" is then for nothing ;-)

    thank you very much,

    Günter

  13. Hello,

    I have written a little tutorial how to set up VRInsight devices, so that they could work as a native joystick with the help of the "FSUIPC VRInsight Mod"!

    I have tried to write it in a hopefully uncomplicated way with many pictures, so that everybody could set it properly up...

    Enjoy!

    Günter/guenseli

    FSUIPC_VRInsight_Mod.pdf

  14. Hi Andy,

    thanks for your kind words!

    Very apprechiated!!

    I have not forgotten the TCAS; just found it as I deleted "increase HDG and SPD" on my TO DO list.

    Shame on me that I haven't thought about the faster SPD and HDG by myself. Its really a big improvement :mrgreen:

    Haven't searched or asked about the TCAS.

    Finn from Aerosoft is under pressure with SP1 :wink:

    And I have unfortunately the time I wanted to have...

    But time will bring.... sure and promised if possible!

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.