From c17a4e22c2913c4e0689bcae8fe3cd34ac09c05f Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Fri, 22 Oct 2021 18:22:58 +0100 Subject: [PATCH 01/10] PDF: fix ground_ref showing / hiding; ECAM - improve DIRECT / ALTN law messages --- Models/Instruments/PFD/PFD.nas | 15 ++++++++------- Nasal/ECAM/ECAM-logic.nas | 17 +++++++++++++---- Nasal/ECAM/ECAM-messages.nas | 1 + Nasal/ECAM/ECAM-nodes.nas | 2 ++ 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index e4175214..f8c2d311 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -238,13 +238,7 @@ var canvas_pfd = { } else { obj["AI_agl"].setText(sprintf("%s", math.round(math.clamp(val, 0, 2500)))); } - - if (-val >= -565 and -val <= 565) { - obj["ground_ref"].setTranslation(0, (-val / 100) * -48.66856); - obj["ground_ref"].show(); - } else { - obj["ground_ref"].hide(); - } + obj["ground_ref"].setTranslation(0, (-val / 100) * -48.66856); }), props.UpdateManager.FromHashList(["agl","gear1Wow", "gear2Wow","fmgcPhase"], nil, func(val) { if (-val.agl >= -565 and -val.agl <= 565) { @@ -1310,6 +1304,13 @@ var canvas_pfd = { me["ASI_trend_up"].hide(); me["ASI_trend_down"].hide(); } + + + if (-notification.agl >= -565 and -notification.agl <= 565) { + me["ground_ref"].show(); + } else { + me["ground_ref"].hide(); + } } else { me["ASI_group"].hide(); me["ASI_error"].show(); diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 03044edd..12fb1791 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -37,6 +37,7 @@ var alt200 = nil; var alt750 = nil; var bigThree = nil; var fltCtlLandAsap = 0; +var gearPosition = nil; var altAlertSteady = 0; var altAlertFlash = 0; @@ -2057,10 +2058,11 @@ var messages_priority_2 = func { ECAM_controller.warningReset(fctlSpdBrkStillOut); } + gearPosition = pts.Gear.position[1].getValue(); if (directLaw.clearFlag == 0 and warningNodes.Timers.directLaw.getValue() and phaseVar2 != 4 and phaseVar2 != 5 and phaseVar2 != 7 and phaseVar2 != 8) { directLaw.active = 1; directLawProt.active = 1; - if (directLawMaxSpeed.clearFlag == 0 and !fbw.tripleADRFail and pts.Gear.position[1].getValue() == 1) { + if (directLawMaxSpeed.clearFlag == 0 and !fbw.tripleADRFail and gearPosition != 1) { directLawMaxSpeed.active = 1; } else { ECAM_controller.warningReset(directLawMaxSpeed); @@ -2070,12 +2072,12 @@ var messages_priority_2 = func { } else { ECAM_controller.warningReset(directLawTrim); } - if (directLawCare.clearFlag == 0 and (fbw.tripleADRFail or pts.Gear.position[1].getValue() == 1)) { + if (directLawCare.clearFlag == 0 and (fbw.tripleADRFail or gearPosition != 1)) { directLawCare.active = 1; } else { ECAM_controller.warningReset(directLawCare); } - if (directLawSpdBrk.clearFlag == 0 and !fbw.tripleADRFail and pts.Gear.position[1].getValue() == 1) { + if (directLawSpdBrk.clearFlag == 0 and !fbw.tripleADRFail and gearPosition != 1) { directLawSpdBrk.active = 1; } else { ECAM_controller.warningReset(directLawSpdBrk); @@ -2111,7 +2113,13 @@ var messages_priority_2 = func { ECAM_controller.warningReset(altnLawMaxSpeed2); } - if (altnLawMaxSpdBrk.clearFlag == 0 and (fbw.tripleADRFail or warningNodes.Logic.leftElevFail.getValue() or warningNodes.Logic.rightElevFail.getValue())) { + if (altnLawCare.clearFlag == 0 and (fbw.tripleADRFail or gearPosition != 1)) { + altnLawCare.active = 1; + } else { + ECAM_controller.warningReset(altnLawCare); + } + + if (altnLawMaxSpdBrk.clearFlag == 0 and (fbw.tripleADRFail or warningNodes.Logic.leftElevFail.getValue() or warningNodes.Logic.rightElevFail.getValue() or warningNodes.Logic.leftElevNotAvail.getValue())) { altnLawMaxSpdBrk.active = 1; } else { ECAM_controller.warningReset(altnLawMaxSpdBrk); @@ -2121,6 +2129,7 @@ var messages_priority_2 = func { ECAM_controller.warningReset(altnLawProt); ECAM_controller.warningReset(altnLawMaxSpeed); ECAM_controller.warningReset(altnLawMaxSpeed2); + ECAM_controller.warningReset(altnLawCare); ECAM_controller.warningReset(altnLawMaxSpdBrk); } diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas index 4eabac35..58c1451f 100644 --- a/Nasal/ECAM/ECAM-messages.nas +++ b/Nasal/ECAM/ECAM-messages.nas @@ -501,6 +501,7 @@ var warnings = std.Vector.new([ var altnLawProt = warning.new(msg: " (PROT LOST)", colour: "a"), var altnLawMaxSpeed = warning.new(msg: " MAX SPEED........320 KT", colour: "c"), var altnLawMaxSpeed2 = warning.new(msg: " MAX SPEED........320/.77", colour: "c"), + var altnLawCare = warning.new(msg: " MANEUVER WITH CARE", colour: "c"), var altnLawMaxSpdBrk = warning.new(msg: " SPD BRK.......DO NOT USE", colour: "c"), # Autothrust diff --git a/Nasal/ECAM/ECAM-nodes.nas b/Nasal/ECAM/ECAM-nodes.nas index 21b38d32..ac6dbf41 100644 --- a/Nasal/ECAM/ECAM-nodes.nas +++ b/Nasal/ECAM/ECAM-nodes.nas @@ -117,7 +117,9 @@ var warningNodes = { greenYellow: props.globals.initNode("/ECAM/warnings/hyd/green-yellow-failure"), greenYellowFuel: props.globals.initNode("/ECAM/warnings/hyd/green-yellow-fuel-consumpt"), leftElevFail: props.globals.initNode("/ECAM/warnings/fctl/leftElevFault"), + leftElevNotAvail: props.globals.initNode("ECAM/warnings/fctl/leftElevFault-cond"), rightElevFail: props.globals.initNode("/ECAM/warnings/fctl/rightElevFault"), + rightElevNotAvail: props.globals.initNode("ECAM/warnings/fctl/rightElevFault-cond"), flapNotZero: props.globals.initNode("/ECAM/warnings/fctl/flaps-not-zero"), slatsConfig: props.globals.initNode("/ECAM/warnings/fctl/slats-config-output"), flapsConfig: props.globals.initNode("/ECAM/warnings/fctl/flaps-config-output"), From 3881343f12fed34a2f1a293384b78243508d65ca Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sat, 23 Oct 2021 15:09:28 +0100 Subject: [PATCH 02/10] MCDU webpanel - improved refresh function by tdammers --- WebPanel/mcdu.html | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/WebPanel/mcdu.html b/WebPanel/mcdu.html index d28da2fb..a6ebb489 100644 --- a/WebPanel/mcdu.html +++ b/WebPanel/mcdu.html @@ -14,8 +14,8 @@ let blank_src; let loading = 0; let scheduled_load = 0; - function refresh_screen() { - if (loading) { + function refresh_screen(force) { + if (loading && !force) { scheduled_load = 1; } else { @@ -100,7 +100,19 @@ }); blank_src = screen_src; screen_src = "/screenshot?canvasindex=10&type=png"; - setInterval(refresh_screen, 1000); + screen.addEventListener('error', function () { + loading = 0; + if (scheduled_load) { + refresh_screen(); + } + }); + screen.addEventListener('abort', function () { + loading = 0; + if (scheduled_load) { + refresh_screen(); + } + }); + setInterval(function () { refresh_screen(true); }, 1000); }, true);