Skip to content

Commit

Permalink
feat(a380x/fcu): automatically select LS on LOC or APPR arming (#9670)
Browse files Browse the repository at this point in the history
* feat(fcu): auto select LS on FCU appr mode active

* docs: add changelog

* fix: also use loc arming
  • Loading branch information
BravoMike99 authored Jan 9, 2025
1 parent 1ca1ea9 commit 6ca94e2
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,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] Automatically select LS on LOC mode arming - @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/EWD] Show THR limit in EWD instead of N1 - @flogross89 (floridude)
Expand Down
2 changes: 2 additions & 0 deletions fbw-a380x/src/systems/instruments/src/FCU/FcuFsInstrument.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { BaroManager } from './Managers/BaroManager';
import { HeadingManager } from './Managers/HeadingManager';
import { SpeedManager } from './Managers/SpeedManager';
import { VerticalSpeedManager } from './Managers/VerticalSpeedManager';
import { LsManager } from './Managers/LsManager';
import { FcuPublisher } from './Publishers/FcuPublisher';
import { FGDataPublisher } from '../MsfsAvionicsCommon/providers/FGDataPublisher';
import { OverheadPublisher } from '../MsfsAvionicsCommon/providers/OverheadPublisher';
Expand Down Expand Up @@ -66,6 +67,7 @@ export class FcuFsInstrument implements FsInstrument {
this.backplane.addInstrument('HeadingManager', new HeadingManager(this.bus));
this.backplane.addInstrument('SpeedManager', new SpeedManager(this.bus));
this.backplane.addInstrument('VerticalSpeedManager', new VerticalSpeedManager(this.bus));
this.backplane.addInstrument('Lsmanager', new LsManager(this.bus));

this.backplane.addPublisher('FcuPublisher', new FcuPublisher(this.bus));
this.backplane.addPublisher('FgBusPublisher', new FGDataPublisher(this.bus));
Expand Down
30 changes: 30 additions & 0 deletions fbw-a380x/src/systems/instruments/src/FCU/Managers/LsManager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (c) 2024 FlyByWire Simulations
// SPDX-License-Identifier: GPL-3.0
import { ConsumerSubject, EventBus, Instrument, MappedSubject, SubscribableMapFunctions } from '@microsoft/msfs-sdk';
import { FcuEvents } from '../Publishers/FcuPublisher';

export class LsManager implements Instrument {
private readonly sub = this.bus.getSubscriber<FcuEvents>();

private readonly locActive = ConsumerSubject.create(this.sub.on('fcu_loc_mode_active'), false);

private readonly apprActive = ConsumerSubject.create(this.sub.on('fcu_approach_mode_active'), false);

private readonly locOrApprSelected = MappedSubject.create(
SubscribableMapFunctions.or(),
this.locActive,
this.apprActive,
);

constructor(private readonly bus: EventBus) {}

init(): void {
this.locOrApprSelected.sub((v) => {
if (v) {
SimVar.SetSimVarValue('L:A380X_EFIS_L_LS_BUTTON_IS_ON', 'Bool', true);
SimVar.SetSimVarValue('L:A380X_EFIS_R_LS_BUTTON_IS_ON', 'Bool', true);
}
});
}
onUpdate(): void {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ interface FcuBaseEvents {
fcu_trk_fpa_active: boolean;
fcu_left_navaid_mode: NavAidMode;
fcu_right_navaid_mode: NavAidMode;
fcu_loc_mode_active: boolean;
fcu_approach_mode_active: boolean;
}

type IndexedTopics = 'fcu_left_navaid_mode' | 'fcu_right_navaid_mode';
Expand Down Expand Up @@ -36,6 +38,20 @@ export class FcuPublisher extends SimVarPublisher<FcuEvents> {
'fcu_right_navaid_mode',
{ name: `L:A32NX_EFIS_R_NAVAID_#index#_MODE`, type: SimVarValueType.Enum, indexed: true },
],
[
'fcu_loc_mode_active',
{
name: 'L:A32NX_FCU_LOC_MODE_ACTIVE',
type: SimVarValueType.Bool,
},
],
[
'fcu_approach_mode_active',
{
name: 'L:A32NX_FCU_APPR_MODE_ACTIVE',
type: SimVarValueType.Bool,
},
],
]);

super(simvars, bus, pacer);
Expand Down

0 comments on commit 6ca94e2

Please sign in to comment.