Skip to content

Commit

Permalink
Airbus A310
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Vincent committed Nov 28, 2022
1 parent de88ae9 commit 5872955
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 54 deletions.
6 changes: 6 additions & 0 deletions power-lights-panel/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 5 additions & 0 deletions power-lights-panel/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ enum Aircraft {
CESSNA_CJ4,
SAVAGE_CUB,
SHOCK_ULTRA,
AIRBUS_A310,
FBW_A320,
BOEING_747,
BOEING_787,
Expand All @@ -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";
Expand Down
9 changes: 7 additions & 2 deletions power-lights-panel/powerLights-panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
9 changes: 4 additions & 5 deletions power-lights-panel/powerLights.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
32 changes: 10 additions & 22 deletions power-lights-panel/simvarDefs.cpp
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
#include <stdio.h>
#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" },
Expand All @@ -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" },
Expand Down Expand Up @@ -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" },

Expand Down Expand Up @@ -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" },
Expand Down Expand Up @@ -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" },
Expand Down Expand Up @@ -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" },
Expand Down Expand Up @@ -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" },
Expand Down
38 changes: 13 additions & 25 deletions power-lights-panel/simvarDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 5872955

Please sign in to comment.