Added auto call of ENG LECAM page on TO

Signed-off-by: merspieler <merspieler@airmail.cc>
This commit is contained in:
merspieler 2018-09-29 03:21:34 +02:00
parent 000fd3cffb
commit 20dd1f4030

View file

@ -184,61 +184,103 @@ var LowerECAM = {
var man_sel = getprop("/ECAM/Lower/man-select");
var fault_sel = getprop("/ECAM/Lower/fault-select");
var apu_timer = getprop("/ECAM/Lower/apu-timer");
var apu_n = getprop("/systems/apu/rpm");
var apu_master = getprop("/controls/APU/master");
var eng_timer = getprop("/ECAM/Lower/eng-timer");
var eng1_state = getprop("/engines/engine[0]/state");
var eng2_state = getprop("/engines/engine[1]/state");
var eng_mode = getprop("/controls/engines/engine-start-switch");
if(!man_sel) {
if(!fault_sel) {
#TODO auto select page for ENG on TO, F/CTL
if( eng_mode == 0
var apu_timer = getprop("/ECAM/Lower/apu-timer");
var apu_n = getprop("/systems/apu/rpm");
var apu_master = getprop("/controls/APU/master");
var eng_timer = getprop("/ECAM/Lower/eng-timer");
var eng_to = getprop("/ECAM/Lower/eng-to");
var eng1_state = getprop("/engines/engine[0]/state");
var eng2_state = getprop("/engines/engine[1]/state");
var eng_mode = getprop("/controls/engines/engine-start-switch");
var flaps = getprop("/controls/flight/flap-lever");
var agl = getprop("/position/gear-agl-ft");
var phase = getprop("/FMGC/status/phase");
var gear0 = getprop("/gear/gear[0]/wow");
var n1_left = getprop("/engines/engine[0]/n1-actual");
var n1_right = getprop("/engines/engine[1]/n1-actual");
var state1 = getprop("/systems/thrust/state1");
var state2 = getprop("/systems/thrust/state2");
var flx = getprop("/systems/thrust/lim-flex");
var thr1 = getprop("/controls/engines/engine[0]/throttle-pos");
var thr2 = getprop("/controls/engines/engine[1]/throttle-pos");
var eng_out = 0;
if ((getprop("/engines/engine[0]/state") == 3 and getprop("/engines/engine[1]/state") != 3) or (getprop("/engines/engine[0]/state") != 3 and getprop("/engines/engine[1]/state") == 3)) {
eng_out = 1;
}
var to_thr = 0;
if (n1_left >= 70 and state1 == "TOGA" or (flx == 1 and state1 == "MCT" and eng_out == 0)
or (flx == 1 and (state1 == "MAN THR" and thr1 >= 0.83 and eng_out == 0))
or n1_right >= 70 and state2 == "TOGA" or (flx == 1 and state2 == "MCT" and eng_out == 0)
or (flx == 1 and (state2 == "MAN THR" and thr2 >= 0.83 and eng_out == 0))) {
to_thr = 1;
}
#TODO auto select page for F/CTL
if ( eng_mode == 0
or eng1_state == 1
or eng1_state == 2
or eng2_state == 1
or eng2_state == 2
or (to_thr == 1 and agl < 1500)
or eng_to == 1
or eng_timer > 0) {
if(eng_timer == 0) {
if (eng_timer == 0) {
setprop("/ECAM/Lower/eng-timer", 1);
}
if(eng_mode == 1) {
if (eng_mode == 1 and to_thr == 0) {
setprop("/ECAM/Lower/eng-timer", 0);
}
if((eng1_state == 0 or eng1_state == 3) and (eng2_state == 0 or eng2_state == 3)) {
if (to_thr == 1 and agl <= 1500) {
setprop("/ECAM/Lower/eng-to", 1);
}
if (eng_to == 1 and flaps == 0 and to_thr == 0 and agl >= 1500) {
setprop("/ECAM/Lower/eng-to", 0);
}
if ((eng1_state == 0 or eng1_state == 3) and (eng2_state == 0 or eng2_state == 3) and gear0 == 1 and to_thr == 0) {
settimer(func() { setprop("/ECAM/Lower/eng-timer", 0);}, 10);
}
if (eng_to == 1 and agl >= 1500) {
settimer(func() { setprop("/ECAM/Lower/eng-to", 0);}, 60);
}
setprop("/ECAM/Lower/page", "eng");
} else if((apu_master == 1 and apu_n < 95) or apu_timer > 0) {
} else if ((apu_master == 1 and apu_n < 95) or apu_timer > 0) {
# apu-timer states:
# 0 -> no apu start
# 1 -> apu starting/started, will be set back to 0 by timer
if(apu_timer == 0) {
if (apu_timer == 0) {
setprop("/ECAM/Lower/apu-timer", 1);
}
if(apu_master == 0) {
if (apu_master == 0) {
setprop("/ECAM/Lower/apu-timer", 0);
}
if(apu_n >= 95) {
if (apu_n >= 95) {
settimer(func() { setprop("/ECAM/Lower/apu-timer", 0);}, 10);
}
setprop("/ECAM/Lower/page", "apu");
} else if(((getprop("/engines/engine[0]/n2-actual") >= 59 or getprop("/engines/engine[1]/n2-actual") >= 59) and getprop("/gear/gear[1]/wow") == 1) or (getprop("/instrumentation/altimeter/indicated-altitude-ft") <= 16000 and getprop("/controls/gear/gear-down") == 1 and getprop("/gear/gear[1]/wow") == 0)) {
} else if (((getprop("/engines/engine[0]/n2-actual") >= 59 or getprop("/engines/engine[1]/n2-actual") >= 59) and getprop("/gear/gear[1]/wow") == 1) or (getprop("/instrumentation/altimeter/indicated-altitude-ft") <= 16000 and getprop("/controls/gear/gear-down") == 1 and getprop("/gear/gear[1]/wow") == 0)) {
setprop("/ECAM/Lower/page", "wheel");
} else if(getprop("/gear/gear[1]/wow") == 1) {
} else if (getprop("/gear/gear[1]/wow") == 1) {
setprop("/ECAM/Lower/page", "door");
} else {
@ -253,6 +295,7 @@ var LowerECAM = {
setprop("/ECAM/Lower/fault-select", 0);
setprop("/ECAM/Lower/apu-timer", 0);
setprop("/ECAM/Lower/eng-timer", 0);
setprop("/ECAM/Lower/eng-to", 0);
setprop("/ECAM/Lower/fctl-timer", 0);
setprop("/ECAM/Lower/light/apu", 0);
setprop("/ECAM/Lower/light/bleed", 0);