Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(a380x): reset perf data on fmc reset #9525

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
1. [A380X/LIGHTS] Added cockpit ambient bounce lights - @ImenesFBW (Imenes)
1. [A380X/PERF] Changed managed speeds to more realistic numbers - @slightlyclueles (abnormaltoast)
1. [A380X/MFD] Add ATCCOM connect page - @heclak (heclak)
1. [A380X/FMC] Fix reset of perf data on done phase or database swap - @tracernz (Mike)

## 0.12.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,7 @@ export class FlightManagementComputer implements FmcInterface {
this.flightPlanService
.reset()
.then(() => {
this.fmgc.data.reset();
this.initSimVars();
this.deleteAllStoredWaypoints();
this.clearLatestFmsErrorMessage();
Expand Down Expand Up @@ -990,6 +991,7 @@ export class FlightManagementComputer implements FmcInterface {
// FIXME reset ATSU when it is added to A380X
// this.atsu.resetAtisAutoUpdate();
await this.flightPlanService.reset();
this.fmgc.data.reset();
this.initSimVars();
this.deleteAllStoredWaypoints();
this.clearLatestFmsErrorMessage();
Expand Down
20 changes: 19 additions & 1 deletion fbw-a380x/src/systems/instruments/src/MFD/FMC/fmgc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { FlapConf } from '@fmgc/guidance/vnav/common';
import { SpeedLimit } from '@fmgc/guidance/vnav/SpeedLimit';
import { FmgcFlightPhase } from '@shared/flightphase';
import { FmcWindVector, FmcWinds } from '@fmgc/guidance/vnav/wind/types';
import { MappedSubject, Subject } from '@microsoft/msfs-sdk';
import { MappedSubject, Subject, SubscribableUtils } from '@microsoft/msfs-sdk';
import { FlightPlanIndex } from '@fmgc/flightplanning/FlightPlanManager';
import { Arinc429Word, Runway, Units } from '@flybywiresim/fbw-sdk';
import { Feet } from 'msfs-geo';
Expand Down Expand Up @@ -303,6 +303,24 @@ export class FmgcData {
* Estimated take-off time, in seconds. Displays as HH:mm:ss. Null if not set
*/
public readonly estimatedTakeoffTime = Subject.create<number | null>(null);

private readonly defaults = new Map<Extract<keyof FmgcData, string>, any>();

constructor() {
for (const prop in this) {
if (SubscribableUtils.isMutableSubscribable(this[prop])) {
this.defaults.set(prop as keyof FmgcData, this[prop].get());
}
}
}

public reset(): void {
for (const prop of this.defaults.keys()) {
if (SubscribableUtils.isMutableSubscribable(this[prop])) {
this[prop].set(this.defaults.get(prop));
}
}
}
}

/**
Expand Down