From 6a36d0e2cf1bbe9f3123ecd4fd226bf58c04a0be Mon Sep 17 00:00:00 2001 From: Denis Freund <info@denis-freund.de> Date: Mon, 25 Nov 2024 10:43:35 +0100 Subject: [PATCH] fix: keep flight number set even if already taken FBW PR 8656 --- flybywire | 2 +- .../FMC/A32NX_FMCMainDisplay.js | 24 +++++++--------- .../FMC/A32NX_FMCMainDisplay.js | 28 ++++++++----------- .../FMC/A32NX_FMCMainDisplay.js | 24 +++++++--------- 4 files changed, 33 insertions(+), 45 deletions(-) diff --git a/flybywire b/flybywire index 0f032936..9ccbc107 160000 --- a/flybywire +++ b/flybywire @@ -1 +1 @@ -Subproject commit 0f032936bdecec5e1bfcde95c4f2126858902605 +Subproject commit 9ccbc1071fcac7566d8eafcadb76c39a4587019a diff --git a/hdw-a333x/src/base/headwindsim-aircraft-a330-300/html_ui/Pages/VCockpit/Instruments/Airliners/Headwind_A333X/FMC/A32NX_FMCMainDisplay.js b/hdw-a333x/src/base/headwindsim-aircraft-a330-300/html_ui/Pages/VCockpit/Instruments/Airliners/Headwind_A333X/FMC/A32NX_FMCMainDisplay.js index d0f5370e..94400806 100644 --- a/hdw-a333x/src/base/headwindsim-aircraft-a330-300/html_ui/Pages/VCockpit/Instruments/Airliners/Headwind_A333X/FMC/A32NX_FMCMainDisplay.js +++ b/hdw-a333x/src/base/headwindsim-aircraft-a330-300/html_ui/Pages/VCockpit/Instruments/Airliners/Headwind_A333X/FMC/A32NX_FMCMainDisplay.js @@ -2424,26 +2424,22 @@ class FMCMainDisplay extends BaseAirliners { return SimVar.SetSimVarValue('L:A32NX_FM_LS_COURSE', 'number', course); } - updateFlightNo(flightNo, callback = EmptyCallback.Boolean) { + async updateFlightNo(flightNo, callback = EmptyCallback.Boolean) { if (flightNo.length > 7) { this.setScratchpadMessage(NXSystemMessages.notAllowed); return callback(false); } - SimVar.SetSimVarValue('ATC FLIGHT NUMBER', 'string', flightNo, 'FMC').then(() => { - this.atsu.connectToNetworks(flightNo).then((code) => { - if (code !== AtsuCommon.AtsuStatusCodes.Ok) { - SimVar.SetSimVarValue('L:A32NX_MCDU_FLT_NO_SET', 'boolean', 0); - this.addNewAtsuMessage(code); - this.flightNo = ''; - return callback(false); - } + this.flightNumber = flightNo; + await SimVar.SetSimVarValue("ATC FLIGHT NUMBER", "string", flightNo, "FMC"); - SimVar.SetSimVarValue('L:A32NX_MCDU_FLT_NO_SET', 'boolean', 1); - this.flightNumber = flightNo; - return callback(true); - }); - }); + // FIXME move ATSU code to ATSU + const code = await this.atsu.connectToNetworks(flightNo); + if (code !== AtsuCommon.AtsuStatusCodes.Ok) { + this.addNewAtsuMessage(code); + } + + return callback(true); } async updateCoRoute(coRouteNum, callback = EmptyCallback.Boolean) { diff --git a/hdw-a339x/src/base/headwindsim-aircraft-a330-900/html_ui/Pages/VCockpit/Instruments/Airliners/Headwind_A339X/FMC/A32NX_FMCMainDisplay.js b/hdw-a339x/src/base/headwindsim-aircraft-a330-900/html_ui/Pages/VCockpit/Instruments/Airliners/Headwind_A339X/FMC/A32NX_FMCMainDisplay.js index 5b602cb5..06d7a150 100644 --- a/hdw-a339x/src/base/headwindsim-aircraft-a330-900/html_ui/Pages/VCockpit/Instruments/Airliners/Headwind_A339X/FMC/A32NX_FMCMainDisplay.js +++ b/hdw-a339x/src/base/headwindsim-aircraft-a330-900/html_ui/Pages/VCockpit/Instruments/Airliners/Headwind_A339X/FMC/A32NX_FMCMainDisplay.js @@ -2424,26 +2424,22 @@ class FMCMainDisplay extends BaseAirliners { return SimVar.SetSimVarValue('L:A32NX_FM_LS_COURSE', 'number', course); } - updateFlightNo(flightNo, callback = EmptyCallback.Boolean) { + async updateFlightNo(flightNo, callback = EmptyCallback.Boolean) { if (flightNo.length > 7) { - this.setScratchpadMessage(NXSystemMessages.notAllowed); - return callback(false); + this.setScratchpadMessage(NXSystemMessages.notAllowed); + return callback(false); } - SimVar.SetSimVarValue('ATC FLIGHT NUMBER', 'string', flightNo, 'FMC').then(() => { - this.atsu.connectToNetworks(flightNo).then((code) => { - if (code !== AtsuCommon.AtsuStatusCodes.Ok) { - SimVar.SetSimVarValue('L:A32NX_MCDU_FLT_NO_SET', 'boolean', 0); - this.addNewAtsuMessage(code); - this.flightNo = ''; - return callback(false); - } + this.flightNumber = flightNo; + await SimVar.SetSimVarValue("ATC FLIGHT NUMBER", "string", flightNo, "FMC"); - SimVar.SetSimVarValue('L:A32NX_MCDU_FLT_NO_SET', 'boolean', 1); - this.flightNumber = flightNo; - return callback(true); - }); - }); + // FIXME move ATSU code to ATSU + const code = await this.atsu.connectToNetworks(flightNo); + if (code !== AtsuCommon.AtsuStatusCodes.Ok) { + this.addNewAtsuMessage(code); + } + + return callback(true); } async updateCoRoute(coRouteNum, callback = EmptyCallback.Boolean) { diff --git a/hdw-su95x/src/base/headwindsim-aircraft-su100-95/html_ui/Pages/VCockpit/Instruments/Airliners/Headwind_SU95X/FMC/A32NX_FMCMainDisplay.js b/hdw-su95x/src/base/headwindsim-aircraft-su100-95/html_ui/Pages/VCockpit/Instruments/Airliners/Headwind_SU95X/FMC/A32NX_FMCMainDisplay.js index 8a03e662..c84449b1 100644 --- a/hdw-su95x/src/base/headwindsim-aircraft-su100-95/html_ui/Pages/VCockpit/Instruments/Airliners/Headwind_SU95X/FMC/A32NX_FMCMainDisplay.js +++ b/hdw-su95x/src/base/headwindsim-aircraft-su100-95/html_ui/Pages/VCockpit/Instruments/Airliners/Headwind_SU95X/FMC/A32NX_FMCMainDisplay.js @@ -2424,26 +2424,22 @@ class FMCMainDisplay extends BaseAirliners { return SimVar.SetSimVarValue('L:A32NX_FM_LS_COURSE', 'number', course); } - updateFlightNo(flightNo, callback = EmptyCallback.Boolean) { + async updateFlightNo(flightNo, callback = EmptyCallback.Boolean) { if (flightNo.length > 7) { this.setScratchpadMessage(NXSystemMessages.notAllowed); return callback(false); } - SimVar.SetSimVarValue('ATC FLIGHT NUMBER', 'string', flightNo, 'FMC').then(() => { - this.atsu.connectToNetworks(flightNo).then((code) => { - if (code !== AtsuCommon.AtsuStatusCodes.Ok) { - SimVar.SetSimVarValue('L:A32NX_MCDU_FLT_NO_SET', 'boolean', 0); - this.addNewAtsuMessage(code); - this.flightNo = ''; - return callback(false); - } + this.flightNumber = flightNo; + await SimVar.SetSimVarValue("ATC FLIGHT NUMBER", "string", flightNo, "FMC"); - SimVar.SetSimVarValue('L:A32NX_MCDU_FLT_NO_SET', 'boolean', 1); - this.flightNumber = flightNo; - return callback(true); - }); - }); + // FIXME move ATSU code to ATSU + const code = await this.atsu.connectToNetworks(flightNo); + if (code !== AtsuCommon.AtsuStatusCodes.Ok) { + this.addNewAtsuMessage(code); + } + + return callback(true); } async updateCoRoute(coRouteNum, callback = EmptyCallback.Boolean) {