finish thrust lock

This commit is contained in:
legoboyvdlp R 2019-03-16 16:39:29 +00:00
parent 2c659c9deb
commit 6dce56234f
6 changed files with 67 additions and 72 deletions

View file

@ -296,23 +296,6 @@ ECAM.MSGclr();
var LowerECAM = { var LowerECAM = {
button: func(b) { button: func(b) {
man_sel = getprop("/ECAM/Lower/man-select");
if (b == "clr" and getprop("/it-autoflight/output/athr-warning") == 2) {
setprop("/it-autoflight/output/athr-warning", 0);
setprop("/ECAM/Lower/light/clr", 0);
setprop("/ECAM/warnings/master-caution-light", 0);
LowerECAM.failCall("sts");
return;
}
if (b == "clr" and getprop("/it-autoflight/output/ap-warning") == 2) {
setprop("/it-autoflight/output/ap-warning", 0);
setprop("/ECAM/Lower/light/clr", 0);
setprop("/ECAM/warnings/master-warning-light", 0);
LowerECAM.failCall("sts");
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();
} }

View file

@ -39,6 +39,7 @@ var warning = {
t.lastSubmsg = lastSubmsg; t.lastSubmsg = lastSubmsg;
t.active = 0; t.active = 0;
t.noRepeat = 0; t.noRepeat = 0;
t.noRepeat2 = 0;
t.clearFlag = 0; t.clearFlag = 0;
return t return t
@ -62,16 +63,19 @@ var warning = {
} }
}, },
warnlight: func() { warnlight: func() {
if (me.light >= 1 or me.noRepeat == 1 or me.active == 0) {return;} if (me.light > 1 or me.noRepeat == 1 or me.active == 0) {return;}
lights[me.light].setBoolValue(1); lights[me.light].setBoolValue(1);
me.noRepeat = 1; me.noRepeat = 1;
}, },
sound: func() { sound: func() {
if (me.aural > 1 or me.active == 0) {return;} if (me.aural > 1 or me.noRepeat2 == 1 or me.active == 0) {return;}
#if (!aural[me.aural].getBoolValue()) { warning.cycleSound(me.aural);
aural[me.aural].setBoolValue(1); me.noRepeat2 = 1;
#}
}, },
cycleSound: func(type) {
aural[type].setBoolValue(0);
aural[type].setBoolValue(1);
}
}; };
var memo = { var memo = {
@ -166,7 +170,9 @@ var ECAM_controller = {
if (w2.noRepeat == 0) { if (w2.noRepeat == 0) {
w2.warnlight(); w2.warnlight();
} }
w2.sound(); if (w2.noRepeat2 == 0) {
w2.sound();
}
break break
} }
} }
@ -234,6 +240,10 @@ var ECAM_controller = {
break; break;
} }
} }
if (lines[0].getValue() == "") { # all messages cleared - call status
libraries.LowerECAM.failCall("sts");
}
}, },
recall: func() { recall: func() {
foreach (var w; warnings.vector) { foreach (var w; warnings.vector) {
@ -244,6 +254,11 @@ var ECAM_controller = {
} }
} }
}, },
warningReset: func(warning) {
warning.active = 0;
warning.noRepeat = 0;
warning.noRepeat2 = 0;
},
}; };
setlistener("/systems/electrical/bus/dc-ess", func { setlistener("/systems/electrical/bus/dc-ess", func {

View file

@ -28,9 +28,7 @@ var messages_priority_3 = func {
if ((flap_not_zero.clearFlag == 0) and phaseVar == 6 and getprop("/controls/flight/flap-lever") != 0 and getprop("/instrumentation/altimeter/indicated-altitude-ft") > 22000) { if ((flap_not_zero.clearFlag == 0) and phaseVar == 6 and getprop("/controls/flight/flap-lever") != 0 and getprop("/instrumentation/altimeter/indicated-altitude-ft") > 22000) {
flap_not_zero.active = 1; flap_not_zero.active = 1;
} else { } else {
flap_not_zero.active = 0; ECAM_controller.warningReset(flap_not_zero);
flap_not_zero.noRepeat = 0;
flap_not_zero.clearFlag = 0;
} }
# ENG DUAL FAIL # ENG DUAL FAIL
@ -38,9 +36,7 @@ var messages_priority_3 = func {
if (phaseVar >= 5 and phaseVar <= 7 and dualFailNode.getBoolValue()) { if (phaseVar >= 5 and phaseVar <= 7 and dualFailNode.getBoolValue()) {
dualFail.active = 1; dualFail.active = 1;
} elsif (dualFail.clearFlag == 1) { } elsif (dualFail.clearFlag == 1) {
dualFail.active = 0; ECAM_controller.warningReset(dualFail);
dualFail.noRepeat = 0;
dualFail.clearFlag = 0;
dualFailFACActive = 1; # reset FAC local variable dualFailFACActive = 1; # reset FAC local variable
} }
@ -166,78 +162,74 @@ var messages_priority_3 = func {
slats_config.active = 1; slats_config.active = 1;
slats_config_1.active = 1; slats_config_1.active = 1;
} else { } else {
slats_config.active = 0; ECAM_controller.warningReset(slats_config);
slats_config.noRepeat = 0; ECAM_controller.warningReset(slats_config_1);
slats_config_1.active = 0;
slats_config_1.noRepeat = 0;
} }
if ((flaps_config.clearFlag == 0) and (getprop("/controls/flight/flap-lever") == 0 or getprop("/controls/flight/flap-lever") == 4) and phaseVar >= 3 and phaseVar <= 4) { if ((flaps_config.clearFlag == 0) and (getprop("/controls/flight/flap-lever") == 0 or getprop("/controls/flight/flap-lever") == 4) and phaseVar >= 3 and phaseVar <= 4) {
flaps_config.active = 1; flaps_config.active = 1;
flaps_config_1.active = 1; flaps_config_1.active = 1;
} else { } else {
flaps_config.active = 0; ECAM_controller.warningReset(flaps_config);
flaps_config.noRepeat = 0; ECAM_controller.warningReset(flaps_config_1);
flaps_config_1.active = 0;
flaps_config_1.noRepeat = 0;
} }
if ((spd_brk_config.clearFlag == 0) and getprop("/controls/flight/speedbrake") != 0 and phaseVar >= 3 and phaseVar <= 4) { if ((spd_brk_config.clearFlag == 0) and getprop("/controls/flight/speedbrake") != 0 and phaseVar >= 3 and phaseVar <= 4) {
spd_brk_config.active = 1; spd_brk_config.active = 1;
spd_brk_config_1.active = 1; spd_brk_config_1.active = 1;
} else { } else {
spd_brk_config.active = 0; ECAM_controller.warningReset(spd_brk_config);
spd_brk_config.noRepeat = 0; ECAM_controller.warningReset(spd_brk_config_1);
spd_brk_config_1.active = 0;
spd_brk_config_1.noRepeat = 0;
} }
if ((pitch_trim_config.clearFlag == 0) and (getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") > 1.75 or getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") < -3.65) and phaseVar >= 3 and phaseVar <= 4) { if ((pitch_trim_config.clearFlag == 0) and (getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") > 1.75 or getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") < -3.65) and phaseVar >= 3 and phaseVar <= 4) {
pitch_trim_config.active = 1; pitch_trim_config.active = 1;
pitch_trim_config_1.active = 1; pitch_trim_config_1.active = 1;
} else { } else {
pitch_trim_config.active = 0; ECAM_controller.warningReset(pitch_trim_config);
pitch_trim_config.noRepeat = 0; ECAM_controller.warningReset(pitch_trim_config_1);
pitch_trim_config_1.active = 0;
pitch_trim_config_1.noRepeat = 0;
} }
if ((rud_trim_config.clearFlag == 0) and (getprop("/fdm/jsbsim/hydraulics/rudder/trim-cmd-deg") < -3.55 or getprop("/fdm/jsbsim/hydraulics/rudder/trim-cmd-deg") > 3.55) and phaseVar >= 3 and phaseVar <= 4) { if ((rud_trim_config.clearFlag == 0) and (getprop("/fdm/jsbsim/hydraulics/rudder/trim-cmd-deg") < -3.55 or getprop("/fdm/jsbsim/hydraulics/rudder/trim-cmd-deg") > 3.55) and phaseVar >= 3 and phaseVar <= 4) {
rud_trim_config.active = 1; rud_trim_config.active = 1;
rud_trim_config_1.active = 1; rud_trim_config_1.active = 1;
} else { } else {
rud_trim_config.active = 0; ECAM_controller.warningReset(rud_trim_config);
rud_trim_config.noRepeat = 0; ECAM_controller.warningReset(rud_trim_config_1);
rud_trim_config_1.active = 0;
rud_trim_config_1.noRepeat = 0;
} }
if ((park_brk_config.clearFlag == 0) and getprop("/controls/gear/brake-parking") == 1 and phaseVar >= 3 and phaseVar <= 4) { if ((park_brk_config.clearFlag == 0) and getprop("/controls/gear/brake-parking") == 1 and phaseVar >= 3 and phaseVar <= 4) {
park_brk_config.active = 1; park_brk_config.active = 1;
} else { } else {
park_brk_config.active = 0; ECAM_controller.warningReset(park_brk_config);
park_brk_config.noRepeat = 0;
} }
# AUTOFLT # AUTOFLT
if ((ap_offw.clearFlag == 0) and apWarn.getValue() == 2) { if ((ap_offw.clearFlag == 0) and apWarn.getValue() == 2) {
ap_offw.active = 1; ap_offw.active = 1;
} else { } else {
ap_offw.active = 0; ECAM_controller.warningReset(ap_offw);
ap_offw.noRepeat = 0; if (getprop("/it-autoflight/output/ap-warning") == 2) {
setprop("/it-autoflight/output/ap-warning", 0);
setprop("/ECAM/Lower/light/clr", 0);
setprop("/ECAM/warnings/master-warning-light", 0);
}
} }
if ((athr_lock.clearFlag == 0) and phaseVar >= 5 and phaseVar <= 7 and getprop("/systems/thrust/thr-locked-alert") == 1) { if ((athr_lock.clearFlag == 0) and phaseVar >= 5 and phaseVar <= 7 and getprop("/systems/thrust/thr-locked-alert") == 1) {
if (getprop("/systems/thrust/thr-locked-flash") == 0) {
athr_lock.msg = " ";
} else {
athr_lock.msg = msgSave
}
athr_lock.active = 1; athr_lock.active = 1;
athr_lock_1.active = 1; athr_lock_1.active = 1;
} else { } else {
athr_lock.active = 0; ECAM_controller.warningReset(athr_lock);
athr_lock_1.active = 0; ECAM_controller.warningReset(athr_lock_1);
athr_lock.noRepeat = 0;
athr_lock_1.noRepeat = 0;
} }
if (getprop("/systems/thrust/thr-locked") == 1) { if (getprop("/systems/thrust/thr-locked-alert") == 1) {
flash = 1; flash = 1;
} else { } else {
flash = 0; flash = 0;
@ -247,20 +239,21 @@ var messages_priority_3 = func {
athr_offw.active = 1; athr_offw.active = 1;
athr_offw_1.active = 1; athr_offw_1.active = 1;
} else { } else {
athr_offw.active = 0; ECAM_controller.warningReset(athr_offw);
athr_offw_1.active = 0; ECAM_controller.warningReset(athr_offw_1);
athr_offw.noRepeat = 0; if (getprop("/it-autoflight/output/athr-warning") == 2) {
athr_offw_1.noRepeat = 0; setprop("/it-autoflight/output/athr-warning", 0);
setprop("/ECAM/Lower/light/clr", 0);
setprop("/ECAM/warnings/master-caution-light", 0);
}
} }
if ((athr_lim.clearFlag == 0) and getprop("/it-autoflight/output/athr") == 1 and ((getprop("/systems/thrust/eng-out") != 1 and (getprop("/systems/thrust/state1") == "MAN" or getprop("/systems/thrust/state2") == "MAN")) or (getprop("/systems/thrust/eng-out") == 1 and (getprop("/systems/thrust/state1") == "MAN" or getprop("/systems/thrust/state2") == "MAN" or (getprop("/systems/thrust/state1") == "MAN THR" and getprop("/controls/engines/engine[0]/throttle-pos") <= 0.83) or (getprop("/systems/thrust/state2") == "MAN THR" and getprop("/controls/engines/engine[0]/throttle-pos") <= 0.83)))) and (phaseVar >= 5 and phaseVar <= 7)) { if ((athr_lim.clearFlag == 0) and getprop("/it-autoflight/output/athr") == 1 and ((getprop("/systems/thrust/eng-out") != 1 and (getprop("/systems/thrust/state1") == "MAN" or getprop("/systems/thrust/state2") == "MAN")) or (getprop("/systems/thrust/eng-out") == 1 and (getprop("/systems/thrust/state1") == "MAN" or getprop("/systems/thrust/state2") == "MAN" or (getprop("/systems/thrust/state1") == "MAN THR" and getprop("/controls/engines/engine[0]/throttle-pos") <= 0.83) or (getprop("/systems/thrust/state2") == "MAN THR" and getprop("/controls/engines/engine[0]/throttle-pos") <= 0.83)))) and (phaseVar >= 5 and phaseVar <= 7)) {
athr_lim.active = 1; athr_lim.active = 1;
athr_lim_1.active = 1; athr_lim_1.active = 1;
} else { } else {
athr_lim.active = 0; ECAM_controller.warningReset(athr_lim);
athr_lim_1.active = 0; ECAM_controller.warningReset(athr_lim_1);
athr_lim.noRepeat = 0;
athr_lim_1.noRepeat = 0;
} }
} }

View file

@ -278,4 +278,7 @@ var statusProc = std.Vector.new();
var statusInfo = std.Vector.new(); var statusInfo = std.Vector.new();
var statusCancelled = std.Vector.new(); var statusCancelled = std.Vector.new();
var statusInop = std.Vector.new(); var statusInop = std.Vector.new();
var statusMaintenance = std.Vector.new(); var statusMaintenance = std.Vector.new();
# hack thrust lock message:
var msgSave = athr_lock.msg;

View file

@ -655,6 +655,7 @@ var checkLockThr = func() {
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-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);
lockTimer.stop(); lockTimer.stop();
lockTimer2.start(); lockTimer2.start();
} }
@ -662,14 +663,12 @@ var checkLockThr = func() {
var checkLockThr2 = func() { var checkLockThr2 = func() {
if (getprop("/systems/thrust/thr-lock-time") + 5 < getprop("/sim/time/elapsed-sec")) { if (getprop("/systems/thrust/thr-lock-time") + 5 < getprop("/sim/time/elapsed-sec")) {
setprop("/systems/thrust/thr-locked-alert", 0); setprop("/systems/thrust/thr-locked-flash", 0);
settimer(func() { settimer(func() {
setprop("/systems/thrust/thr-locked-alert", 1); setprop("/systems/thrust/thr-locked-flash", 1);
setprop("/systems/thrust/thr-lock-time", getprop("/sim/time/elapsed-sec")); setprop("/systems/thrust/thr-lock-time", getprop("/sim/time/elapsed-sec"));
print(ecam.athr_lock.noRepeat);
ecam.athr_lock.noRepeat = 0; ecam.athr_lock.noRepeat = 0;
print(ecam.athr_lock.noRepeat); }, 0.15);
}, 0.2);
} }
state1 = getprop("/systems/thrust/state1"); state1 = getprop("/systems/thrust/state1");
@ -677,6 +676,7 @@ var checkLockThr2 = func() {
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);
setprop("/systems/thrust/thr-locked-alert", 0); setprop("/systems/thrust/thr-locked-alert", 0);
setprop("/systems/thrust/thr-locked-flash", 0);
lockTimer2.stop(); lockTimer2.stop();
} }
} }

View file

@ -53,6 +53,7 @@ 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-locked-alert", 0);
setprop("/systems/thrust/thr-locked-flash", 0);
setprop("/systems/thrust/thr-lock-time", 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);