From f055eb02dc0af32441f8b2873f58e8316d7ca638 Mon Sep 17 00:00:00 2001 From: Saschl Date: Fri, 3 Nov 2023 18:33:42 +0100 Subject: [PATCH] Revert "fix(pfd): show ils frequency when loc not received (#8271)" This reverts commit 19843be7c00ff30dc1e60573ca3f32feb7aa08f2. --- .github/CHANGELOG.md | 13 - .../src/PFD/LandingSystemIndicator.tsx | 331 +++++++----------- .../instruments/src/PFD/instrument.tsx | 13 - .../src/PFD/shared/PFDSimvarPublisher.tsx | 2 +- 4 files changed, 131 insertions(+), 228 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 5e13d2f11b1..bd63a6a8b00 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -5,19 +5,6 @@ - -## 0.12.0 - -1. [EFB/ATSU] Added NOAA (aviationweather.gov) as a METAR source - @tracernz (Mike) -1. [EFB] Fixed the main page and landing calculator to use the selected METAR source - @tracernz (Mike) -1. [FMS] Improve layout of PERF CLB, PERF CRZ and PERF DES pages according to H3 - @BlueberryKing (BlueberryKing) -1. [FMS] Implement CHECK SPEED MODE message - @BlueberryKing (BlueberryKing) - - -## 0.11.1 -1. [PFD] The ILS frequency is now visible even when a LOC is not received - @tracernz (Mike) - - ## 0.11.0 1. [FMS] Implement vertical navigation functions - @BlueberryKing (BlueberryKing) diff --git a/fbw-a32nx/src/systems/instruments/src/PFD/LandingSystemIndicator.tsx b/fbw-a32nx/src/systems/instruments/src/PFD/LandingSystemIndicator.tsx index 18c57578511..7e8fa3a766e 100644 --- a/fbw-a32nx/src/systems/instruments/src/PFD/LandingSystemIndicator.tsx +++ b/fbw-a32nx/src/systems/instruments/src/PFD/LandingSystemIndicator.tsx @@ -2,71 +2,92 @@ // // SPDX-License-Identifier: GPL-3.0 -import { ConsumerSubject, DisplayComponent, FSComponent, HEvent, MappedSubject, MathUtils, Subject, Subscribable, SubscribableMapFunctions, Subscription, VNode } from '@microsoft/msfs-sdk'; +import { DisplayComponent, FSComponent, HEvent, Subject, VNode } from '@microsoft/msfs-sdk'; import { getDisplayIndex } from 'instruments/src/PFD/PFD'; -import { Arinc429RegisterSubject } from 'instruments/src/MsfsAvionicsCommon/Arinc429RegisterSubject'; +import { Arinc429Register, Arinc429Word } from '@flybywiresim/fbw-sdk'; import { Arinc429Values } from './shared/ArincValueProvider'; import { PFDSimvars } from './shared/PFDSimvarPublisher'; import { LagFilter } from './PFDUtils'; import { ArincEventBus } from '../MsfsAvionicsCommon/ArincEventBus'; -// FIXME true ref +// TODO true ref export class LandingSystem extends DisplayComponent<{ bus: ArincEventBus, instrument: BaseInstrument }> { - private readonly lsVisible = ConsumerSubject.create(null, false); + private lsButtonPressedVisibility = false; - private readonly lsHidden = this.lsVisible.map(SubscribableMapFunctions.not()); + private xtkValid = Subject.create(false); - private readonly xtk = ConsumerSubject.create(null, 0); + private ldevRequest = false; - // FIXME this seems like a dubious test... - private readonly xtkValid = this.xtk.map((v) => Math.abs(v) > 0); + private lsGroupRef = FSComponent.createRef(); - private readonly ldevRequest = ConsumerSubject.create(null, false); + private gsReferenceLine = FSComponent.createRef(); - private readonly altitude2 = Arinc429RegisterSubject.createEmpty(); + private deviationGroup = FSComponent.createRef(); - private readonly isGsReferenceLineHidden = MappedSubject.create( - ([lsVisible, altitude]) => !lsVisible && !altitude.isNormalOperation(), - this.lsVisible, - this.altitude2, - ); + private ldevRef = FSComponent.createRef(); - private readonly isLDevHidden = MappedSubject.create( - ([request, xtkValid]) => !request || !xtkValid, - this.ldevRequest, - this.xtkValid, - ); + private vdevRef = FSComponent.createRef(); - private readonly isVDevHidden = Subject.create(true); + private altitude = Arinc429Word.empty(); + + private handleGsReferenceLine() { + if (this.lsButtonPressedVisibility || (this.altitude.isNormalOperation())) { + this.gsReferenceLine.instance.style.display = 'inline'; + } else if (!this.lsButtonPressedVisibility) { + this.gsReferenceLine.instance.style.display = 'none'; + } + } onAfterRender(node: VNode): void { super.onAfterRender(node); const sub = this.props.bus.getSubscriber(); - // FIXME clean this up.. should be handled by an IE in the XML sub.on('hEvent').handle((eventName) => { if (eventName === `A320_Neo_PFD_BTN_LS_${getDisplayIndex()}`) { - SimVar.SetSimVarValue(`L:BTN_LS_${getDisplayIndex()}_FILTER_ACTIVE`, 'Bool', !this.lsVisible.get()); + this.lsButtonPressedVisibility = !this.lsButtonPressedVisibility; + SimVar.SetSimVarValue(`L:BTN_LS_${getDisplayIndex()}_FILTER_ACTIVE`, 'Bool', this.lsButtonPressedVisibility); + + this.lsGroupRef.instance.style.display = this.lsButtonPressedVisibility ? 'inline' : 'none'; + this.handleGsReferenceLine(); } }); - this.lsVisible.setConsumer(sub.on(getDisplayIndex() === 1 ? 'ls1Button' : 'ls2Button')); + sub.on(getDisplayIndex() === 1 ? 'ls1Button' : 'ls2Button').whenChanged().handle((lsButton) => { + this.lsButtonPressedVisibility = lsButton; + this.lsGroupRef.instance.style.display = this.lsButtonPressedVisibility ? 'inline' : 'none'; + this.deviationGroup.instance.style.display = this.lsButtonPressedVisibility ? 'none' : 'inline'; + this.handleGsReferenceLine(); + }); - sub.on('baroCorrectedAltitude').handle((altitude) => { - this.altitude2.setWord(altitude); + sub.on('altitudeAr').handle((altitude) => { + this.altitude = altitude; + this.handleGsReferenceLine(); }); - this.ldevRequest.setConsumer(sub.on(getDisplayIndex() === 1 ? 'ldevRequestLeft' : 'ldevRequestRight')); + sub.on(getDisplayIndex() === 1 ? 'ldevRequestLeft' : 'ldevRequestRight').whenChanged().handle((ldevRequest) => { + this.ldevRequest = ldevRequest; + this.updateLdevVisibility(); + }); - this.xtk.setConsumer(sub.on('xtk')); + sub.on('xtk').whenChanged().handle((xtk) => { + this.xtkValid.set(Math.abs(xtk) > 0); + }); + + this.xtkValid.sub(() => { + this.updateLdevVisibility(); + }); + } + + updateLdevVisibility() { + this.ldevRef.instance.style.display = this.ldevRequest && this.xtkValid ? 'inline' : 'none'; } render(): VNode { return ( <> - - + - - +