From 97b75ffa9c4a481977572c2f1c5cb364d840461e Mon Sep 17 00:00:00 2001 From: BravoMike99 <119708186+BravoMike99@users.noreply.github.com> Date: Sun, 9 Mar 2025 12:28:07 +0000 Subject: [PATCH] chore: use strict equality for appr wind (review suggestion) --- .../src/MCDU/legacy/A32NX_FMCMainDisplay.ts | 12 ++++++------ .../legacy_pages/A320_Neo_CDU_PerformancePage.ts | 4 ++-- .../src/MFD/FMC/FlightManagementComputer.ts | 2 +- .../instruments/src/MFD/FMC/FmcAircraftInterface.ts | 4 ++-- .../src/systems/instruments/src/MFD/FMC/fmgc.ts | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/fbw-a32nx/src/systems/instruments/src/MCDU/legacy/A32NX_FMCMainDisplay.ts b/fbw-a32nx/src/systems/instruments/src/MCDU/legacy/A32NX_FMCMainDisplay.ts index 14d7af3f3d9..ee6b3a42874 100644 --- a/fbw-a32nx/src/systems/instruments/src/MCDU/legacy/A32NX_FMCMainDisplay.ts +++ b/fbw-a32nx/src/systems/instruments/src/MCDU/legacy/A32NX_FMCMainDisplay.ts @@ -1516,7 +1516,7 @@ export abstract class FMCMainDisplay implements FmsDataInterface, FmsDisplayInte weight = this.zeroFuelWeight + Math.max(0, (vnavPrediction.estimatedFuelOnBoard * 0.4535934) / 1000); } // if pilot has set approach wind in MCDU we use it, otherwise fall back to current measured wind - if (this.perfApprWindSpeed != null && this.perfApprWindHeading != null) { + if (this.perfApprWindSpeed !== null && this.perfApprWindHeading !== null) { this.approachSpeeds = new NXSpeedsApp(weight, this.perfApprFlaps3, this._towerHeadwind); } else { this.approachSpeeds = new NXSpeedsApp(weight, this.perfApprFlaps3); @@ -2034,8 +2034,8 @@ export abstract class FMCMainDisplay implements FmsDataInterface, FmsDisplayInte return ( isFinite(this.perfApprQNH) && isFinite(this.perfApprTemp) && - this.perfApprWindHeading != null && - this.perfApprWindSpeed != null + this.perfApprWindHeading !== null && + this.perfApprWindSpeed !== null ); }); } @@ -4041,7 +4041,7 @@ export abstract class FMCMainDisplay implements FmsDataInterface, FmsDisplayInte */ private getVAppGsMini() { let vAppTarget = this.getVApp(); - if (this.perfApprWindSpeed !== null && this.perfApprWindHeading != null) { + if (this.perfApprWindSpeed !== null && this.perfApprWindHeading !== null) { vAppTarget = NXSpeedsUtils.getVtargetGSMini(vAppTarget, NXSpeedsUtils.getHeadWindDiff(this._towerHeadwind)); } return vAppTarget; @@ -4392,7 +4392,7 @@ export abstract class FMCMainDisplay implements FmsDataInterface, FmsDisplayInte } public updateTowerHeadwind() { - if (this.perfApprWindHeading != null && this.perfApprWindSpeed != null) { + if (this.perfApprWindHeading !== null && this.perfApprWindSpeed !== null) { const activePlan = this.flightPlanService.active; if (activePlan.destinationRunway) { @@ -5105,7 +5105,7 @@ export abstract class FMCMainDisplay implements FmsDataInterface, FmsDisplayInte const activePlan = this.currFlightPlanService.active; const destination = activePlan.destinationAirport; - if (!destination || !destination.location || this.perfApprWindHeading == null || this.perfApprWindSpeed == null) { + if (!destination || !destination.location || this.perfApprWindHeading === null || this.perfApprWindSpeed === null) { return null; } diff --git a/fbw-a32nx/src/systems/instruments/src/MCDU/legacy_pages/A320_Neo_CDU_PerformancePage.ts b/fbw-a32nx/src/systems/instruments/src/MCDU/legacy_pages/A320_Neo_CDU_PerformancePage.ts index 7a487365307..a173e2362b0 100644 --- a/fbw-a32nx/src/systems/instruments/src/MCDU/legacy_pages/A320_Neo_CDU_PerformancePage.ts +++ b/fbw-a32nx/src/systems/instruments/src/MCDU/legacy_pages/A320_Neo_CDU_PerformancePage.ts @@ -924,11 +924,11 @@ export class CDUPerformancePage { } }; let magWindHeadingCell = '[\xa0]'; - if (mcdu.perfApprWindHeading != null) { + if (mcdu.perfApprWindHeading !== null) { magWindHeadingCell = ('' + mcdu.perfApprWindHeading.toFixed(0)).padStart(3, '0'); } let magWindSpeedCell = '[\xa0]'; - if (mcdu.perfApprWindSpeed != null) { + if (mcdu.perfApprWindSpeed !== null) { magWindSpeedCell = mcdu.perfApprWindSpeed.toFixed(0).padStart(3, '0'); } mcdu.onLeftInput[2] = (value, scratchpadCallback) => { diff --git a/fbw-a380x/src/systems/instruments/src/MFD/FMC/FlightManagementComputer.ts b/fbw-a380x/src/systems/instruments/src/MFD/FMC/FlightManagementComputer.ts index 278424566de..292756e0840 100644 --- a/fbw-a380x/src/systems/instruments/src/MFD/FMC/FlightManagementComputer.ts +++ b/fbw-a380x/src/systems/instruments/src/MFD/FMC/FlightManagementComputer.ts @@ -212,7 +212,7 @@ export class FlightManagementComputer implements FmcInterface { ); private readonly destDataEntered = MappedSubject.create( - ([qnh, temperature, wind]) => qnh !== null && temperature != null && wind !== null, + ([qnh, temperature, wind]) => qnh !== null && temperature !== null && wind !== null, this.fmgc.data.approachQnh, this.fmgc.data.approachTemperature, this.fmgc.data.approachWind, diff --git a/fbw-a380x/src/systems/instruments/src/MFD/FMC/FmcAircraftInterface.ts b/fbw-a380x/src/systems/instruments/src/MFD/FMC/FmcAircraftInterface.ts index 5723164b7bb..8581d17af93 100644 --- a/fbw-a380x/src/systems/instruments/src/MFD/FMC/FmcAircraftInterface.ts +++ b/fbw-a380x/src/systems/instruments/src/MFD/FMC/FmcAircraftInterface.ts @@ -979,7 +979,7 @@ export class FmcAircraftInterface { let towerHeadwind = 0; const appWind = this.fmgc.data.approachWind.get(); const destRwy = this.fmgc.getDestinationRunway(); - if (appWind) { + if (appWind !== null) { if (destRwy) { towerHeadwind = A380SpeedsUtils.getHeadwind(appWind.speed, appWind.direction, destRwy.magneticBearing); } @@ -1196,7 +1196,7 @@ export class FmcAircraftInterface { // if pilot has set approach wind in MCDU we use it, otherwise fall back to current measured wind const appWind = this.fmgc.data.approachWind.get(); let towerHeadwind = 0; - if (appWind) { + if (appWind !== null) { if (this.flightPlanService.active.destinationRunway) { towerHeadwind = A380SpeedsUtils.getHeadwind( appWind.speed, diff --git a/fbw-a380x/src/systems/instruments/src/MFD/FMC/fmgc.ts b/fbw-a380x/src/systems/instruments/src/MFD/FMC/fmgc.ts index 010d5b5e3da..4c1df6abe98 100644 --- a/fbw-a380x/src/systems/instruments/src/MFD/FMC/fmgc.ts +++ b/fbw-a380x/src/systems/instruments/src/MFD/FMC/fmgc.ts @@ -237,7 +237,7 @@ export class FmgcData { public readonly approachWindSpeed = Subject.create(null); public readonly approachWind: MappedSubject = MappedSubject.create( - ([direction, speed]) => (direction != null && speed !== null ? { direction: direction, speed: speed } : null), + ([direction, speed]) => (direction !== null && speed !== null ? { direction: direction, speed: speed } : null), this.approachSpeed, this.approachWindSpeed, );