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/oans): Handle single-digit runway identifiers #9603

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -81,6 +81,7 @@
1. [A32NX] Fixed APU fire detection - @tracernz (Mike)
1. [A380X/COND] Fix wasm crash during rapid decompression - @mjuhe (Miquel Juhe)
1. [A380X] Fix EWD avail. thrust fill area & PFD rudder trim visibility on ground - @flogross89 (floridude)
1. [A380X/OANS] Fix "BTV/FMS RWY DISAGREE" message for single-digit runway identifiers - @flogross89 (floridude)

## 0.12.0

Expand Down
4 changes: 3 additions & 1 deletion fbw-common/src/systems/instruments/src/OANC/Oanc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,10 @@ export class Oanc<T extends number> extends DisplayComponent<OancProps<T>> {
const thresholdFeature = this.data.features.filter(
(it) => it.properties.feattype === FeatureType.RunwayThreshold && it.properties?.idthr === label.text,
);
// Handle single-digit runway identifiers: Pad with 0
const paddedRunwayQfu = label.text.replace(/[^0-9]/g, '').length < 2 ? `0${label.text}` : label.text;
this.btvUtils.selectRunwayFromOans(
`${this.dataAirportIcao.get()}${label.text}`,
`${this.dataAirportIcao.get()}${paddedRunwayQfu}`,
label.associatedFeature,
thresholdFeature[0],
);
Expand Down
25 changes: 19 additions & 6 deletions fbw-common/src/systems/instruments/src/OANC/OancLabelFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ export interface MajorLabelFilter extends BaseOancLabelFilter {

export type OancLabelFilter = RunwayBtvSelectionLabelFilter | NoneLabelFilter | NullLabelFilter | MajorLabelFilter;

function isSameQfu(qfu1: string, qfu2: string) {
if (!qfu1 || !qfu2) {
return false;
}

// Checks if same runway QFU, with special handling for american QFU with missing leading zeroes
const qfu1Padded = qfu1.replace(/[^0-9]/g, '').length < 2 ? `0${qfu1}` : qfu1;
const qfu2Padded = qfu2.replace(/[^0-9]/g, '').length < 2 ? `0${qfu2}` : qfu2;
return qfu1Padded === qfu2Padded;
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function filterLabel(
label: Label,
Expand All @@ -39,15 +50,15 @@ export function filterLabel(
btvSelectedExit?: string,
): boolean {
if (label.style === LabelStyle.FmsSelectedRunwayEnd && label.text) {
return label.text === fmsDepRunway?.substring(4) || label.text === fmsLdgRunway?.substring(4);
return isSameQfu(label.text, fmsDepRunway?.substring(4)) || isSameQfu(label.text, fmsLdgRunway?.substring(4));
}
if (label.style === LabelStyle.BtvSelectedRunwayArrow && label.text) {
return label.text === btvSelectedRunway?.substring(4);
return isSameQfu(label.text, btvSelectedRunway?.substring(4));
}
if (
btvSelectedRunway &&
label.associatedFeature?.properties.feattype === FeatureType.PaintedCenterline &&
label.text === btvSelectedRunway?.substring(4)
isSameQfu(label.text, btvSelectedRunway?.substring(4))
) {
return true;
}
Expand Down Expand Up @@ -94,12 +105,14 @@ export function labelStyle(
btvSelectedExit: string,
): LabelStyle {
if (label.style === LabelStyle.RunwayEnd || label.style === LabelStyle.BtvSelectedRunwayEnd) {
return btvSelectedRunway?.substring(4) === label.text ? LabelStyle.BtvSelectedRunwayEnd : LabelStyle.RunwayEnd;
return isSameQfu(btvSelectedRunway?.substring(4), label.text)
? LabelStyle.BtvSelectedRunwayEnd
: LabelStyle.RunwayEnd;
}
if (label.style === LabelStyle.RunwayAxis || label.style === LabelStyle.FmsSelectedRunwayAxis) {
const isSelectedRunway =
(isFmsOrigin && label.text === fmsDataStore.departureRunway.get()?.substring(4)) ||
(isFmsDestination && label.text === fmsDataStore.landingRunway.get()?.substring(4));
(isFmsOrigin && isSameQfu(label.text, fmsDataStore.departureRunway.get()?.substring(4))) ||
(isFmsDestination && isSameQfu(label.text, fmsDataStore.landingRunway.get()?.substring(4)));
return isSelectedRunway ? LabelStyle.FmsSelectedRunwayAxis : LabelStyle.RunwayAxis;
}
if (label.style === LabelStyle.ExitLine || label.style === LabelStyle.BtvSelectedExit) {
Expand Down