Skip to content

Commit

Permalink
Fix wrong TO waypoint for runways
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueberryKing committed Apr 6, 2024
1 parent 0e1dab7 commit 1519ca3
Show file tree
Hide file tree
Showing 13 changed files with 4 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import {
LegType,
ProcedureLeg,
Runway,
SectionCode,
WaypointArea,
WaypointDescriptor,
AirportSubsectionCode,
} from '@flybywiresim/fbw-sdk';
import { Coordinates } from 'msfs-geo';
import { FlightPlanLegDefinition } from '@fmgc/flightplanning/new/legs/FlightPlanLegDefinition';
Expand Down Expand Up @@ -365,7 +362,7 @@ export class FlightPlanLeg implements ReadonlyFlightPlanLeg {
procedureIdent: '',
type: LegType.IF,
overfly: false,
waypoint: { ...airport, sectionCode: SectionCode.Airport, subSectionCode: AirportSubsectionCode.TerminalWaypoints, area: WaypointArea.Terminal },
waypoint: WaypointFactory.fromAirport(airport),
waypointDescriptor: WaypointDescriptor.Airport,
magneticCourse: runway?.magneticBearing,
}, airportRunwayIdent(airport, runway), procedureIdent, undefined);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { loadAirport, loadAllDepartures, loadAllRunways, loadRunway } from '@fmg
import { SegmentClass } from '@fmgc/flightplanning/new/segments/SegmentClass';
import { BaseFlightPlan, FlightPlanQueuedOperation } from '@fmgc/flightplanning/new/plans/BaseFlightPlan';
import { bearingTo } from 'msfs-geo';
import { airportRunwayIdent } from '@fmgc/flightplanning/new/legs/FlightPlanLegNaming';
import { RestringOptions } from '../plans/RestringOptions';
import { FlightPlanElement, FlightPlanLeg, FlightPlanLegFlags } from '../legs/FlightPlanLeg';
import { NavigationDatabaseService } from '../NavigationDatabaseService';
Expand Down Expand Up @@ -108,7 +107,6 @@ export class OriginSegment extends FlightPlanSegment {
if (areDatabaseItemsEqual(firstDepartureLeg.terminationWaypoint(), this.runway)) {
// TODO should this stuff go into DepartureRunwayTransitionSegment?
firstDepartureLeg.flags |= FlightPlanLegFlags.Origin;
firstDepartureLeg.ident = airportRunwayIdent(this.originAirport, this.runway);

addOriginLeg = false;
addRunwayLeg = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import { Airport, EnrouteSubsectionCode, Runway, SectionCode, Waypoint, WaypointArea, Icao, AirportSubsectionCode } from '@flybywiresim/fbw-sdk';
import { Coordinates, distanceTo, placeBearingDistance, placeBearingIntersection } from 'msfs-geo';
import { airportRunwayIdent } from '@fmgc/flightplanning/new/legs/FlightPlanLegNaming';

export namespace WaypointFactory {
export function fromLocation(
Expand Down Expand Up @@ -54,7 +53,6 @@ export namespace WaypointFactory {
...runway,
sectionCode: SectionCode.Airport,
subSectionCode: AirportSubsectionCode.TerminalWaypoints,
ident: airportRunwayIdent(airport, runway),
location: runway.thresholdLocation,
area: WaypointArea.Terminal,
};
Expand Down
4 changes: 2 additions & 2 deletions fbw-a32nx/src/systems/fmgc/src/guidance/GuidanceController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ export class GuidanceController {

private updateEfisIdent() {
// Update EFIS ident

const efisIdent = this.activeGeometry.legs.get(this.activeLegIndex)?.ident ?? 'PPOS';
const activeLeg = this.flightPlanService.active?.activeLeg;
const efisIdent = activeLeg?.isDiscontinuity === false ? activeLeg.ident : 'PPOS';

const efisVars = SimVarString.pack(efisIdent, 9);
// setting the simvar as a number greater than about 16 million causes precision error > 1... but this works..
Expand Down
4 changes: 0 additions & 4 deletions fbw-a32nx/src/systems/fmgc/src/guidance/lnav/legs/CA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ export class CALeg extends Leg {
return this.estimatedTermination;
}

get ident(): string {
return Math.round(this.altitude).toString();
}

getPathStartPoint(): Coordinates | undefined {
return this.inboundGuidable?.getPathEndPoint();
}
Expand Down
5 changes: 0 additions & 5 deletions fbw-a32nx/src/systems/fmgc/src/guidance/lnav/legs/CD.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { SegmentType } from '@fmgc/flightplanning/FlightPlanSegment';
import { NdbNavaid, VhfNavaid, Waypoint } from '@flybywiresim/fbw-sdk';
import { Coordinates, distanceTo, firstSmallCircleIntersection } from 'msfs-geo';
import { GuidanceParameters } from '@fmgc/guidance/ControlLaws';
import { procedureLegIdentAndAnnotation } from '@fmgc/flightplanning/new/legs/FlightPlanLegNaming';
import { LnavConfig } from '@fmgc/guidance/LnavConfig';
import { LegMetadata } from './index';
import { courseToFixDistanceToGo, fixToFixGuidance } from '../CommonGeometry';
Expand Down Expand Up @@ -42,10 +41,6 @@ export class CDLeg extends Leg {
return this.pbdPoint;
}

get ident(): string {
return procedureLegIdentAndAnnotation(this.metadata.flightPlanLegDefinition, '')[0];
}

getPathStartPoint(): Coordinates | undefined {
if (this.inboundGuidable?.isComputed) {
return this.inboundGuidable.getPathEndPoint();
Expand Down
4 changes: 0 additions & 4 deletions fbw-a32nx/src/systems/fmgc/src/guidance/lnav/legs/CI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ export class CILeg extends Leg {
return this.intercept;
}

get ident(): string {
return 'INTCPT';
}

getPathStartPoint(): Coordinates | undefined {
if (this.inboundGuidable instanceof IFLeg) {
return this.inboundGuidable.fix.location;
Expand Down
4 changes: 0 additions & 4 deletions fbw-a32nx/src/systems/fmgc/src/guidance/lnav/legs/CR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ export class CRLeg extends Leg {
return this.intercept;
}

get ident(): string {
return this.origin.ident.substring(0, 3) + this.metadata.flightPlanLegDefinition.theta.toFixed(0);
}

getPathStartPoint(): Coordinates | undefined {
if (this.inboundGuidable && this.inboundGuidable.isComputed) {
return this.inboundGuidable.getPathEndPoint();
Expand Down
5 changes: 0 additions & 5 deletions fbw-a32nx/src/systems/fmgc/src/guidance/lnav/legs/FD.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { SegmentType } from '@fmgc/flightplanning/FlightPlanSegment';
import { NdbNavaid, VhfNavaid, Waypoint } from '@flybywiresim/fbw-sdk';
import { Coordinates, distanceTo, firstSmallCircleIntersection } from 'msfs-geo';
import { GuidanceParameters } from '@fmgc/guidance/ControlLaws';
import { procedureLegIdentAndAnnotation } from '@fmgc/flightplanning/new/legs/FlightPlanLegNaming';
import { LnavConfig } from '@fmgc/guidance/LnavConfig';
import { FixedRadiusTransition } from '@fmgc/guidance/lnav/transitions/FixedRadiusTransition';
import { LegMetadata } from './index';
Expand Down Expand Up @@ -77,10 +76,6 @@ export class FDLeg extends Leg {
return this.intercept;
}

get ident(): string {
return procedureLegIdentAndAnnotation(this.metadata.flightPlanLegDefinition, '')[0];
}

getPathStartPoint(): Coordinates | undefined {
if (this.inboundGuidable instanceof FixedRadiusTransition && this.inboundGuidable.isComputed) {
return this.inboundGuidable.getPathEndPoint();
Expand Down
4 changes: 0 additions & 4 deletions fbw-a32nx/src/systems/fmgc/src/guidance/lnav/legs/HX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ abstract class HXLeg extends XFLeg {
return this.metadata.flightPlanLegDefinition.turnDirection;
}

get ident(): string {
return this.fix.ident;
}

/**
* Used by hold entry transition to set our initial state depending on entry type
* @param initialState
Expand Down
2 changes: 0 additions & 2 deletions fbw-a32nx/src/systems/fmgc/src/guidance/lnav/legs/Leg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ export abstract class Leg extends Guidable {

abstract get terminationWaypoint(): Fix | Coordinates | undefined;

abstract get ident(): string

isNull = false

displayedOnMap = true
Expand Down
6 changes: 1 addition & 5 deletions fbw-a32nx/src/systems/fmgc/src/guidance/lnav/legs/PI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,7 @@ export class PILeg extends Leg {
];
}

get ident(): string {
return 'INTCPT';
}

get repr(): string {
return `PI ${this.ident}`;
return 'PI INTCPT';
}
}
4 changes: 0 additions & 4 deletions fbw-a32nx/src/systems/fmgc/src/guidance/lnav/legs/VM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ export class VMLeg extends Leg {
return undefined;
}

get ident(): string {
return 'MANUAL';
}

displayedOnMap = false;

getPathStartPoint(): Coordinates | undefined {
Expand Down

0 comments on commit 1519ca3

Please sign in to comment.