Failures call status properly, fix large bug in thrust lock

This commit is contained in:
legoboyvdlp R 2019-03-20 16:29:54 +00:00
parent 3ea6a4c3ce
commit 0f26acf4b9
3 changed files with 31 additions and 17 deletions

View file

@ -301,7 +301,6 @@ var LowerECAM = {
setprop("/it-autoflight/output/athr-warning", 0); setprop("/it-autoflight/output/athr-warning", 0);
setprop("/ECAM/Lower/light/clr", 0); setprop("/ECAM/Lower/light/clr", 0);
setprop("/ECAM/warnings/master-caution-light", 0); setprop("/ECAM/warnings/master-caution-light", 0);
LowerECAM.failCall("sts");
return; return;
} }
@ -309,12 +308,12 @@ var LowerECAM = {
setprop("/it-autoflight/output/ap-warning", 0); setprop("/it-autoflight/output/ap-warning", 0);
setprop("/ECAM/Lower/light/clr", 0); setprop("/ECAM/Lower/light/clr", 0);
setprop("/ECAM/warnings/master-warning-light", 0); setprop("/ECAM/warnings/master-warning-light", 0);
LowerECAM.failCall("sts");
return; return;
} }
if (b == "clr" and getprop("/ECAM/Lower/man-select") == 0 and getprop("/ECAM/Lower/fault-select") == 0) { if (b == "clr" and getprop("/ECAM/Lower/man-select") == 0 and getprop("/ECAM/Lower/fault-select") == 0) {
ecam.ECAM_controller.clear(); ecam.ECAM_controller.clear();
return;
} }
if (getprop("/ECAM/Lower/fault-select") == 0) { if (getprop("/ECAM/Lower/fault-select") == 0) {

View file

@ -26,6 +26,8 @@ var rightLineIndex = 0;
var statusIndex = 0; var statusIndex = 0;
var flash = 0; var flash = 0;
var hasCleared = 0;
var statusFlag = 0;
var warning = { var warning = {
new: func(msg,colour = "g",aural = 9,light = 9,hasSubmsg = 0,lastSubmsg = 0) { new: func(msg,colour = "g",aural = 9,light = 9,hasSubmsg = 0,lastSubmsg = 0) {
@ -45,7 +47,7 @@ var warning = {
return t return t
}, },
write: func() { write: func() {
if (me.active == 0) {return;} if (me.active == 0) { return; }
lineIndex = 0; lineIndex = 0;
while (lineIndex < 7 and lines[lineIndex].getValue() != "") { while (lineIndex < 7 and lines[lineIndex].getValue() != "") {
lineIndex = lineIndex + 1; # go to next line until empty line lineIndex = lineIndex + 1; # go to next line until empty line
@ -69,15 +71,11 @@ var warning = {
}, },
sound: func() { sound: func() {
if (me.aural > 1 or me.noRepeat2 == 1 or me.active == 0) {return;} if (me.aural > 1 or me.noRepeat2 == 1 or me.active == 0) {return;}
aural[me.aural].setBoolValue(0);
me.noRepeat2 = 1; me.noRepeat2 = 1;
if (aural[me.aural].getBoolValue()) { settimer(func() {
aural[me.aural].setBoolValue(0); aural[me.aural].setBoolValue(1);
settimer(func() { }, 0.15);
aural[me.aural].setBoolValue(1);
}, 0.15);
} else {
aural[me.aural].setBoolValue(1);
}
}, },
}; };
@ -236,16 +234,20 @@ var ECAM_controller = {
} }
}, },
clear: func() { clear: func() {
hasCleared = 0;
foreach (var w; warnings.vector) { foreach (var w; warnings.vector) {
if (w.active == 1) { if (w.active == 1) {
if (w.hasSubmsg == 1) { continue; } if (w.hasSubmsg == 1) { continue; }
w.clearFlag = 1; w.clearFlag = 1;
hasCleared = 1;
statusFlag = 1;
break; break;
} }
} }
if (lines[0].getValue() == "") { # all messages cleared - call status if (hasCleared == 0 and statusFlag == 1) {
libraries.LowerECAM.failCall("sts"); libraries.LowerECAM.failCall("sts");
statusFlag = 0;
} }
}, },
recall: func() { recall: func() {

View file

@ -635,9 +635,13 @@ var athrWarn = func(type) {
} }
var lockThr = func() { var lockThr = func() {
setprop("/systems/thrust/thr-lock-time", getprop("/sim/time/elapsed-sec")); state1 = getprop("/systems/thrust/state1");
setprop("/systems/thrust/thr-locked", 1); state2 = getprop("/systems/thrust/state2");
lockTimer.start(); if ((state1 == "CL" and state2 == "CL" and getprop("/systems/thrust/eng-out") == 0) or (state1 == "MCT" and state2 == "MCT" and getprop("/systems/thrust/eng-out") == 1)) {
setprop("/systems/thrust/thr-lock-time", getprop("/sim/time/elapsed-sec"));
setprop("/systems/thrust/thr-locked", 1);
lockTimer.start();
}
} }
var checkLockThr = func() { var checkLockThr = func() {
@ -664,7 +668,13 @@ var checkLockThr = func() {
state1 = getprop("/systems/thrust/state1"); state1 = getprop("/systems/thrust/state1");
state2 = getprop("/systems/thrust/state2"); state2 = getprop("/systems/thrust/state2");
if ((state1 == "CL" and state2 == "CL" and getprop("/systems/thrust/eng-out") == 0) or (state1 == "MCT" and state2 == "MCT" and getprop("/systems/thrust/eng-out") == 1)) { if ((state1 != "CL" and state2 != "CL" and getprop("/systems/thrust/eng-out") == 0) or (state1 != "MCT" and state2 != "MCT" and getprop("/systems/thrust/eng-out") == 1)) {
lockTimer.stop();
setprop("/systems/thrust/thr-locked", 0);
setprop("/systems/thrust/thr-locked-alert", 0);
setprop("/systems/thrust/thr-lock-time", 0);
setprop("/systems/thrust/thr-locked-flash", 0);
} elsif ((state1 == "CL" and state2 == "CL" and getprop("/systems/thrust/eng-out") == 0) or (state1 == "MCT" and state2 == "MCT" and getprop("/systems/thrust/eng-out") == 1)) {
setprop("/systems/thrust/thr-locked-alert", 1); setprop("/systems/thrust/thr-locked-alert", 1);
setprop("/systems/thrust/thr-lock-time", getprop("/sim/time/elapsed-sec")); setprop("/systems/thrust/thr-lock-time", getprop("/sim/time/elapsed-sec"));
setprop("/systems/thrust/thr-locked-flash", 1); setprop("/systems/thrust/thr-locked-flash", 1);
@ -704,11 +714,14 @@ var checkLockThr2 = func() {
state1 = getprop("/systems/thrust/state1"); state1 = getprop("/systems/thrust/state1");
state2 = getprop("/systems/thrust/state2"); state2 = getprop("/systems/thrust/state2");
if ((state1 != "CL" and state2 != "CL" and getprop("/systems/thrust/eng-out") == 0) or (state1 != "MCT" and state2 != "MCT" and getprop("/systems/thrust/eng-out") == 1)) { if ((state1 != "CL" and state2 != "CL" and getprop("/systems/thrust/eng-out") == 0) or (state1 != "MCT" and state2 != "MCT" and getprop("/systems/thrust/eng-out") == 1)) {
lockTimer2.stop();
setprop("/systems/thrust/thr-locked", 0); setprop("/systems/thrust/thr-locked", 0);
setprop("/systems/thrust/thr-locked-alert", 0); setprop("/systems/thrust/thr-locked-alert", 0);
setprop("/systems/thrust/thr-lock-time", 0);
setprop("/systems/thrust/thr-locked-flash", 0); setprop("/systems/thrust/thr-locked-flash", 0);
lockTimer2.stop();
} }
} }