Skip to content

Commit

Permalink
feat(fwc): non-cancellable warnings (#8604)
Browse files Browse the repository at this point in the history
* fix: clean up master caution/warning buttons

* feat/fix(fwc): implement non-cancellable master warning

* fix(fwc): vfe warnings are non-cancellable

---------
  • Loading branch information
tracernz authored Apr 4, 2024
1 parent fba91d9 commit e73c4b5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 34 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
1. [MISC] Fixed wrong msfs plane acceleration during reverser use causing autobrake wrong brake inputs - @Crocket63 (crocket)
1. [EFB] Fix default value for boarding rate - @tracernz (Mike)
1. [EFB] Added missing localization for SimBridge related settings in SimOptions page - @implasmatbh (Plasma)
1. [FWC] Implement non-cancellable master warning for overspeed and gear not down - @tracernz (Mike)

## 0.11.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5016,7 +5016,6 @@
<NODE_ID>A32NX_PUSH_WARN_L</NODE_ID>
<PART_ID>A32NX_PUSH_WARN_L</PART_ID>
<LEFT_SINGLE_CODE>
0 (&gt;L:A32NX_MASTER_WARNING)
1 (&gt;L:PUSH_AUTOPILOT_MASTERAWARN_L)
</LEFT_SINGLE_CODE>
<LEFT_LEAVE_CODE>
Expand All @@ -5040,7 +5039,6 @@
<NODE_ID>A32NX_PUSH_CAUTION_L</NODE_ID>
<PART_ID>A32NX_PUSH_CAUTION_L</PART_ID>
<LEFT_SINGLE_CODE>
0 (&gt;L:A32NX_MASTER_CAUTION)
1 (&gt;L:PUSH_AUTOPILOT_MASTERCAUT_L)
</LEFT_SINGLE_CODE>
<LEFT_LEAVE_CODE>
Expand All @@ -5064,7 +5062,6 @@
<NODE_ID>A32NX_PUSH_WARN_R</NODE_ID>
<PART_ID>A32NX_PUSH_WARN_R</PART_ID>
<LEFT_SINGLE_CODE>
0 (&gt;L:A32NX_MASTER_WARNING)
1 (&gt;L:PUSH_AUTOPILOT_MASTERAWARN_L)
</LEFT_SINGLE_CODE>
<LEFT_LEAVE_CODE>
Expand All @@ -5088,7 +5085,6 @@
<NODE_ID>A32NX_PUSH_CAUTION_R</NODE_ID>
<PART_ID>A32NX_PUSH_CAUTION_R</PART_ID>
<LEFT_SINGLE_CODE>
0 (&gt;L:A32NX_MASTER_CAUTION)
1 (&gt;L:PUSH_AUTOPILOT_MASTERCAUT_L)
</LEFT_SINGLE_CODE>
<LEFT_LEAVE_CODE>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ class A32NX_FWC {
// ESDL 1. 0.320
this.memoLdgInhibit_conf01 = new NXLogic_ConfirmNode(3, true); // CONF 01

// master warning & caution buttons
this.warningPressed = false;
this.cautionPressed = false;

// altitude warning
this.previousTargetAltitude = NaN;
this._wasBellowThreshold = false;
Expand All @@ -75,17 +71,6 @@ class A32NX_FWC {

_updateButtons(_deltaTime) {
this.toConfigTest = SimVar.GetSimVarValue('L:A32NX_FWS_TO_CONFIG_TEST', 'boolean');

if (SimVar.GetSimVarValue("L:PUSH_AUTOPILOT_MASTERAWARN_L", "Bool") || SimVar.GetSimVarValue("L:PUSH_AUTOPILOT_MASTERAWARN_R", "Bool")) {
this.warningPressed = true;
} else {
this.warningPressed = false;
}
if (SimVar.GetSimVarValue("L:PUSH_AUTOPILOT_MASTERCAUT_L", "Bool") || SimVar.GetSimVarValue("L:PUSH_AUTOPILOT_MASTERCAUT_R", "Bool")) {
this.cautionPressed = true;
} else {
this.cautionPressed = false;
}
}

_updateFlightPhase(_deltaTime) {
Expand Down Expand Up @@ -302,7 +287,8 @@ class A32NX_FWC {
SimVar.SetSimVarValue("L:A32NX_ALT_DEVIATION_SHORT", "Bool", false);
}

if (this.warningPressed === true) {
const warningPressed = SimVar.GetSimVarValue("L:PUSH_AUTOPILOT_MASTERAWARN_L", "Bool") || SimVar.GetSimVarValue("L:PUSH_AUTOPILOT_MASTERAWARN_R", "Bool");
if (warningPressed) {
this._wasBellowThreshold = false;
this._wasAboveThreshold = false;
this._wasInRange = false;
Expand Down
35 changes: 21 additions & 14 deletions fbw-a32nx/src/systems/instruments/src/EWD/PseudoFWC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: GPL-3.0

import { Subject, Subscribable, MappedSubject, DebounceTimer, ConsumerValue, EventBus, ConsumerSubject, SimVarValueType } from '@microsoft/msfs-sdk';
import { Subject, Subscribable, MappedSubject, DebounceTimer, ConsumerValue, EventBus, ConsumerSubject, SimVarValueType, SubscribableMapFunctions } from '@microsoft/msfs-sdk';

import { Arinc429Register, Arinc429Word, NXDataStore, NXLogicClockNode, NXLogicConfirmNode, NXLogicMemoryNode, NXLogicPulseNode, NXLogicTriggeredMonostableNode } from '@flybywiresim/fbw-sdk';
import { VerticalMode } from '@shared/autopilot';
Expand All @@ -25,7 +25,7 @@ interface EWDItem {
failure: number,
sysPage: number,
side: string,
/** Cancel flag (only emergency cancel can cancel if false), defaults to true. */
/** Cancel flag for level 3 warning audio (only emergency cancel can cancel if false), defaults to true. */
cancel?: boolean,
}

Expand Down Expand Up @@ -86,8 +86,10 @@ export class PseudoFWC {

private readonly fireActive = Subject.create(false);

private nonCancellableWarningCount = 0;

private readonly masterWarningOutput = MappedSubject.create(
([masterWarning, fireActive]) => masterWarning || fireActive,
SubscribableMapFunctions.or(),
this.masterWarning,
this.fireActive,
);
Expand Down Expand Up @@ -1573,7 +1575,7 @@ export class PseudoFWC {
this.masterCaution.set(false);
this.auralSingleChimePending = false;
}
if (masterWarningButtonLeft || masterWarningButtonRight) {
if ((masterWarningButtonLeft || masterWarningButtonRight) && this.nonCancellableWarningCount === 0) {
this.masterWarning.set(false);
this.auralCrcActive.set(false);
}
Expand Down Expand Up @@ -1603,15 +1605,8 @@ export class PseudoFWC {

/* CLEAR AND RECALL */
if (this.clrTriggerRisingEdge) {
// delete the first cancellable failure
for (const [index, failure] of this.failuresLeft.entries()) {
const cancellable = this.ewdMessageFailures[failure]?.cancel;
if (cancellable === false) {
continue;
}
this.failuresLeft.splice(index, 1);
break;
}
// delete the first failure
this.failuresLeft.splice(0, 1);
this.recallFailures = this.allCurrentFailures.filter((item) => !this.failuresLeft.includes(item));
}

Expand Down Expand Up @@ -1665,6 +1660,7 @@ export class PseudoFWC {

this.recallFailures.length = 0;
this.recallFailures.push(...recallFailureKeys);
this.nonCancellableWarningCount = 0;

// Failures first
for (const [key, value] of Object.entries(this.ewdMessageFailures)) {
Expand All @@ -1691,6 +1687,10 @@ export class PseudoFWC {
}
}

if (value.cancel === false && value.failure === 3) {
this.nonCancellableWarningCount++;
}

// if the warning is the same as the aural
if (value.auralWarning === undefined && value.failure === 3) {
if (newWarning) {
Expand Down Expand Up @@ -1833,7 +1833,9 @@ export class PseudoFWC {

if (orderedFailureArrayRight.length === 0) {
this.masterCaution.set(false);
this.masterWarning.set(false);
if (this.nonCancellableWarningCount === 0) {
this.masterWarning.set(false);
}
}
}

Expand Down Expand Up @@ -1921,6 +1923,7 @@ export class PseudoFWC {
failure: 3,
sysPage: -1,
side: 'LEFT',
cancel: false,
},
3400220: { // OVERSPEED FLAPS 3
flightPhaseInhib: [2, 3, 4, 8, 9, 10],
Expand All @@ -1932,6 +1935,7 @@ export class PseudoFWC {
failure: 3,
sysPage: -1,
side: 'LEFT',
cancel: false,
},
3400230: { // OVERSPEED FLAPS 2
flightPhaseInhib: [2, 3, 4, 8, 9, 10],
Expand All @@ -1944,6 +1948,7 @@ export class PseudoFWC {
failure: 3,
sysPage: -1,
side: 'LEFT',
cancel: false,
},
3400235: { // OVERSPEED FLAPS 1+F
flightPhaseInhib: [2, 3, 4, 8, 9, 10],
Expand All @@ -1956,6 +1961,7 @@ export class PseudoFWC {
failure: 3,
sysPage: -1,
side: 'LEFT',
cancel: false,
},
3400240: { // OVERSPEED FLAPS 1
flightPhaseInhib: [2, 3, 4, 8, 9, 10],
Expand All @@ -1968,6 +1974,7 @@ export class PseudoFWC {
failure: 3,
sysPage: -1,
side: 'LEFT',
cancel: false,
},
7700027: { // DUAL ENGINE FAILURE
flightPhaseInhib: [],
Expand Down

0 comments on commit e73c4b5

Please sign in to comment.