if (getprop("/ECAM/engine-start-time-switch") != 0) {
setprop("/ECAM/engine-start-time-switch", 0);
}
}
if (getprop("/ECAM/warning-phase") >= 3) {
setprop("/ECAM/to-memo-enable", 0);
} else {
setprop("/ECAM/to-memo-enable", 1);
}
if (getprop("/position/gear-agl-ft") <= 2000 and (getprop("/FMGC/status/phase") == 3 or getprop("/FMGC/status/phase") == 4 or getprop("/FMGC/status/phase") == 5) and wow == 0) {
setprop("/ECAM/ldg-memo-enable", 1);
} else if (getprop("/ECAM/left-msg") == "LDG-MEMO" and speed <= 80 and wow == 1) {
setprop("/ECAM/ldg-memo-enable", 0);
} else if (getprop("/ECAM/left-msg") != "LDG-MEMO") {
setprop("/ECAM/ldg-memo-enable", 0);
}
if (stateL == 3 and stateR == 3 and getprop("/ECAM/engine-start-time") + 120 < getprop("/sim/time/elapsed-sec") and getprop("/ECAM/to-memo-enable") == 1 and wow == 1) {
setprop("/ECAM/left-msg", "TO-MEMO");
} elsif (getprop("/ECAM/ldg-memo-enable") == 1) {
setprop("/ECAM/left-msg", "LDG-MEMO");
} elsif (getprop("/ECAM/show-left-msg") == 1) {
setprop("/ECAM/left-msg", "MSG"); # messages should have priority over memos - how?
} else {
setprop("/ECAM/left-msg", "NONE");
}
if (getprop("/ECAM/show-right-msg") == 1) {
setprop("/ECAM/right-msg", "MSG");
} else {
setprop("/ECAM/right-msg", "NONE");
}
if (getprop("/controls/autobrake/mode") == 3 and getprop("/controls/lighting/no-smoking-sign") == 1 and getprop("/controls/lighting/seatbelt-sign") == 1 and getprop("/controls/flight/speedbrake-arm") == 1 and getprop("/controls/flight/flap-pos") > 0
and getprop("/controls/flight/flap-pos") < 5) {
# Do nothing
} else {
setprop("/ECAM/to-config", 0);
}
if (eng == "IAE") {
eprlim = getprop("/controls/engines/epr-limit");
if (abs(getprop("/engines/engine[0]/epr-actual") - eprlim) <= 0.005 or abs(getprop("/engines/engine[0]/epr-actual") - eprlim) <= 0.005) {
toPowerSet = 1;
} else {
toPowerSet = 0;
}
} else {
n1lim = getprop("/controls/engines/n1-limit");
if (abs(getprop("/engines/engine[0]/n1-actual") - n1lim) <= 0.1 or abs(getprop("/engines/engine[0]/n1-actual") - n1lim) <= 0.1) {
toPowerSet = 1;
} else {
toPowerSet = 0;
}
}
# AP / ATHR warnings
if (ap_active == 1 and getprop("/it-autoflight/output/ap-warning") == 0) {
ap_active = 0;
} elsif (ap_active == 1 and getprop("/it-autoflight/output/ap-warning") == 1 and getprop("/sim/time/elapsed-sec") > (getprop("/ECAM/ap-off-time") + 9)) {
ap_active = 0;
setprop("/it-autoflight/output/ap-warning", 0);
} elsif (ap_active == 0 and getprop("/it-autoflight/output/ap-warning") != 0) {
ap_active = 1;
}
if (ap_active == 1 and getprop("/it-autoflight/output/ap-warning") == 1 and getprop("/sim/time/elapsed-sec") > (getprop("/ECAM/ap-off-time") + 3) and getprop("/ECAM/warnings/master-warning-light") == 1) {
if (getprop("/it-autoflight/output/ap-warning") == 2 and (getprop("/it-autoflight/output/ap1") == 1 or getprop("/it-autoflight/output/ap2") == 1)) {
setprop("/it-autoflight/output/ap-warning", 0);
}
if (athr_active == 1 and getprop("/it-autoflight/output/athr-warning") == 0) {
athr_active = 0;
} elsif (athr_active == 1 and getprop("/it-autoflight/output/athr-warning") == 1 and getprop("/sim/time/elapsed-sec") > (getprop("/ECAM/athr-off-time") + 9)) {
athr_active = 0;
setprop("/it-autoflight/output/athr-warning", 0);
} elsif (athr_active == 0 and getprop("/it-autoflight/output/athr-warning") != 0) {
athr_active = 1;
}
if (athr_active == 1 and getprop("/it-autoflight/output/athr-warning") == 1 and getprop("/sim/time/elapsed-sec") > (getprop("/ECAM/athr-off-time") + 3) and getprop("/ECAM/warnings/master-caution-light") == 1) {
} else if (phase == 5 and getprop("/position/gear-agl-ft") >= 1500) {
setprop("/ECAM/warning-phase", 6);
} else if (phase == 6 and getprop("/position/gear-agl-ft") < 800) {
if (mode == "OP CLB" or mode == "CLB" or (modeI == "V/S" and getprop("/it-autoflight/input/vs") >= 100) or (modeI == "FPA" and getprop("/it-autoflight/input/fpa") >= 0.1)) {
# Do not do this if we are climbing, not in FCOM, but prevents terrain from causing early mode change. If this ends up using baro alt, not radio, then delete this if
} else {
setprop("/ECAM/warning-phase", 7);
}
} else if (phase == 7 and getprop("/fdm/jsbsim/position/wow") == 1) { # Touchdown
setprop("/ECAM/warning-phase", 8);
} else if (phase == 8 and speed < 80) {
setprop("/ECAM/warning-phase", 9);
} else if (phase == 9 and (stateL == 0 or stateR == 0)) {
} else if (phase == 10 and getprop("/ECAM/warning-phase-10-time") + 300 < getprop("/sim/time/elapsed-sec")) { # After 5 mins, reset to phase 1
setprop("/ECAM/warning-phase", 1);
}
}
LowerECAM.loop();
},
toConfig: func() {
stateL = getprop("/engines/engine[0]/state");
stateR = getprop("/engines/engine[1]/state");
wow = getprop("/gear/gear[0]/wow");
if ((getprop("/ECAM/warning-phase") == 2 or getprop("/ECAM/warning-phase") == 9) and wow == 1 and (stateL == 3 or stateR == 3) and getprop("/ECAM/left-msg") != "TO-MEMO") {
if (getprop("/controls/autobrake/mode") == 3 and getprop("/controls/switches/no-smoking-sign") == 1 and getprop("/controls/switches/seatbelt-sign") == 1 and getprop("/controls/flight/speedbrake-arm") == 1 and getprop("/controls/flight/flap-pos") > 0
and getprop("/controls/flight/flap-pos") < 5) {
setprop("/ECAM/to-config", 1);
}
},
};
ECAM.MSGclr();
# Lower ECAM Pages
var LowerECAM = {
button: func(b) {
man_sel = getprop("/ECAM/Lower/man-select");
if (b == "clr" and getprop("/it-autoflight/output/athr-warning") == 2) {