From f3b767203955d8e4bc767411bc56c8ac94b3ec5c Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sun, 17 Oct 2021 19:40:49 +0100 Subject: [PATCH] FBW: fix restoration from direct to alternate law --- Nasal/ECAM/ECAM-logic.nas | 2 +- Nasal/FBW/it-fbw.nas | 35 ++++++++++++++++------------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 47d360d9..03044edd 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -3239,7 +3239,7 @@ var messages_config_memo = func { ldgMemoLine3.colour = "c"; } - if (getprop("/it-fbw/law") == 1 or getprop("instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override")) { + if (fbw.FBW.activeLaw.getValue() == 1 or pts.Instrumentation.MKVII.Inputs.Discretes.flap3Override.getValue()) { if (pts.Controls.Flight.flapsPos.getValue() == 4) { ldgMemoLine4.msg = " FLAPS CONF 3"; ldgMemoLine4.colour = "g"; diff --git a/Nasal/FBW/it-fbw.nas b/Nasal/FBW/it-fbw.nas index ad04e827..88a68888 100644 --- a/Nasal/FBW/it-fbw.nas +++ b/Nasal/FBW/it-fbw.nas @@ -163,6 +163,8 @@ var FBW = { }, }; +var degradeLaw = 0; + var update_loop = func { elac1 = FBW.Computers.elac1.getBoolValue(); elac2 = FBW.Computers.elac2.getBoolValue(); @@ -210,35 +212,30 @@ var update_loop = func { FBW.degradeYawLaw.setValue(1); } - if (law == 0 and !tripleIRFail) { - FBW.degradeLaw.setValue(1); + if ((law == 0 or law == 2 or law == 3) and !tripleIRFail) { + degradeLaw = 1; if (!tripleSECFault) { FBW.apOff = 1; } - } elsif (tripleIRFail and (law == 0 or law == 1)) { - FBW.degradeLaw.setValue(2); + } elsif (tripleIRFail and (law == 0 or law == 1 or law == 3)) { + degradeLaw = 2; FBW.apOff = 1; } + + if (!pts.Gear.wow[1].getBoolValue() and !pts.Gear.wow[2].getBoolValue()) { + if (degradeLaw == 1 and pts.Controls.Gear.gearDown.getBoolValue()) { + FBW.degradeLaw.setValue(2); # todo 3 sec timer + } else { + FBW.degradeLaw.setValue(degradeLaw) + } + } else { + FBW.degradeLaw.setValue(degradeLaw) + } } else { FBW.degradeYawLaw.setValue(0); FBW.degradeLaw.setValue(0); FBW.apOff = 0; } - - # degrade loop runs faster; reset this variable - law = FBW.activeLaw.getValue(); - - if (!pts.Gear.wow[1].getBoolValue() and !pts.Gear.wow[2].getBoolValue()) { - if (pts.Controls.Gear.gearDown.getBoolValue()) { - if (law == 1) { - FBW.degradeLaw.setValue(2); # todo 3 sec timer - } - } else { - if (law == 2 and !tripleIRFail) { - FBW.degradeLaw.setValue(1); # todo 3 sec timer - } - } - } cas = pts.Instrumentation.AirspeedIndicator.indicatedSpdKt.getValue();