From 0bc294314a71f0916f834ff28776071d60741d78 Mon Sep 17 00:00:00 2001 From: Scott Vincent Date: Sun, 18 Dec 2022 10:31:11 +0000 Subject: [PATCH] Update guages for multi-engined aircraft --- instrument-data-link/LVars-A32NX.h | 12 ++++++--- instrument-data-link/instrument-data-link.cpp | 15 +++++++++-- instrument-data-link/jetbridge.cpp | 20 +++++++++----- instrument-data-link/simvarDefs.cpp | 16 ++++++++++++ instrument-data-link/simvarDefs.h | 26 +++++++++++++++---- 5 files changed, 72 insertions(+), 17 deletions(-) diff --git a/instrument-data-link/LVars-A32NX.h b/instrument-data-link/LVars-A32NX.h index 021cf42..f54052f 100644 --- a/instrument-data-link/LVars-A32NX.h +++ b/instrument-data-link/LVars-A32NX.h @@ -32,8 +32,10 @@ const char A32NX_AUTOBRAKE[] = "L:A32NX_AUTOBRAKES_ARMED_MODE, bool"; const char A32NX_LEFT_BRAKEPEDAL[] = "L:A32NX_LEFT_BRAKE_PEDAL_INPUT, percent"; const char A32NX_RIGHT_BRAKEPEDAL[] = "L:A32NX_RIGHT_BRAKE_PEDAL_INPUT, percent"; const char A32NX_RUDDER_PEDAL_POS[] = "L:A32NX_RUDDER_PEDAL_POSITION, number"; -const char A32NX_ENGINE_EGT[] = "L:A32NX_ENGINE_EGT:1, number"; -const char A32NX_ENGINE_FUEL_FLOW[] = "L:A32NX_ENGINE_FF:1, number"; +const char A32NX_ENGINE_EGT1[] = "L:A32NX_ENGINE_EGT:1, number"; +const char A32NX_ENGINE_EGT2[] = "L:A32NX_ENGINE_EGT:2, number"; +const char A32NX_ENGINE_FUEL_FLOW1[] = "L:A32NX_ENGINE_FF:1, number"; +const char A32NX_ENGINE_FUEL_FLOW2[] = "L:A32NX_ENGINE_FF:2, number"; const char A32NX_FLAPS_INDEX[] = "L:A32NX_FLAPS_HANDLE_INDEX, number"; const char A32NX_SPOILERS_HANDLE_POS[] = "L:A32NX_SPOILERS_HANDLE_POSITION, number"; @@ -54,8 +56,10 @@ struct LVars_A320 double leftBrakePedal = 0; double rightBrakePedal = 0; double rudderPedalPos = 0; - double engineEgt = 0; - double engineFuelFlow = 0; + double engineEgt1 = 0; + double engineEgt2 = 0; + double engineFuelFlow1 = 0; + double engineFuelFlow2 = 0; }; #endif // _LVARS_A32NX_H_ diff --git a/instrument-data-link/instrument-data-link.cpp b/instrument-data-link/instrument-data-link.cpp index e6fd51b..fb8caee 100644 --- a/instrument-data-link/instrument-data-link.cpp +++ b/instrument-data-link/instrument-data-link.cpp @@ -75,6 +75,7 @@ double lastHeading = 0; int lastSoftkey = 0; int lastG1000Key = 0; time_t lastG1000Press = 0; +int seatBeltsReplicateDelay = 0; LVars_A310 a310Vars; LVars_A320 a320Vars; HANDLE hSimConnect = NULL; @@ -250,6 +251,14 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV* pData, DWORD cbData, void* pContex simVars.apuPercentRpm = 0; } simVars.suctionPressure = 5; + if (seatBeltsReplicateDelay > 0) { + seatBeltsReplicateDelay--; + } + else if (simVars.seatBeltsSwitch != a310Vars.seatbeltsSwitch) { + // Replicate lvar value back to standard SDK variable to make PACX work correctly + SimConnect_TransmitClientEvent(hSimConnect, 0, KEY_CABIN_SEATBELTS_ALERT_SWITCH_TOGGLE, 1, SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY); + seatBeltsReplicateDelay = 10; + } simVars.seatBeltsSwitch = a310Vars.seatbeltsSwitch; simVars.jbPitchTrim = a310Vars.pitchTrim1 + a310Vars.pitchTrim2; simVars.autopilotAirspeed = a310Vars.autopilotAirspeed; @@ -323,8 +332,10 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV* pData, DWORD cbData, void* pContex simVars.autopilotApproachHold = simVars.jbLocMode; simVars.autopilotGlideslopeHold = simVars.jbApprMode; simVars.tfAutoBrake = simVars.jbAutobrake + 1; - simVars.exhaustGasTemp = a320Vars.engineEgt; - simVars.engineFuelFlow = a320Vars.engineFuelFlow; + simVars.exhaustGasTemp1 = a320Vars.engineEgt1; + simVars.exhaustGasTemp2 = a320Vars.engineEgt2; + simVars.engineFuelFlow1 = a320Vars.engineFuelFlow1; + simVars.engineFuelFlow2 = a320Vars.engineFuelFlow2; } else if (is747) { // Map Salty 747 vars to real vars diff --git a/instrument-data-link/jetbridge.cpp b/instrument-data-link/jetbridge.cpp index 8221fc9..3f332a3 100644 --- a/instrument-data-link/jetbridge.cpp +++ b/instrument-data-link/jetbridge.cpp @@ -256,11 +256,17 @@ void updateA320FromJetbridge(const char* data) else if (strncmp(&data[1], A32NX_RUDDER_PEDAL_POS, sizeof(A32NX_RUDDER_PEDAL_POS) - 1) == 0) { a320Vars.rudderPedalPos = atof(&data[sizeof(A32NX_RUDDER_PEDAL_POS) + 1]); } - else if (strncmp(&data[1], A32NX_ENGINE_EGT, sizeof(A32NX_ENGINE_EGT) - 1) == 0) { - a320Vars.engineEgt = atof(&data[sizeof(A32NX_ENGINE_EGT) + 1]); + else if (strncmp(&data[1], A32NX_ENGINE_EGT1, sizeof(A32NX_ENGINE_EGT1) - 1) == 0) { + a320Vars.engineEgt1 = atof(&data[sizeof(A32NX_ENGINE_EGT1) + 1]); } - else if (strncmp(&data[1], A32NX_ENGINE_FUEL_FLOW, sizeof(A32NX_ENGINE_FUEL_FLOW) - 1) == 0) { - a320Vars.engineFuelFlow = atof(&data[sizeof(A32NX_ENGINE_FUEL_FLOW) + 1]); + else if (strncmp(&data[1], A32NX_ENGINE_EGT2, sizeof(A32NX_ENGINE_EGT2) - 1) == 0) { + a320Vars.engineEgt2 = atof(&data[sizeof(A32NX_ENGINE_EGT2) + 1]); + } + else if (strncmp(&data[1], A32NX_ENGINE_FUEL_FLOW1, sizeof(A32NX_ENGINE_FUEL_FLOW1) - 1) == 0) { + a320Vars.engineFuelFlow1 = atof(&data[sizeof(A32NX_ENGINE_FUEL_FLOW1) + 1]); + } + else if (strncmp(&data[1], A32NX_ENGINE_FUEL_FLOW2, sizeof(A32NX_ENGINE_FUEL_FLOW2) - 1) == 0) { + a320Vars.engineFuelFlow2 = atof(&data[sizeof(A32NX_ENGINE_FUEL_FLOW2) + 1]); } } @@ -539,8 +545,10 @@ void readA320Jetbridge() readJetbridgeVar(A32NX_AUTOPILOT_HDG); readJetbridgeVar(A32NX_AUTOPILOT_VS); readJetbridgeVar(A32NX_AUTOPILOT_FPA); - readJetbridgeVar(A32NX_ENGINE_EGT); - readJetbridgeVar(A32NX_ENGINE_FUEL_FLOW); + readJetbridgeVar(A32NX_ENGINE_EGT1); + readJetbridgeVar(A32NX_ENGINE_EGT2); + readJetbridgeVar(A32NX_ENGINE_FUEL_FLOW1); + readJetbridgeVar(A32NX_ENGINE_FUEL_FLOW2); } #endif // jetbridgeFallback diff --git a/instrument-data-link/simvarDefs.cpp b/instrument-data-link/simvarDefs.cpp index 334ece1..93560c2 100644 --- a/instrument-data-link/simvarDefs.cpp +++ b/instrument-data-link/simvarDefs.cpp @@ -104,6 +104,7 @@ const char* SimVarDefs[][2] = { { "Local Time", "seconds" }, { "Absolute Time", "seconds" }, { "Ambient Temperature", "celsius" }, + { "Number Of Engines", "number" }, { "General Eng Rpm:1", "rpm" }, { "Eng Rpm Animation Percent:1", "percent" }, { "General Eng Elapsed Time:1", "hours" }, @@ -133,14 +134,29 @@ const char* SimVarDefs[][2] = { { "Brake Left Position", "percent" }, { "Brake Right Position", "percent" }, { "General Eng Oil Temperature:1", "fahrenheit" }, + { "General Eng Oil Temperature:2", "fahrenheit" }, + { "General Eng Oil Temperature:3", "fahrenheit" }, + { "General Eng Oil Temperature:4", "fahrenheit" }, { "General Eng Oil Pressure:1", "psi" }, + { "General Eng Oil Pressure:2", "psi" }, + { "General Eng Oil Pressure:3", "psi" }, + { "General Eng Oil Pressure:4", "psi" }, { "General Eng Exhaust Gas Temperature:1", "celsius" }, + { "General Eng Exhaust Gas Temperature:2", "celsius" }, + { "General Eng Exhaust Gas Temperature:3", "celsius" }, + { "General Eng Exhaust Gas Temperature:4", "celsius" }, { "Engine Type", "enum" }, { "Max Rated Engine RPM", "rpm" }, { "Turb Eng N1:1", "percent" }, + { "Turb Eng N1:2", "percent" }, + { "Turb Eng N1:3", "percent" }, + { "Turb Eng N1:4", "percent" }, { "Prop RPM:1", "rpm" }, { "Eng Manifold Pressure:1", "inches of mercury" }, { "Eng Fuel Flow GPH:1", "gallons per hour" }, + { "Eng Fuel Flow GPH:2", "gallons per hour" }, + { "Eng Fuel Flow GPH:3", "gallons per hour" }, + { "Eng Fuel Flow GPH:4", "gallons per hour" }, { "Suction Pressure", "inches of mercury" }, { "Sim On Ground", "bool" }, { "G Force", "gforce"}, diff --git a/instrument-data-link/simvarDefs.h b/instrument-data-link/simvarDefs.h index a4ce5b3..e3bc69d 100644 --- a/instrument-data-link/simvarDefs.h +++ b/instrument-data-link/simvarDefs.h @@ -108,6 +108,7 @@ struct SimVars double dcLocalSeconds = 46800; double dcFlightSeconds = 0; double dcTempC = 26.2; + double numberOfEngines = 1; double rpmEngine = 0; double rpmPercent = 0; double rpmElapsedTime = 0; @@ -136,15 +137,30 @@ struct SimVars double rudderPosition = 0; double brakeLeftPedal = 0; double brakeRightPedal = 0; - double oilTemp = 0; - double oilPressure = 0; - double exhaustGasTemp = 0; + double oilTemp1 = 0; + double oilTemp2 = 0; + double oilTemp3 = 0; + double oilTemp4 = 0; + double oilPressure1 = 0; + double oilPressure2 = 0; + double oilPressure3 = 0; + double oilPressure4 = 0; + double exhaustGasTemp1 = 0; + double exhaustGasTemp2 = 0; + double exhaustGasTemp3 = 0; + double exhaustGasTemp4 = 0; double engineType = 0; double engineMaxRpm = 0; - double turbineEngineN1 = 0; + double turbineEngine1N1 = 0; + double turbineEngine2N1 = 0; + double turbineEngine3N1 = 0; + double turbineEngine4N1 = 0; double propRpm = 0; double engineManifoldPressure = 0; - double engineFuelFlow = 0; + double engineFuelFlow1 = 0; + double engineFuelFlow2 = 0; + double engineFuelFlow3 = 0; + double engineFuelFlow4 = 0; double suctionPressure = 1; double onGround = 0; double gForce = 0;