From 39b3842031abece0d402c04d7395c143da38d275 Mon Sep 17 00:00:00 2001 From: BravoMike99 <119708186+BravoMike99@users.noreply.github.com> Date: Fri, 3 Nov 2023 08:22:07 +0000 Subject: [PATCH] fix(mcdu): Disable alternate time predictions if fuel manually specified (#8273) * output altTime as 0 if manual fuel input * dash altn Time prediction if time is zero * fix(fuel pred): dash altn time if value is 0 Update changelog * changed fms alt time to null if manual fuel input --- .github/CHANGELOG.md | 1 + .../CDU/A320_Neo_CDU_FuelPredPage.js | 35 +++++++++++-------- .../CDU/A320_Neo_CDU_InitPage.js | 20 ++++++----- .../FMC/A32NX_FMCMainDisplay.js | 5 +-- 4 files changed, 36 insertions(+), 25 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 864006362cd..0071a89479b 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -13,6 +13,7 @@ 1. [FMS] Implement CHECK SPEED MODE message - @BlueberryKing (BlueberryKing) 1. [PFD] The ILS frequency is now visible even when a LOC is not received - @tracernz (Mike) 1. [ATSU] Fixed GROUND REQ page not updating after successful station insert - @BravoMike99 (bruno_pt99) +1. [MCDU] Dash alternate time predictions if alternate fuel is manually inserted @BravoMike99 (bruno_pt99) ## 0.11.0 diff --git a/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/Airliners/FlyByWire_A320_Neo/CDU/A320_Neo_CDU_FuelPredPage.js b/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/Airliners/FlyByWire_A320_Neo/CDU/A320_Neo_CDU_FuelPredPage.js index e0661780d33..95f0ee0bd96 100644 --- a/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/Airliners/FlyByWire_A320_Neo/CDU/A320_Neo_CDU_FuelPredPage.js +++ b/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/Airliners/FlyByWire_A320_Neo/CDU/A320_Neo_CDU_FuelPredPage.js @@ -128,20 +128,20 @@ class CDUFuelPredPage { }; if (mcdu.altDestination) { - if (mcdu._routeAltFuelEntered) { - if (isFinite(mcdu.getRouteAltFuelWeight())) { - altFuelCell = "{sp}{sp}" + (NXUnits.kgToUser(mcdu.getRouteAltFuelWeight())).toFixed(1); - altFuelTimeCell = "{small}" + FMCMainDisplay.minutesTohhmm(mcdu.getRouteAltFuelTime()) + "{end}"; - altTimeColor = "{green}"; - altFuelColor = "[color]cyan"; - } - } else { + const altnFuelEntered = mcdu._routeAltFuelEntered; + if (!altnFuelEntered) { mcdu.tryUpdateRouteAlternate(); - if (isFinite(mcdu.getRouteAltFuelWeight())) { - altFuelCell = "{sp}{sp}{small}" + (NXUnits.kgToUser(mcdu.getRouteAltFuelWeight())).toFixed(1); - altFuelTimeCell = FMCMainDisplay.minutesTohhmm(mcdu.getRouteAltFuelTime()) + "{end}"; + } + if (isFinite(mcdu.getRouteAltFuelWeight())) { + altFuelCell = "{sp}{sp}" + (altnFuelEntered ? "" : "{small}") + (NXUnits.kgToUser(mcdu.getRouteAltFuelWeight())).toFixed(1); + altFuelColor = "[color]cyan"; + const time = mcdu.getRouteAltFuelTime(); + if (time) { + altFuelTimeCell = "{small}" + FMCMainDisplay.minutesTohhmm(time) + "{end}"; altTimeColor = "{green}"; - altFuelColor = "[color]cyan"; + } else { + altFuelTimeCell = "----"; + altTimeColor = "{white}"; } } } else { @@ -161,7 +161,6 @@ class CDUFuelPredPage { altIdentCell = mcdu.altDestination.ident; altEFOBCell = (NXUnits.kgToUser(mcdu.getAltEFOB(true))).toFixed(1); altEFOBCellColor = mcdu.getAltEFOB(true) < mcdu._minDestFob ? "[color]amber" : "[color]green"; - altTimeCellColor = "[color]green"; } mcdu.tryUpdateRouteTrip(isFlying); @@ -173,10 +172,18 @@ class CDUFuelPredPage { // Should we use predicted values or liveETATo and liveUTCto? destTimeCell = isFlying ? FMCMainDisplay.secondsToUTC(utcTime + FMCMainDisplay.minuteToSeconds(mcdu._routeTripTime)) : destTimeCell = FMCMainDisplay.minutesTohhmm(mcdu._routeTripTime); + if (mcdu.altDestination) { - altTimeCell = isFlying ? FMCMainDisplay.secondsToUTC(utcTime + FMCMainDisplay.minuteToSeconds(mcdu._routeTripTime) + FMCMainDisplay.minuteToSeconds(mcdu.getRouteAltFuelTime())) + if (mcdu.getRouteAltFuelTime()) { + altTimeCell = isFlying ? FMCMainDisplay.secondsToUTC(utcTime + FMCMainDisplay.minuteToSeconds(mcdu._routeTripTime) + FMCMainDisplay.minuteToSeconds(mcdu.getRouteAltFuelTime())) : FMCMainDisplay.minutesTohhmm(mcdu.getRouteAltFuelTime()); + altTimeCellColor = "[color]green"; + } else { + altTimeCell = "----"; + altTimeCellColor = "[color]white"; + } } + destEFOBCellColor = "[color]green"; destTimeCellColor = "[color]green"; diff --git a/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/Airliners/FlyByWire_A320_Neo/CDU/A320_Neo_CDU_InitPage.js b/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/Airliners/FlyByWire_A320_Neo/CDU/A320_Neo_CDU_InitPage.js index cd1fe8a68c5..7bbdf818a5b 100644 --- a/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/Airliners/FlyByWire_A320_Neo/CDU/A320_Neo_CDU_InitPage.js +++ b/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/Airliners/FlyByWire_A320_Neo/CDU/A320_Neo_CDU_InitPage.js @@ -582,19 +582,21 @@ class CDUInitPage { }; if (mcdu.altDestination) { - if (mcdu._routeAltFuelEntered) { - if (isFinite(mcdu.getRouteAltFuelWeight())) { - altnWeightCell.update(NXUnits.kgToUser(mcdu.getRouteAltFuelWeight()).toFixed(1), Column.cyan); - altnTimeCell.update(FMCMainDisplay.minutesTohhmm(mcdu.getRouteAltFuelTime()), Column.green, Column.small); - } - } else { + const altFuelEntered = mcdu._routeAltFuelEntered; + if (!altFuelEntered) { mcdu.tryUpdateRouteAlternate(); - if (isFinite(mcdu.getRouteAltFuelWeight())) { - altnWeightCell.update(NXUnits.kgToUser(mcdu.getRouteAltFuelWeight()).toFixed(1), Column.cyan, Column.small); + } + if (isFinite(mcdu.getRouteAltFuelWeight())) { + altnWeightCell.update(NXUnits.kgToUser(mcdu.getRouteAltFuelWeight()).toFixed(1), Column.cyan, altFuelEntered? Column.big : Column.small); + const time = mcdu.getRouteAltFuelTime(); + if (time) { altnTimeCell.update(FMCMainDisplay.minutesTohhmm(mcdu.getRouteAltFuelTime()), Column.green, Column.small); + altnCellDivider.updateAttributes(Column.green, Column.small); + } else { + altnTimeCell.update('----',Column.white); + altnCellDivider.updateAttributes(Column.white, altFuelEntered? Column.big : Column.small); } } - altnCellDivider.updateAttributes(Column.green, Column.small); } else { altnWeightCell.update("0.0", Column.green, Column.small); } diff --git a/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/Airliners/FlyByWire_A320_Neo/FMC/A32NX_FMCMainDisplay.js b/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/Airliners/FlyByWire_A320_Neo/FMC/A32NX_FMCMainDisplay.js index 5b9f9ceb530..1f542d91e3a 100644 --- a/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/Airliners/FlyByWire_A320_Neo/FMC/A32NX_FMCMainDisplay.js +++ b/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/Airliners/FlyByWire_A320_Neo/FMC/A32NX_FMCMainDisplay.js @@ -2155,7 +2155,7 @@ class FMCMainDisplay extends BaseAirliners { if (this.isAltFuelInRange(value)) { this._routeAltFuelEntered = true; this._routeAltFuelWeight = value; - this._routeAltFuelTime = FMCMainDisplay.minutesTohhmm(A32NX_FuelPred.computeUserAltTime(this._routeAltFuelWeight * 1000, 290)); + this._routeAltFuelTime = null; return true; } else { this.setScratchpadMessage(NXSystemMessages.entryOutOfRange); @@ -2242,7 +2242,7 @@ class FMCMainDisplay extends BaseAirliners { const deviation = (this.zeroFuelWeight + this._routeFinalFuelWeight - A32NX_FuelPred.refWeight) * A32NX_FuelPred.computeNumbers(airDistance, placeholderFl, A32NX_FuelPred.computations.CORRECTIONS, true); if ((20 < airDistance && airDistance < 200) && (100 < placeholderFl && placeholderFl < 290)) { //This will always be true until we can setup alternate routes this._routeAltFuelWeight = (A32NX_FuelPred.computeNumbers(airDistance, placeholderFl, A32NX_FuelPred.computations.FUEL, true) + deviation) / 1000; - this._routeAltFuelTime = A32NX_FuelPred.computeNumbers(airDistance, placeholderFl, A32NX_FuelPred.computations.TIME, true); + this._routeAltFuelTime = this._routeAltFuelEntered ? null : A32NX_FuelPred.computeNumbers(airDistance, placeholderFl, A32NX_FuelPred.computations.TIME, true); } } } @@ -2320,6 +2320,7 @@ class FMCMainDisplay extends BaseAirliners { } getRouteAltFuelTime() { + return this._routeAltFuelTime; }