From cdfba52e2eb7e70e9eddcad456ee964f499b9462 Mon Sep 17 00:00:00 2001 From: BravoMike99 <119708186+BravoMike99@users.noreply.github.com> Date: Sun, 29 Dec 2024 21:04:39 +0000 Subject: [PATCH] feat(a380x/fma): disconnect ap for ldg message (#9606) * feat(a380x/fma): disconnect ap for ldg message * Address notation & subject usage with tracer suggestions Co-Authored-By: Michael Corcoran --------- Co-authored-by: Michael Corcoran --- .github/CHANGELOG.md | 1 + .../src/systems/instruments/src/PFD/FMA.tsx | 119 ++++++++++++++---- 2 files changed, 93 insertions(+), 27 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index fcda5e4943e..e6fcd8ae2f6 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -101,6 +101,7 @@ 1. [ELEC] Improved elec system startup behaviour - @Gurgel100 (Pascal) - @saschl 1. [A380X] Improve pilot and copilot camera positions - @heclak (Heclak) 1. [A380X/EFIS] Illuminate ND range and mode selectors during light test - @BravoMike99 (bruno_pt99) +1. [A380/PFD] Add DISCONNECT AP FOR LDG FMA message - @BravoMike99 (bruno_pt99) 1. [A380X/ENG] Adjust climb thrust to be more accurate - @BlueberryKing (BlueberryKing) 1. [A380X/ANIM] Animation of flaps now from FPPU position. Interim fix for spoiler low end animation - @Crocket63 (crocket) 1. [A380X/ENGINES] Adjust climb thrust to be more accurate - @BlueberryKing (BlueberryKing) diff --git a/fbw-a380x/src/systems/instruments/src/PFD/FMA.tsx b/fbw-a380x/src/systems/instruments/src/PFD/FMA.tsx index baf382f2f10..fd9cc280592 100644 --- a/fbw-a380x/src/systems/instruments/src/PFD/FMA.tsx +++ b/fbw-a380x/src/systems/instruments/src/PFD/FMA.tsx @@ -2,9 +2,11 @@ /* eslint-disable no-constant-condition */ import { ComponentProps, + ConsumerSubject, DisplayComponent, EventBus, FSComponent, + MappedSubject, Subject, Subscribable, VNode, @@ -43,9 +45,9 @@ abstract class ShowForSecondsComponent extends Display } export class FMA extends DisplayComponent<{ bus: EventBus; isAttExcessive: Subscribable }> { - private activeLateralMode: number = 0; + private sub = this.props.bus.getSubscriber(); - private activeVerticalMode: number = 0; + private activeLateralMode: number = 0; private armedVerticalModeSub = Subject.create(0); @@ -69,12 +71,56 @@ export class FMA extends DisplayComponent<{ bus: EventBus; isAttExcessive: Subsc private AB3Message = Subject.create(false); + private readonly radioHeight = ConsumerSubject.create(this.sub.on('chosenRa'), Arinc429Word.empty()); + + private readonly altitude = ConsumerSubject.create(this.sub.on('altitudeAr'), Arinc429Word.empty()); + + private readonly landingElevation = ConsumerSubject.create(this.sub.on('landingElevation'), Arinc429Word.empty()); + + private readonly ap1Active = ConsumerSubject.create(this.sub.on('ap1Active'), false); + + private readonly ap2Active = ConsumerSubject.create(this.sub.on('ap2Active'), false); + + private readonly activeVerticalMode = ConsumerSubject.create(this.sub.on('activeVerticalMode'), 0); + + private readonly selectedVerticalSpeed = ConsumerSubject.create(this.sub.on('apVsSelected'), null); + + private readonly selectedFpa = ConsumerSubject.create(this.sub.on('selectedFpa'), null); + + private readonly approachCapability = ConsumerSubject.create(this.sub.on('approachCapability'), 0); + + private disconnectApForLdg = MappedSubject.create( + ([ap1, ap2, ra, altitude, landingElevation, verticalMode, selectedFpa, selectedVs, approachCapability]) => { + return ( + (ap1 || ap2) && + (ra.isNormalOperation() ? ra.value <= 150 : altitude.valueOr(Infinity) - landingElevation.valueOr(0) <= 150) && + (approachCapability === 1 || // CAT 1 or FLS + approachCapability === 6 || + approachCapability === 7 || + approachCapability === 8 || + verticalMode === VerticalMode.DES || + verticalMode === VerticalMode.OP_DES || + (verticalMode === VerticalMode.FPA && selectedFpa <= 0) || + (verticalMode === VerticalMode.VS && selectedVs <= 0)) + ); + }, + this.ap1Active, + this.ap2Active, + this.radioHeight, + this.altitude, + this.landingElevation, + this.activeVerticalMode, + this.selectedFpa, + this.selectedVerticalSpeed, + this.approachCapability, + ); + private handleFMABorders() { const sharedModeActive = this.activeLateralMode === 32 || this.activeLateralMode === 33 || this.activeLateralMode === 34 || - (this.activeLateralMode === 20 && this.activeVerticalMode === 24); + (this.activeLateralMode === 20 && this.activeVerticalMode.get() === 24); const BC3Message = getBC3Message( this.props.isAttExcessive.get(), @@ -83,6 +129,7 @@ export class FMA extends DisplayComponent<{ bus: EventBus; isAttExcessive: Subsc this.trkFpaDeselected.get(), this.tcasRaInhibited.get(), this.tdReached, + this.disconnectApForLdg.get(), )[0] !== null; const engineMessage = this.athrModeMessage; @@ -115,13 +162,13 @@ export class FMA extends DisplayComponent<{ bus: EventBus; isAttExcessive: Subsc onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); + this.disconnectApForLdg.sub(() => this.handleFMABorders()); this.props.isAttExcessive.sub((_a) => { this.handleFMABorders(); }); - sub + this.sub .on('fmaVerticalArmed') .whenChanged() .handle((a) => { @@ -129,22 +176,17 @@ export class FMA extends DisplayComponent<{ bus: EventBus; isAttExcessive: Subsc this.handleFMABorders(); }); - sub + this.sub .on('activeLateralMode') .whenChanged() .handle((activeLateralMode) => { this.activeLateralMode = activeLateralMode; this.handleFMABorders(); }); - sub - .on('activeVerticalMode') - .whenChanged() - .handle((activeVerticalMode) => { - this.activeVerticalMode = activeVerticalMode; - this.handleFMABorders(); - }); - sub + this.activeVerticalMode.sub(() => this.handleFMABorders()); + + this.sub .on('setHoldSpeed') .whenChanged() .handle((shs) => { @@ -152,7 +194,7 @@ export class FMA extends DisplayComponent<{ bus: EventBus; isAttExcessive: Subsc this.handleFMABorders(); }); - sub + this.sub .on('tcasRaInhibited') .whenChanged() .handle((tra) => { @@ -160,7 +202,7 @@ export class FMA extends DisplayComponent<{ bus: EventBus; isAttExcessive: Subsc this.handleFMABorders(); }); - sub + this.sub .on('trkFpaDeselectedTCAS') .whenChanged() .handle((trk) => { @@ -168,7 +210,7 @@ export class FMA extends DisplayComponent<{ bus: EventBus; isAttExcessive: Subsc this.handleFMABorders(); }); - sub + this.sub .on('tdReached') .whenChanged() .handle((tdr) => { @@ -189,7 +231,12 @@ export class FMA extends DisplayComponent<{ bus: EventBus; isAttExcessive: Subsc - + ); } @@ -347,6 +394,7 @@ class A2Cell extends DisplayComponent<{ bus: EventBus }> { class Row3 extends DisplayComponent<{ bus: EventBus; isAttExcessive: Subscribable; + disconnectApForLdg: Subscribable; AB3Message: Subscribable; }> { private cellsToHide = FSComponent.createRef(); @@ -371,7 +419,11 @@ class Row3 extends DisplayComponent<{ - + ); @@ -1298,6 +1350,7 @@ const getBC3Message = ( trkFpaDeselectedTCAS: boolean, tcasRaInhibited: boolean, tdReached: boolean, + disconnectApForLdg: boolean, ) => { const armedVerticalBitmask = armedVerticalMode; const TCASArmed = (armedVerticalBitmask >> 6) & 1; @@ -1312,6 +1365,9 @@ const getBC3Message = ( } else if (false) { text = 'FOR GA: SET TOGA'; className = 'PulseAmber9Seconds Amber'; + } else if (disconnectApForLdg) { + text = 'DISCONNECT AP FOR LDG'; + className = 'FontSmall PulseAmber9Seconds Amber'; } else if (TCASArmed && !isAttExcessive) { text = 'TCAS '; className = 'FontMediumSmaller Cyan'; @@ -1346,7 +1402,13 @@ const getBC3Message = ( return [text, className]; }; -class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable; bus: EventBus }> { +class BC3Cell extends DisplayComponent<{ + isAttExcessive: Subscribable; + disconnectApForLdg: Subscribable; + bus: EventBus; +}> { + private sub = this.props.bus.getSubscriber(); + private bc3Cell = FSComponent.createRef(); private classNameSub = Subject.create(''); @@ -1371,6 +1433,7 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable; this.trkFpaDeselected, this.tcasRaInhibited, this.tdReached, + this.props.disconnectApForLdg.get(), ); this.classNameSub.set(`FontMedium MiddleAlign ${className}`); if (text !== null) { @@ -1383,14 +1446,16 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable; onAfterRender(node: VNode): void { super.onAfterRender(node); - const sub = this.props.bus.getSubscriber(); - this.props.isAttExcessive.sub((e) => { this.isAttExcessive = e; this.fillBC3Cell(); }); - sub + this.props.disconnectApForLdg.sub(() => { + this.fillBC3Cell(); + }); + + this.sub .on('fmaVerticalArmed') .whenChanged() .handle((v) => { @@ -1398,7 +1463,7 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable; this.fillBC3Cell(); }); - sub + this.sub .on('setHoldSpeed') .whenChanged() .handle((shs) => { @@ -1406,7 +1471,7 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable; this.fillBC3Cell(); }); - sub + this.sub .on('tcasRaInhibited') .whenChanged() .handle((tra) => { @@ -1414,7 +1479,7 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable; this.fillBC3Cell(); }); - sub + this.sub .on('trkFpaDeselectedTCAS') .whenChanged() .handle((trk) => { @@ -1422,7 +1487,7 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable; this.fillBC3Cell(); }); - sub + this.sub .on('tdReached') .whenChanged() .handle((tdr) => {