ECAM actions (disabled by /sim/options/enable-ecam-actions)

This commit is contained in:
Jonathan Redpath 2017-08-14 16:29:00 +01:00
parent 23ffd9acef
commit 141c9f72f7
3 changed files with 216 additions and 36 deletions

View file

@ -719,6 +719,7 @@
<steep-ils type="bool">0</steep-ils>
<steep-ils-avail type="bool">0</steep-ils-avail>
<test-canvas type="bool">0</test-canvas> <!-- Enables WIP Canvas Stuff -->
<enable-ecam-actions>0</enable-ecam-actions>
</options>
<instrumentation n="0">

View file

@ -151,87 +151,87 @@ var canvas_upperECAM_base = {
me["ECAML1"].setColor(1,0,0);
}
if (getprop("/ECAM/msg/line1c") == "w") {
if (getprop("/ECAM/msg/line2c") == "w") {
me["ECAML2"].setColor(1,1,1);
} else if (getprop("/ECAM/msg/line1c") == "b") {
} else if (getprop("/ECAM/msg/line2c") == "b") {
me["ECAML2"].setColor(0,0.5,0.7);
} else if (getprop("/ECAM/msg/line1c") == "g") {
} else if (getprop("/ECAM/msg/line2c") == "g") {
me["ECAML2"].setColor(0,1,0);
} else if (getprop("/ECAM/msg/line1c") == "a") {
} else if (getprop("/ECAM/msg/line2c") == "a") {
me["ECAML2"].setColor(1,0.6,0);
} else if (getprop("/ECAM/msg/line1c") == "r") {
} else if (getprop("/ECAM/msg/line2c") == "r") {
me["ECAML2"].setColor(1,0,0);
}
if (getprop("/ECAM/msg/line1c") == "w") {
if (getprop("/ECAM/msg/line3c") == "w") {
me["ECAML3"].setColor(1,1,1);
} else if (getprop("/ECAM/msg/line1c") == "b") {
} else if (getprop("/ECAM/msg/line3c") == "b") {
me["ECAML3"].setColor(0,0.5,0.7);
} else if (getprop("/ECAM/msg/line1c") == "g") {
} else if (getprop("/ECAM/msg/line3c") == "g") {
me["ECAML3"].setColor(0,1,0);
} else if (getprop("/ECAM/msg/line1c") == "a") {
} else if (getprop("/ECAM/msg/line3c") == "a") {
me["ECAML3"].setColor(1,0.6,0);
} else if (getprop("/ECAM/msg/line1c") == "r") {
} else if (getprop("/ECAM/msg/line3c") == "r") {
me["ECAML3"].setColor(1,0,0);
}
if (getprop("/ECAM/msg/line1c") == "w") {
if (getprop("/ECAM/msg/line4c") == "w") {
me["ECAML4"].setColor(1,1,1);
} else if (getprop("/ECAM/msg/line1c") == "b") {
} else if (getprop("/ECAM/msg/line4c") == "b") {
me["ECAML4"].setColor(0,0.5,0.7);
} else if (getprop("/ECAM/msg/line1c") == "g") {
} else if (getprop("/ECAM/msg/line4c") == "g") {
me["ECAML4"].setColor(0,1,0);
} else if (getprop("/ECAM/msg/line1c") == "a") {
} else if (getprop("/ECAM/msg/line4c") == "a") {
me["ECAML4"].setColor(1,0.6,0);
} else if (getprop("/ECAM/msg/line1c") == "r") {
} else if (getprop("/ECAM/msg/line4c") == "r") {
me["ECAML4"].setColor(1,0,0);
}
if (getprop("/ECAM/msg/line1c") == "w") {
if (getprop("/ECAM/msg/line5c") == "w") {
me["ECAML5"].setColor(1,1,1);
} else if (getprop("/ECAM/msg/line1c") == "b") {
} else if (getprop("/ECAM/msg/line5c") == "b") {
me["ECAML5"].setColor(0,0.5,0.7);
} else if (getprop("/ECAM/msg/line1c") == "g") {
} else if (getprop("/ECAM/msg/line5c") == "g") {
me["ECAML5"].setColor(0,1,0);
} else if (getprop("/ECAM/msg/line1c") == "a") {
} else if (getprop("/ECAM/msg/line5c") == "a") {
me["ECAML5"].setColor(1,0.6,0);
} else if (getprop("/ECAM/msg/line1c") == "r") {
} else if (getprop("/ECAM/msg/line5c") == "r") {
me["ECAML5"].setColor(1,0,0);
}
if (getprop("/ECAM/msg/line1c") == "w") {
if (getprop("/ECAM/msg/line6c") == "w") {
me["ECAML6"].setColor(1,1,1);
} else if (getprop("/ECAM/msg/line1c") == "b") {
} else if (getprop("/ECAM/msg/line6c") == "b") {
me["ECAML6"].setColor(0,0.5,0.7);
} else if (getprop("/ECAM/msg/line1c") == "g") {
} else if (getprop("/ECAM/msg/line6c") == "g") {
me["ECAML6"].setColor(0,1,0);
} else if (getprop("/ECAM/msg/line1c") == "a") {
} else if (getprop("/ECAM/msg/line6c") == "a") {
me["ECAML6"].setColor(1,0.6,0);
} else if (getprop("/ECAM/msg/line1c") == "r") {
} else if (getprop("/ECAM/msg/line6c") == "r") {
me["ECAML6"].setColor(1,0,0);
}
if (getprop("/ECAM/msg/line1c") == "w") {
if (getprop("/ECAM/msg/line7c") == "w") {
me["ECAML7"].setColor(1,1,1);
} else if (getprop("/ECAM/msg/line1c") == "b") {
} else if (getprop("/ECAM/msg/line7c") == "b") {
me["ECAML7"].setColor(0,0.5,0.7);
} else if (getprop("/ECAM/msg/line1c") == "g") {
} else if (getprop("/ECAM/msg/line7c") == "g") {
me["ECAML7"].setColor(0,1,0);
} else if (getprop("/ECAM/msg/line1c") == "a") {
} else if (getprop("/ECAM/msg/line7c") == "a") {
me["ECAML7"].setColor(1,0.6,0);
} else if (getprop("/ECAM/msg/line1c") == "r") {
} else if (getprop("/ECAM/msg/line7c") == "r") {
me["ECAML7"].setColor(1,0,0);
}
if (getprop("/ECAM/msg/line1c") == "w") {
if (getprop("/ECAM/msg/line8c") == "w") {
me["ECAML8"].setColor(1,1,1);
} else if (getprop("/ECAM/msg/line1c") == "b") {
} else if (getprop("/ECAM/msg/line8c") == "b") {
me["ECAML8"].setColor(0,0.5,0.7);
} else if (getprop("/ECAM/msg/line1c") == "g") {
} else if (getprop("/ECAM/msg/line8c") == "g") {
me["ECAML8"].setColor(0,1,0);
} else if (getprop("/ECAM/msg/line1c") == "a") {
} else if (getprop("/ECAM/msg/line8c") == "a") {
me["ECAML8"].setColor(1,0.6,0);
} else if (getprop("/ECAM/msg/line1c") == "r") {
} else if (getprop("/ECAM/msg/line8c") == "r") {
me["ECAML8"].setColor(1,0,0);
}

View file

@ -21,9 +21,48 @@ setprop("/ECAM/Lower/page", "eng");
######################################################
var ECAMinit = func {
if (getprop("/sim/options/enable-ecam-actions") == 1) {
ECAMloop.start();
setprop("/ECAM/phase-1-inhibit", 0);
setprop("/ECAM/phase-2-inhibit", 0);
setprop("/ECAM/phase-3-inhibit", 0);
setprop("/ECAM/phase-4-inhibit", 0);
setprop("/ECAM/phase-5-inhibit", 0);
setprop("/ECAM/phase-6-inhibit", 0);
setprop("/ECAM/phase-7-inhibit", 0);
setprop("/ECAM/phase-8-inhibit", 0);
setprop("/ECAM/phase-9-inhibit", 0);
setprop("/ECAM/phase-10-inhibit", 0);
var stateL = getprop("/engines/engine[0]/state");
var stateR = getprop("/engines/engine[1]/state");
var thrustL = getprop("/systems/thrust/state1");
var thrustR = getprop("/systems/thrust/state2");
var elec = getprop("/systems/electrical/on");
var speed = getprop("/velocities/airspeed-kt");
var wowL = getprop("/gear/gear[1]/wow");
var altitude = getprop("/position/gear-agl-ft");
var phase1inhibit = getprop("/ECAM/phase-1-inhibit");
var phase2inhibit = getprop("/ECAM/phase-2-inhibit");
var phase3inhibit = getprop("/ECAM/phase-3-inhibit");
var phase4inhibit = getprop("/ECAM/phase-4-inhibit");
var phase5inhibit = getprop("/ECAM/phase-5-inhibit");
var phase6inhibit = getprop("/ECAM/phase-6-inhibit");
var phase7inhibit = getprop("/ECAM/phase-7-inhibit");
var phase8inhibit = getprop("/ECAM/phase-8-inhibit");
var phase9inhibit = getprop("/ECAM/phase-9-inhibit");
var phase10inhibit = getprop("/ECAM/phase-10-inhibit");
}
}
# setlistener("/ECAM/phase-10-inhibit", func {
# phase10inhibit = getprop("/ECAM/phase-10-inhibit");
# if (phase10inhibit) {
# settimer(func {
# setprop("/ECAM/phase-10-inhibit", 0);
# }, 300);
# }
#});
var MSGclr = func {
setprop("/ECAM/ecam-checklist-active", 0);
setprop("/ECAM/left-msg", "NONE");
@ -47,7 +86,27 @@ var MSGclr = func {
MSGclr();
var ECAMloop = maketimer(1, func {
var ECAMloop = maketimer(0.2, func {
stateL = getprop("/engines/engine[0]/state");
stateR = getprop("/engines/engine[1]/state");
thrustL = getprop("/systems/thrust/state1");
thrustR = getprop("/systems/thrust/state2");
elec = getprop("/systems/electrical/on");
speed = getprop("/velocities/airspeed-kt");
wowL = getprop("/gear/gear[1]/wow");
altitude = getprop("/position/gear-agl-ft");
phase1inhibit = getprop("/ECAM/phase-1-inhibit");
phase2inhibit = getprop("/ECAM/phase-2-inhibit");
phase3inhibit = getprop("/ECAM/phase-3-inhibit");
phase4inhibit = getprop("/ECAM/phase-4-inhibit");
phase5inhibit = getprop("/ECAM/phase-5-inhibit");
phase6inhibit = getprop("/ECAM/phase-6-inhibit");
phase7inhibit = getprop("/ECAM/phase-7-inhibit");
phase8inhibit = getprop("/ECAM/phase-8-inhibit");
phase9inhibit = getprop("/ECAM/phase-9-inhibit");
phase10inhibit = getprop("/ECAM/phase-10-inhibit");
var noUpdate = getprop("/ECAM/noupdate");
var doNotRevert = getprop("/ECAM/donotrevert");
if (getprop("/FMGC/status/phase") == 0 and getprop("/engines/engine[0]/state") == 3 and getprop("/engines/engine[1]/state") == 3) {
@ -76,4 +135,124 @@ var ECAMloop = maketimer(1, func {
setprop("/ECAM/msg/line7c", "g");
setprop("/ECAM/msg/line8c", "g");
}
###########
# Inhibit #
###########
if (elec == 1 and !phase1inhibit and !phase2inhibit and !phase3inhibit and !phase4inhibit and !phase5inhibit and !phase6inhibit and !phase7inhibit and !phase8inhibit and !phase9inhibit and !phase10inhibit) {
setprop("/ECAM/phase-1-inhibit", 1);
} else if (stateL == 3 or stateR == 3 and !phase2inhibit and !phase3inhibit and !phase4inhibit and !phase5inhibit and !phase6inhibit and !phase7inhibit and !phase8inhibit and !phase9inhibit and !phase10inhibit) {
setprop("/ECAM/phase-1-inhibit", 0);
setprop("/ECAM/phase-2-inhibit", 1);
} else if (thrustL == "FLX" or thrustL == "TOGA" or thrustR == "FLX" or thrustR == "TOGA" and speed < 80 and !phase1inhibit and !phase3inhibit and !phase4inhibit and !phase5inhibit and !phase6inhibit and !phase7inhibit and !phase8inhibit and !phase9inhibit and !phase10inhibit) {
setprop("/ECAM/phase-2-inhibit", 0);
setprop("/ECAM/phase-3-inhibit", 1);
} else if (thrustL == "FLX" or thrustL == "TOGA" or thrustR == "FLX" or thrustR == "TOGA" and speed > 80 and wowL and !phase1inhibit and !phase2inhibit and !phase4inhibit and !phase5inhibit and !phase6inhibit and !phase7inhibit and !phase8inhibit and !phase9inhibit and !phase10inhibit) {
setprop("/ECAM/phase-3-inhibit", 0);
setprop("/ECAM/phase-4-inhibit", 1);
} else if (speed > 80 and !wowL and altitude < 1501 and !phase1inhibit and !phase2inhibit and !phase3inhibit and !phase5inhibit and !phase6inhibit and !phase7inhibit and !phase8inhibit and !phase9inhibit and !phase10inhibit) {
setprop("/ECAM/phase-4-inhibit", 0);
setprop("/ECAM/phase-5-inhibit", 1);
} else if (speed > 80 and !wowL and altitude > 1501 and !phase1inhibit and !phase2inhibit and !phase3inhibit and !phase4inhibit and !phase6inhibit and !phase7inhibit and !phase8inhibit and !phase9inhibit and !phase10inhibit) {
setprop("/ECAM/phase-5-inhibit", 0);
setprop("/ECAM/phase-6-inhibit", 1);
} else if (speed > 80 and !wowL and altitude < 801 and !phase1inhibit and !phase2inhibit and !phase3inhibit and !phase4inhibit and !phase5inhibit and !phase7inhibit and !phase8inhibit and !phase9inhibit and !phase10inhibit) {
setprop("/ECAM/phase-6-inhibit", 0);
setprop("/ECAM/phase-7-inhibit", 1);
} else if (speed > 80 and wowL and !phase1inhibit and !phase2inhibit and !phase3inhibit and !phase4inhibit and !phase5inhibit and !phase6inhibit and !phase8inhibit and !phase9inhibit and !phase10inhibit) {
setprop("/ECAM/phase-7-inhibit", 0);
setprop("/ECAM/phase-8-inhibit", 1);
} else if (speed < 80 and wowL and !phase1inhibit and !phase2inhibit and !phase3inhibit and !phase4inhibit and !phase5inhibit and !phase6inhibit and !phase7inhibit and !phase9inhibit and !phase10inhibit) {
setprop("/ECAM/phase-8-inhibit", 0);
setprop("/ECAM/phase-9-inhibit", 1);
} else if (stateL == 0 and stateR == 0 and !phase1inhibit and !phase2inhibit and !phase3inhibit and !phase4inhibit and !phase5inhibit and !phase6inhibit and !phase7inhibit and !phase8inhibit and !phase10inhibit) {
setprop("/ECAM/phase-9-inhibit", 0);
setprop("/ECAM/phase-10-inhibit", 1);
}
############
# Air Cond #
############
if (getprop("/systems/failures/pack1") == 1 and getprop("/systems/failures/pack2") == 0 and getprop("/controls/pneumatic/switches/pack1") == 1 and !phase3inhibit and !phase4inhibit and !phase5inhibit and !phase7inhibit and !phase8inhibit) {
setprop("/ECAM/msg/line1", "AIR PACK 1 FAULT");
setprop("/ECAM/msg/line2", " - PACK 1: OFF");
setprop("/ECAM/msg/line3", "");
setprop("/ECAM/msg/line4", "");
setprop("/ECAM/msg/line5", "");
setprop("/ECAM/msg/line6", "");
setprop("/ECAM/msg/line7", "");
setprop("/ECAM/msg/line8", "");
setprop("/ECAM/msg/line1c", "a");
setprop("/ECAM/msg/line2c", "b");
setprop("/ECAM/msg/line3c", "g");
setprop("/ECAM/msg/line4c", "g");
setprop("/ECAM/msg/line5c", "g");
setprop("/ECAM/msg/line6c", "g");
setprop("/ECAM/msg/line7c", "g");
setprop("/ECAM/msg/line8c", "g");
setprop("/ECAM/left-msg", "MSG");
} else if (getprop("/systems/failures/pack1") == 1 and getprop("/systems/failures/pack2") == 0 and getprop("/controls/pneumatic/switches/pack1") == 0 and !phase3inhibit and !phase4inhibit and !phase5inhibit and !phase7inhibit and !phase8inhibit) {
setprop("/ECAM/msg/line1", "AIR PACK 1 FAULT");
setprop("/ECAM/msg/line2", "");
setprop("/ECAM/msg/line3", "");
setprop("/ECAM/msg/line4", "");
setprop("/ECAM/msg/line5", "");
setprop("/ECAM/msg/line6", "");
setprop("/ECAM/msg/line7", "");
setprop("/ECAM/msg/line8", "");
setprop("/ECAM/msg/line1c", "a");
setprop("/ECAM/msg/line2c", "g");
setprop("/ECAM/msg/line3c", "g");
setprop("/ECAM/msg/line4c", "g");
setprop("/ECAM/msg/line5c", "g");
setprop("/ECAM/msg/line6c", "g");
setprop("/ECAM/msg/line7c", "g");
setprop("/ECAM/msg/line8c", "g");
setprop("/ECAM/left-msg", "MSG");
} else {
# MSGclr();
}
if (getprop("/systems/failures/pack1") == 0 and getprop("/systems/failures/pack2") == 1 and getprop("/controls/pneumatic/switches/pack2") == 1 and !phase3inhibit and !phase4inhibit and !phase5inhibit and !phase7inhibit and !phase8inhibit) {
setprop("/ECAM/msg/line1", "AIR PACK 2 FAULT");
setprop("/ECAM/msg/line2", " - PACK 2: OFF");
setprop("/ECAM/msg/line3", "");
setprop("/ECAM/msg/line4", "");
setprop("/ECAM/msg/line5", "");
setprop("/ECAM/msg/line6", "");
setprop("/ECAM/msg/line7", "");
setprop("/ECAM/msg/line8", "");
setprop("/ECAM/msg/line1c", "a");
setprop("/ECAM/msg/line2c", "b");
setprop("/ECAM/msg/line3c", "g");
setprop("/ECAM/msg/line4c", "g");
setprop("/ECAM/msg/line5c", "g");
setprop("/ECAM/msg/line6c", "g");
setprop("/ECAM/msg/line7c", "g");
setprop("/ECAM/msg/line8c", "g");
setprop("/ECAM/left-msg", "MSG");
} else if (getprop("/systems/failures/pack1") == 0 and getprop("/systems/failures/pack2") == 1 and getprop("/controls/pneumatic/switches/pack2") == 0 and !phase3inhibit and !phase4inhibit and !phase5inhibit and !phase7inhibit and !phase8inhibit) {
setprop("/ECAM/msg/line1", "AIR PACK 2 FAULT");
setprop("/ECAM/msg/line2", "");
setprop("/ECAM/msg/line3", "");
setprop("/ECAM/msg/line4", "");
setprop("/ECAM/msg/line5", "");
setprop("/ECAM/msg/line6", "");
setprop("/ECAM/msg/line7", "");
setprop("/ECAM/msg/line8", "");
setprop("/ECAM/msg/line1c", "a");
setprop("/ECAM/msg/line2c", "g");
setprop("/ECAM/msg/line3c", "g");
setprop("/ECAM/msg/line4c", "g");
setprop("/ECAM/msg/line5c", "g");
setprop("/ECAM/msg/line6c", "g");
setprop("/ECAM/msg/line7c", "g");
setprop("/ECAM/msg/line8c", "g");
setprop("/ECAM/left-msg", "MSG");
} else {
# MSGclr();
}
});