Skip to content

Commit

Permalink
fix(fwc): Visual and audible warning/caution fix (#7137)
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardPilbery authored and aguther committed May 1, 2022
1 parent fcd51ec commit 05bd2af
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/instruments/src/EWD/elements/PseudoFWC.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1390,20 +1390,28 @@ const PseudoFWC: React.FC = () => {
let tempMemoArrayRight:string[] = [];
const allFailureKeys: string[] = [];
let tempFailureArrayLeft:string[] = [];
const failureKeysLeft: string[] = failuresLeft;
let failureKeysLeft: string[] = failuresLeft;
let recallFailureKeys: string[] = recallFailures;
let tempFailureArrayRight:string[] = [];
const failureKeysRight: string[] = failuresRight;
let leftFailureSystemCount = 0;
let rightFailureSystemCount = 0;

// Update failuresLeft list in case failure has been resolved
for (const [key, value] of Object.entries(EWDMessageFailures)) {
if (!value.simVarIsActive || value.flightPhaseInhib.some((e) => e === flightPhase)) {
failureKeysLeft = failureKeysLeft.filter((e) => e !== key);
recallFailureKeys = recallFailures.filter((e) => e !== key);
}
}
setRecallFailures(recallFailureKeys);
// Failures first
for (const [key, value] of Object.entries(EWDMessageFailures)) {
if (value.simVarIsActive && !value.flightPhaseInhib.some((e) => e === flightPhase)) {
if (value.side === 'LEFT') {
allFailureKeys.push(key);
}

if ((value.side === 'LEFT' && !failuresLeft.includes(key) && !recallFailures.includes(key)) || (value.side === 'RIGHT' && !failuresRight.includes(key))) {
if ((value.side === 'LEFT' && !failuresLeft.includes(key) && !recallFailureKeys.includes(key)) || (value.side === 'RIGHT' && !failuresRight.includes(key))) {
if (value.side === 'LEFT') {
failureKeysLeft.push(key);
} else {
Expand All @@ -1419,9 +1427,8 @@ const PseudoFWC: React.FC = () => {
} else if (![eng1FireTest, eng2FireTest, apuFireTest, cargoFireTest].every((e) => e === 0)) {
masterWarning(1);
}

const newCode: string[] = [];
if (!recallFailures.includes(key)) {
if (!recallFailureKeys.includes(key)) {
const codeIndex = value.whichCodeToReturn.filter((e) => e !== null);
codeIndex.forEach((e: number) => {
newCode.push(value.codesToReturn[e]);
Expand All @@ -1447,7 +1454,6 @@ const PseudoFWC: React.FC = () => {
}

const failLeft = tempFailureArrayLeft.length > 0;
// const failRight = tempFailureArrayRight.length > 0;

const mesgFailOrderLeft: string[] = [];
const mesgFailOrderRight: string[] = [];
Expand All @@ -1465,7 +1471,7 @@ const PseudoFWC: React.FC = () => {
setFailuresLeft(failureKeysLeft);
setFailuresRight(failureKeysRight);

if (failLeft) {
if (tempFailureArrayLeft.length > 0) {
setMemoMessageLeft(orderedFailureArrayLeft);
}

Expand Down

0 comments on commit 05bd2af

Please sign in to comment.