diff --git a/src/instruments/src/PFD/HeadingIndicator.tsx b/src/instruments/src/PFD/HeadingIndicator.tsx index 8f2d09b41cb5..c4879642b6bd 100644 --- a/src/instruments/src/PFD/HeadingIndicator.tsx +++ b/src/instruments/src/PFD/HeadingIndicator.tsx @@ -347,18 +347,36 @@ interface TrueFlagProps { } class TrueFlag extends DisplayComponent { - private trueRefActive = Subject.create(false); + private readonly trueRefActive = Subject.create(false); + + private readonly slatsExtended = Subject.create(false); + + private readonly slatsExtendedWithTrue = Subject.create(false); + + private readonly trueFlagRef = FSComponent.createRef(); /** @inheritdoc */ // eslint-disable-next-line @typescript-eslint/no-unused-vars onAfterRender(node: VNode): void { this.props.bus.getSubscriber().on('trueRefActive').whenChanged().handle((v) => this.trueRefActive.set(v)); + // FIXME this should be 127-11 from FWC + this.props.bus.getSubscriber().on('slatPosLeft').withPrecision(0.25).handle((v) => this.slatsExtended.set(v > 0.4)); + + this.trueRefActive.sub((trueRef) => this.trueFlagRef.instance.classList.toggle('HiddenElement', !trueRef), true); + + this.trueRefActive.sub(this.handleSlatsTrue.bind(this)); + this.slatsExtended.sub(this.handleSlatsTrue.bind(this)); + this.slatsExtendedWithTrue.sub((flash) => this.trueFlagRef.instance.classList.toggle('Blink10Seconds', flash)); + } + + private handleSlatsTrue(): void { + this.slatsExtendedWithTrue.set(this.trueRefActive.get() && this.slatsExtended.get()); } /** @inheritdoc */ render(): VNode { return ( - + TRUE diff --git a/src/instruments/src/PFD/animations.scss b/src/instruments/src/PFD/animations.scss index 97f9bd61f66c..1a2f5c3f9929 100644 --- a/src/instruments/src/PFD/animations.scss +++ b/src/instruments/src/PFD/animations.scss @@ -54,6 +54,12 @@ animation-iteration-count: 9; } +.Blink10Seconds { + animation-name: blinking; + animation-duration: 1s; + animation-iteration-count: 10; +} + .OuterMarkerBlink { animation-name: OuterMarkerAnim; animation-duration: 460ms; diff --git a/src/instruments/src/PFD/instrument.tsx b/src/instruments/src/PFD/instrument.tsx index 5331200e4706..6ce3d0473556 100644 --- a/src/instruments/src/PFD/instrument.tsx +++ b/src/instruments/src/PFD/instrument.tsx @@ -221,6 +221,7 @@ class A32NX_PFD extends BaseInstrument { this.simVarPublisher.subscribe('irMaintWordRaw'); this.simVarPublisher.subscribe('trueHeadingRaw'); this.simVarPublisher.subscribe('trueTrackRaw'); + this.simVarPublisher.subscribe('slatPosLeft'); FSComponent.render(, document.getElementById('PFD_CONTENT')); } diff --git a/src/instruments/src/PFD/shared/DisplayManagementComputer.tsx b/src/instruments/src/PFD/shared/DisplayManagementComputer.tsx index a0abd2515c41..d959417b7783 100644 --- a/src/instruments/src/PFD/shared/DisplayManagementComputer.tsx +++ b/src/instruments/src/PFD/shared/DisplayManagementComputer.tsx @@ -29,7 +29,10 @@ export class DisplayManagementComputer { init(): void { const pub = this.bus.getPublisher(); - this.trueRefActive.sub((v) => pub.pub('trueRefActive', v), true); + this.trueRefActive.sub((v) => { + pub.pub('trueRefActive', v); + this.handleHeading(); + }, true); const sub = this.bus.getSubscriber(); @@ -54,13 +57,12 @@ export class DisplayManagementComputer { // and the ADIRU must not be in ATT reversion mode const trueRequested = this.irMaintWord.get().getBitValueOr(15, false) || this.trueRefPb.get(); this.trueRefActive.set(trueRequested && !this.irMaintWord.get().getBitValueOr(2, false)); - this.handleHeading(); } private handleHeading(): void { const pub = this.bus.getPublisher(); - pub.pub('heading', this.trueRefActive ? this.trueHeading.get() : this.magHeading.get()); - pub.pub('track', this.trueRefActive ? this.trueTrack.get() : this.magTrack.get()); + pub.pub('heading', this.trueRefActive.get() ? this.trueHeading.get() : this.magHeading.get()); + pub.pub('track', this.trueRefActive.get() ? this.trueTrack.get() : this.magTrack.get()); } } diff --git a/src/instruments/src/PFD/shared/PFDSimvarPublisher.tsx b/src/instruments/src/PFD/shared/PFDSimvarPublisher.tsx index 80762033d62b..acddbcb7b46a 100644 --- a/src/instruments/src/PFD/shared/PFDSimvarPublisher.tsx +++ b/src/instruments/src/PFD/shared/PFDSimvarPublisher.tsx @@ -146,6 +146,7 @@ export interface PFDSimvars { irMaintWordRaw: number; trueHeadingRaw: number; trueTrackRaw: number; + slatPosLeft: number; } export enum PFDVars { @@ -293,6 +294,7 @@ export enum PFDVars { irMaintWordRaw = 'L:A32NX_ADIRS_IR_1_MAINT_WORD', trueHeadingRaw = 'L:A32NX_ADIRS_IR_1_TRUE_HEADING', trueTrackRaw = 'L:A32NX_ADIRS_IR_1_TRUE_TRACK', + slatPosLeft = 'L:A32NX_LEFT_SLATS_ANGLE', } /** A publisher to poll and publish nav/com simvars. */ @@ -442,6 +444,7 @@ export class PFDSimvarPublisher extends SimVarPublisher { ['irMaintWordRaw', { name: PFDVars.irMaintWordRaw, type: SimVarValueType.Number }], ['trueHeadingRaw', { name: PFDVars.trueHeadingRaw, type: SimVarValueType.Number }], ['trueTrackRaw', { name: PFDVars.trueTrackRaw, type: SimVarValueType.Number }], + ['slatPosLeft', { name: PFDVars.slatPosLeft, type: SimVarValueType.Number }], ]) public constructor(bus: EventBus) {