diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 95feac70..b941520a 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) { @@ -1188,6 +1182,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 14aa0f75..82a8c36d 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); } @@ -2237,31 +2246,7 @@ var messages_priority_2 = func { ECAM_controller.warningReset(fac2FaultFacOff); } - if (yawDamper1Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 == 9 or phaseVar2 == 6) and warningNodes.Timers.yawDamper1Fault.getValue() == 1 and !warningNodes.Logic.yawDamper12Fault.getBoolValue()) { - yawDamper1Fault.active = 1; - } else { - ECAM_controller.warningReset(yawDamper1Fault); - } - - if (yawDamper2Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 == 9 or phaseVar2 == 6) and warningNodes.Timers.yawDamper2Fault.getValue() == 1 and !warningNodes.Logic.yawDamper12Fault.getBoolValue()) { - yawDamper2Fault.active = 1; - } else { - ECAM_controller.warningReset(yawDamper2Fault); - } - - if (rudTravLimSys1Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 >= 9 or phaseVar2 == 6) and warningNodes.Logic.rtlu1Fault.getBoolValue()) { - rudTravLimSys1Fault.active = 1; - } else { - ECAM_controller.warningReset(rudTravLimSys1Fault); - } - - if (rudTravLimSys2Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 >= 9 or phaseVar2 == 6) and warningNodes.Logic.rtlu2Fault.getBoolValue()) { - rudTravLimSys2Fault.active = 1; - } else { - ECAM_controller.warningReset(rudTravLimSys2Fault); - } - - if (fcu.FCUController.FCU1.failed and fcu.FCUController.FCU2.failed and systems.ELEC.Bus.dcEss.getValue() >= 25 and systems.ELEC.Bus.dcEss.getValue() >= 25 and fcuFault.clearFlag == 0) { + if (fcu.FCUController.FCU1.failed and fcu.FCUController.FCU2.failed and systems.ELEC.Bus.dcEss.getValue() >= 25 and systems.ELEC.Bus.dc2.getValue() >= 25 and fcuFault.clearFlag == 0) { fcuFault.active = 1; fcuFaultBaro.active = 1; } else { @@ -2269,22 +2254,6 @@ var messages_priority_2 = func { ECAM_controller.warningReset(fcuFaultBaro); } - if (fcu.FCUController.FCU1.failed and !fcu.FCUController.FCU2.failed and systems.ELEC.Bus.dcEss.getValue() >= 25 and fcuFault1.clearFlag == 0) { - fcuFault1.active = 1; - fcuFault1Baro.active = 1; - } else { - ECAM_controller.warningReset(fcuFault1); - ECAM_controller.warningReset(fcuFault1Baro); - } - - if (fcu.FCUController.FCU2.failed and !fcu.FCUController.FCU1.failed and systems.ELEC.Bus.dc2.getValue() >= 25 and fcuFault2.clearFlag == 0) { - fcuFault2.active = 1; - fcuFault2Baro.active = 1; - } else { - ECAM_controller.warningReset(fcuFault2); - ECAM_controller.warningReset(fcuFault2Baro); - } - # FUEL if (wingLoLvl.clearFlag == 0 and warningNodes.Timers.lowLevelBoth.getValue() == 1 and (phaseVar2 <= 2 or phaseVar2 == 6 or phaseVar2 >= 9)) { wingLoLvl.active = 1; @@ -3018,6 +2987,46 @@ var messages_priority_2 = func { ECAM_controller.warningReset(wingIceOpenGndShut); } + if (yawDamper1Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 == 9 or phaseVar2 == 6) and warningNodes.Timers.yawDamper1Fault.getValue() == 1 and !warningNodes.Logic.yawDamper12Fault.getBoolValue()) { + yawDamper1Fault.active = 1; + } else { + ECAM_controller.warningReset(yawDamper1Fault); + } + + if (yawDamper2Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 == 9 or phaseVar2 == 6) and warningNodes.Timers.yawDamper2Fault.getValue() == 1 and !warningNodes.Logic.yawDamper12Fault.getBoolValue()) { + yawDamper2Fault.active = 1; + } else { + ECAM_controller.warningReset(yawDamper2Fault); + } + + if (rudTravLimSys1Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 >= 9 or phaseVar2 == 6) and warningNodes.Logic.rtlu1Fault.getBoolValue()) { + rudTravLimSys1Fault.active = 1; + } else { + ECAM_controller.warningReset(rudTravLimSys1Fault); + } + + if (rudTravLimSys2Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 >= 9 or phaseVar2 == 6) and warningNodes.Logic.rtlu2Fault.getBoolValue()) { + rudTravLimSys2Fault.active = 1; + } else { + ECAM_controller.warningReset(rudTravLimSys2Fault); + } + + if (fcu.FCUController.FCU1.failed and !fcu.FCUController.FCU2.failed and systems.ELEC.Bus.dcEss.getValue() >= 25 and fcuFault1.clearFlag == 0) { + fcuFault1.active = 1; + fcuFault1Baro.active = 1; + } else { + ECAM_controller.warningReset(fcuFault1); + ECAM_controller.warningReset(fcuFault1Baro); + } + + if (fcu.FCUController.FCU2.failed and !fcu.FCUController.FCU1.failed and systems.ELEC.Bus.dc2.getValue() >= 25 and fcuFault2.clearFlag == 0) { + fcuFault2.active = 1; + fcuFault2Baro.active = 1; + } else { + ECAM_controller.warningReset(fcuFault2); + ECAM_controller.warningReset(fcuFault2Baro); + } + if (wingIceLHiPr.clearFlag == 0 and warningNodes.Timers.waiLhiPr.getValue() == 1 and (phaseVar2 <= 2 or phaseVar2 >= 9 or phaseVar2 == 6)) { wingIceLHiPr.active = 1; wingIceLHiPrThrust.active = 1; diff --git a/Nasal/ECAM/ECAM-main.nas b/Nasal/ECAM/ECAM-main.nas index 521c5c96..9deef84b 100644 --- a/Nasal/ECAM/ECAM-main.nas +++ b/Nasal/ECAM/ECAM-main.nas @@ -233,7 +233,7 @@ var ECAMRecipient = if (math.mod(notifications.frameNotification.FrameCount,10) == 0) { phaseLoop(); } - if (math.mod(notifications.frameNotification.FrameCount,10) == 5) { + if (isint(notifications.frameNotification.FrameCount / 5)) { ECAM_controller.loop(notification); } return emesary.Transmitter.ReceiptStatus_OK; 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"), diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index 9fd19ff6..6b371f14 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -20,8 +20,18 @@ var FCU = { f.elecSupply = elecNode; return f; }, - loop: func() { - me.failed = (me.elecSupply.getValue() < 25 or me.condition == 0) ? 1 : 0; + elec: nil, + powerOffTime: -99, + loop: func(notification) { + me.elec = me.elecSupply.getValue(); + if (me.elec < 25) { + if (me.powerOffTime == -99) { + me.powerOffTime = notification.elapsedTime; + } + } else { + me.powerOffTime = -99; + } + me.failed = ((notification.elapsedTime > (me.powerOffTime + 0.25) and me.elec < 25) or me.condition == 0) ? 1 : 0; }, setFail: func() { me.condition = 0; @@ -46,8 +56,8 @@ var FCUController = { if (me._init == 0) { return; } # Update FCU Power - me.FCU1.loop(); - me.FCU2.loop(); + me.FCU1.loop(notification); + me.FCU2.loop(notification); if (!me.FCU1.failed or !me.FCU2.failed) { me.FCUworking = 1; diff --git a/Nasal/MCDU/DUPLICATE.nas b/Nasal/MCDU/DUPLICATE.nas index 9e6c58ee..c5496993 100644 --- a/Nasal/MCDU/DUPLICATE.nas +++ b/Nasal/MCDU/DUPLICATE.nas @@ -134,6 +134,11 @@ var duplicateNamesPage = { } }, pushButtonLeft: func(indexSelect) { + if (indexSelect > size(me.vector)) { + mcdu_message(me.computer, "NOT ALLOWED"); + return; + } + if (!dirToFlag) { if (!me.flagPBD and !me.flagPROG) { if (size(me.vector[0].id) == 5) { diff --git a/Systems/a320-fbw.xml b/Systems/a320-fbw.xml index 5c15614b..8ec6ca99 100644 --- a/Systems/a320-fbw.xml +++ b/Systems/a320-fbw.xml @@ -368,6 +368,123 @@ + + + + + + /systems/hydraulic/blue-psi ge 1500 + /systems/hydraulic/green-psi ge 1500 + /systems/hydraulic/yellow-psi ge 1500 + + + + + + + + /systems/fctl/elac1 eq 1 + + + + + /systems/fctl/power-supply/elac1/relay-condition + 100 + 0.03333333333 + + + + + + /systems/electrical/bus/sub-bus/dc-hot-1-703 ge 25 + /systems/fctl/power-supply/elac1/relay-timer ne 0 + + + + + + + /systems/fctl/power-supply/elac2/relay-power eq 1 + /systems/electrical/bus/sub-bus/dc-2-202 lt 25 + + + /systems/fctl/elac2 eq 1 + /systems/electrical/bus/sub-bus/dc-2-202 lt 25 + + + + + + + + + /systems/hydraulic/blue-psi lt 1500 + /gear/gear[1]/position-norm ne 0 + + /systems/electrical/some-electric-thingie/speed-abv-100 eq 1 + /systems/fctl/power-supply/elac2/relay-power eq 1 + + + + + /systems/fctl/power-supply/elac2/relay-power + 0.03333333333 + 100 + + + + + + /systems/electrical/bus/sub-bus/dc-hot-2-704 ge 25 + /systems/fctl/power-supply/elac2/relay-power eq 1 + + /systems/fctl/power-supply/elac2/relay-power-override eq 1 + /systems/fctl/power-supply/elac2/relay-timer ne 1 + + + + + + + + + + + + /systems/hydraulic/blue-psi ge 1500 + /systems/hydraulic/green-psi ge 1500 + /systems/hydraulic/yellow-psi ge 1500 + + + + + + + + /systems/fctl/sec1 eq 1 + + + + + /systems/fctl/power-supply/sec1/relay-condition + 100 + 0.03333333333 + + + + + + /systems/electrical/bus/sub-bus/dc-hot-1-703 ge 25 + /systems/fctl/power-supply/sec1/relay-timer ne 0 + + + + + @@ -377,19 +494,27 @@ /systems/fctl/elac1 eq 0 - + + + + + /systems/electrical/bus/dc-ess ge 25 + /systems/fctl/power-supply/elac1/relay ge 25 + + + + + /systems/fctl/power-supply/elac1/has-power + 100 + 10 + + /controls/fctl/switches/elac1 eq 1 /systems/failures/fctl/elac1 eq 0 - - /systems/electrical/bus/dc-ess ge 25 - - /systems/electrical/bus/sub-bus/dc-hot-1-703 ge 25 - /gear/gear[1]/wow eq 0 - - + /systems/fctl/power-supply/elac1/has-power-output ne 0 @@ -401,18 +526,26 @@ + + + + /systems/electrical/bus/sub-bus/dc-2-202 ge 25 + /systems/fctl/power-supply/elac2/relay ge 25 + + + + + /systems/fctl/power-supply/elac2/has-power + 100 + 10 + + /controls/fctl/switches/elac2 eq 1 /systems/failures/fctl/elac2 eq 0 - - /systems/electrical/bus/sub-bus/dc-2-202 ge 25 - - /systems/electrical/bus/sub-bus/dc-hot-2-704 ge 25 - /gear/gear[1]/wow eq 0 - - + /systems/fctl/power-supply/elac2/has-power-output ne 0 @@ -424,18 +557,26 @@ + + + + /systems/electrical/bus/dc-ess ge 25 + /systems/fctl/power-supply/sec1/relay ge 25 + + + + + /systems/fctl/power-supply/sec1/has-power + 100 + 10 + + /controls/fctl/switches/sec1 eq 1 /systems/failures/fctl/sec1 eq 0 - - /systems/electrical/bus/dc-ess ge 25 - - /systems/electrical/bus/sub-bus/dc-hot-1-703 ge 25 - /gear/gear[1]/wow eq 0 - - + /systems/fctl/power-supply/sec1/has-power-output ne 0 @@ -447,12 +588,25 @@ + + + + /systems/electrical/bus/sub-bus/dc-2-204 ge 25 + + + + + /systems/fctl/power-supply/sec2/has-power + 100 + 10 + + /controls/fctl/switches/sec2 eq 1 /systems/failures/fctl/sec2 eq 0 - /systems/electrical/bus/sub-bus/dc-2-204 ge 25 + /systems/fctl/power-supply/sec2/has-power-output ne 0 @@ -464,12 +618,26 @@ + + + + /systems/electrical/bus/sub-bus/dc-2-204 ge 25 + + + + + /systems/fctl/power-supply/sec3/has-power + 100 + 10 + + + /controls/fctl/switches/sec3 eq 1 /systems/failures/fctl/sec3 eq 0 - /systems/electrical/bus/sub-bus/dc-2-204 ge 25 + /systems/fctl/power-supply/sec3/has-power-output ne 0 diff --git a/Systems/a320-hydraulic.xml b/Systems/a320-hydraulic.xml index 3f8a0c19..8e858611 100644 --- a/Systems/a320-hydraulic.xml +++ b/Systems/a320-hydraulic.xml @@ -305,7 +305,7 @@ /controls/hydraulic/switches/yellow-elec eq 1 /systems/failures/hydraulic/yellow-elec ne 1 - /systems/electrical/sources/ext/output-volt ge 110 + /systems/electrical/relay/ext-epc/output ge 110 /systems/electrical/bus/ac-2 ge 110 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);