Thrust Lock logic improve
This commit is contained in:
parent
95be0a6fbe
commit
859bc8febc
6 changed files with 72 additions and 26 deletions
|
@ -5030,9 +5030,9 @@
|
|||
setprop("/it-autoflight/output/athr-warning", 0);
|
||||
}
|
||||
|
||||
if (getprop("/sim/sound/warnings/chime") == 1) {
|
||||
setprop("/sim/sound/warnings/chime", 0);
|
||||
}
|
||||
# if (getprop("/sim/sound/warnings/chime") == 1) {
|
||||
# setprop("/sim/sound/warnings/chime", 0);
|
||||
#}
|
||||
</script>
|
||||
</binding>
|
||||
</action>
|
||||
|
|
|
@ -25,6 +25,8 @@ var lineIndex = 0;
|
|||
var rightLineIndex = 0;
|
||||
var statusIndex = 0;
|
||||
|
||||
var flash = 0;
|
||||
|
||||
var warning = {
|
||||
new: func(msg,colour = "g",aural = 9,light = 9,hasSubmsg = 0,lastSubmsg = 0) {
|
||||
var t = {parents:[warning]};
|
||||
|
@ -60,19 +62,15 @@ var warning = {
|
|||
}
|
||||
},
|
||||
warnlight: func() {
|
||||
if (me.light >= 1) {return;}
|
||||
if (me.active == 1 and me.noRepeat == 0) { # only toggle light once per message, allows canceling
|
||||
if (me.light >= 1 or me.noRepeat == 1 or me.active == 0) {return;}
|
||||
lights[me.light].setBoolValue(1);
|
||||
me.noRepeat = 1;
|
||||
}
|
||||
},
|
||||
sound: func() {
|
||||
if (me.aural > 1) {return;}
|
||||
if (me.active == 1) {
|
||||
if (!aural[me.aural].getBoolValue()) {
|
||||
if (me.aural > 1 or me.active == 0) {return;}
|
||||
#if (!aural[me.aural].getBoolValue()) {
|
||||
aural[me.aural].setBoolValue(1);
|
||||
}
|
||||
}
|
||||
#}
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -161,11 +159,19 @@ var ECAM_controller = {
|
|||
|
||||
foreach (var w; warnings.vector) {
|
||||
w.write();
|
||||
w.warnlight();
|
||||
w.sound();
|
||||
}
|
||||
|
||||
if (lines[0].getValue() == "") { # disable left memos if a warning exists. Warnings are processed first, so this stops leftmemos if line1 is not empty
|
||||
foreach (var w2; warnings.vector) {
|
||||
if (w2.active == 1) {
|
||||
if (w2.noRepeat == 0) {
|
||||
w2.warnlight();
|
||||
}
|
||||
w2.sound();
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (lines[0].getValue() == "" and flash == 0) { # disable left memos if a warning exists. Warnings are processed first, so this stops leftmemos if line1 is not empty
|
||||
foreach (var l; leftmemos.vector) {
|
||||
l.write();
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ var wowNode = props.globals.getNode("/fdm/jsbsim/position/wow", 1);
|
|||
# local variables
|
||||
var phaseVar = nil;
|
||||
var dualFailFACActive = 1;
|
||||
var flash = 0;
|
||||
|
||||
var messages_priority_3 = func {
|
||||
phaseVar = phaseNode.getValue();
|
||||
|
@ -226,7 +227,7 @@ var messages_priority_3 = func {
|
|||
ap_offw.noRepeat = 0;
|
||||
}
|
||||
|
||||
if ((athr_lock.clearFlag == 0) and phaseVar >= 5 and phaseVar <= 7 and getprop("/systems/thrust/thr-locked") == 1) {
|
||||
if ((athr_lock.clearFlag == 0) and phaseVar >= 5 and phaseVar <= 7 and getprop("/systems/thrust/thr-locked-alert") == 1) {
|
||||
athr_lock.active = 1;
|
||||
athr_lock_1.active = 1;
|
||||
} else {
|
||||
|
@ -236,6 +237,12 @@ var messages_priority_3 = func {
|
|||
athr_lock_1.noRepeat = 0;
|
||||
}
|
||||
|
||||
if (getprop("/systems/thrust/thr-locked") == 1) {
|
||||
flash = 1;
|
||||
} else {
|
||||
flash = 0;
|
||||
}
|
||||
|
||||
if ((athr_offw.clearFlag == 0) and athrWarn.getValue() == 2 and phaseVar != 4 and phaseVar != 8 and phaseVar != 10) {
|
||||
athr_offw.active = 1;
|
||||
athr_offw_1.active = 1;
|
||||
|
|
|
@ -180,6 +180,7 @@ var Custom = {
|
|||
athrOff: props.globals.initNode("/it-autoflight/sound/athrsound", 0, "BOOL"),
|
||||
enableAthrOff: 0,
|
||||
},
|
||||
ThrLock: props.globals.getNode("/systems/thrust/thr-locked", 1)
|
||||
};
|
||||
|
||||
var ITAF = {
|
||||
|
@ -492,6 +493,7 @@ var ITAF = {
|
|||
if (s == 1) {
|
||||
if (Misc.acEss.getValue() >= 110) {
|
||||
Output.athr.setBoolValue(1);
|
||||
Custom.ThrLock.setValue(0);
|
||||
Custom.Sound.enableAthrOff = 1;
|
||||
Custom.Sound.athrOff.setBoolValue(0);
|
||||
}
|
||||
|
|
|
@ -635,23 +635,52 @@ var athrWarn = func(type) {
|
|||
}
|
||||
|
||||
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-lock-time", getprop("/sim/time/elapsed-sec"));
|
||||
setprop("/systems/thrust/thr-locked", 1);
|
||||
}
|
||||
|
||||
lockTimer.start();
|
||||
}
|
||||
|
||||
var checkLockThr = func() {
|
||||
if (getprop("/systems/thrust/thr-lock-time") + 5 > getprop("/sim/time/elapsed-sec")) { return; }
|
||||
|
||||
if (getprop("/systems/thrust/thr-locked") == 0) {
|
||||
setprop("/systems/thrust/thr-locked-alert", 0);
|
||||
setprop("/systems/thrust/thr-lock-time", 0);
|
||||
lockTimer.stop();
|
||||
}
|
||||
|
||||
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-alert", 1);
|
||||
setprop("/systems/thrust/thr-lock-time", getprop("/sim/time/elapsed-sec"));
|
||||
lockTimer.stop();
|
||||
lockTimer2.start();
|
||||
}
|
||||
}
|
||||
|
||||
var checkLockThr2 = func() {
|
||||
if (getprop("/systems/thrust/thr-lock-time") + 5 < getprop("/sim/time/elapsed-sec")) {
|
||||
setprop("/systems/thrust/thr-locked-alert", 0);
|
||||
settimer(func() {
|
||||
setprop("/systems/thrust/thr-locked-alert", 1);
|
||||
setprop("/systems/thrust/thr-lock-time", getprop("/sim/time/elapsed-sec"));
|
||||
print(ecam.athr_lock.noRepeat);
|
||||
ecam.athr_lock.noRepeat = 0;
|
||||
print(ecam.athr_lock.noRepeat);
|
||||
}, 0.2);
|
||||
}
|
||||
|
||||
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();
|
||||
setprop("/systems/thrust/thr-locked-alert", 0);
|
||||
lockTimer2.stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var lockTimer = maketimer(0.02, checkLockThr);
|
||||
var lockTimer2 = maketimer(0.02, checkLockThr2);
|
|
@ -52,6 +52,8 @@ setprop("/systems/thrust/lim-flex", 0);
|
|||
setprop("/engines/flex-derate", 0);
|
||||
setprop("/systems/thrust/eng-out", 0);
|
||||
setprop("/systems/thrust/thr-locked", 0);
|
||||
setprop("/systems/thrust/thr-locked-alert", 0);
|
||||
setprop("/systems/thrust/thr-lock-time", 0);
|
||||
setprop("/systems/thrust/thr-lock-cmd[0]", 0);
|
||||
setprop("/systems/thrust/thr-lock-cmd[1]", 0);
|
||||
|
||||
|
|
Reference in a new issue