From 43f4ac908e8e56fee16da8136aae4ec1e1f199a2 Mon Sep 17 00:00:00 2001 From: Scott Vincent Date: Fri, 18 Feb 2022 07:24:50 +0000 Subject: [PATCH] Minor bug fixes --- instrument-data-link/instrument-data-link.cpp | 15 ++++++++++----- instrument-data-link/simvarDefs.cpp | 3 ++- instrument-data-link/simvarDefs.h | 3 ++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/instrument-data-link/instrument-data-link.cpp b/instrument-data-link/instrument-data-link.cpp index b0b7550..5fe80d3 100644 --- a/instrument-data-link/instrument-data-link.cpp +++ b/instrument-data-link/instrument-data-link.cpp @@ -69,7 +69,8 @@ const char JETBRIDGE_APU_BLEED[] = "L:A32NX_OVHD_PNEU_APU_BLEED_PB_IS_ON, bool"; const char JETBRIDGE_ELEC_BAT1[] = "L:A32NX_OVHD_ELEC_BAT_1_PB_IS_AUTO, bool"; const char JETBRIDGE_ELEC_BAT2[] = "L:A32NX_OVHD_ELEC_BAT_2_PB_IS_AUTO, bool"; const char JETBRIDGE_PARK_BRAKE_POS[] = "L:A32NX_PARK_BRAKE_LEVER_POS, bool"; -const char JETBRIDGE_AUTOPILOT[] = "L:A32NX_AUTOPILOT_1_ACTIVE, bool"; +const char JETBRIDGE_AUTOPILOT_1[] = "L:A32NX_AUTOPILOT_1_ACTIVE, bool"; +const char JETBRIDGE_AUTOPILOT_2[] = "L:A32NX_AUTOPILOT_2_ACTIVE, bool"; const char JETBRIDGE_AUTOTHRUST[] = "L:A32NX_AUTOTHRUST_STATUS, enum"; const char JETBRIDGE_AUTOPILOT_HDG[] = "L:A32NX_AUTOPILOT_HEADING_SELECTED, degrees"; const char JETBRIDGE_AUTOPILOT_VS[] = "L:A32NX_AUTOPILOT_VS_SELECTED, feetperminute"; @@ -205,8 +206,11 @@ void updateVarFromJetbridge(const char* data) else if (strncmp(&data[1], JETBRIDGE_PARK_BRAKE_POS, sizeof(JETBRIDGE_PARK_BRAKE_POS) - 1) == 0) { simVars.jbParkBrakePos = atof(&data[sizeof(JETBRIDGE_PARK_BRAKE_POS) + 1]); } - else if (strncmp(&data[1], JETBRIDGE_AUTOPILOT, sizeof(JETBRIDGE_AUTOPILOT) - 1) == 0) { - simVars.jbAutopilot = atof(&data[sizeof(JETBRIDGE_AUTOPILOT) + 1]); + else if (strncmp(&data[1], JETBRIDGE_AUTOPILOT_1, sizeof(JETBRIDGE_AUTOPILOT_1) - 1) == 0) { + simVars.jbAutopilot1 = atof(&data[sizeof(JETBRIDGE_AUTOPILOT_1) + 1]); + } + else if (strncmp(&data[1], JETBRIDGE_AUTOPILOT_2, sizeof(JETBRIDGE_AUTOPILOT_2) - 1) == 0) { + simVars.jbAutopilot2 = atof(&data[sizeof(JETBRIDGE_AUTOPILOT_2) + 1]); } else if (strncmp(&data[1], JETBRIDGE_AUTOTHRUST, sizeof(JETBRIDGE_AUTOTHRUST) - 1) == 0) { simVars.jbAutothrust = atof(&data[sizeof(JETBRIDGE_AUTOTHRUST) + 1]); @@ -307,7 +311,8 @@ void pollJetbridge() readJetbridgeVar(JETBRIDGE_ELEC_BAT2); readJetbridgeVar(JETBRIDGE_FLAPS_INDEX); readJetbridgeVar(JETBRIDGE_PARK_BRAKE_POS); - readJetbridgeVar(JETBRIDGE_AUTOPILOT); + readJetbridgeVar(JETBRIDGE_AUTOPILOT_1); + readJetbridgeVar(JETBRIDGE_AUTOPILOT_2); readJetbridgeVar(JETBRIDGE_AUTOTHRUST); readJetbridgeVar(JETBRIDGE_MANAGED_SPEED); readJetbridgeVar(JETBRIDGE_MANAGED_HEADING); @@ -403,7 +408,7 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV* pData, DWORD cbData, void* pContex simVars.tfFlapsIndex = simVars.jbFlapsIndex; simVars.parkingBrakeOn = simVars.jbParkBrakePos; simVars.brakePedal = (simVars.jbLeftBrakePedal + simVars.jbRightBrakePedal) / 2.0; - simVars.autopilotEngaged = simVars.jbAutopilot; + simVars.autopilotEngaged = simVars.jbAutopilot1 == 0 && simVars.jbAutopilot2 == 0 ? 0 : 1; if (simVars.jbAutothrust == 0) { simVars.autothrottleActive = 0; } diff --git a/instrument-data-link/simvarDefs.cpp b/instrument-data-link/simvarDefs.cpp index 8812e44..42a8d24 100644 --- a/instrument-data-link/simvarDefs.cpp +++ b/instrument-data-link/simvarDefs.cpp @@ -13,7 +13,8 @@ const char* SimVarDefs[][2] = { { "Elec Bat2", "jetbridge" }, { "Flaps Index", "jetbridge" }, { "Parking Brake", "jetbridge" }, - { "Autopilot", "jetbridge" }, + { "Autopilot 1", "jetbridge" }, + { "Autopilot 2", "jetbridge" }, { "Autothrust", "jetbridge" }, { "Autopilot Heading", "jetbridge" }, { "Autopilot Vertical Speed", "jetbridge" }, diff --git a/instrument-data-link/simvarDefs.h b/instrument-data-link/simvarDefs.h index 0f5a797..9300125 100644 --- a/instrument-data-link/simvarDefs.h +++ b/instrument-data-link/simvarDefs.h @@ -16,7 +16,8 @@ struct SimVars double elecBat2 = 0; double jbFlapsIndex = 0; double jbParkBrakePos = 0; - double jbAutopilot = 0; + double jbAutopilot1 = 0; + double jbAutopilot2 = 0; double jbAutothrust = 0; double jbAutopilotHeading; double jbAutopilotVerticalSpeed;