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

feat(A380X/FMS+MFD): Lateral Offset Functionality + FPLN OFFSET Page #9393

Draft
wants to merge 32 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
92623ad
initial for the offset page
Slightlyclueless Nov 2, 2024
67cd02b
Make page kown about to the actual page directory system
Slightlyclueless Nov 3, 2024
71ef3ea
Start of the page look
Slightlyclueless Nov 3, 2024
6a5bbe8
Initial CSS
Slightlyclueless Nov 3, 2024
7ce2917
Yeah don't try and set the two dropdowns to the same waypoint index
Slightlyclueless Nov 3, 2024
71b3908
Added custom data entry formats for offset parameters
Slightlyclueless Nov 3, 2024
732bba1
page layouting
Slightlyclueless Nov 3, 2024
ed37045
More layouting and offset parameter addition
Slightlyclueless Nov 3, 2024
e58f898
Merge branch 'flybywiresim:master' into fms-offset
Slightlyclueless Nov 3, 2024
f78672c
Edit parameters for where the offset page can be selected
Slightlyclueless Nov 4, 2024
c02a764
Some more style stuff. added radio buttons
Slightlyclueless Nov 4, 2024
74a2ff9
Added offset Data to the flightplan data
Slightlyclueless Nov 4, 2024
72921a2
Better naming
Slightlyclueless Nov 4, 2024
6fa65c9
Adding offset to the flight planning
Slightlyclueless Nov 4, 2024
f9c1629
Add lateraloffset to withPilotEnteredDataFrom. Not sure if needed? bu…
Slightlyclueless Nov 4, 2024
edf7fad
Fixed the offset dist selection layouting. I am a buffoon who is blind
Slightlyclueless Nov 4, 2024
3ce556a
Make elements not squished
Slightlyclueless Nov 4, 2024
e8f2d04
Margins futzed with
Slightlyclueless Nov 4, 2024
85aa8da
Set offset start waypoint to selected waypoint
Slightlyclueless Nov 5, 2024
fade5ee
Merge branch 'flybywiresim:master' into fms-offset
Slightlyclueless Nov 6, 2024
9d7116c
Merge branch 'fms-offset' of https://github.com/Slightlyclueless/airc…
Slightlyclueless Nov 6, 2024
8f1c788
I don't want this to be the fix but
Slightlyclueless Nov 6, 2024
a625c4c
Properly picks the right start waypoint when no offset is programmed
Slightlyclueless Nov 6, 2024
ead1781
Add bottom section of the page navigation
Slightlyclueless Nov 7, 2024
f5ccd98
text on button was wrong lol
Slightlyclueless Nov 7, 2024
42ca9fe
Setup offset data in the interface
Slightlyclueless Nov 9, 2024
52f3789
Change offsetFlags. We shouldn't need to care about intermediate legs
Slightlyclueless Nov 9, 2024
018ada6
Implement offset functions in the flight plan service
Slightlyclueless Nov 9, 2024
fe3e9c7
Add to Rpc Client
Slightlyclueless Nov 9, 2024
2a4d346
Comment fix
Slightlyclueless Nov 14, 2024
56dd27e
Merge branch 'flybywiresim:master' into fms-offset
Slightlyclueless Nov 15, 2024
2869fd4
Merge branch 'master' into fms-offset
Slightlyclueless Jan 18, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { Fix, Waypoint } from '@flybywiresim/fbw-sdk';
import { Coordinates, Degrees } from 'msfs-geo';
import { HoldData } from '@fmgc/flightplanning/data/flightplan';
import { HoldData, OffsetData } from '@fmgc/flightplanning/data/flightplan';
import { FlightPlanLegDefinition } from '@fmgc/flightplanning/legs/FlightPlanLegDefinition';
import { FixInfoEntry } from '@fmgc/flightplanning/plans/FixInfo';
import { FlightPlan } from '@fmgc/flightplanning/plans/FlightPlan';
Expand Down Expand Up @@ -253,6 +253,23 @@ export interface FlightPlanInterface<P extends FlightPlanPerformanceData = Fligh
alternate?: boolean,
): Promise<number>;

