-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat(a380x/mfd): Vertical Revision speed limit modification #9845
base: master
Are you sure you want to change the base?
Changes from 14 commits
b6de06c
0bfd9d5
7a79a2e
1ab428a
28e1128
e724e85
333f819
b8991b0
69700bd
80f4dc0
bcb23b6
530d051
f5ef74e
974f72a
0206638
b9fc35f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,10 @@ import { FlightPlanLegDefinition } from '@fmgc/flightplanning/legs/FlightPlanLeg | |
import { FlightPlanInterface } from '@fmgc/flightplanning/FlightPlanInterface'; | ||
import { AltitudeConstraint } from '@fmgc/flightplanning/data/constraint'; | ||
import { CopyOptions } from '@fmgc/flightplanning/plans/CloningOptions'; | ||
import { FlightPlanPerformanceData } from '@fmgc/flightplanning/plans/performance/FlightPlanPerformanceData'; | ||
import { | ||
DefaultPerformanceData, | ||
FlightPlanPerformanceData, | ||
} from '@fmgc/flightplanning/plans/performance/FlightPlanPerformanceData'; | ||
|
||
export class FlightPlanService<P extends FlightPlanPerformanceData = FlightPlanPerformanceData> | ||
implements FlightPlanInterface<P> | ||
|
@@ -574,6 +577,116 @@ export class FlightPlanService<P extends FlightPlanPerformanceData = FlightPlanP | |
plan.editFixInfoEntry(index, callback); | ||
} | ||
|
||
async setPilotEntryClimbSpeedLimitSpeed(value: number, planIndex = FlightPlanIndex.Active, alternate = false) { | ||
const finalIndex = this.config.TMPY_ON_CONSTRAINT_EDIT ? this.prepareDestructiveModification(planIndex) : planIndex; | ||
|
||
const plan = this.flightPlanManager.get(finalIndex); | ||
|
||
const performanceDataAltitudeKey = alternate ? 'alternateClimbSpeedLimitAltitude' : 'climbSpeedLimitAltitude'; | ||
|
||
if (plan.performanceData[performanceDataAltitudeKey] === null) { | ||
plan.setPerformanceData(performanceDataAltitudeKey, DefaultPerformanceData.ClimbSpeedLimitAltitude); | ||
} | ||
|
||
plan.setPerformanceData(alternate ? 'alternateClimbSpeedLimitSpeed' : 'climbSpeedLimitSpeed', value); | ||
plan.setPerformanceData( | ||
alternate ? 'isAlternateClimbSpeedLimitPilotEntered' : 'isClimbSpeedLimitPilotEntered', | ||
true, | ||
); | ||
|
||
plan.incrementVersion(); | ||
} | ||
|
||
async setPilotEntryClimbSpeedLimitAltitude(value: number, planIndex = FlightPlanIndex.Active, alternate = false) { | ||
const finalIndex = this.config.TMPY_ON_CONSTRAINT_EDIT ? this.prepareDestructiveModification(planIndex) : planIndex; | ||
|
||
const plan = this.flightPlanManager.get(finalIndex); | ||
|
||
const performanceDataSpeedKey = alternate ? 'alternateClimbSpeedLimitSpeed' : 'climbSpeedLimitSpeed'; | ||
|
||
if (plan.performanceData[performanceDataSpeedKey] === null) { | ||
plan.setPerformanceData(performanceDataSpeedKey, DefaultPerformanceData.ClimbSpeedLimitSpeed); | ||
} | ||
|
||
plan.setPerformanceData(alternate ? 'alternateClimbSpeedLimitAltitude' : 'climbSpeedLimitAltitude', value); | ||
plan.setPerformanceData( | ||
alternate ? 'isAlternateClimbSpeedLimitPilotEntered' : 'isClimbSpeedLimitPilotEntered', | ||
true, | ||
); | ||
|
||
plan.incrementVersion(); | ||
} | ||
|
||
async deleteClimbSpeedLimit(planIndex = FlightPlanIndex.Active, alternate = false) { | ||
const finalIndex = this.config.TMPY_ON_CONSTRAINT_EDIT ? this.prepareDestructiveModification(planIndex) : planIndex; | ||
|
||
const plan = this.flightPlanManager.get(finalIndex); | ||
|
||
plan.setPerformanceData(alternate ? 'alternateClimbSpeedLimitSpeed' : 'climbSpeedLimitSpeed', null); | ||
plan.setPerformanceData(alternate ? 'alternateClimbSpeedLimitAltitude' : 'climbSpeedLimitAltitude', null); | ||
plan.setPerformanceData( | ||
alternate ? 'isAlternateClimbSpeedLimitPilotEntered' : 'isClimbSpeedLimitPilotEntered', | ||
false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deletion would be setting a pilot value of null IMO? Anything setting it to a non-default value would be a pilot entry. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kept it as false for consistency as that's how it also is on the A32NX currently (default entry or deleted -> false). I can change both to null but in that case I need to update the performance data interface as the type there is just boolean currently. |
||
); | ||
|
||
plan.incrementVersion(); | ||
} | ||
|
||
async setPilotEntryDescentSpeedLimitSpeed(value: number, planIndex = FlightPlanIndex.Active, alternate = false) { | ||
const finalIndex = this.config.TMPY_ON_CONSTRAINT_EDIT ? this.prepareDestructiveModification(planIndex) : planIndex; | ||
|
||
const plan = this.flightPlanManager.get(finalIndex); | ||
|
||
const performanceDataAltitudeKey = alternate ? 'alternateDescentSpeedLimitAltitude' : 'descentSpeedLimitAltitude'; | ||
|
||
if (plan.performanceData[performanceDataAltitudeKey] === null) { | ||
plan.setPerformanceData(performanceDataAltitudeKey, DefaultPerformanceData.DescentSpeedLimitAltitude); | ||
} | ||
|
||
plan.setPerformanceData(alternate ? 'alternateDescentSpeedLimitSpeed' : 'descentSpeedLimitSpeed', value); | ||
plan.setPerformanceData( | ||
alternate ? 'isAlternateDescentSpeedLimitPilotEntered' : 'isDescentSpeedLimitPilotEntered', | ||
true, | ||
); | ||
|
||
plan.incrementVersion(); | ||
} | ||
|
||
async setPilotEntryDescentSpeedLimitAltitude(value: number, planIndex = FlightPlanIndex.Active, alternate = false) { | ||
const finalIndex = this.config.TMPY_ON_CONSTRAINT_EDIT ? this.prepareDestructiveModification(planIndex) : planIndex; | ||
|
||
const plan = this.flightPlanManager.get(finalIndex); | ||
|
||
const performanceDataSpeedKey = alternate ? 'alternateDescentSpeedLimitSpeed' : 'descentSpeedLimitSpeed'; | ||
|
||
if (plan.performanceData[performanceDataSpeedKey] === null) { | ||
plan.setPerformanceData(performanceDataSpeedKey, DefaultPerformanceData.DescentSpeedLimitSpeed); | ||
} | ||
|
||
plan.setPerformanceData(alternate ? 'alternateDescentSpeedLimitAltitude' : 'descentSpeedLimitAltitude', value); | ||
plan.setPerformanceData( | ||
alternate ? 'isAlternateDescentSpeedLimitPilotEntered' : 'isDescentSpeedLimitPilotEntered', | ||
true, | ||
); | ||
|
||
plan.incrementVersion(); | ||
} | ||
|
||
async deleteDescentSpeedLimit(planIndex = FlightPlanIndex.Active, alternate = false) { | ||
const finalIndex = this.config.TMPY_ON_CONSTRAINT_EDIT ? this.prepareDestructiveModification(planIndex) : planIndex; | ||
|
||
const plan = this.flightPlanManager.get(finalIndex); | ||
|
||
plan.setPerformanceData(alternate ? 'alternateDescentSpeedLimitSpeed' : 'descentSpeedLimitSpeed', null); | ||
plan.setPerformanceData(alternate ? 'alternateDescentSpeedLimitAltitude' : 'descentSpeedLimitAltitude', null); | ||
plan.setPerformanceData( | ||
alternate ? 'isAlternateDescentSpeedLimitPilotEntered' : 'isDescentSpeedLimitPilotEntered', | ||
false, | ||
); | ||
|
||
plan.incrementVersion(); | ||
} | ||
|
||
get activeLegIndex(): number { | ||
return this.active.activeLegIndex; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should all have full JSDocs for all parameters with unit and possible values (as should the existing ones, but too late for them).