Skip to content

Commit

Permalink
feat(a380x/fcu): add TRUE indication on FCU when TRUE/MAG pb is pushed (
Browse files Browse the repository at this point in the history
#9678)

* feat(a380x/fcu): add TRUE indication on FCU when TRUE/MAG pb is pushed

* add logic for TRUE indicator to display when true north ref is selected on AFS CP
* partial port of heading display to MSFS Avionics Framework

Fixes #9519

* refactor(a380/fcu): switch to SubscribableMapFunction
  • Loading branch information
heclak authored Jan 13, 2025
1 parent 781db96 commit 007db04
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
1. [ATSU] Fixed issues with the ALL-CALLSIGNS recipient on Hoppie - @CronixZero (CronixZero)
1. [A380X/MFD] Add ATCCOM D-ATIS page layout - @heclak (Heclak)
1. [A380X/FMS] Enable FMC reset through overhead reset panel push buttons - @flogross89 (floridude)
1. [A380X/FCU] Add TRUE indication on FCU when TRUE North reference is selected on AFS CP - @heclak (Heclak)

## 0.12.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class FcuDisplay extends DisplayComponent<FcuDisplayProps> {
<div id="Electricity" state={this.props.isHidden.map((v) => (v ? 'off' : 'on'))}>
<div id="LargeScreen">
<Speed />
<Heading />
<Heading bus={this.props.bus} />

<div id="AltVS">
<Altitude bus={this.props.bus} />
Expand Down
42 changes: 39 additions & 3 deletions fbw-a380x/src/systems/instruments/src/FCU/Components/Heading.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,52 @@
// Copyright (c) 2023-2024 FlyByWire Simulations
// SPDX-License-Identifier: GPL-3.0

import { DisplayComponent, FSComponent, VNode } from '@microsoft/msfs-sdk';
import {
ConsumerSubject,
DisplayComponent,
EventBus,
FSComponent,
MappedSubject,
SubscribableMapFunctions,
VNode,
} from '@microsoft/msfs-sdk';
import { FcuEvents } from 'instruments/src/FCU/Publishers/FcuPublisher';
import { OverheadEvents } from 'instruments/src/MsfsAvionicsCommon/providers/OverheadPublisher';

export interface HeadingProps {}
export interface HeadingProps {
readonly bus: EventBus;
}

export class Heading extends DisplayComponent<HeadingProps> {
private readonly sub = this.props.bus.getSubscriber<FcuEvents & OverheadEvents>();

private readonly isLightTestActive = ConsumerSubject.create(this.sub.on('ovhd_ann_lt_test_active'), false);
private readonly trueRefActive = ConsumerSubject.create(this.sub.on('fcu_push_true_ref'), false);

private readonly trueIndicatorActive = MappedSubject.create(
SubscribableMapFunctions.or(),
this.isLightTestActive,
this.trueRefActive,
);

onAfterRender(node: VNode): void {
super.onAfterRender(node);
}

render(): VNode | null {
return (
<div id="Heading">
<svg width="100%" height="100%">
<text id="TRUE" class="Common Active " x="23%" y="20%">
<text
id="TRUE"
class={{
Common: true,
Active: this.trueIndicatorActive,
Inactive: this.trueIndicatorActive.map(SubscribableMapFunctions.not()),
}}
x="23%"
y="20%"
>
TRUE
</text>
<text id="HDG" class="Common Active" x="48%" y="20%">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,10 @@ export class HeadingManager extends TemporaryHax implements Instrument {
this.isTRKMode = _isTRKMode;
this.showSelectedHeading = _showSelectedHeading;
this.currentValue = _value;
this.setTextElementActive(this.textTRUE, false);
this.setTextElementActive(this.textHDG, !this.isTRKMode);
this.setTextElementActive(this.textTRK, !!this.isTRKMode);
this.lightsTest = _lightsTest;
if (this.lightsTest) {
this.setTextElementActive(this.textTRUE, true);
this.setTextElementActive(this.textHDG, true);
this.setTextElementActive(this.textTRK, true);
this.setElementVisibility(this.signDegrees, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface FcuBaseEvents {
fcu_trk_fpa_active: boolean;
fcu_left_navaid_mode: NavAidMode;
fcu_right_navaid_mode: NavAidMode;
fcu_push_true_ref: boolean;
fcu_loc_mode_active: boolean;
fcu_approach_mode_active: boolean;
}
Expand Down Expand Up @@ -38,6 +39,7 @@ export class FcuPublisher extends SimVarPublisher<FcuEvents> {
'fcu_right_navaid_mode',
{ name: `L:A32NX_EFIS_R_NAVAID_#index#_MODE`, type: SimVarValueType.Enum, indexed: true },
],
['fcu_push_true_ref', { name: `L:A32NX_PUSH_TRUE_REF`, type: SimVarValueType.Bool }],
[
'fcu_loc_mode_active',
{
Expand Down

0 comments on commit 007db04

Please sign in to comment.