thrust locked function

This commit is contained in:
Jonathan Redpath 2018-12-29 13:17:00 +00:00
parent 772e9f93c7
commit ee9b1ba066
2 changed files with 58 additions and 0 deletions

View file

@ -187,6 +187,37 @@ var ECAM_controller = {
setprop("/ECAM/warnings/overflow", 0); setprop("/ECAM/warnings/overflow", 0);
} }
}, },
reset: func() {
foreach (var w; warnings.vector) {
if (w.active == 1) {
w.active = 0;
}
}
foreach (var l; leftmemos.vector) {
if (l.active == 1) {
l.active = 0;
}
}
foreach (var sL; specialLines.vector) {
if (sL.active == 1) {
sL.active = 0;
}
}
foreach (var sF; secondaryFailures.vector) {
if (sF.active == 1) {
sF.active = 0;
}
}
foreach (var m; memos.vector) {
if (m.active == 1) {
m.active = 0;
}
}
},
}; };
var ECAMloopTimer = maketimer(0.2, func { var ECAMloopTimer = maketimer(0.2, func {

View file

@ -277,7 +277,12 @@ var apWarn = func(type) {
} }
var athrOff = func(type) { var athrOff = func(type) {
if (type == "hard") {
lockThr();
}
setprop("/it-autoflight/input/athr", 0); setprop("/it-autoflight/input/athr", 0);
athrWarn(type); athrWarn(type);
} }
@ -293,3 +298,25 @@ var athrWarn = func(type) {
} }
setprop("/ECAM/warnings/master-caution-light", 1); setprop("/ECAM/warnings/master-caution-light", 1);
} }
var lockThr = func() {
state1 = getprop("/systems/thrust/state1");
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)) {
setprop("/systems/thrust/thr-locked", 1);
}
lockTimer.start();
}
var checkLockThr = func() {
state1 = getprop("/systems/thrust/state1");
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)) {
setprop("/systems/thrust/thr-locked", 0);
lockTimer.stop();
}
}
var lockTimer = maketimer(0.02, checkLockThr);