forked from flybywiresim/aircraft
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(a380x): arrivals page approach data (flybywiresim#8938)
* chore: this is not tsx * feat: add approach name function for a380x * feat: add approach suffix to data * fix: rnp-ar logic * fix: runway ls return undefined * feat: add some type predicates to help us * feat: add LandingSystemUtils * fix: hax to work around rec navaid * fix: approach ls ident/freq/chan * fix: approach naming on arrivals page * fix: filter out invalid and unsupported approaches * fix(a380x/fms): perf appr approach name
- Loading branch information
Showing
10 changed files
with
151 additions
and
45 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
fbw-a32nx/src/systems/fmgc/src/flightplanning/data/landingsystem.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) 2024 FlyByWire Simulations | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
import { Approach, ApproachType, isVhfNavaid, VhfNavaid, VhfNavaidType } from '@flybywiresim/fbw-sdk'; | ||
|
||
export class LandingSystemUtils { | ||
// FIXME IlsNavaid when MSFS mapping can support it | ||
static getLsFromApproach(approach: Approach): VhfNavaid | null { | ||
if (approach.legs.length < 1) { | ||
return null; | ||
} | ||
|
||
const mapLeg = approach.legs[approach.legs.length - 1]; | ||
|
||
// FIXME support GLS later... | ||
switch (approach.type) { | ||
case ApproachType.Igs: | ||
case ApproachType.Ils: | ||
case ApproachType.Lda: | ||
case ApproachType.Loc: | ||
case ApproachType.LocBackcourse: | ||
case ApproachType.Sdf: | ||
if (isVhfNavaid(mapLeg.recommendedNavaid) && mapLeg.recommendedNavaid.type === VhfNavaidType.IlsDme) { | ||
return mapLeg.recommendedNavaid; | ||
} | ||
// fallthrough | ||
default: | ||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (c) 2023-2024 FlyByWire Simulations | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
import { Approach, ApproachType } from '@flybywiresim/fbw-sdk'; | ||
|
||
export function secondsToHHmmString(seconds: number) { | ||
const minutesTotal = seconds / 60; | ||
const hours = Math.abs(Math.floor(minutesTotal / 60)) | ||
.toFixed(0) | ||
.toString() | ||
.padStart(2, '0'); | ||
const minutes = Math.abs(minutesTotal % 60) | ||
.toFixed(0) | ||
.toString() | ||
.padStart(2, '0'); | ||
return `${hours}:${minutes}`; | ||
} | ||
|
||
const approachTypeNames: Record<ApproachType, string> = { | ||
[ApproachType.Ils]: 'ILS', | ||
[ApproachType.Gls]: 'GLS', | ||
[ApproachType.Igs]: 'IGS', | ||
[ApproachType.Loc]: 'LOC', | ||
[ApproachType.LocBackcourse]: 'BAC', | ||
[ApproachType.Lda]: 'LDA', | ||
[ApproachType.Sdf]: 'SDF', | ||
[ApproachType.Gps]: 'GPS', | ||
[ApproachType.Rnav]: 'RNV', | ||
[ApproachType.Vor]: 'VOR', | ||
[ApproachType.VorDme]: 'VOR', | ||
[ApproachType.Vortac]: 'VOR', | ||
[ApproachType.Ndb]: 'NDB', | ||
[ApproachType.NdbDme]: 'NDB', | ||
[ApproachType.Fms]: 'RNAV', | ||
[ApproachType.Mls]: 'MLS', // not actually supported | ||
[ApproachType.MlsTypeA]: 'MLS', // not actually supported | ||
[ApproachType.MlsTypeBC]: 'MLS', // not actually supported | ||
[ApproachType.Tacan]: 'TAC', // not actually supported | ||
[ApproachType.Unknown]: '', | ||
}; | ||
|
||
export function getApproachName(approach: Approach, withRnpSuffix = true): string { | ||
// we don't need to worry about circling approaches as they aren't available, so we can always expect a runway ident | ||
// FIXME add (RNP) suffix for RNP-AR missed approaches (even on non-RNAV approaches) | ||
const approachSuffix = approach.suffix ? `-${approach.suffix}` : ''; | ||
const arSuffix = withRnpSuffix && approach.authorisationRequired ? ' (RNP)' : ''; | ||
return `${approachTypeNames[approach.type]}${approach.runwayIdent?.substring(4)}${approachSuffix}${arSuffix}`; | ||
} |
12 changes: 0 additions & 12 deletions
12
fbw-a380x/src/systems/instruments/src/MFD/shared/utils.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters