From 1fa30b2b97b7cb6e058fc609c44f942dbdbde3a4 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 29 Oct 2019 14:03:36 +0000 Subject: [PATCH] FCU: fix case sensitive --- Nasal/FMGC/FCU.nas | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index d37c1b3c..dbda3922 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -38,13 +38,20 @@ var apprArm = props.globals.getNode("/it-autoflight/output/appr-armed", 1); var FCU = { elecSupply: "", failed: 0, + condition: 100, new: func(elecNode) { var f = { parents:[FCU] }; f.elecSupply = elecNode; return f; }, loop: func() { - me.failed = me.elecSupply.getValue() < 25 ? 1 : 0; + me.failed = (me.elecSupply.getValue() < 25 or me.condition == 0) ? 1 : 0; + }, + setFail: func() { + me.condition = 0; + }, + restore: func() { + me.condition = 100; }, }; @@ -52,11 +59,15 @@ var FCUController = { FCU1: nil, FCU2: nil, FCUworking: 0, + _init: 0, init: func() { me.FCU1 = FCU.new(systems.ELEC.Bus.dcEssShed); me.FCU2 = FCU.new(systems.ELEC.Bus.dc2); + me._init = 1; }, loop: func() { + if (me._init == 0) { return; } + # Update FCU Power me.FCU1.loop(); me.FCU2.loop(); @@ -67,7 +78,11 @@ var FCUController = { me.FCUworking = 0; } }, - + resetFail: func() { + if (me._init == 0) { return; } + me.FCU1.restore(); + me.FCU2.restore(); + }, AP1: func() { if (me.FCUworking) { if (!ap1.getBoolValue()) {