Skip to content

Commit

Permalink
feat(a380/mfd): add automatic perf page switching depending on fms ph…
Browse files Browse the repository at this point in the history
…ase (flybywiresim#8907)

* feat(mfd): add automatic perf switching based on phase

* only change active perf page when the phase is the same as the selected page
  • Loading branch information
BravoMike99 committed Sep 18, 2024
1 parent 71ebfd4 commit 4694f87
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions fbw-a380x/src/systems/instruments/src/MFD/pages/FMS/MfdFmsPerf.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export class MfdFmsPerf extends FmsPage<MfdFmsPerfProps> {

private managedSpeedActive = Subject.create<boolean>(false);

private previousFmsFlightPhase: FmgcFlightPhase | null = null;

// Subjects
private crzFl = Subject.create<number | null>(null);

Expand Down Expand Up @@ -594,6 +596,24 @@ export class MfdFmsPerf extends FmsPage<MfdFmsPerfProps> {
this.activateApprButton.instance.style.visibility = 'hidden';
}
}

if (this.previousFmsFlightPhase) {
const isSamePhase = this.flightPhasesSelectedPageIndex.get() + 1 === this.previousFmsFlightPhase;
if (isSamePhase) {
switch (val) {
case FmgcFlightPhase.Takeoff:
case FmgcFlightPhase.Climb:
case FmgcFlightPhase.Cruise:
case FmgcFlightPhase.Descent:
case FmgcFlightPhase.Approach:
case FmgcFlightPhase.GoAround: {
this.flightPhasesSelectedPageIndex.set(val - 1);
break;
}
}
}
}
this.previousFmsFlightPhase = val;
}, true),
);

Expand Down

0 comments on commit 4694f87

Please sign in to comment.