Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueberryKing committed Sep 19, 2024
1 parent e858ac7 commit ded22a4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
1. [FWC] Improved LDG LT memo to take into account light position - @BravoMike99 (bruno_pt99)
1. [EFB] Added warning for not compatible aircraft type to simbrief import - @2hwk (2Cas)
1. [PRESS] Add pressurization system failures - @mjuhe (Miquel Juhe)
1. [CDU] Fix for EFOB calculation not pulling from block fuel prior to engine start - @PatM (Patrick Macken)
1. [EFB] Added simrate indicator to status bar - @2hwk (2Cas)
1. [EFB] Added simrate and pause on TOD controls to control center - @2hwk (2Cas)
1. [FMS] Implement missed approach route - @Benjozork (Benjamin Dupont), @tracernz (Mike), @saschl (saschl#9432), @BlueberryKing (BlueberryKing)
Expand All @@ -120,6 +119,7 @@
1. [FADEC] Added quick start for engines and APU - @frankkopp (Frank Kopp) - @Gurgel100 (Pascal)
1. [EFB] Added expedited presets - @frankkopp (Frank Kopp)
1. [FMS] Show runway ident on lateral/vertical revision page of the missed approach point - @BlueberryKing (BlueberryKing)
1. [CDU] Fix for EFOB calculation not pulling from block fuel prior to engine start - @PatM (Patrick Macken)

## 0.11.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CDUAocInit {
ete = `${FMCMainDisplay.secondsTohhmm(mcdu.simbrief.ete)}[color]cyan`;
}
if (mcdu.isAnEngineOn()) {
//should only get if an engine running
// should only get if an engine running
const currentFob = formatWeight(NXUnits.kgToUser(mcdu.getFOB()));
if (currentFob) {
fob = `{small}${currentFob}{end}[color]green`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2021-2023 FlyByWire Simulations
//
// SPDX-License-Identifier: GPL-3.0

class FMCMainDisplay extends BaseAirliners {
constructor() {
super(...arguments);
Expand Down Expand Up @@ -2655,13 +2656,13 @@ class FMCMainDisplay extends BaseAirliners {
* @returns {number | null} gross weight in tons or null if not available.
*/
getGrossWeight() {
const useFqi = this.isAnEngineOn();
const fob = this.getFOB();

if (this.zeroFuelWeight === undefined || (!useFqi && this.blockFuel === undefined)) {
if (this.zeroFuelWeight === undefined || fob === undefined) {
return null;
}

return this.zeroFuelWeight + (this.getFOB());
return this.zeroFuelWeight + fob;
}

getToSpeedsTooLow() {
Expand Down Expand Up @@ -4540,28 +4541,24 @@ class FMCMainDisplay extends BaseAirliners {
*/
//TODO: Can this be util?
getFOB() {
if (this.isAnEngineOn()) {
return (SimVar.GetSimVarValue("FUEL TOTAL QUANTITY WEIGHT", "pound") * 0.4535934) / 1000;
} else {
//If an engine is not running, use pilot entered block fuel to calculate fuel predictions
return this.blockFuel;
}
const useFqi = this.isAnEngineOn();

// If an engine is not running, use pilot entered block fuel to calculate fuel predictions
return useFqi ? (SimVar.GetSimVarValue("FUEL TOTAL QUANTITY WEIGHT", "pound") * 0.4535934) / 1000 : this.blockFuel;
}

/**
* retrieves GW in Tons
* retrieves gross weight in tons or 0 if not available
* @returns {number}
* @deprecated use getGrossWeight() instead
*/
//TODO: Can this be util?
getGW() {
let fmGW = 0;
const currFob = this.getFOB();
//Simplified to just checking fuelWeight as GetFOB handles what fuel level to use (block vs tank reading)
if (Number.isFinite(this.zeroFuelWeight) && Number.isFinite(currFob)) {
fmGW = (currFob + this.zeroFuelWeight);
}
SimVar.SetSimVarValue("L:A32NX_FM_GROSS_WEIGHT", "Number", fmGW);
return fmGW;
const fmGwOrNull = this.getGrossWeight();
const fmGw = fmGwOrNull !== null ? fmGwOrNull : 0;

SimVar.SetSimVarValue("L:A32NX_FM_GROSS_WEIGHT", "Number", fmGw);
return fmGw;
}

//TODO: Can this be util?
Expand Down

0 comments on commit ded22a4

Please sign in to comment.