Thrust Lock logic improve

This commit is contained in:
legoboyvdlp R 2019-03-16 10:43:52 +00:00
parent 95be0a6fbe
commit 859bc8febc
6 changed files with 72 additions and 26 deletions

View file

@ -5030,9 +5030,9 @@
setprop("/it-autoflight/output/athr-warning", 0); setprop("/it-autoflight/output/athr-warning", 0);
} }
if (getprop("/sim/sound/warnings/chime") == 1) { # if (getprop("/sim/sound/warnings/chime") == 1) {
setprop("/sim/sound/warnings/chime", 0); # setprop("/sim/sound/warnings/chime", 0);
} #}
</script> </script>
</binding> </binding>
</action> </action>

View file

@ -25,6 +25,8 @@ var lineIndex = 0;
var rightLineIndex = 0; var rightLineIndex = 0;
var statusIndex = 0; var statusIndex = 0;
var flash = 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) {
var t = {parents:[warning]}; var t = {parents:[warning]};
@ -60,19 +62,15 @@ var warning = {
} }
}, },
warnlight: func() { warnlight: func() {
if (me.light >= 1) {return;} if (me.light >= 1 or me.noRepeat == 1 or me.active == 0) {return;}
if (me.active == 1 and me.noRepeat == 0) { # only toggle light once per message, allows canceling
lights[me.light].setBoolValue(1); lights[me.light].setBoolValue(1);
me.noRepeat = 1; me.noRepeat = 1;
}
}, },
sound: func() { sound: func() {
if (me.aural > 1) {return;} if (me.aural > 1 or me.active == 0) {return;}
if (me.active == 1) { #if (!aural[me.aural].getBoolValue()) {
if (!aural[me.aural].getBoolValue()) {
aural[me.aural].setBoolValue(1); aural[me.aural].setBoolValue(1);
} #}
}
}, },
}; };
@ -161,11 +159,19 @@ var ECAM_controller = {
foreach (var w; warnings.vector) { foreach (var w; warnings.vector) {
w.write(); 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) { foreach (var l; leftmemos.vector) {
l.write(); l.write();
} }

View file

@ -19,6 +19,7 @@ var wowNode = props.globals.getNode("/fdm/jsbsim/position/wow", 1);
# local variables # local variables
var phaseVar = nil; var phaseVar = nil;
var dualFailFACActive = 1; var dualFailFACActive = 1;
var flash = 0;
var messages_priority_3 = func { var messages_priority_3 = func {
phaseVar = phaseNode.getValue(); phaseVar = phaseNode.getValue();
@ -226,7 +227,7 @@ var messages_priority_3 = func {
ap_offw.noRepeat = 0; 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.active = 1;
athr_lock_1.active = 1; athr_lock_1.active = 1;
} else { } else {
@ -236,6 +237,12 @@ var messages_priority_3 = func {
athr_lock_1.noRepeat = 0; 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) { if ((athr_offw.clearFlag == 0) and athrWarn.getValue() == 2 and phaseVar != 4 and phaseVar != 8 and phaseVar != 10) {
athr_offw.active = 1; athr_offw.active = 1;
athr_offw_1.active = 1; athr_offw_1.active = 1;

View file

@ -180,6 +180,7 @@ var Custom = {
athrOff: props.globals.initNode("/it-autoflight/sound/athrsound", 0, "BOOL"), athrOff: props.globals.initNode("/it-autoflight/sound/athrsound", 0, "BOOL"),
enableAthrOff: 0, enableAthrOff: 0,
}, },
ThrLock: props.globals.getNode("/systems/thrust/thr-locked", 1)
}; };
var ITAF = { var ITAF = {
@ -492,6 +493,7 @@ var ITAF = {
if (s == 1) { if (s == 1) {
if (Misc.acEss.getValue() >= 110) { if (Misc.acEss.getValue() >= 110) {
Output.athr.setBoolValue(1); Output.athr.setBoolValue(1);
Custom.ThrLock.setValue(0);
Custom.Sound.enableAthrOff = 1; Custom.Sound.enableAthrOff = 1;
Custom.Sound.athrOff.setBoolValue(0); Custom.Sound.athrOff.setBoolValue(0);
} }

View file

@ -635,23 +635,52 @@ var athrWarn = func(type) {
} }
var lockThr = func() { var lockThr = func() {
state1 = getprop("/systems/thrust/state1"); setprop("/systems/thrust/thr-lock-time", getprop("/sim/time/elapsed-sec"));
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); setprop("/systems/thrust/thr-locked", 1);
}
lockTimer.start(); lockTimer.start();
} }
var checkLockThr = func() { 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"); 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)) {
setprop("/systems/thrust/thr-locked", 0); setprop("/systems/thrust/thr-locked", 0);
lockTimer.stop(); setprop("/systems/thrust/thr-locked-alert", 0);
lockTimer2.stop();
} }
} }
var lockTimer = maketimer(0.02, checkLockThr); var lockTimer = maketimer(0.02, checkLockThr);
var lockTimer2 = maketimer(0.02, checkLockThr2);

View file

@ -52,6 +52,8 @@ setprop("/systems/thrust/lim-flex", 0);
setprop("/engines/flex-derate", 0); setprop("/engines/flex-derate", 0);
setprop("/systems/thrust/eng-out", 0); setprop("/systems/thrust/eng-out", 0);
setprop("/systems/thrust/thr-locked", 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[0]", 0);
setprop("/systems/thrust/thr-lock-cmd[1]", 0); setprop("/systems/thrust/thr-lock-cmd[1]", 0);