Skip to content

Commit

Permalink
chore: use strict equality for appr wind (review suggestion)
Browse files Browse the repository at this point in the history
  • Loading branch information
BravoMike99 committed Mar 9, 2025
1 parent 2adfba6 commit 97b75ff
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
);
});
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion fbw-a380x/src/systems/instruments/src/MFD/FMC/fmgc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export class FmgcData {
public readonly approachWindSpeed = Subject.create<number | null>(null);

public readonly approachWind: MappedSubject<number[], FmcWindVector | null> = 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,
);
Expand Down

0 comments on commit 97b75ff

Please sign in to comment.