Skip to content

Commit

Permalink
Add fbw A380
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Vincent committed Nov 11, 2024
1 parent 9826a32 commit 8d2adb5
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 71 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

Download the following two files.

Link: [Latest release of Power/Lights Panel for Raspberry Pi Zero W](https://github.com/scott-vincent/power-lights-panel/releases/latest/download/power-lights-panel-v1.5.3-raspi.tar.gz)
Link: [Latest release of Power/Lights Panel for Raspberry Pi Zero W](https://github.com/scott-vincent/power-lights-panel/releases/latest/download/power-lights-panel-v1.5.4-raspi.tar.gz)

Link: [Latest release of Instrument Data Link for Windows](https://github.com/scott-vincent/instrument-data-link/releases/latest/download/instrument-data-link-v2.0.3-windows-x64.zip)
Link: [Latest release of Instrument Data Link for Windows](https://github.com/scott-vincent/instrument-data-link/releases/latest/download/instrument-data-link-v2.0.4-windows-x64.zip)

Unzip instrument-data-link into its own folder and double-click instrument-data-link.exe to run it.

Expand Down
110 changes: 57 additions & 53 deletions power-lights-panel/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,62 +10,66 @@ void identifyAircraft(char* aircraft)
{
// Identify aircraft
if (strcmp(aircraft, globals.lastAircraft) != 0) {
if (strncmp(aircraft, globals.Cessna_152_Text, globals.Cessna_152_Len) == 0) {
globals.aircraft = CESSNA_152;
}
else if (strncmp(aircraft, globals.Cessna_172_Text, globals.Cessna_172_Len) == 0) {
globals.aircraft = CESSNA_172;
}
else if (strncmp(aircraft, globals.Cessna_CJ4_Text, globals.Cessna_CJ4_Len) == 0) {
globals.aircraft = CESSNA_CJ4;
}
else if (strncmp(aircraft, globals.Savage_Cub_Text, globals.Savage_Cub_Len) == 0) {
globals.aircraft = SAVAGE_CUB;
}
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;
}
else if (strncmp(aircraft, globals.FBW_A320_Text, globals.FBW_A320_Len) == 0) {
globals.aircraft = FBW_A320;
}
else if (strncmp(aircraft, globals.Boeing_747_Text, globals.Boeing_747_Len) == 0) {
globals.aircraft = BOEING_747;
}
else if (strncmp(aircraft, globals.Salty_Boeing_747_Text, globals.Salty_Boeing_747_Len) == 0) {
globals.aircraft = BOEING_747;
}
else if (strncmp(aircraft, globals.Boeing_787_Text, globals.Boeing_787_Len) == 0) {
globals.aircraft = BOEING_787;
}
else if (strncmp(aircraft, globals.Supermarine_Spitfire_Text, globals.Supermarine_Spitfire_Len) == 0) {
globals.aircraft = SUPERMARINE_SPITFIRE;
}
else if (strncmp(aircraft, globals.F15_Eagle_Text, globals.F15_Eagle_Len) == 0) {
globals.aircraft = F15_EAGLE;
}
else if (strncmp(aircraft, globals.F18_Hornet_Text, globals.F18_Hornet_Len) == 0) {
globals.aircraft = F18_HORNET;
}
else if (strncmp(aircraft, globals.JustFlight_PA28_Text, globals.JustFlight_PA28_Len) == 0) {
globals.aircraft = JUSTFLIGHT_PA28;
bool foundAircraft = false;

char* pos = strchr(aircraft, '3');
if (pos && *(pos - 1) == 'A') {
if (*(pos + 1) == '1') {
globals.aircraft = AIRBUS_A310;
foundAircraft = true;
}
else if (*(pos + 1) == '2' || *(pos + 1) == '8') {
globals.aircraft = FBW;
foundAircraft = true;
}
}
else {
// Need to flip between other aircraft so that instruments
// can detect the aircraft has changed.
if (globals.aircraft == OTHER_AIRCRAFT) {
globals.aircraft = OTHER_AIRCRAFT2;

if (!foundAircraft) {
if (strncmp(aircraft, globals.Cessna_152_Text, globals.Cessna_152_Len) == 0) {
globals.aircraft = CESSNA_152;
}
else if (strncmp(aircraft, globals.Cessna_172_Text, globals.Cessna_172_Len) == 0) {
globals.aircraft = CESSNA_172;
}
else if (strncmp(aircraft, globals.Cessna_CJ4_Text, globals.Cessna_CJ4_Len) == 0) {
globals.aircraft = CESSNA_CJ4;
}
else if (strncmp(aircraft, globals.Savage_Cub_Text, globals.Savage_Cub_Len) == 0) {
globals.aircraft = SAVAGE_CUB;
}
else if (strncmp(aircraft, globals.Shock_Ultra_Text, globals.Shock_Ultra_Len) == 0) {
globals.aircraft = SHOCK_ULTRA;
}
else if (strncmp(aircraft, globals.Boeing_747_Text, globals.Boeing_747_Len) == 0) {
globals.aircraft = BOEING_747;
}
else if (strncmp(aircraft, globals.Salty_Boeing_747_Text, globals.Salty_Boeing_747_Len) == 0) {
globals.aircraft = BOEING_747;
}
else if (strncmp(aircraft, globals.Boeing_787_Text, globals.Boeing_787_Len) == 0) {
globals.aircraft = BOEING_787;
}
else if (strncmp(aircraft, globals.Supermarine_Spitfire_Text, globals.Supermarine_Spitfire_Len) == 0) {
globals.aircraft = SUPERMARINE_SPITFIRE;
}
else if (strncmp(aircraft, globals.F15_Eagle_Text, globals.F15_Eagle_Len) == 0) {
globals.aircraft = F15_EAGLE;
}
else if (strncmp(aircraft, globals.F18_Hornet_Text, globals.F18_Hornet_Len) == 0) {
globals.aircraft = F18_HORNET;
}
else if (strncmp(aircraft, globals.JustFlight_PA28_Text, globals.JustFlight_PA28_Len) == 0) {
globals.aircraft = JUSTFLIGHT_PA28;
}
else {
globals.aircraft = OTHER_AIRCRAFT;
// Need to flip between other aircraft so that instruments
// can detect the aircraft has changed.
if (globals.aircraft == OTHER_AIRCRAFT) {
globals.aircraft = OTHER_AIRCRAFT2;
}
else {
globals.aircraft = OTHER_AIRCRAFT;
}
}
}
strcpy(globals.lastAircraft, aircraft);
Expand Down
10 changes: 1 addition & 9 deletions power-lights-panel/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum Aircraft {
SAVAGE_CUB,
SHOCK_ULTRA,
AIRBUS_A310,
FBW_A320,
FBW,
BOEING_747,
BOEING_787,
SUPERMARINE_SPITFIRE,
Expand All @@ -40,14 +40,6 @@ 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";
const int FBW_A320_Len = 3;
const char* Boeing_747_Text = "Boeing 747-8";
const int Boeing_747_Len = 12;
const char* Salty_Boeing_747_Text = "Salty Boeing 747";
Expand Down
2 changes: 1 addition & 1 deletion 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.5.3";
const char* powerLightsVersion = "v1.5.4";
const bool Debug = false;

struct globalVars globals;
Expand Down
8 changes: 4 additions & 4 deletions power-lights-panel/powerLights.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,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) {
if (loadedAircraft == AIRBUS_A310 || loadedAircraft == FBW_A320) {
if (loadedAircraft == AIRBUS_A310 || loadedAircraft == FBW) {
apuMaster = simVars->apuMasterSw > 0;
}
else if (simVars->apuStartSwitch > 0) {
Expand Down Expand Up @@ -138,7 +138,7 @@ void powerLights::update()

if (lastApuBleedAdjust == 0) {
// Only relevant to A32NX
if (loadedAircraft == AIRBUS_A310 || loadedAircraft == FBW_A320) {
if (loadedAircraft == AIRBUS_A310 || loadedAircraft == FBW) {
apuBleed = simVars->apuBleed > 0;
}
else {
Expand Down Expand Up @@ -181,7 +181,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 == AIRBUS_A310 || globals.aircraft == FBW_A320) {
if (globals.aircraft == AIRBUS_A310 || globals.aircraft == FBW) {
globals.simVars->write(KEY_ELEC_BAT1, val);
}
else if (airliner) {
Expand All @@ -205,7 +205,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 == AIRBUS_A310 || globals.aircraft == FBW_A320) {
if (globals.aircraft == AIRBUS_A310 || globals.aircraft == FBW) {
globals.simVars->write(KEY_ELEC_BAT2, val);
}
else if (airliner) {
Expand Down
2 changes: 1 addition & 1 deletion power-lights-panel/simvarDefs.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <stdio.h>
#include "simvarDefs.h"

const char* versionString = "v2.0.3";
const char* versionString = "v2.0.4";

const char* SimVarDefs[][2] = {
// Vars for Jetbridge (must come first)
Expand Down
2 changes: 1 addition & 1 deletion release.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rel=v1.5.3
rel=v1.5.4
mkdir release >/dev/null 2>&1
rm -rf release/$rel >/dev/null 2>&1
mkdir release/$rel
Expand Down

0 comments on commit 8d2adb5

Please sign in to comment.