From 9d0a94b5be26afc81d1f5760287a3c61f4c6b7f2 Mon Sep 17 00:00:00 2001 From: Florian Gross <63071941+flogross89@users.noreply.github.com> Date: Tue, 4 Feb 2025 01:44:15 +0200 Subject: [PATCH] fix deferred auto display, add STS auto display --- .../FlightWarningSystem/FwsAbnormalSensed.ts | 17 +++++++++++ .../systems/FlightWarningSystem/FwsCore.ts | 11 +++++++- .../FwsNormalChecklists.ts | 28 ++++++++----------- 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/fbw-a380x/src/systems/systems-host/systems/FlightWarningSystem/FwsAbnormalSensed.ts b/fbw-a380x/src/systems/systems-host/systems/FlightWarningSystem/FwsAbnormalSensed.ts index 79954b7b716..0f02bf256ee 100644 --- a/fbw-a380x/src/systems/systems-host/systems/FlightWarningSystem/FwsAbnormalSensed.ts +++ b/fbw-a380x/src/systems/systems-host/systems/FlightWarningSystem/FwsAbnormalSensed.ts @@ -236,6 +236,21 @@ export class FwsAbnormalSensed { this.showFromLine.set(Math.max(0, this.activeProcedure.numLinesUntilSelected() - WD_NUM_LINES + 2)); } + private checkIfStsAutoDisplay() { + const approachCondition = + this.fws.presentedAbnormalProceduresList.get().size === 0 && + this.fws.flightPhase.get() === 8 && + this.fws.adrPressureAltitude.get() < 20_000 && + !this.fws.ecamStsNormal.get(); + const triggerAutoDisplay = + this.fws.approachAutoDisplayQnhSetPulseNode.read() || this.fws.approachAutoDisplaySlatsExtendedPulseNode.read(); + + if (approachCondition && triggerAutoDisplay) { + // Call STS page on SD + SimVar.SetSimVarValue('L:A32NX_ECAM_SD_CURRENT_PAGE_INDEX', SimVarValueType.Enum, SdPages.Status); + } + } + /** * The majority of ECAM fault logic is still inside FwsCore (due to dependencies to MEMOs, and general flow) * This block deals mostly with the pilot interaction through the ECAM CP and transmission to the CDS/EWD @@ -247,6 +262,8 @@ export class FwsAbnormalSensed { this.showAbnormalSensedRequested.set(false); } + this.checkIfStsAutoDisplay(); + if (!this.abnormalShown.get()) { return; } diff --git a/fbw-a380x/src/systems/systems-host/systems/FlightWarningSystem/FwsCore.ts b/fbw-a380x/src/systems/systems-host/systems/FlightWarningSystem/FwsCore.ts index 70d1a18a6a2..88bf4b17566 100644 --- a/fbw-a380x/src/systems/systems-host/systems/FlightWarningSystem/FwsCore.ts +++ b/fbw-a380x/src/systems/systems-host/systems/FlightWarningSystem/FwsCore.ts @@ -304,6 +304,9 @@ export class FwsCore { public readonly fwcOut126 = Arinc429RegisterSubject.createEmpty(); + public readonly approachAutoDisplayQnhSetPulseNode = new NXLogicPulseNode(true); + public readonly approachAutoDisplaySlatsExtendedPulseNode = new NXLogicPulseNode(true); + /* MISC STUFF */ public readonly airKnob = Subject.create(0); @@ -4433,6 +4436,12 @@ export class FwsCore { const sdStsShown = SimVar.GetSimVarValue('L:A32NX_ECAM_SD_CURRENT_PAGE_INDEX', SimVarValueType.Number) === 14; this.ecamEwdShowStsIndication.set(!this.ecamStsNormal.get() && !sdStsShown); + this.approachAutoDisplayQnhSetPulseNode.write( + Simplane.getPressureSelectedMode(Aircraft.A320_NEO) !== 'STD', + deltaTime, + ); + this.approachAutoDisplaySlatsExtendedPulseNode.write(this.flapsHandle.get() > 0, deltaTime); + const chimeRequested = (this.auralSingleChimePending || this.requestSingleChimeFromAThrOff) && !this.auralCrcActive.get(); if (chimeRequested && !this.auralSingleChimeInhibitTimer.isPending()) { @@ -4446,7 +4455,7 @@ export class FwsCore { ); } - this.normalChecklists.update(deltaTime); + this.normalChecklists.update(); this.abnormalSensed.update(); this.abnormalNonSensed.update(); this.updateRowRopWarnings(); diff --git a/fbw-a380x/src/systems/systems-host/systems/FlightWarningSystem/FwsNormalChecklists.ts b/fbw-a380x/src/systems/systems-host/systems/FlightWarningSystem/FwsNormalChecklists.ts index 2c8a96301eb..8e114e94010 100644 --- a/fbw-a380x/src/systems/systems-host/systems/FlightWarningSystem/FwsNormalChecklists.ts +++ b/fbw-a380x/src/systems/systems-host/systems/FlightWarningSystem/FwsNormalChecklists.ts @@ -27,7 +27,6 @@ import { ProcedureType, SPECIAL_INDEX_DEFERRED_PAGE_CLEAR, } from 'instruments/src/MsfsAvionicsCommon/EcamMessages/ProcedureLinesGenerator'; -import { NXLogicPulseNode } from '@flybywiresim/fbw-sdk'; export interface NormalEclSensedItems { /** Returns a boolean vector (same length as number of items). If true, item is marked as completed. If null, it's a non-sensed item */ @@ -71,8 +70,6 @@ export class FwsNormalChecklists { private deferredProcedures: ProcedureLinesGenerator[] = []; - private readonly deferredAutoDisplayPulseNode = new NXLogicPulseNode(true); - private activeProcedure: ProcedureLinesGenerator; constructor(private fws: FwsCore) { @@ -361,24 +358,23 @@ export class FwsNormalChecklists { this.showFromLine.set(Math.max(0, this.selectedLine.get() - WD_NUM_LINES + 2)); } - private checkIfDeferredAutoDisplay(deltaTime: number) { - this.deferredAutoDisplayPulseNode.write( + private checkIfDeferredAutoDisplay() { + const approachCondition = this.fws.presentedAbnormalProceduresList.get().size === 0 && - this.fws.flightPhase.get() === 8 && - this.fws.adrPressureAltitude.get() < 20_000 && - (this.fws.slatsAngle.get() > 0 || Simplane.getPressureSelectedMode(Aircraft.A320_NEO) !== 'STD') && - this.hasDeferred.some((v) => v) && - this.deferredIsCompleted.some((v) => !v), - deltaTime, - ); - - if (this.deferredAutoDisplayPulseNode.read() && !this.showChecklistRequested.get()) { + this.fws.flightPhase.get() === 8 && + this.fws.adrPressureAltitude.get() < 20_000 && + this.hasDeferred.some((v) => v) && + this.deferredIsCompleted.some((v) => !v); + const triggerAutoDisplay = + this.fws.approachAutoDisplayQnhSetPulseNode.read() || this.fws.approachAutoDisplaySlatsExtendedPulseNode.read(); + + if (approachCondition && triggerAutoDisplay && !this.showChecklistRequested.get()) { this.showChecklistRequested.set(true); this.navigateToChecklist(0); } } - update(deltaTime: number) { + update() { if (this.fws.clPulseNode.read()) { this.navigateToChecklist(0); this.showChecklistRequested.set(!this.showChecklistRequested.get()); @@ -418,7 +414,7 @@ export class FwsNormalChecklists { } }); - this.checkIfDeferredAutoDisplay(deltaTime); + this.checkIfDeferredAutoDisplay(); if (!this.checklistShown.get()) { return;