Skip to content

Commit

Permalink
Update guages for multi-engined aircraft
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Vincent committed Dec 18, 2022
1 parent a889475 commit 0bc2943
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 17 deletions.
12 changes: 8 additions & 4 deletions instrument-data-link/LVars-A32NX.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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_
15 changes: 13 additions & 2 deletions instrument-data-link/instrument-data-link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
20 changes: 14 additions & 6 deletions instrument-data-link/jetbridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}

Expand Down Expand Up @@ -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
16 changes: 16 additions & 0 deletions instrument-data-link/simvarDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down Expand Up @@ -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"},
Expand Down
26 changes: 21 additions & 5 deletions instrument-data-link/simvarDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0bc2943

Please sign in to comment.