Skip to content

Commit

Permalink
fix deferred auto display, add STS auto display
Browse files Browse the repository at this point in the history
  • Loading branch information
flogross89 committed Feb 3, 2025
1 parent 01e1b27 commit 9d0a94b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -247,6 +262,8 @@ export class FwsAbnormalSensed {
this.showAbnormalSensedRequested.set(false);
}

this.checkIfStsAutoDisplay();

if (!this.abnormalShown.get()) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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()) {
Expand All @@ -4446,7 +4455,7 @@ export class FwsCore {
);
}

this.normalChecklists.update(deltaTime);
this.normalChecklists.update();
this.abnormalSensed.update();
this.abnormalNonSensed.update();
this.updateRowRopWarnings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -71,8 +70,6 @@ export class FwsNormalChecklists {

private deferredProcedures: ProcedureLinesGenerator[] = [];

private readonly deferredAutoDisplayPulseNode = new NXLogicPulseNode(true);

private activeProcedure: ProcedureLinesGenerator;

constructor(private fws: FwsCore) {
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -418,7 +414,7 @@ export class FwsNormalChecklists {
}
});

this.checkIfDeferredAutoDisplay(deltaTime);
this.checkIfDeferredAutoDisplay();

if (!this.checklistShown.get()) {
return;
Expand Down

0 comments on commit 9d0a94b

Please sign in to comment.