From 5872955661a9c977a106fe89f571c80c9e1249bd Mon Sep 17 00:00:00 2001 From: Scott Vincent Date: Mon, 28 Nov 2022 08:32:34 +0000 Subject: [PATCH] Airbus A310 --- power-lights-panel/globals.cpp | 6 ++++ power-lights-panel/globals.h | 5 ++++ power-lights-panel/powerLights-panel.cpp | 9 ++++-- power-lights-panel/powerLights.cpp | 9 +++--- power-lights-panel/simvarDefs.cpp | 32 +++++++------------- power-lights-panel/simvarDefs.h | 38 ++++++++---------------- 6 files changed, 45 insertions(+), 54 deletions(-) diff --git a/power-lights-panel/globals.cpp b/power-lights-panel/globals.cpp index 5195ec1..c8923c4 100644 --- a/power-lights-panel/globals.cpp +++ b/power-lights-panel/globals.cpp @@ -25,6 +25,12 @@ void identifyAircraft(char* aircraft) else if (strncmp(aircraft, globals.Shock_Ultra_Text, globals.Shock_Ultra_Len) == 0) { globals.aircraft = SHOCK_ULTRA; } + else if (strncmp(aircraft, globals.Airbus_A310_Text, globals.Airbus_A310_Len) == 0) { + globals.aircraft = AIRBUS_A310; + } + else if (strncmp(aircraft, globals.IniBuilds_A310_Text, globals.IniBuilds_A310_Len) == 0) { + globals.aircraft = AIRBUS_A310; + } else if (strncmp(aircraft, globals.Airbus_A320_Text, globals.Airbus_A320_Len) == 0) { globals.aircraft = FBW_A320; } diff --git a/power-lights-panel/globals.h b/power-lights-panel/globals.h index 21b9fe6..1b6150c 100644 --- a/power-lights-panel/globals.h +++ b/power-lights-panel/globals.h @@ -16,6 +16,7 @@ enum Aircraft { CESSNA_CJ4, SAVAGE_CUB, SHOCK_ULTRA, + AIRBUS_A310, FBW_A320, BOEING_747, BOEING_787, @@ -38,6 +39,10 @@ struct globalVars const int Savage_Cub_Len = 16; const char* Shock_Ultra_Text = "Savage Shock Ultra"; const int Shock_Ultra_Len = 18; + const char* Airbus_A310_Text = "Airbus A310"; + const int Airbus_A310_Len = 11; + const char* IniBuilds_A310_Text = "A310"; + const int IniBuilds_A310_Len = 4; const char* Airbus_A320_Text = "Airbus A320"; const int Airbus_A320_Len = 11; const char* FBW_A320_Text = "FBW"; diff --git a/power-lights-panel/powerLights-panel.cpp b/power-lights-panel/powerLights-panel.cpp index c8c8722..a76a433 100644 --- a/power-lights-panel/powerLights-panel.cpp +++ b/power-lights-panel/powerLights-panel.cpp @@ -13,7 +13,7 @@ #include "simvars.h" #include "powerLights.h" -const char* powerLightsVersion = "v1.3.0"; +const char* powerLightsVersion = "v1.3.1"; const bool Debug = false; struct globalVars globals; @@ -38,7 +38,12 @@ void updateCommon() SimVars* simVars = &globals.simVars->simVars; // Electrics check - globals.electrics = globals.connected && simVars->dcVolts > 0; + if (globals.aircraft == AIRBUS_A310) { + globals.electrics = globals.connected && simVars->batteryLoad < 0; + } + else { + globals.electrics = globals.connected && simVars->dcVolts > 0; + } // Avionics check globals.avionics = globals.connected && (simVars->com1Status == 0 || simVars->com2Status == 0); diff --git a/power-lights-panel/powerLights.cpp b/power-lights-panel/powerLights.cpp index 1fa6384..c7cea66 100644 --- a/power-lights-panel/powerLights.cpp +++ b/power-lights-panel/powerLights.cpp @@ -83,8 +83,7 @@ void powerLights::update() // Only update local values from sim if they are not currently being adjusted. // This stops them from jumping around due to lag of fetch/update cycle. if (lastApuMasterAdjust == 0) { - // Only relevant to A32NX - if (loadedAircraft == FBW_A320) { + if (loadedAircraft == AIRBUS_A310 || loadedAircraft == FBW_A320) { apuMaster = simVars->apuMasterSw > 0; } else if (simVars->apuStartSwitch > 0) { @@ -116,7 +115,7 @@ void powerLights::update() if (lastApuBleedAdjust == 0) { // Only relevant to A32NX - if (loadedAircraft == FBW_A320) { + if (loadedAircraft == AIRBUS_A310 || loadedAircraft == FBW_A320) { apuBleed = simVars->apuBleed > 0; } else { @@ -159,7 +158,7 @@ void powerLights::gpioSwitchesInput() // This allows a toggle to be switched without causing an // action (to fix an inverted toggle). if (prevApuBleedPush % 2 == 1) { - if (globals.aircraft == FBW_A320) { + if (globals.aircraft == AIRBUS_A310 || globals.aircraft == FBW_A320) { globals.simVars->write(KEY_ELEC_BAT1, val); } else if (airliner) { @@ -183,7 +182,7 @@ void powerLights::gpioSwitchesInput() if (val != INT_MIN && val != prevBattery2Toggle) { // Switch toggled (ignore if APU Bleed being pressed) if (prevApuBleedPush % 2 == 1) { - if (globals.aircraft == FBW_A320) { + if (globals.aircraft == AIRBUS_A310 || globals.aircraft == FBW_A320) { globals.simVars->write(KEY_ELEC_BAT2, val); } else if (airliner) { diff --git a/power-lights-panel/simvarDefs.cpp b/power-lights-panel/simvarDefs.cpp index 24648ba..f7cb023 100644 --- a/power-lights-panel/simvarDefs.cpp +++ b/power-lights-panel/simvarDefs.cpp @@ -1,27 +1,14 @@ #include #include "simvarDefs.h" -const char* versionString = "v1.7.0"; +const char* versionString = "v1.7.1"; const char* SimVarDefs[][2] = { // Vars for Jetbridge (must come first) { "Apu Master Sw", "jetbridge" }, - { "Apu Start", "jetbridge" }, - { "Apu Start Avail", "jetbridge" }, { "Apu Bleed", "jetbridge" }, { "Elec Bat1", "jetbridge" }, { "Elec Bat2", "jetbridge" }, - { "Flaps Index", "jetbridge" }, - { "Parking Brake", "jetbridge" }, - { "Spoilers Handle Pos", "jetbridge" }, - { "Transponder Mode", "jetbridge" }, - { "Autopilot 1", "jetbridge" }, - { "Autopilot 2", "jetbridge" }, - { "Autothrust", "jetbridge" }, - { "Tcas Mode", "jetbridge" }, - { "Autopilot Heading", "jetbridge" }, - { "Autopilot Vertical Speed", "jetbridge" }, - { "Autopilot Flight Path Angle", "jetbridge" }, { "Autopilot Managed Speed", "jetbridge" }, { "Autopilot Managed Heading", "jetbridge" }, { "Autopilot Managed Altitude", "jetbridge" }, @@ -30,17 +17,16 @@ const char* SimVarDefs[][2] = { { "Loc Mode", "jetbridge" }, { "Appr Mode", "jetbridge" }, { "Autothrust Mode", "jetbridge" }, + { "Show Mach", "jetbridge" }, { "Autobrake Armed", "jetbridge" }, - { "Left Brake Pedal", "jetbridge" }, - { "Right Brake Pedal", "jetbridge" }, - { "Rudder Pedal Position", "jetbridge" }, - { "Engine EGT", "jetbridge" }, - { "Engine Fuel Flow", "jetbridge" }, + { "Pitch Trim", "jetbridge" }, + { "Tcas Mode", "jetbridge" }, // Vars required for all panels (screensaver, aircraft identification etc.) { "Title", "string32" }, { "Estimated Cruise Speed", "knots" }, { "Electrical Main Bus Voltage", "volts" }, + { "Electrical Battery Load", "amperes" }, // Vars for Power/Lights panel { "Light On States", "mask" }, @@ -69,7 +55,6 @@ const char* SimVarDefs[][2] = { { "Adf Active Frequency:1", "khz" }, { "Adf Standby Frequency:1", "khz" }, { "Cabin Seatbelts Alert Switch", "bool" }, - { "Transponder Available", "bool" }, { "Transponder State:1", "enum" }, { "Transponder Code:1", "bco16" }, @@ -119,7 +104,6 @@ const char* SimVarDefs[][2] = { { "Local Time", "seconds" }, { "Absolute Time", "seconds" }, { "Ambient Temperature", "celsius" }, - { "Electrical Battery Load", "amperes" }, { "General Eng Rpm:1", "rpm" }, { "Eng Rpm Animation Percent:1", "percent" }, { "General Eng Elapsed Time:1", "hours" }, @@ -147,6 +131,7 @@ const char* SimVarDefs[][2] = { { "Gear Right Position", "percent" }, { "Rudder Position", "position" }, { "Brake Left Position", "percent" }, + { "Brake Right Position", "percent" }, { "General Eng Oil Temperature:1", "fahrenheit" }, { "General Eng Oil Pressure:1", "psi" }, { "General Eng Exhaust Gas Temperature:1", "celsius" }, @@ -208,6 +193,9 @@ WriteEvent WriteEvents[] = { { KEY_ADF_STBY_SET, "ADF_STBY_SET" }, { KEY_ADF1_RADIO_SWAP, "ADF1_RADIO_SWAP" }, { KEY_XPNDR_SET, "XPNDR_SET" }, + { KEY_XPNDR_HIGH_SET, "XPNDR_HIGH_SET" }, + { KEY_XPNDR_LOW_SET, "XPNDR_LOW_SET" }, + { KEY_XPNDR_STATE, "XPNDR_STATE" }, { KEY_AP_MASTER, "AP_MASTER" }, { KEY_TOGGLE_FLIGHT_DIRECTOR, "TOGGLE_FLIGHT_DIRECTOR" }, { KEY_AP_SPD_VAR_SET, "AP_SPD_VAR_SET" }, @@ -257,7 +245,7 @@ WriteEvent WriteEvents[] = { { KEY_AUTOBRAKE, "AUTOBRAKE" }, { KEY_TANK_SELECT_1, "TANK_SELECT_1" }, { KEY_TANK_SELECT_2, "TANK_SELECT_2" }, - { KEY_RUDDER_SENSITIVITY, "RUDDER_SENSITIVITY" }, + { KEY_ENG_CRANK, "ENGINE_CRANK" }, { KEY_SKYTRACK_STATE, "SKYTRACK_STATE" }, { KEY_G1000_PFD_SOFTKEY_1, "MobiFlight.AS1000_PFD_SOFTKEYS_1" }, { KEY_G1000_PFD_SOFTKEY_2, "MobiFlight.AS1000_PFD_SOFTKEYS_2" }, diff --git a/power-lights-panel/simvarDefs.h b/power-lights-panel/simvarDefs.h index ee126cc..a4ce5b3 100644 --- a/power-lights-panel/simvarDefs.h +++ b/power-lights-panel/simvarDefs.h @@ -9,22 +9,9 @@ struct SimVars // All Jetbridge vars must come first double apuMasterSw = 0; - double jbApuStart = 0; - double jbApuStartAvail = 0; double apuBleed = 0; double elecBat1 = 0; double elecBat2 = 0; - double jbFlapsIndex = 0; - double jbParkBrakePos = 0; - double jbSpoilersHandlePos = 0; - double jbXpndrMode = 0; - double jbAutopilot1 = 0; - double jbAutopilot2 = 0; - double jbAutothrust = 0; - double jbTcasMode = 0; - double jbAutopilotHeading; - double jbAutopilotVerticalSpeed; - double jbAutopilotFpa; double jbManagedSpeed = 0; double jbManagedHeading = 0; double jbManagedAltitude = 0; @@ -33,17 +20,16 @@ struct SimVars double jbLocMode = 0; double jbApprMode = 0; double jbAutothrustMode = 0; + double jbShowMach = 0; double jbAutobrake = 0; - double jbLeftBrakePedal = 0; - double jbRightBrakePedal = 0; - double jbRudderPedalPos = 0; - double jbEngineEgt = 0; - double jbEngineFuelFlow = 0; + double jbPitchTrim = 0; + double jbTcasMode = 0; // Vars required for all panels (screensaver, aircraft identification etc.) char aircraft[32] = "\0"; double cruiseSpeed = 120; double dcVolts = 23.7; + double batteryLoad = 0; // Vars for Power/Lights panel double lightStates = 0; @@ -72,7 +58,6 @@ struct SimVars double adfFreq = 394; double adfStandby = 368; double seatBeltsSwitch = 0; - double tcasState = 0; // Store TCAS state instead of xpndr avail double transponderState = 0; double transponderCode = 4608; // No vars after here required by Radio panel @@ -123,11 +108,10 @@ struct SimVars double dcLocalSeconds = 46800; double dcFlightSeconds = 0; double dcTempC = 26.2; - double batteryLoad = 0; double rpmEngine = 0; double rpmPercent = 0; double rpmElapsedTime = 0; - double fuelCapacity = 0; + double fuelCapacity = 50; double fuelQuantity = 0; double fuelLeftPercent = 0; double fuelRightPercent = 0; @@ -150,9 +134,10 @@ struct SimVars double gearCentrePos = 100; double gearRightPos = 100; double rudderPosition = 0; - double brakePedal = 0; - double oilTemp = 75; - double oilPressure = 50; + double brakeLeftPedal = 0; + double brakeRightPedal = 0; + double oilTemp = 0; + double oilPressure = 0; double exhaustGasTemp = 0; double engineType = 0; double engineMaxRpm = 0; @@ -212,6 +197,9 @@ enum EVENT_ID { KEY_ADF_STBY_SET, KEY_ADF1_RADIO_SWAP, KEY_XPNDR_SET, + KEY_XPNDR_HIGH_SET, + KEY_XPNDR_LOW_SET, + KEY_XPNDR_STATE, KEY_AP_MASTER, KEY_TOGGLE_FLIGHT_DIRECTOR, KEY_AP_SPD_VAR_SET, @@ -261,7 +249,7 @@ enum EVENT_ID { KEY_AUTOBRAKE, KEY_TANK_SELECT_1, KEY_TANK_SELECT_2, - KEY_RUDDER_SENSITIVITY, + KEY_ENG_CRANK, KEY_SKYTRACK_STATE, KEY_G1000_PFD_SOFTKEY_1, KEY_G1000_PFD_SOFTKEY_2,