/**
* OFFSET revision. Inserts or eidts an offset with a defined start and end point.
*
* @param startIndex the index of the leg to start the offset at
* @param endIndex the index of the leg to end the offset at
* @param desiredOffset the desired offset
* @param planIndex the flight plan to make the change on
* @param alternate whether to edit the plan's alternate flight plan
*/
setOffsetParams(
startIndex: number,
endIndex: number,
desiredOffset: OffsetData,
planIndex: FlightPlanIndex,
alternate?: boolean,
): Promise<void>;

/**
* Reverts a hold parented to a leg to a computed hold.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { NavigationDatabase } from '@fmgc/NavigationDatabase';
import { Coordinates, Degrees } from 'msfs-geo';
import { BitFlags, EventBus } from '@microsoft/msfs-sdk';
import { FixInfoEntry } from '@fmgc/flightplanning/plans/FixInfo';
import { HoldData } from '@fmgc/flightplanning/data/flightplan';
import { HoldData, OffsetData } from '@fmgc/flightplanning/data/flightplan';
import { FlightPlanLegDefinition } from '@fmgc/flightplanning/legs/FlightPlanLegDefinition';
import { FlightPlanInterface } from '@fmgc/flightplanning/FlightPlanInterface';
import { AltitudeConstraint } from '@fmgc/flightplanning/data/constraint';
Expand Down Expand Up @@ -461,6 +461,22 @@ export class FlightPlanService<P extends FlightPlanPerformanceData = FlightPlanP
await plan.enableAltn(atIndexInAlternate, cruiseLevel);
}

async setOffsetParams(
startIndex: number,
endIndex: number,
desiredOffset: OffsetData,
planIndex: FlightPlanIndex,
alternate?: boolean,
): Promise<void> {
const finalIndex = this.prepareDestructiveModification(planIndex);

const plan = alternate
? this.flightPlanManager.get(finalIndex).alternateFlightPlan
: this.flightPlanManager.get(finalIndex);

plan.setOffsetParams(startIndex, endIndex, desiredOffset);
}

async setPilotEnteredAltitudeConstraintAt(
atIndex: number,
isDescentConstraint: boolean,
Expand Down
15 changes: 15 additions & 0 deletions fbw-a32nx/src/systems/fmgc/src/flightplanning/data/flightplan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,18 @@ export interface StepData {

ident: string;
}

export interface OffsetData {
interceptAngle?: number;

offsetDistance?: NauticalMiles;

offsetDirection?: TurnDirection;

offsetFlags: offsetFlags;
}

export enum offsetFlags {
Start = 0,
End = 1,
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { procedureLegIdentAndAnnotation } from '@fmgc/flightplanning/legs/Flight
import { WaypointFactory } from '@fmgc/flightplanning/waypoints/WaypointFactory';
import { FlightPlanSegment } from '@fmgc/flightplanning/segments/FlightPlanSegment';
import { EnrouteSegment } from '@fmgc/flightplanning/segments/EnrouteSegment';
import { HoldData } from '@fmgc/flightplanning/data/flightplan';
import { HoldData, OffsetData } from '@fmgc/flightplanning/data/flightplan';
import { CruiseStepEntry } from '@fmgc/flightplanning/CruiseStep';
import { WaypointConstraintType, AltitudeConstraint, SpeedConstraint } from '@fmgc/flightplanning/data/constraint';
import { HoldUtils } from '@fmgc/flightplanning/data/hold';
Expand All @@ -42,6 +42,7 @@ export interface SerializedFlightPlanLeg {
cruiseStep: CruiseStepEntry | undefined;
pilotEnteredAltitudeConstraint: AltitudeConstraint | undefined;
pilotEnteredSpeedConstraint: SpeedConstraint | undefined;
lateralOffset: OffsetData | undefined;
}

export enum FlightPlanLegFlags {
Expand Down Expand Up @@ -105,6 +106,8 @@ export class FlightPlanLeg implements ReadonlyFlightPlanLeg {

calculated: LegCalculations | undefined;

lateralOffset: OffsetData | undefined = undefined;

serialize(): SerializedFlightPlanLeg {
return {
ident: this.ident,
Expand All @@ -123,6 +126,7 @@ export class FlightPlanLeg implements ReadonlyFlightPlanLeg {
pilotEnteredSpeedConstraint: this.pilotEnteredSpeedConstraint
? JSON.parse(JSON.stringify(this.pilotEnteredSpeedConstraint))
: undefined,
lateralOffset: this.lateralOffset ? JSON.parse(JSON.stringify(this.lateralOffset)) : undefined,
};
}

Expand All @@ -143,6 +147,7 @@ export class FlightPlanLeg implements ReadonlyFlightPlanLeg {
leg.cruiseStep = serialized.cruiseStep;
leg.pilotEnteredAltitudeConstraint = serialized.pilotEnteredAltitudeConstraint;
leg.pilotEnteredSpeedConstraint = serialized.pilotEnteredSpeedConstraint;
leg.lateralOffset = serialized.lateralOffset;

return leg;
}
Expand Down Expand Up @@ -288,6 +293,7 @@ export class FlightPlanLeg implements ReadonlyFlightPlanLeg {
this.pilotEnteredSpeedConstraint = from.pilotEnteredSpeedConstraint;
this.constraintType = from.constraintType;
this.cruiseStep = from.cruiseStep;
this.lateralOffset = from.lateralOffset;
/**
* Don't copy holds. When we string the arrival to the upstream plan, the upstream plan may have a hold
* and the downstream leg doesn't, but the upstream leg is the one that's kept. In this case, we don't want to remove the hold
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { LegType } from '@flybywiresim/fbw-sdk';
import { FlightPlanSegment } from '@fmgc/flightplanning/segments/FlightPlanSegment';
import { FlightPlanLegDefinition } from '@fmgc/flightplanning/legs/FlightPlanLegDefinition';
import { HoldData } from '@fmgc/flightplanning/data/flightplan';
import { HoldData, OffsetData } from '@fmgc/flightplanning/data/flightplan';
import { WaypointConstraintType, AltitudeConstraint, SpeedConstraint } from '@fmgc/flightplanning/data/constraint';
import { CruiseStepEntry } from '@fmgc/flightplanning/CruiseStep';

Expand Down Expand Up @@ -39,6 +39,8 @@ export interface ReadonlyFlightPlanLeg {
readonly pilotEnteredAltitudeConstraint: AltitudeConstraint | undefined;

readonly pilotEnteredSpeedConstraint: SpeedConstraint | undefined;

readonly lateralOffset: OffsetData | undefined;
}

export interface ReadonlyDiscontinuity {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { MissedApproachSegment } from '@fmgc/flightplanning/segments/MissedAppro
import { ArrivalRunwayTransitionSegment } from '@fmgc/flightplanning/segments/ArrivalRunwayTransitionSegment';
import { ApproachViaSegment } from '@fmgc/flightplanning/segments/ApproachViaSegment';
import { SegmentClass } from '@fmgc/flightplanning/segments/SegmentClass';
import { HoldData, WaypointStats } from '@fmgc/flightplanning/data/flightplan';
import { HoldData, OffsetData, offsetFlags, WaypointStats } from '@fmgc/flightplanning/data/flightplan';
import { procedureLegIdentAndAnnotation } from '@fmgc/flightplanning/legs/FlightPlanLegNaming';
import {
FlightPlanEvents,
Expand Down Expand Up @@ -1451,6 +1451,22 @@ export abstract class BaseFlightPlan<P extends FlightPlanPerformanceData = Fligh
this.syncLegDefinitionChange(index);
}

setOffsetParams(startIndex, endIndex, offsetData: OffsetData) {
const startElement = this.legElementAt(startIndex);
const endElement = this.legElementAt(endIndex);

startElement.lateralOffset = offsetData;
endElement.lateralOffset = offsetData;

startElement.lateralOffset.offsetFlags = offsetFlags.Start;
endElement.lateralOffset.offsetFlags = offsetFlags.End;

this.syncLegDefinitionChange(startIndex);
this.syncLegDefinitionChange(endIndex);

this.incrementVersion();
}

setPilotEnteredAltitudeConstraintAt(index: number, isDescentConstraint: boolean, constraint?: AltitudeConstraint) {
const element = this.elementAt(index);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Fix, Waypoint } from '@flybywiresim/fbw-sdk';
import { FlightPlanIndex, FlightPlanManager } from '@fmgc/flightplanning/FlightPlanManager';
import { EventBus, EventSubscriber, Publisher, Subscription } from '@microsoft/msfs-sdk';
import { v4 } from 'uuid';
import { HoldData } from '@fmgc/flightplanning/data/flightplan';
import { HoldData, OffsetData } from '@fmgc/flightplanning/data/flightplan';
import { Coordinates } from '@fmgc/flightplanning/data/geo';
import { AltitudeConstraint } from '@fmgc/flightplanning/data/constraint';
import { FlightPlanPerformanceData } from '@fmgc/flightplanning/plans/performance/FlightPlanPerformanceData';
Expand Down Expand Up @@ -293,6 +293,16 @@ export class FlightPlanRpcClient<P extends FlightPlanPerformanceData> implements
return this.callFunctionViaRpc('enableAltn', atIndexInAlternate, cruiseLevel, planIndex);
}

setOffsetParams(
startIndex: number,
endIndex: number,
desiredOffset: OffsetData,
planIndex: FlightPlanIndex,
alternate?: boolean,
): Promise<void> {
return this.callFunctionViaRpc('setOffsetParams', startIndex, endIndex, desiredOffset, planIndex, alternate);
}

setPilotEnteredAltitudeConstraintAt(
atIndex: number,
isDescentConstraint: boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { MfdFmsDataDebug } from 'instruments/src/MFD/pages/FMS/DATA/MfdFmsDataDe
import { MfdSurvControls } from 'instruments/src/MFD/pages/SURV/MfdSurvControls';
import { MfdSurvStatusSwitching } from 'instruments/src/MFD/pages/SURV/MfdSurvStatusSwitching';
import { MfdFmsDataAirport } from 'instruments/src/MFD/pages/FMS/DATA/MfdFmsDataAirport';
import { MfdFmsFplnOffset } from 'instruments/src/MFD/pages/FMS/F-PLN/MfdFmsFplnOffset';

export function pageForUrl(
url: string,
Expand Down Expand Up @@ -87,6 +88,11 @@ export function pageForUrl(
case 'fms/sec2/f-pln-hold':
case 'fms/sec3/f-pln-hold':
return <MfdFmsFplnHold pageTitle="F-PLN/HOLD" bus={bus} mfd={mfd} fmcService={fmcService} />;
case 'fms/active/f-pln-offset':
case 'fms/sec1/f-pln-offset':
case 'fms/sec2/f-pln-offset':
case 'fms/sec3/f-pln-offset':
return <MfdFmsFplnOffset pageTitle="F-PLN/OFFSET" bus={bus} mfd={mfd} fmcService={fmcService} />;
case 'fms/position/irs':
return <MfdFmsPositionIrs pageTitle="IRS" bus={bus} mfd={mfd} fmcService={fmcService} />;
case 'fms/position/navaids':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export function getRevisionsMenu(fpln: MfdFmsFpln, type: FplnRevisionsMenuType):
fpln.props.mfd.uiService.navigateTo(`fms/${fpln.props.mfd.uiService.activeUri.get().category}/f-pln-arrival`),
},
{
name: '(N/A) OFFSET',
disabled: true,
name: 'OFFSET',
disabled: !fpln.loadedFlightPlan?.legElementAt(legIndex).isXF,
onPressed: () =>
fpln.props.mfd.uiService.navigateTo(`fms/${fpln.props.mfd.uiService.activeUri.get().category}/f-pln-offset`),
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@import "../../../../MsfsAvionicsCommon/definitions";

.mfd-fms-fpln-offset-waypoint-text-grid {
padding-top: 20px;
display: grid;
grid-template-columns: 200px 200px 30px 200px;
padding-left: 5px;
margin-top: 10px;
padding-bottom: 15px;
}

.mfd-offset-dist-angle-input-grid {
display: grid;
grid-template-columns: auto;
}

.mfd-offset-dist-input-grid {
display: grid;
grid-template-columns: 150px 150px;
}

.mfd-offset-ret-canc-tmpy-grid {
padding-top: 440px;
grid-column: span 4;
display: grid;
grid-template-columns: 251px 256px 248px;
}
Loading
Loading