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
* 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 flybywiresim#9519
  • Loading branch information
heclak committed Dec 26, 2024
1 parent 22b5854 commit 067800e
Show file tree
Hide file tree
Showing 5 changed files with 49 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 @@ -98,6 +98,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. [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
48 changes: 45 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,58 @@
// 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(
([isLightTest, trueRef]) => {
if (isLightTest) {
return true;
} else {
return trueRef;
}
},
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;
}

type IndexedTopics = 'fcu_left_navaid_mode' | 'fcu_right_navaid_mode';
Expand Down Expand Up @@ -36,6 +37,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 }],
]);

super(simvars, bus, pacer);
Expand Down

0 comments on commit 067800e

Please sign in to comment.