This repository has been archived on 2021-09-26. You can view files and clone it, but cannot push or open issues or pull requests.
IDG-A32X/Models/Instruments/Lower-ECAM/Lower-ECAM.nas
2018-04-12 19:31:34 -04:00

2482 lines
85 KiB
Text

# A3XX Lower ECAM Canvas
# Joshua Davidson (it0uchpods)
##############################################
# Copyright (c) Joshua Davidson (it0uchpods) #
##############################################
var lowerECAM_apu = nil;
var lowerECAM_bleed = nil;
var lowerECAM_cond = nil;
var lowerECAM_door = nil;
var lowerECAM_elec = nil;
var lowerECAM_eng = nil;
var lowerECAM_fctl = nil;
var lowerECAM_fuel = nil;
var lowerECAM_hyd = nil;
var lowerECAM_press = nil;
var lowerECAM_wheel = nil;
var lowerECAM_test = nil;
var lowerECAM_display = nil;
var page = "fctl";
var oat = getprop("/environment/temperature-degc");
var blue_psi = 0;
var green_psi = 0;
var yellow_psi = 0;
var autobrakemode = 0;
var nosegear = 0;
var leftgear = 0;
var rightgear = 0;
var leftdoor = 0;
var rightdoor = 0;
var nosedoor = 0;
var gearlvr = 0;
var askidsw = 0;
var brakemode = 0;
var accum = 0;
var elapsedtime = 0;
var tr1_v = 0;
var tr1_a = 0;
var tr2_v = 0;
var tr2_a = 0;
setprop("/systems/electrical/extra/apu-load", 0);
setprop("/systems/electrical/extra/apu-volts", 0);
setprop("/systems/electrical/extra/apu-hz", 0);
setprop("/systems/pneumatic/bleedapu", 0);
setprop("/engines/engine[0]/oil-psi-actual", 0);
setprop("/engines/engine[1]/oil-psi-actual", 0);
setprop("/ECAM/Lower/door-left", 0);
setprop("/ECAM/Lower/door-right", 0);
setprop("/ECAM/Lower/door-nose-left", 0);
setprop("/ECAM/Lower/door-nose-right", 0);
setprop("/ECAM/Lower/APU-N", 0);
setprop("/ECAM/Lower/APU-EGT", 0);
setprop("/ECAM/Lower/Oil-QT[0]", 0);
setprop("/ECAM/Lower/Oil-QT[1]", 0);
setprop("/ECAM/Lower/Oil-PSI[0]", 0);
setprop("/ECAM/Lower/Oil-PSI[1]", 0);
setprop("/ECAM/Lower/aileron-ind-left", 0);
setprop("/ECAM/Lower/aileron-ind-right", 0);
setprop("/ECAM/Lower/elevator-ind-left", 0);
setprop("/ECAM/Lower/elevator-ind-right", 0);
setprop("/ECAM/Lower/elevator-trim-deg", 0);
setprop("/controls/flight/rudder-fdm", 0);
setprop("/environment/temperature-degc", 0);
setprop("/FMGC/internal/gw", 0);
setprop("/controls/flight/spoiler-l1-failed", 0);
setprop("/controls/flight/spoiler-l2-failed", 0);
setprop("/controls/flight/spoiler-l3-failed", 0);
setprop("/controls/flight/spoiler-l4-failed", 0);
setprop("/controls/flight/spoiler-l5-failed", 0);
setprop("/controls/flight/spoiler-r1-failed", 0);
setprop("/controls/flight/spoiler-r2-failed", 0);
setprop("/controls/flight/spoiler-r3-failed", 0);
setprop("/controls/flight/spoiler-r4-failed", 0);
setprop("/controls/flight/spoiler-r5-failed", 0);
setprop("/instrumentation/du/du4-test", 0);
setprop("/instrumentation/du/du4-test-time", 0);
setprop("/instrumentation/du/du4-test-amount", 0);
var canvas_lowerECAM_base = {
init: func(canvas_group, file) {
var font_mapper = func(family, weight) {
return "LiberationFonts/LiberationSans-Regular.ttf";
};
canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper});
var svg_keys = me.getKeys();
foreach(var key; svg_keys) {
me[key] = canvas_group.getElementById(key);
}
me.page = canvas_group;
return me;
},
getKeys: func() {
return [];
},
update: func() {
elapsedtime = getprop("/sim/time/elapsed-sec");
if (getprop("/systems/electrical/bus/ac2") >= 110) {
if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/du/du4-test") != 1) {
setprop("/instrumentation/du/du4-test", 1);
setprop("/instrumentation/du/du4-test-amount", math.round((rand() * 5 ) + 35, 0.1));
setprop("/instrumentation/du/du4-test-time", getprop("/sim/time/elapsed-sec"));
} else if (getprop("/systems/acconfig/autoconfig-running") == 1 and getprop("/instrumentation/du/du4-test") != 1) {
setprop("/instrumentation/du/du4-test", 1);
setprop("/instrumentation/du/du4-test-amount", math.round((rand() * 5 ) + 35, 0.1));
setprop("/instrumentation/du/du4-test-time", getprop("/sim/time/elapsed-sec") - 30);
}
} else if (getprop("/systems/electrical/ac1-src") == "XX" or getprop("/systems/electrical/ac2-src") == "XX") {
setprop("/instrumentation/du/du4-test", 0);
}
if (getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/controls/lighting/DU/du4") > 0) {
if (getprop("/instrumentation/du/du4-test-time") + getprop("/instrumentation/du/du4-test-amount") >= elapsedtime) {
lowerECAM_apu.page.hide();
lowerECAM_bleed.page.hide();
lowerECAM_cond.page.hide();
lowerECAM_door.page.hide();
lowerECAM_elec.page.hide();
lowerECAM_eng.page.hide();
lowerECAM_fctl.page.hide();
lowerECAM_fuel.page.hide();
lowerECAM_press.page.hide();
lowerECAM_wheel.page.hide();
lowerECAM_test.page.show();
lowerECAM_test.update();
} else {
lowerECAM_test.page.hide();
page = getprop("/ECAM/Lower/page");
if (page == "apu") {
lowerECAM_apu.page.show();
lowerECAM_bleed.page.hide();
lowerECAM_cond.page.hide();
lowerECAM_door.page.hide();
lowerECAM_elec.page.hide();
lowerECAM_eng.page.hide();
lowerECAM_fctl.page.hide();
lowerECAM_fuel.page.hide();
lowerECAM_press.page.hide();
lowerECAM_hyd.page.hide();
lowerECAM_wheel.page.hide();
lowerECAM_apu.update();
} else if (page == "bleed") {
lowerECAM_apu.page.hide();
lowerECAM_bleed.page.show();
lowerECAM_cond.page.hide();
lowerECAM_door.page.hide();
lowerECAM_elec.page.hide();
lowerECAM_eng.page.hide();
lowerECAM_fctl.page.hide();
lowerECAM_fuel.page.hide();
lowerECAM_press.page.hide();
lowerECAM_hyd.page.hide();
lowerECAM_wheel.page.hide();
lowerECAM_bleed.update();
} else if (page == "cond") {
lowerECAM_apu.page.hide();
lowerECAM_bleed.page.hide();
lowerECAM_cond.page.show();
lowerECAM_door.page.hide();
lowerECAM_elec.page.hide();
lowerECAM_eng.page.hide();
lowerECAM_fctl.page.hide();
lowerECAM_fuel.page.hide();
lowerECAM_press.page.hide();
lowerECAM_hyd.page.hide();
lowerECAM_wheel.page.hide();
lowerECAM_cond.update();
} else if (page == "door") {
lowerECAM_apu.page.hide();
lowerECAM_bleed.page.hide();
lowerECAM_cond.page.hide();
lowerECAM_door.page.show();
lowerECAM_elec.page.hide();
lowerECAM_eng.page.hide();
lowerECAM_fctl.page.hide();
lowerECAM_fuel.page.hide();
lowerECAM_press.page.hide();
lowerECAM_hyd.page.hide();
lowerECAM_wheel.page.hide();
lowerECAM_door.update();
} else if (page == "elec") {
lowerECAM_apu.page.hide();
lowerECAM_bleed.page.hide();
lowerECAM_cond.page.hide();
lowerECAM_door.page.hide();
lowerECAM_elec.page.show();
lowerECAM_eng.page.hide();
lowerECAM_fctl.page.hide();
lowerECAM_fuel.page.hide();
lowerECAM_press.page.hide();
lowerECAM_hyd.page.hide();
lowerECAM_wheel.page.hide();
lowerECAM_elec.update();
} else if (page == "eng") {
lowerECAM_apu.page.hide();
lowerECAM_bleed.page.hide();
lowerECAM_cond.page.hide();
lowerECAM_door.page.hide();
lowerECAM_elec.page.hide();
lowerECAM_eng.page.show();
lowerECAM_fctl.page.hide();
lowerECAM_fuel.page.hide();
lowerECAM_press.page.hide();
lowerECAM_hyd.page.hide();
lowerECAM_wheel.page.hide();
lowerECAM_eng.update();
} else if (page == "fctl") {
lowerECAM_apu.page.hide();
lowerECAM_bleed.page.hide();
lowerECAM_cond.page.hide();
lowerECAM_door.page.hide();
lowerECAM_elec.page.hide();
lowerECAM_eng.page.hide();
lowerECAM_fctl.page.show();
lowerECAM_fuel.page.hide();
lowerECAM_press.page.hide();
lowerECAM_hyd.page.hide();
lowerECAM_wheel.page.hide();
lowerECAM_fctl.update();
} else if (page == "fuel") {
lowerECAM_apu.page.hide();
lowerECAM_bleed.page.hide();
lowerECAM_cond.page.hide();
lowerECAM_door.page.hide();
lowerECAM_elec.page.hide();
lowerECAM_eng.page.hide();
lowerECAM_fctl.page.hide();
lowerECAM_fuel.page.show();
lowerECAM_press.page.hide();
lowerECAM_hyd.page.hide();
lowerECAM_wheel.page.hide();
lowerECAM_fuel.update();
} else if (page == "press") {
lowerECAM_apu.page.hide();
lowerECAM_bleed.page.hide();
lowerECAM_cond.page.hide();
lowerECAM_door.page.hide();
lowerECAM_elec.page.hide();
lowerECAM_eng.page.hide();
lowerECAM_fctl.page.hide();
lowerECAM_fuel.page.hide();
lowerECAM_press.page.show();
lowerECAM_hyd.page.hide();
lowerECAM_wheel.page.hide();
lowerECAM_press.update();
} else if (page == "hyd") {
lowerECAM_apu.page.hide();
lowerECAM_bleed.page.hide();
lowerECAM_cond.page.hide();
lowerECAM_door.page.hide();
lowerECAM_elec.page.hide();
lowerECAM_eng.page.hide();
lowerECAM_fctl.page.hide();
lowerECAM_fuel.page.hide();
lowerECAM_press.page.hide();
lowerECAM_hyd.page.show();
lowerECAM_wheel.page.hide();
lowerECAM_hyd.update();
} else if (page == "wheel") {
lowerECAM_apu.page.hide();
lowerECAM_bleed.page.hide();
lowerECAM_cond.page.hide();
lowerECAM_door.page.hide();
lowerECAM_elec.page.hide();
lowerECAM_eng.page.hide();
lowerECAM_fctl.page.hide();
lowerECAM_fuel.page.hide();
lowerECAM_press.page.hide();
lowerECAM_hyd.page.hide();
lowerECAM_wheel.page.show();
lowerECAM_wheel.update();
} else {
lowerECAM_apu.page.hide();
lowerECAM_bleed.page.hide();
lowerECAM_cond.page.hide();
lowerECAM_door.page.hide();
lowerECAM_elec.page.hide();
lowerECAM_eng.page.hide();
lowerECAM_fctl.page.hide();
lowerECAM_fuel.page.hide();
lowerECAM_press.page.hide();
lowerECAM_hyd.page.hide();
lowerECAM_wheel.page.hide();
}
}
} else {
lowerECAM_test.page.hide();
lowerECAM_apu.page.hide();
lowerECAM_bleed.page.hide();
lowerECAM_cond.page.hide();
lowerECAM_door.page.hide();
lowerECAM_elec.page.hide();
lowerECAM_eng.page.hide();
lowerECAM_fctl.page.hide();
lowerECAM_fuel.page.hide();
lowerECAM_press.page.hide();
lowerECAM_hyd.page.hide();
lowerECAM_wheel.page.hide();
}
},
updateBottomStatus: func() {
me["TAT"].setText(sprintf("%2.0f", getprop("/environment/temperature-degc")));
me["SAT"].setText(sprintf("%2.0f", getprop("/environment/temperature-degc")));
me["GW"].setText(sprintf("%s", math.round(getprop("/FMGC/internal/gw"))));
me["UTCh"].setText(sprintf("%02d", getprop("/sim/time/utc/hour")));
me["UTCm"].setText(sprintf("%02d", getprop("/sim/time/utc/minute")));
},
};
var canvas_lowerECAM_apu = {
new: func(canvas_group, file) {
var m = {parents: [canvas_lowerECAM_apu, canvas_lowerECAM_base]};
m.init(canvas_group, file);
return m;
},
getKeys: func() {
return ["TAT","SAT","GW","UTCh","UTCm","APUN-needle","APUEGT-needle","APUN","APUEGT","APUAvail","APUFlapOpen","APUBleedValve","APUBleedOnline","APUGenOnline","APUGentext","APUGenLoad","APUGenbox","APUGenVolt","APUGenHz","APUBleedPSI","APUfuelLO",
"text3724","text3728","text3732"];
},
update: func() {
oat = getprop("/environment/temperature-degc");
# Avail and Flap Open
if (getprop("/systems/apu/flap") == 1) {
me["APUFlapOpen"].show();
} else {
me["APUFlapOpen"].hide();
}
if (getprop("/systems/apu/rpm") > 94.9) {
me["APUAvail"].show();
} else {
me["APUAvail"].hide();
}
if (getprop("/fdm/jsbsim/propulsion/tank[2]/contents-lbs") < 100) {
me["APUfuelLO"].show();
} else {
me["APUfuelLO"].hide();
}
# APU Gen
if (getprop("/systems/electrical/extra/apu-volts") > 110) {
me["APUGenVolt"].setColor(0.0509,0.7529,0.2941);
} else {
me["APUGenVolt"].setColor(0.7333,0.3803,0);
}
if (getprop("/systems/electrical/extra/apu-hz") > 380) {
me["APUGenHz"].setColor(0.0509,0.7529,0.2941);
} else {
me["APUGenHz"].setColor(0.7333,0.3803,0);
}
if (getprop("/controls/APU/master") == 1 or getprop("/systems/apu/rpm") >= 94.9) {
me["APUGenbox"].show();
me["APUGenHz"].show();
me["APUGenVolt"].show();
me["APUGenLoad"].show();
me["text3724"].show();
me["text3728"].show();
me["text3732"].show();
} else {
me["APUGenbox"].hide();
me["APUGenHz"].hide();
me["APUGenVolt"].hide();
me["APUGenLoad"].hide();
me["text3724"].hide();
me["text3728"].hide();
me["text3732"].hide();
}
if ((getprop("/systems/apu/rpm") > 94.9) and (getprop("/controls/electrical/switches/gen-apu") == 1)) {
me["APUGenOnline"].show();
} else {
me["APUGenOnline"].hide();
}
if ((getprop("/controls/APU/master") == 0) or ((getprop("/controls/APU/master") == 1) and (getprop("/controls/electrical/switches/gen-apu") == 1) and (getprop("/systems/apu/rpm") > 94.9))) {
me["APUGentext"].setColor(0.8078,0.8039,0.8078);
} else if ((getprop("/controls/APU/master") == 1) and (getprop("/controls/electrical/switches/gen-apu") == 0) and (getprop("/systems/apu/rpm") < 94.9)) {
me["APUGentext"].setColor(0.7333,0.3803,0);
}
me["APUGenLoad"].setText(sprintf("%s", math.round(getprop("/systems/electrical/extra/apu-load"))));
me["APUGenVolt"].setText(sprintf("%s", math.round(getprop("/systems/electrical/extra/apu-volts"))));
me["APUGenHz"].setText(sprintf("%s", math.round(getprop("/systems/electrical/extra/apu-hz"))));
# APU Bleed
if (getprop("/controls/adirs/ir[1]/knob") != 1 and (getprop("/controls/APU/master") == 1 or getprop("/systems/pneumatic/bleedapu") > 0)) {
me["APUBleedPSI"].setColor(0.0509,0.7529,0.2941);
me["APUBleedPSI"].setText(sprintf("%s", math.round(getprop("/systems/pneumatic/bleedapu"))));
} else {
me["APUBleedPSI"].setColor(0.7333,0.3803,0);
me["APUBleedPSI"].setText(sprintf("%s", "XX"));
}
if (getprop("/controls/pneumatic/switches/bleedapu") == 1) {
me["APUBleedValve"].setRotation(90 * D2R);
me["APUBleedOnline"].show();
} else {
me["APUBleedValve"].setRotation(0);
me["APUBleedOnline"].hide();
}
# APU N and EGT
if (getprop("/controls/APU/master") == 1) {
me["APUN"].setColor(0.0509,0.7529,0.2941);
me["APUN"].setText(sprintf("%s", math.round(getprop("/systems/apu/rpm"))));
me["APUEGT"].setColor(0.0509,0.7529,0.2941);
me["APUEGT"].setText(sprintf("%s", math.round(getprop("/systems/apu/egt"))));
} else if (getprop("/systems/apu/rpm") >= 1) {
me["APUN"].setColor(0.0509,0.7529,0.2941);
me["APUN"].setText(sprintf("%s", math.round(getprop("/systems/apu/rpm"))));
me["APUEGT"].setColor(0.0509,0.7529,0.2941);
me["APUEGT"].setText(sprintf("%s", math.round(getprop("/systems/apu/egt"))));
} else {
me["APUN"].setColor(0.7333,0.3803,0);
me["APUN"].setText(sprintf("%s", "XX"));
me["APUEGT"].setColor(0.7333,0.3803,0);
me["APUEGT"].setText(sprintf("%s", "XX"));
}
me["APUN-needle"].setRotation((getprop("/ECAM/Lower/APU-N") + 90) * D2R);
me["APUEGT-needle"].setRotation((getprop("/ECAM/Lower/APU-EGT") + 90) * D2R);
me.updateBottomStatus();
},
};
var canvas_lowerECAM_bleed = {
new: func(canvas_group, file) {
var m = {parents: [canvas_lowerECAM_bleed, canvas_lowerECAM_base]};
m.init(canvas_group, file);
return m;
},
getKeys: func() {
return ["TAT","SAT","GW","UTCh","UTCm"];
},
update: func() {
me.updateBottomStatus();
},
};
var canvas_lowerECAM_cond = {
new: func(canvas_group, file) {
var m = {parents: [canvas_lowerECAM_cond, canvas_lowerECAM_base]};
m.init(canvas_group, file);
return m;
},
getKeys: func() {
return ["TAT","SAT","GW","UTCh","UTCm"];
},
update: func() {
me.updateBottomStatus();
},
};
var canvas_lowerECAM_door = {
new: func(canvas_group, file) {
var m = {parents: [canvas_lowerECAM_door, canvas_lowerECAM_base]};
m.init(canvas_group, file);
return m;
},
getKeys: func() {
return["TAT","SAT","GW","UTCh","UTCm","Bulk","BulkLine","BulkLbl","Exit1L","Exit1R","Cabin1Left","Cabin1LeftLbl","Cabin1LeftLine","Cabin1LeftSlide","Cabin1Right","Cabin1RightLbl","Cabin1RightLine","Cabin1RightSlide","Cabin2Left","Cabin2LeftLbl",
"Cabin2LeftLine","Cabin2LeftSlide","Cabin2Right","Cabin2RightLbl","Cabin2RightLine","Cabin2RightSlide","Cabin3Left","Cabin3LeftLbl","Cabin3LeftLine","Cabin3LeftSlide","Cabin3Right","Cabin3RightLbl","Cabin3RightLine","Cabin3RightSlide","AvionicsLine1",
"AvionicsLbl1","AvionicsLine2","AvionicsLbl2","Cargo1Line","Cargo1Lbl","Cargo1Door","Cargo2Line","Cargo2Lbl","Cargo2Door","ExitLSlide","ExitLLine","ExitLLbl","ExitRSlide","ExitRLine","ExitRLbl","Cabin4Left","Cabin4LeftLbl","Cabin4LeftLine",
"Cabin4LeftSlide","Cabin4Right","Cabin4RightLbl","Cabin4RightLine","Cabin4RightSlide","DOOROXY-REGUL-LO-PR"];
},
update: func() {
# If you make AirBerlin or Allegiant livery add below
if (getprop("sim/model/door-positions/doorl1/position-norm") > 0) {
me["Cabin1Left"].show();
me["Cabin1Left"].setColor(0.7333,0.3803,0);
me["Cabin1Left"].setColorFill(0.7333,0.3803,0);
me["Cabin1LeftLbl"].show();
me["Cabin1LeftLine"].show();
} else {
me["Cabin1Left"].setColor(0.0509,0.7529,0.2941);
me["Cabin1Left"].setColorFill(0,0,0);
me["Cabin1LeftLbl"].hide();
me["Cabin1LeftLine"].hide();
}
if (getprop("sim/model/door-positions/doorr1/position-norm") > 0) {
me["Cabin1Right"].show();
me["Cabin1Right"].setColor(0.7333,0.3803,0);
me["Cabin1Right"].setColorFill(0.7333,0.3803,0);
me["Cabin1RightLbl"].show();
me["Cabin1RightLine"].show();
} else {
me["Cabin1Right"].setColor(0.0509,0.7529,0.2941);
me["Cabin1Right"].setColorFill(0,0,0);
me["Cabin1RightLbl"].hide();
me["Cabin1RightLine"].hide();
}
if (getprop("sim/model/door-positions/doorl4/position-norm") > 0) {
me["Cabin4Left"].show();
me["Cabin4Left"].setColor(0.7333,0.3803,0);
me["Cabin4Left"].setColorFill(0.7333,0.3803,0);
me["Cabin4LeftLbl"].show();
me["Cabin4LeftLine"].show();
} else {
me["Cabin4Left"].setColor(0.0509,0.7529,0.2941);
me["Cabin4Left"].setColorFill(0,0,0);
me["Cabin4LeftLbl"].hide();
me["Cabin4LeftLine"].hide();
}
if (getprop("sim/model/door-positions/doorr4/position-norm") > 0) {
me["Cabin4Right"].show();
me["Cabin4Right"].setColor(0.7333,0.3803,0);
me["Cabin4Right"].setColorFill(0.7333,0.3803,0);
me["Cabin4RightLbl"].show();
me["Cabin4RightLine"].show();
} else {
me["Cabin4Right"].setColor(0.0509,0.7529,0.2941);
me["Cabin4Right"].setColorFill(0,0,0);
me["Cabin4RightLbl"].hide();
me["Cabin4RightLine"].hide();
}
if (getprop("/sim/model/door-positions/cargobulk/position-norm") > 0) {
me["Bulk"].setColor(0.7333,0.3803,0);
me["Bulk"].setColorFill(0.7333,0.3803,0);
me["BulkLbl"].show();
me["BulkLine"].show();
} else {
me["Bulk"].setColor(0.0509,0.7529,0.2941);
me["Bulk"].setColorFill(0,0,0);
me["BulkLbl"].hide();
me["BulkLine"].hide();
}
if (getprop("/sim/model/door-positions/cargofwd/position-norm") > 0) {
me["Cargo1Door"].setColor(0.7333,0.3803,0);
me["Cargo1Door"].setColorFill(0.7333,0.3803,0);
me["Cargo1Lbl"].show();
me["Cargo1Line"].show();
} else {
me["Cargo1Door"].setColor(0.0509,0.7529,0.2941);
me["Cargo1Door"].setColorFill(0,0,0);
me["Cargo1Lbl"].hide();
me["Cargo1Line"].hide();
}
if (getprop("/sim/model/door-positions/cargoaft/position-norm") > 0) {
me["Cargo2Door"].setColor(0.7333,0.3803,0);
me["Cargo2Door"].setColorFill(0.7333,0.3803,0);
me["Cargo2Lbl"].show();
me["Cargo2Line"].show();
} else {
me["Cargo2Door"].setColor(0.0509,0.7529,0.2941);
me["Cargo2Door"].setColorFill(0,0,0);
me["Cargo2Lbl"].hide();
me["Cargo2Line"].hide();
}
me["Cabin1LeftSlide"].hide();
me["Cabin1RightSlide"].hide();
me["Cabin2LeftSlide"].hide();
me["Cabin2RightSlide"].hide();
me["Cabin3LeftSlide"].hide();
me["Cabin3RightSlide"].hide();
me["Cabin4LeftSlide"].hide();
me["Cabin4RightSlide"].hide();
me["DOOROXY-REGUL-LO-PR"].hide();
me["AvionicsLine1"].hide();
me["AvionicsLine2"].hide();
me["AvionicsLbl1"].hide();
me["AvionicsLbl2"].hide();
me["ExitLSlide"].hide();
me["ExitLLine"].hide();
me["ExitLLbl"].hide();
me["ExitRSlide"].hide();
me["ExitRLine"].hide();
me["ExitRLbl"].hide();
me["Cabin1LeftSlide"].hide();
me["Cabin1RightSlide"].hide();
me["Cabin4LeftSlide"].hide();
me["Cabin4RightSlide"].hide();
me["Cabin2Left"].hide();
me["Cabin2LeftLine"].hide();
me["Cabin2LeftLbl"].hide();
me["Cabin2Right"].hide();
me["Cabin2RightLine"].hide();
me["Cabin2RightLbl"].hide();
me["Cabin3Left"].hide();
me["Cabin3LeftLine"].hide();
me["Cabin3LeftLbl"].hide();
me["Cabin3Right"].hide();
me["Cabin3RightLine"].hide();
me["Cabin3RightLbl"].hide();
me.updateBottomStatus();
},
};
var canvas_lowerECAM_elec = {
new: func(canvas_group, file) {
var m = {parents: [canvas_lowerECAM_elec, canvas_lowerECAM_base]};
m.init(canvas_group, file);
return m;
},
getKeys: func() {
return ["TAT","SAT","GW","UTCh","UTCm","BAT1-label","Bat1Volt","Bat1Ampere","BAT2-label","Bat2Volt","Bat2Ampere","BAT1-charge","BAT1-discharge","BAT2-charge","BAT2-discharge","ELEC-Line-DC1-DCBAT","ELEC-Line-DC1-DCESS","ELEC-Line-DC2-DCBAT",
"ELEC-Line-DC1-DCESS_DCBAT","ELEC-Line-DC2-DCESS_DCBAT","ELEC-Line-TR1-DC1","ELEC-Line-TR2-DC2","Shed-label","ELEC-Line-ESSTR-DCESS","TR1-label","TR1Volt","TR1Ampere","TR2-label","TR2Volt","TR2Ampere","EMERGEN-Box-on","EmergenVolt","EmergenHz",
"ELEC-Line-Emergen-ESSTR","EMERGEN-Label-off","EMERGEN-out","ELEC-Line-ACESS-TRESS","ELEC-Line-AC1-TR1","ELEC-Line-AC2-TR2","ELEC-Line-AC1-ACESS","ELEC-Line-AC2-ACESS","ACESS-SHED","ACESS","AC1-in","AC2-in","ELEC-Line-GEN1-AC1","ELEC-Line-GEN2-AC2",
"ELEC-Line-APU-AC1","ELEC-Line-APU-EXT","ELEC-Line-EXT-AC2","APU-out","EXT-out","EXTPWR-group","ExtVolt","ExtHz","APU-content","APU-border","APUGentext","APUGenLoad","APUGenVolt","APUGenHz","APUGEN-off","GEN1-label","Gen1Load","Gen1Volt","Gen1Hz",
"GEN2-label","Gen2Load","GEN2-off","Gen2Volt","Gen2Hz","ELEC-IDG-1-label","ELEC-IDG-1-Temp","IDG1-LOPR","IDG1-DISC","IDG1-RISE-Value","IDG1-RISE-label","GalleyShed","ELEC-IDG-2-Temp","ELEC-IDG-2-label","IDG2-RISE-label","IDG2-RISE-Value","IDG2-LOPR",
"IDG2-DISC","ESSTR-group","ESSTR-Volt","ESSTR-Ampere","BAT1-content","BAT2-content","BAT1-OFF","BAT2-OFF","GEN1-content","GEN2-content","GEN-1-num-label","GEN-2-num-label","GEN1-off","GEN2-off","GEN1-num-label","GEN2-num-label","EXTPWR-label",
"ELEC-ACESS-SHED-label","ELEC-DCBAT-label","ELEC-DCESS-label","ELEC-DC2-label","ELEC-DC1-label","ELEC-AC1-label","ELEC-AC2-label","ELEC-ACESS-label"];
},
update: func() {
# BAT1
if (getprop("/controls/electrical/switches/battery1") == 0) {
me["BAT1-OFF"].show();
me["BAT1-content"].hide();
me["BAT1-discharge"].hide();
me["BAT1-charge"].hide();
} else {
me["BAT1-OFF"].hide();
me["BAT1-content"].show();
me["Bat1Ampere"].setText(sprintf("%s", math.round(getprop("/systems/electrical/battery1-amps"))));
me["Bat1Volt"].setText(sprintf("%s", math.round(getprop("/systems/electrical/battery1-volts"))));
if (getprop("/systems/electrical/battery1-volts") >= 25) {
me["Bat1Volt"].setColor(0.0509,0.7529,0.2941);
} else {
me["Bat1Volt"].setColor(0.7333,0.3803,0);
}
if (getprop("/systems/electrical/battery1-amps") > 5) {
me["Bat1Ampere"].setColor(0.7333,0.3803,0);
} else {
me["Bat1Ampere"].setColor(0.0509,0.7529,0.2941);
}
# TODO add correct charge/dischare behaviour
# this is only temporary
me["BAT1-discharge"].hide();
me["BAT1-charge"].hide();
}
if (getprop("/systems/electrical/batt1-fault") == 1 or getprop("/systems/electrical/battery1-volts") < 25 or getprop("/systems/electrical/battery1-amps") > 5) {
me["BAT1-label"].setColor(0.7333,0.3803,0);
} else {
me["BAT1-label"].setColor(0.8078,0.8039,0.8078);
}
# BAT2
if (getprop("/controls/electrical/switches/battery2") == 0) {
me["BAT2-OFF"].show();
me["BAT2-content"].hide();
me["BAT2-discharge"].hide();
me["BAT2-charge"].hide();
} else {
me["BAT2-OFF"].hide();
me["BAT2-content"].show();
me["Bat2Ampere"].setText(sprintf("%s", math.round(getprop("/systems/electrical/battery2-amps"))));
me["Bat2Volt"].setText(sprintf("%s", math.round(getprop("/systems/electrical/battery2-volts"))));
if (getprop("/systems/electrical/battery2-volts") >= 25) {
me["Bat2Volt"].setColor(0.0509,0.7529,0.2941);
} else {
me["Bat2Volt"].setColor(0.7333,0.3803,0);
}
if (getprop("/systems/electrical/battery2-amps") > 5) {
me["Bat2Ampere"].setColor(0.7333,0.3803,0);
} else {
me["Bat2Ampere"].setColor(0.0509,0.7529,0.2941);
}
# TODO add correct charge/dischare behaviour
# this is only temporary
me["BAT2-discharge"].hide();
me["BAT2-charge"].hide();
}
if (getprop("/systems/electrical/batt2-fault") == 1 or getprop("/systems/electrical/battery2-volts") < 25 or getprop("/systems/electrical/battery2-amps") > 5) {
me["BAT2-label"].setColor(0.7333,0.3803,0);
} else {
me["BAT2-label"].setColor(0.8078,0.8039,0.8078);
}
# TR1
# is only powered when ac1 has power
tr1_v = getprop("/systems/electrical/extra/tr1-volts");
tr1_a = getprop("/systems/electrical/extra/tr1-amps");
me["TR1Volt"].setText(sprintf("%s", math.round(tr1_v)));
me["TR1Ampere"].setText(sprintf("%s", math.round(tr1_a)));
if (tr1_v < 25 or tr1_v > 31 or tr1_a <= 5) {
me["TR1-label"].setColor(0.7333,0.3803,0);
} else {
me["TR1-label"].setColor(0.8078,0.8039,0.8078);
}
if (tr1_v < 25 or tr1_v > 31) {
me["TR1Volt"].setColor(0.7333,0.3803,0);
} else {
me["TR1Volt"].setColor(0.0509,0.7529,0.2941);
}
if (tr1_a <= 5) {
me["TR1Ampere"].setColor(0.7333,0.3803,0);
} else {
me["TR1Ampere"].setColor(0.0509,0.7529,0.2941);
}
# TR2
# is only powered when ac2 has power
tr2_v = getprop("/systems/electrical/extra/tr2-volts");
tr2_a = getprop("/systems/electrical/extra/tr2-amps");
me["TR2Volt"].setText(sprintf("%s", math.round(tr2_v)));
me["TR2Ampere"].setText(sprintf("%s", math.round(tr2_a)));
if (tr2_v < 25 or tr2_v > 31 or tr2_a <= 5) {
me["TR2-label"].setColor(0.7333,0.3803,0);
} else {
me["TR2-label"].setColor(0.8078,0.8039,0.8078);
}
if (tr2_v < 25 or tr2_v > 31) {
me["TR2Volt"].setColor(0.7333,0.3803,0);
} else {
me["TR2Volt"].setColor(0.0509,0.7529,0.2941);
}
if (tr2_a <= 5) {
me["TR2Ampere"].setColor(0.7333,0.3803,0);
} else {
me["TR2Ampere"].setColor(0.0509,0.7529,0.2941);
}
# ESS TR
# TODO add amber title on under A.
# TODO add correct A
if (getprop("/systems/electrical/bus/dc1") < 25) {
me["ESSTR-group"].show();
me["ESSTR-Volt"].setText(sprintf("%s", math.round(getprop("/systems/electrical/bus/dc-ess"))));
if (getprop("/systems/electrical/bus/dc-ess") < 25 or getprop("/systems/electrical/bus/dc-ess") > 31) {
me["ESSTR-Volt"].setColor(0.7333,0.3803,0);
} else {
me["ESSTR-Volt"].setColor(0.0509,0.7529,0.2941);
}
} else {
me["ESSTR-group"].hide();
}
# EMER GEN
# TODO add values and amber on over/under load
# TODO changes the prop to the one which indicates the use of the emergen and not of the man depoly
if (getprop("/controls/electrical/switches/emer-gen") == 0) {
me["EMERGEN-Box-on"].hide();
me["EMERGEN-Label-off"].show();
} else {
me["EMERGEN-Box-on"].show();
me["EMERGEN-Label-off"].hide();
}
# GEN1
if (getprop("/controls/electrical/switches/gen1") == 0) {
me["GEN1-content"].hide();
me["GEN1-off"].show();
me["GEN1-label"].setColor(0.7333,0.3803,0);
if (getprop("/engines/engine[0]/running") == 0) {
me["GEN1-num-label"].setColor(0.7333,0.3803,0);
} else {
me["GEN1-num-label"].setColor(0.8078,0.8039,0.8078);
}
} else {
me["GEN1-content"].show();
me["GEN1-off"].hide();
me["Gen1Load"].setText(sprintf("%s", math.round(getprop("/systems/electrical/extra/gen1-load"))));
me["Gen1Volt"].setText(sprintf("%s", math.round(getprop("/systems/electrical/extra/gen1-volts"))));
if (getprop("/systems/electrical/bus/gen1-hz") == 0) {
me["Gen1Hz"].setText(sprintf("XX"));
} else {
me["Gen1Hz"].setText(sprintf("%s", math.round(getprop("/systems/electrical/bus/gen1-hz"))));
}
if (getprop("/engines/engine[0]/running") == 0) {
me["GEN1-num-label"].setColor(0.7333,0.3803,0);
} else {
me["GEN1-num-label"].setColor(0.8078,0.8039,0.8078);
}
if (getprop("/systems/electrical/extra/gen1-volts") > 120 or getprop("/systems/electrical/extra/gen1-volts") < 110 or getprop("/systems/electrical/bus/gen1-hz") > 410 or getprop("/systems/electrical/bus/gen1-hz") < 390 or getprop("/systems/electrical/extra/gen1-load") > 100) {
me["GEN1-label"].setColor(0.7333,0.3803,0);
} else {
me["GEN1-label"].setColor(0.8078,0.8039,0.8078);
}
if (getprop("/systems/electrical/extra/gen1-load") > 100) {
me["Gen1Load"].setColor(0.7333,0.3803,0);
} else {
me["Gen1Load"].setColor(0.0509,0.7529,0.2941);
}
if (getprop("/systems/electrical/extra/gen1-volts") > 120 or getprop("/systems/electrical/extra/gen1-volts") < 110) {
me["Gen1Volt"].setColor(0.7333,0.3803,0);
} else {
me["Gen1Volt"].setColor(0.0509,0.7529,0.2941);
}
if (getprop("/systems/electrical/bus/gen1-hz") > 410 or getprop("/systems/electrical/bus/gen1-hz") < 390) {
me["Gen1Hz"].setColor(0.7333,0.3803,0);
} else {
me["Gen1Hz"].setColor(0.0509,0.7529,0.2941);
}
}
# GEN2
if (getprop("/controls/electrical/switches/gen2") == 0) {
me["GEN2-content"].hide();
me["GEN2-off"].show();
me["GEN2-label"].setColor(0.7333,0.3803,0);
if (getprop("/engines/engine[1]/running") == 0) {
me["GEN2-num-label"].setColor(0.7333,0.3803,0);
} else {
me["GEN2-num-label"].setColor(0.8078,0.8039,0.8078);
}
} else {
me["GEN2-content"].show();
me["GEN2-off"].hide();
me["Gen2Load"].setText(sprintf("%s", math.round(getprop("/systems/electrical/extra/gen2-load"))));
me["Gen2Volt"].setText(sprintf("%s", math.round(getprop("/systems/electrical/extra/gen2-volts"))));
if (getprop("/systems/electrical/bus/gen2-hz") == 0) {
me["Gen2Hz"].setText(sprintf("XX"));
} else {
me["Gen2Hz"].setText(sprintf("%s", math.round(getprop("/systems/electrical/bus/gen2-hz"))));
}
if (getprop("/engines/engine[1]/running") == 0) {
me["GEN2-num-label"].setColor(0.7333,0.3803,0);
} else {
me["GEN2-num-label"].setColor(0.8078,0.8039,0.8078);
}
if (getprop("/systems/electrical/extra/gen2-volts") > 120 or getprop("/systems/electrical/extra/gen2-volts") < 110 or getprop("/systems/electrical/bus/gen2-hz") > 410 or getprop("/systems/electrical/bus/gen2-hz") < 390 or getprop("/systems/electrical/extra/gen2-load") > 100) {
me["GEN2-label"].setColor(0.7333,0.3803,0);
} else {
me["GEN2-label"].setColor(0.8078,0.8039,0.8078);
}
if (getprop("/systems/electrical/extra/gen1-load") > 100) {
me["Gen1Load"].setColor(0.7333,0.3803,0);
} else {
me["Gen1Load"].setColor(0.0509,0.7529,0.2941);
}
if (getprop("/systems/electrical/extra/gen2-volts") > 120 or getprop("/systems/electrical/extra/gen2-volts") < 110) {
me["Gen2Volt"].setColor(0.7333,0.3803,0);
} else {
me["Gen2Volt"].setColor(0.0509,0.7529,0.2941);
}
if (getprop("/systems/electrical/bus/gen2-hz") > 410 or getprop("/systems/electrical/bus/gen2-hz") < 390) {
me["Gen2Hz"].setColor(0.7333,0.3803,0);
} else {
me["Gen2Hz"].setColor(0.0509,0.7529,0.2941);
}
}
# APU
if (getprop("/controls/APU/master") == 0) {
me["APU-content"].hide();
me["APUGEN-off"].hide();
me["APU-border"].hide();
me["APUGentext"].setColor(0.8078,0.8039,0.8078);
} else {
me["APU-border"].show();
if (getprop("/controls/electrical/switches/gen-apu") == 0) {
me["APU-content"].hide();
me["APUGEN-off"].show();
me["APUGentext"].setColor(0.7333,0.3803,0);
} else {
me["APU-content"].show();
me["APUGEN-off"].hide();
me["APUGenLoad"].setText(sprintf("%s", math.round(getprop("/systems/electrical/extra/apu-load"))));
me["APUGenVolt"].setText(sprintf("%s", math.round(getprop("/systems/electrical/extra/apu-volts"))));
if (getprop("/systems/electrical/extra/apu-hz") == 0) {
me["APUGenHz"].setText(sprintf("XX"));
} else {
me["APUGenHz"].setText(sprintf("%s", math.round(getprop("/systems/electrical/extra/apu-hz"))));
}
if (getprop("/systems/electrical/extra/apu-volts") > 120 or getprop("/systems/electrical/extra/apu-volts") < 110 or getprop("/systems/electrical/extra/apu-hz") > 410 or getprop("/systems/electrical/extra/apu-hz") < 390 or getprop("/systems/electrical/extra/apu-load") > 100) {
me["APUGentext"].setColor(0.7333,0.3803,0);
} else {
me["APUGentext"].setColor(0.8078,0.8039,0.8078);
}
if(getprop("/systems/electrical/extra/apu-load") > 100) {
me["APUGenLoad"].setColor(0.7333,0.3803,0);
} else {
me["APUGenLoad"].setColor(0.0509,0.7529,0.2941);
}
if (getprop("/systems/electrical/extra/apu-volts") > 120 or getprop("/systems/electrical/extra/apu-volts") < 110) {
me["APUGenVolt"].setColor(0.7333,0.3803,0);
} else {
me["APUGenVolt"].setColor(0.0509,0.7529,0.2941);
}
if (getprop("/systems/electrical/extra/apu-hz") > 410 or getprop("/systems/electrical/extra/apu-hz") < 390) {
me["APUGenHz"].setColor(0.7333,0.3803,0);
} else {
me["APUGenHz"].setColor(0.0509,0.7529,0.2941);
}
}
}
# EXT PWR
if (getprop("/controls/switches/cart") == 0) {
me["EXTPWR-group"].hide();
} else {
me["EXTPWR-group"].show();
me["ExtVolt"].setText(sprintf("%s", math.round(getprop("/systems/electrical/extra/ext-volts"))));
me["ExtHz"].setText(sprintf("%s", math.round(getprop("/systems/electrical/extra/ext-hz"))));
if (getprop("/systems/electrical/extra/ext-hz") > 410 or getprop("/systems/electrical/extra/ext-hz") < 390 or getprop("/systems/electrical/extra/ext-volts") > 120 or getprop("/systems/electrical/extra/ext-volts") < 110) {
me["EXTPWR-label"].setColor(0.7333,0.3803,0);
} else {
me["EXTPWR-label"].setColor(0.0509,0.7529,0.2941);
}
if (getprop("/systems/electrical/extra/ext-hz") > 410 or getprop("/systems/electrical/extra/ext-hz") < 390) {
me["ExtHz"].setColor(0.7333,0.3803,0);
} else {
me["ExtHz"].setColor(0.0509,0.7529,0.2941);
}
if (getprop("/systems/electrical/extra/ext-volts") > 120 or getprop("/systems/electrical/extra/ext-volts") < 110) {
me["ExtVolt"].setColor(0.7333,0.3803,0);
} else {
me["ExtVolt"].setColor(0.0509,0.7529,0.2941);
}
}
# TODO add IDG warnings and rise part
if (getprop("/systems/electrical/extra/galleyshed") == 1 or (getprop("/controls/electrical/switches/galley") == 0)) {
me["GalleyShed"].show();
} else {
me["GalleyShed"].hide();
}
# Bus indicators
if (getprop("/systems/electrical/bus/dcbat") > 25) {
me["ELEC-DCBAT-label"].setColor(0.0509,0.7529,0.2941);
} else {
me["ELEC-DCBAT-label"].setColor(0.7333,0.3803,0);
}
if (getprop("/systems/electrical/bus/dc1") > 25) {
me["ELEC-DC1-label"].setColor(0.0509,0.7529,0.2941);
} else {
me["ELEC-DC1-label"].setColor(0.7333,0.3803,0);
}
if (getprop("/systems/electrical/bus/dc2") > 25) {
me["ELEC-DC2-label"].setColor(0.0509,0.7529,0.2941);
} else {
me["ELEC-DC2-label"].setColor(0.7333,0.3803,0);
}
if (getprop("/systems/electrical/bus/dc-ess") > 25) {
me["ELEC-DCESS-label"].setColor(0.0509,0.7529,0.2941);
} else {
me["ELEC-DCESS-label"].setColor(0.7333,0.3803,0);
}
if (getprop("/systems/electrical/bus/ac-ess") > 110) {
me["ELEC-ACESS-label"].setColor(0.0509,0.7529,0.2941);
} else {
me["ELEC-ACESS-label"].setColor(0.7333,0.3803,0);
}
if (getprop("/systems/electrical/bus/ac-ess") > 110) {
me["ACESS-SHED"].hide();
} else {
me["ACESS-SHED"].show();
}
if (getprop("/systems/electrical/bus/ac1") > 110) {
me["ELEC-AC1-label"].setColor(0.0509,0.7529,0.2941);
} else {
me["ELEC-AC1-label"].setColor(0.7333,0.3803,0);
}
if (getprop("/systems/electrical/bus/ac2") > 110) {
me["ELEC-AC2-label"].setColor(0.0509,0.7529,0.2941);
} else {
me["ELEC-AC2-label"].setColor(0.7333,0.3803,0);
}
# Managment of the connecting lines between the components
if (getprop("/systems/electrical/ac1-src") == "APU" or getprop("/systems/electrical/ac2-src") == "APU") {
me["APU-out"].show();
} else {
me["APU-out"].hide();
}
if (getprop("/systems/electrical/ac1-src") == "EXT" or getprop("/systems/electrical/ac2-src") == "EXT") {
me["EXT-out"].show();
} else {
me["EXT-out"].hide();
}
if (getprop("/systems/electrical/extra/gen1-volts") >= 110) {
me["ELEC-Line-GEN1-AC1"].show();
} else {
me["ELEC-Line-GEN1-AC1"].hide();
}
if (getprop("/systems/electrical/extra/gen2-volts") >= 110) {
me["ELEC-Line-GEN2-AC2"].show();
} else {
me["ELEC-Line-GEN2-AC2"].hide();
}
if (getprop("/systems/electrical/bus/ac1") >= 110) {
me["AC1-in"].show();
} else {
me["AC1-in"].hide()
}
if (getprop("/systems/electrical/bus/ac2") >= 110) {
me["AC2-in"].show();
} else {
me["AC2-in"].hide()
}
if (getprop("/systems/electrical/ac1-src") == "APU" or getprop("/systems/electrical/ac1-src") == "EXT" or getprop("/systems/electrical/ac1-src") == "XTIE" or getprop("/systems/electrical/ac2-src") == "XTIE") {
me["ELEC-Line-APU-AC1"].show();
} else {
me["ELEC-Line-APU-AC1"].hide();
}
if (getprop("/systems/electrical/ac1-src") == "EXT" or getprop("/systems/electrical/ac2-src") == "APU" or getprop("/systems/electrical/ac1-src") == "XTIE" or getprop("/systems/electrical/ac2-src") == "XTIE") {
me["ELEC-Line-APU-EXT"].show();
} else {
me["ELEC-Line-APU-EXT"].hide();
}
if (getprop("/systems/electrical/ac2-src") == "APU" or getprop("/systems/electrical/ac2-src") == "EXT" or getprop("/systems/electrical/ac1-src") == "XTIE" or getprop("/systems/electrical/ac2-src") == "XTIE") {
me["ELEC-Line-EXT-AC2"].show();
} else {
me["ELEC-Line-EXT-AC2"].hide();
}
if (getprop("/controls/electrical/switches/ac-ess-feed") == 1) {
me["ELEC-Line-AC1-ACESS"].hide();
me["ELEC-Line-AC2-ACESS"].show();
} else {
me["ELEC-Line-AC1-ACESS"].show();
me["ELEC-Line-AC2-ACESS"].hide();
}
if (getprop("/systems/electrical/tr1-fault") == 0) {
if (getprop("/systems/electrical/bus/ac1") < 110) {
me["ELEC-Line-AC1-TR1"].setColorFill(0.7333,0.3803,0);
} else {
me["ELEC-Line-AC1-TR1"].setColorFill(0.0509,0.7529,0.2941);
}
me["ELEC-Line-AC1-TR1"].show();
me["ELEC-Line-TR1-DC1"].show();
} else {
me["ELEC-Line-AC1-TR1"].hide();
me["ELEC-Line-TR1-DC1"].hide();
}
if (getprop("/systems/electrical/tr2-fault") == 0) {
if (getprop("/systems/electrical/bus/ac2") < 110) {
me["ELEC-Line-AC2-TR2"].setColorFill(0.7333,0.3803,0);
} else {
me["ELEC-Line-AC2-TR2"].setColorFill(0.0509,0.7529,0.2941);
}
me["ELEC-Line-AC2-TR2"].show();
me["ELEC-Line-TR2-DC2"].show();
} else {
me["ELEC-Line-AC2-TR2"].hide();
me["ELEC-Line-TR2-DC2"].hide();
}
if (getprop("/systems/electrical/bus/ac1") < 110) {
me["ELEC-Line-DC1-DCESS"].hide();
} else {
me["ELEC-Line-DC1-DCESS"].show();
}
if (getprop("/systems/electrical/bus/dc1") < 25) {
me["ELEC-Line-DC1-DCESS_DCBAT"].hide();
me["ELEC-Line-DC1-DCBAT"].hide();
} else {
me["ELEC-Line-DC1-DCESS_DCBAT"].show();
me["ELEC-Line-DC1-DCBAT"].show();
}
if (getprop("/systems/electrical/bus/dc2") < 25 or getprop("/systems/electrical/bus/dc1") >= 25 and getprop("/systems/electrical/bus/ac1") >= 110) {
me["ELEC-Line-DC2-DCESS_DCBAT"].hide();
me["ELEC-Line-DC2-DCBAT"].hide();
} else {
me["ELEC-Line-DC2-DCESS_DCBAT"].show();
me["ELEC-Line-DC2-DCBAT"].show();
}
if (getprop("/controls/electrical/switches/emer-gen") == 1 and (getprop("/systems/electrical/bus/ac1") < 110 and getprop("/controls/electrical/switches/ac-ess-feed") == 0 or getprop("/systems/electrical/bus/ac2") < 110 and getprop("/controls/electrical/switches/ac-ess-feed") == 1)) {
me["EMERGEN-out"].show();
} else {
me["EMERGEN-out"].hide();
}
# TODO add connections from/to ESS TR
# hide not yet implemented items
me["IDG1-LOPR"].hide();
me["IDG2-LOPR"].hide();
me["IDG1-DISC"].hide();
me["IDG2-DISC"].hide();
me["Shed-label"].hide();
me["ELEC-Line-ACESS-TRESS"].hide();
me["ELEC-Line-Emergen-ESSTR"].hide();
me["IDG2-RISE-label"].hide();
me["IDG2-RISE-Value"].hide();
me["IDG1-RISE-label"].hide();
me["IDG1-RISE-Value"].hide();
me.updateBottomStatus();
},
};
var canvas_lowerECAM_eng = {
new: func(canvas_group, file) {
var m = {parents: [canvas_lowerECAM_eng, canvas_lowerECAM_base]};
m.init(canvas_group, file);
return m;
},
getKeys: func() {
return ["TAT","SAT","GW","UTCh","UTCm","OilQT1-needle","OilQT2-needle","OilQT1","OilQT2","OilQT1-decimal","OilQT2-decimal","OilPSI1-needle","OilPSI2-needle","OilPSI1","OilPSI2"];
},
update: func() {
# Oil Quantity
me["OilQT1"].setText(sprintf("%s", math.round(getprop("/engines/engine[0]/oil-qt-actual"))));
me["OilQT2"].setText(sprintf("%s", math.round(getprop("/engines/engine[1]/oil-qt-actual"))));
me["OilQT1-decimal"].setText(sprintf("%s", int(10*math.mod(getprop("/engines/engine[0]/oil-qt-actual"),1))));
me["OilQT2-decimal"].setText(sprintf("%s", int(10*math.mod(getprop("/engines/engine[1]/oil-qt-actual"),1))));
me["OilQT1-needle"].setRotation((getprop("/ECAM/Lower/Oil-QT[0]") + 90) * D2R);
me["OilQT2-needle"].setRotation((getprop("/ECAM/Lower/Oil-QT[1]") + 90) * D2R);
# Oil Pressure
if (getprop("/engines/engine[0]/oil-psi-actual") >= 20) {
me["OilPSI1"].setColor(0.0509,0.7529,0.2941);
me["OilPSI1-needle"].setColor(0.0509,0.7529,0.2941);
} else {
me["OilPSI1"].setColor(1,0,0);
me["OilPSI1-needle"].setColor(1,0,0);
}
if (getprop("/engines/engine[1]/oil-psi-actual") >= 20) {
me["OilPSI2"].setColor(0.0509,0.7529,0.2941);
me["OilPSI2-needle"].setColor(0.0509,0.7529,0.2941);
} else {
me["OilPSI2"].setColor(1,0,0);
me["OilPSI2-needle"].setColor(1,0,0);
}
me["OilPSI1"].setText(sprintf("%s", math.round(getprop("/engines/engine[0]/oil-psi-actual"))));
me["OilPSI2"].setText(sprintf("%s", math.round(getprop("/engines/engine[1]/oil-psi-actual"))));
me["OilPSI1-needle"].setRotation((getprop("/ECAM/Lower/Oil-PSI[0]") + 90) * D2R);
me["OilPSI2-needle"].setRotation((getprop("/ECAM/Lower/Oil-PSI[1]") + 90) * D2R);
me.updateBottomStatus();
},
};
var canvas_lowerECAM_fctl = {
new: func(canvas_group, file) {
var m = {parents: [canvas_lowerECAM_fctl, canvas_lowerECAM_base]};
m.init(canvas_group, file);
return m;
},
getKeys: func() {
return["TAT","SAT","GW","UTCh","UTCm","ailL","ailR","elevL","elevR","PTcc","PT","PTupdn","elac1","elac2","sec1","sec2","sec3","ailLblue","ailRblue","elevLblue","elevRblue","rudderblue","ailLgreen","ailRgreen","elevLgreen","ruddergreen","PTgreen",
"elevRyellow","rudderyellow","PTyellow","rudder","spdbrkblue","spdbrkgreen","spdbrkyellow","spoiler1Rex","spoiler1Rrt","spoiler2Rex","spoiler2Rrt","spoiler3Rex","spoiler3Rrt","spoiler4Rex","spoiler4Rrt","spoiler5Rex","spoiler5Rrt","spoiler1Lex",
"spoiler1Lrt","spoiler2Lex","spoiler2Lrt","spoiler3Lex","spoiler3Lrt","spoiler4Lex","spoiler4Lrt","spoiler5Lex","spoiler5Lrt","spoiler1Rf","spoiler2Rf","spoiler3Rf","spoiler4Rf","spoiler5Rf","spoiler1Lf","spoiler2Lf","spoiler3Lf","spoiler4Lf",
"spoiler5Lf","ailLscale","ailRscale","path4249","path4249-3","path4249-3-6-7","path4249-3-6-7-5","path4249-3-6"];
},
update: func() {
blue_psi = getprop("/systems/hydraulic/blue-psi");
green_psi = getprop("/systems/hydraulic/green-psi");
yellow_psi = getprop("/systems/hydraulic/yellow-psi");
# Pitch Trim
me["PT"].setText(sprintf("%2.1f", math.round(getprop("/ECAM/Lower/elevator-trim-deg"), 0.1)));
if (math.round(getprop("/ECAM/Lower/elevator-trim-deg"), 0.1) >= 0) {
me["PTupdn"].setText(sprintf("UP"));
} else if (math.round(getprop("/ECAM/Lower/elevator-trim-deg"), 0.1) < 0) {
me["PTupdn"].setText(sprintf("DN"));
}
if (green_psi < 1500 and yellow_psi < 1500) {
me["PT"].setColor(0.7333,0.3803,0);
me["PTupdn"].setColor(0.7333,0.3803,0);
me["PTcc"].setColor(0.7333,0.3803,0);
} else {
me["PT"].setColor(0.0509,0.7529,0.2941);
me["PTupdn"].setColor(0.0509,0.7529,0.2941);
me["PTcc"].setColor(0.0509,0.7529,0.2941);
}
# Ailerons
me["ailL"].setTranslation(0,getprop("/ECAM/Lower/aileron-ind-left")*100);
me["ailR"].setTranslation(0,getprop("/ECAM/Lower/aileron-ind-right")*(-100));
if (blue_psi < 1500 and green_psi < 1500) {
me["ailL"].setColor(0.7333,0.3803,0);
me["ailR"].setColor(0.7333,0.3803,0);
} else {
me["ailL"].setColor(0.0509,0.7529,0.2941);
me["ailR"].setColor(0.0509,0.7529,0.2941);
}
# Elevators
me["elevL"].setTranslation(0,getprop("/ECAM/Lower/elevator-ind-left")*100);
me["elevR"].setTranslation(0,getprop("/ECAM/Lower/elevator-ind-right")*100);
if (blue_psi < 1500 and green_psi < 1500) {
me["elevL"].setColor(0.7333,0.3803,0);
} else {
me["elevL"].setColor(0.0509,0.7529,0.2941);
}
if (blue_psi < 1500 and yellow_psi < 1500) {
me["elevR"].setColor(0.7333,0.3803,0);
} else {
me["elevR"].setColor(0.0509,0.7529,0.2941);
}
# Rudder
me["rudder"].setRotation(getprop("/controls/flight/rudder-fdm")*(-0.6));
if (blue_psi < 1500 and yellow_psi < 1500 and green_psi < 1500) {
me["rudder"].setColor(0.7333,0.3803,0);
} else {
me["rudder"].setColor(0.0509,0.7529,0.2941);
}
# Spoilers
if (getprop("/controls/flight/spoiler-l1") < 0.033) {
me["spoiler1Lex"].hide();
me["spoiler1Lrt"].show();
} else {
me["spoiler1Lrt"].hide();
me["spoiler1Lex"].show();
}
if (getprop("/controls/flight/spoiler-l2") < 0.033) {
me["spoiler2Lex"].hide();
me["spoiler2Lrt"].show();
} else {
me["spoiler2Lrt"].hide();
me["spoiler2Lex"].show();
}
if (getprop("/controls/flight/spoiler-l3") < 0.033) {
me["spoiler3Lex"].hide();
me["spoiler3Lrt"].show();
} else {
me["spoiler3Lrt"].hide();
me["spoiler3Lex"].show();
}
if (getprop("/controls/flight/spoiler-l4") < 0.033) {
me["spoiler4Lex"].hide();
me["spoiler4Lrt"].show();
} else {
me["spoiler4Lrt"].hide();
me["spoiler4Lex"].show();
}
if (getprop("/controls/flight/spoiler-l5") < 0.033) {
me["spoiler5Lex"].hide();
me["spoiler5Lrt"].show();
} else {
me["spoiler5Lrt"].hide();
me["spoiler5Lex"].show();
}
if (getprop("/controls/flight/spoiler-r1") < 0.033) {
me["spoiler1Rex"].hide();
me["spoiler1Rrt"].show();
} else {
me["spoiler1Rrt"].hide();
me["spoiler1Rex"].show();
}
if (getprop("/controls/flight/spoiler-r2") < 0.033) {
me["spoiler2Rex"].hide();
me["spoiler2Rrt"].show();
} else {
me["spoiler2Rrt"].hide();
me["spoiler2Rex"].show();
}
if (getprop("/controls/flight/spoiler-r3") < 0.033) {
me["spoiler3Rex"].hide();
me["spoiler3Rrt"].show();
} else {
me["spoiler3Rrt"].hide();
me["spoiler3Rex"].show();
}
if (getprop("/controls/flight/spoiler-r4") < 0.033) {
me["spoiler4Rex"].hide();
me["spoiler4Rrt"].show();
} else {
me["spoiler4Rrt"].hide();
me["spoiler4Rex"].show();
}
if (getprop("/controls/flight/spoiler-r5") < 0.033) {
me["spoiler5Rex"].hide();
me["spoiler5Rrt"].show();
} else {
me["spoiler5Rrt"].hide();
me["spoiler5Rex"].show();
}
# Spoiler Fail
if (getprop("/controls/flight/spoiler-l1-failed") or green_psi < 1500) {
me["spoiler1Lex"].setColor(0.7333,0.3803,0);
me["spoiler1Lrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-l1") < 0.033) {
me["spoiler1Lf"].show();
} else {
me["spoiler1Lf"].hide();
}
} else {
me["spoiler1Lex"].setColor(0.0509,0.7529,0.2941);
me["spoiler1Lrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler1Lf"].hide();
}
if (getprop("/controls/flight/spoiler-l2-failed") or yellow_psi < 1500) {
me["spoiler2Lex"].setColor(0.7333,0.3803,0);
me["spoiler2Lrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-l2") < 0.033) {
me["spoiler2Lf"].show();
} else {
me["spoiler2Lf"].hide();
}
} else {
me["spoiler2Lex"].setColor(0.0509,0.7529,0.2941);
me["spoiler2Lrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler2Lf"].hide();
}
if (getprop("/controls/flight/spoiler-l3-failed") or blue_psi < 1500) {
me["spoiler3Lex"].setColor(0.7333,0.3803,0);
me["spoiler3Lrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-l3") < 0.033) {
me["spoiler3Lf"].show();
} else {
me["spoiler3Lf"].hide();
}
} else {
me["spoiler3Lex"].setColor(0.0509,0.7529,0.2941);
me["spoiler3Lrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler3Lf"].hide();
}
if (getprop("/controls/flight/spoiler-l4-failed") or yellow_psi < 1500) {
me["spoiler4Lex"].setColor(0.7333,0.3803,0);
me["spoiler4Lrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-l4") < 0.033) {
me["spoiler4Lf"].show();
} else {
me["spoiler4Lf"].hide();
}
} else {
me["spoiler4Lex"].setColor(0.0509,0.7529,0.2941);
me["spoiler4Lrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler4Lf"].hide();
}
if (getprop("/controls/flight/spoiler-l5-failed") or green_psi < 1500) {
me["spoiler5Lex"].setColor(0.7333,0.3803,0);
me["spoiler5Lrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-l5") < 0.033) {
me["spoiler5Lf"].show();
} else {
me["spoiler5Lf"].hide();
}
} else {
me["spoiler5Lex"].setColor(0.0509,0.7529,0.2941);
me["spoiler5Lrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler5Lf"].hide();
}
if (getprop("/controls/flight/spoiler-r1-failed") or green_psi < 1500) {
me["spoiler1Rex"].setColor(0.7333,0.3803,0);
me["spoiler1Rrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-r1") < 0.033) {
me["spoiler1Rf"].show();
} else {
me["spoiler1Rf"].hide();
}
} else {
me["spoiler1Rex"].setColor(0.0509,0.7529,0.2941);
me["spoiler1Rrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler1Rf"].hide();
}
if (getprop("/controls/flight/spoiler-r2-failed") or yellow_psi < 1500) {
me["spoiler2Rex"].setColor(0.7333,0.3803,0);
me["spoiler2Rrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-r2") < 0.033) {
me["spoiler2Rf"].show();
} else {
me["spoiler2Rf"].hide();
}
} else {
me["spoiler2Rex"].setColor(0.0509,0.7529,0.2941);
me["spoiler2Rrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler2Rf"].hide();
}
if (getprop("/controls/flight/spoiler-r3-failed") or blue_psi < 1500) {
me["spoiler3Rex"].setColor(0.7333,0.3803,0);
me["spoiler3Rrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-r3") < 0.033) {
me["spoiler3Rf"].show();
} else {
me["spoiler3Rf"].hide();
}
} else {
me["spoiler3Rex"].setColor(0.0509,0.7529,0.2941);
me["spoiler3Rrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler3Rf"].hide();
}
if (getprop("/controls/flight/spoiler-r4-failed") or yellow_psi < 1500) {
me["spoiler4Rex"].setColor(0.7333,0.3803,0);
me["spoiler4Rrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-r4") < 0.033) {
me["spoiler4Rf"].show();
} else {
me["spoiler4Rf"].hide();
}
} else {
me["spoiler4Rex"].setColor(0.0509,0.7529,0.2941);
me["spoiler4Rrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler4Rf"].hide();
}
if (getprop("/controls/flight/spoiler-r5-failed") or green_psi < 1500) {
me["spoiler5Rex"].setColor(0.7333,0.3803,0);
me["spoiler5Rrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-r5") < 0.033) {
me["spoiler5Rf"].show();
} else {
me["spoiler5Rf"].hide();
}
} else {
me["spoiler5Rex"].setColor(0.0509,0.7529,0.2941);
me["spoiler5Rrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler5Rf"].hide();
}
# Flight Computers
if (getprop("/systems/fctl/elac1")) {
me["elac1"].setColor(0.0509,0.7529,0.2941);
me["path4249"].setColor(0.0509,0.7529,0.2941);
} else if ((getprop("/systems/fctl/elac1") == 0) or (getprop("/systems/failures/elac1") == 1)) {
me["elac1"].setColor(0.7333,0.3803,0);
me["path4249"].setColor(0.7333,0.3803,0);
}
if (getprop("/systems/fctl/elac2")) {
me["elac2"].setColor(0.0509,0.7529,0.2941);
me["path4249-3"].setColor(0.0509,0.7529,0.2941);
} else if ((getprop("/systems/fctl/elac2") == 0) or (getprop("/systems/failures/elac2") == 1)) {
me["elac2"].setColor(0.7333,0.3803,0);
me["path4249-3"].setColor(0.7333,0.3803,0);
}
if (getprop("/systems/fctl/sec1")) {
me["sec1"].setColor(0.0509,0.7529,0.2941);
me["path4249-3-6-7"].setColor(0.0509,0.7529,0.2941);
} else if ((getprop("/systems/fctl/sec1") == 0) or (getprop("/systems/failures/sec1") == 1)) {
me["sec1"].setColor(0.7333,0.3803,0);
me["path4249-3-6-7"].setColor(0.7333,0.3803,0);
}
if (getprop("/systems/fctl/sec2")) {
me["sec2"].setColor(0.0509,0.7529,0.2941);
me["path4249-3-6-7-5"].setColor(0.0509,0.7529,0.2941);
} else if ((getprop("/systems/fctl/sec2") == 0) or (getprop("/systems/failures/sec2") == 1)) {
me["sec2"].setColor(0.7333,0.3803,0);
me["path4249-3-6-7-5"].setColor(0.7333,0.3803,0);
}
if (getprop("/systems/fctl/sec3")) {
me["sec3"].setColor(0.0509,0.7529,0.2941);
me["path4249-3-6"].setColor(0.0509,0.7529,0.2941);
} else if ((getprop("/systems/fctl/sec3") == 0) or (getprop("/systems/failures/sec3") == 1)) {
me["sec3"].setColor(0.7333,0.3803,0);
me["path4249-3-6"].setColor(0.7333,0.3803,0);
}
# Hydraulic Indicators
if (getprop("/systems/hydraulic/blue-psi") >= 1500) {
me["ailLblue"].setColor(0.0509,0.7529,0.2941);
me["ailRblue"].setColor(0.0509,0.7529,0.2941);
me["elevLblue"].setColor(0.0509,0.7529,0.2941);
me["elevRblue"].setColor(0.0509,0.7529,0.2941);
me["rudderblue"].setColor(0.0509,0.7529,0.2941);
me["spdbrkblue"].setColor(0.0509,0.7529,0.2941);
} else {
me["ailLblue"].setColor(0.7333,0.3803,0);
me["ailRblue"].setColor(0.7333,0.3803,0);
me["elevLblue"].setColor(0.7333,0.3803,0);
me["elevRblue"].setColor(0.7333,0.3803,0);
me["rudderblue"].setColor(0.7333,0.3803,0);
me["spdbrkblue"].setColor(0.7333,0.3803,0);
}
if (getprop("/systems/hydraulic/green-psi") >= 1500) {
me["ailLgreen"].setColor(0.0509,0.7529,0.2941);
me["ailRgreen"].setColor(0.0509,0.7529,0.2941);
me["elevLgreen"].setColor(0.0509,0.7529,0.2941);
me["ruddergreen"].setColor(0.0509,0.7529,0.2941);
me["PTgreen"].setColor(0.0509,0.7529,0.2941);
me["spdbrkgreen"].setColor(0.0509,0.7529,0.2941);
} else {
me["ailLgreen"].setColor(0.7333,0.3803,0);
me["ailRgreen"].setColor(0.7333,0.3803,0);
me["elevLgreen"].setColor(0.7333,0.3803,0);
me["ruddergreen"].setColor(0.7333,0.3803,0);
me["PTgreen"].setColor(0.7333,0.3803,0);
me["spdbrkgreen"].setColor(0.7333,0.3803,0);
}
if (getprop("/systems/hydraulic/yellow-psi") >= 1500) {
me["elevRyellow"].setColor(0.0509,0.7529,0.2941);
me["rudderyellow"].setColor(0.0509,0.7529,0.2941);
me["PTyellow"].setColor(0.0509,0.7529,0.2941);
me["spdbrkyellow"].setColor(0.0509,0.7529,0.2941);
} else {
me["elevRyellow"].setColor(0.7333,0.3803,0);
me["rudderyellow"].setColor(0.7333,0.3803,0);
me["PTyellow"].setColor(0.7333,0.3803,0);
me["spdbrkyellow"].setColor(0.7333,0.3803,0);
}
me.updateBottomStatus();
},
};
var canvas_lowerECAM_fuel = {
new: func(canvas_group, file) {
var m = {parents: [canvas_lowerECAM_fuel, canvas_lowerECAM_base]};
m.init(canvas_group, file);
return m;
},
getKeys: func() {
return["TAT","SAT","GW","UTCh","UTCm","FUEL-Pump-Left-1","FUEL-Pump-Left-2","FUEL-Pump-Center-1","FUEL-Pump-Center-2","FUEL-Pump-Right-1","FUEL-Pump-Right-2","FUEL-Left-blocked","FUEL-Right-blocked","FUEL-Center-blocked","FUEL-Left-Tranfser",
"FUEL-Right-Tranfse","FUEL-Left-Outer-Inacc","FUEL-Left-Inner-Inacc","FUEL-Center-Inacc","FUEL-Right-Inner-Inacc","FUEL-Right-Outer-Inacc","FUEL-Left-Outer-quantity","FUEL-Left-Inner-quantity","FUEL-Center-quantity","FUEL-Right-Inner-quantity",
"FUEL-Right-Outer-quantity","FUEL-On-Board","FUEL-Flow-per-min","FUEL-APU-arrow","FUEL-APU-label","FUEL-used-1","FUEL-used-both","FUEL-used-2","FUEL-ENG-Master-1","FUEL-ENG-Master-2","FUEL-XFEED","FUEL-XFEED-pipes","FUEL-Left-Outer-temp",
"FUEL-Left-Inner-temp","FUEL-Right-Inner-temp","FUEL-Right-Outer-temp","FUEL-Pump-Left-1-Closed","FUEL-Pump-Left-1-Open","FUEL-Pump-Left-2-Closed","FUEL-Pump-Left-2-Open","FUEL-Pump-Center-1-Open","FUEL-Pump-Center-1-Closed","FUEL-Pump-Center-2-Closed",
"FUEL-Pump-Center-2-Open","FUEL-Pump-Right-1-Closed","FUEL-Pump-Right-1-Open","FUEL-Pump-Right-2-Closed","FUEL-Pump-Right-2-Open","FUEL-ENG-1-label","FUEL-ENG-2-label","FUEL-ENG-1-pipe","FUEL-ENG-2-pipe","FUEL-Right-Tranfser","ENG1idFFlow","ENG2idFFlow"];
},
update: func() {
# if (getprop("engines/engine[0]/n1-actual") < getprop("/controls/engines/idle-limit")) {
if (getprop("engines/engine[0]/n1-actual") < 19.7) {
me["ENG1idFFlow"].setColor(0.7333,0.3803,0);
} else {
me["ENG1idFFlow"].setColor(0.8078,0.8039,0.8078);
}
# if (getprop("engines/engine[1]/n1-actual") < getprop("/controls/engines/idle-limit")) {
if (getprop("engines/engine[1]/n1-actual") < 19.7) {
me["ENG2idFFlow"].setColor(0.7333,0.3803,0);
} else {
me["ENG2idFFlow"].setColor(0.8078,0.8039,0.8078);
}
# TODO add FOB half-boxed amber if some fuel is blocked
me["FUEL-On-Board"].setText(sprintf("%s", math.round(getprop("/consumables/fuel/total-fuel-lbs"), 10)));
if (getprop("/systems/fadec/powered1") == 1 and getprop("/systems/fadec/powered2") == 1) {
me["FUEL-Flow-per-min"].setColor(0.0509,0.7529,0.2941);
me["FUEL-Flow-per-min"].setText(sprintf("%s", math.round((getprop("/engines/engine[0]/fuel-flow_actual") + getprop("/engines/engine[1]/fuel-flow_actual")) / 60, 1)));
} else {
me["FUEL-Flow-per-min"].setColor(0.7333,0.3803,0);
me["FUEL-Flow-per-min"].setText("XX");
}
# this is now bound to the ENG master switch
# TODO use the valve prop and add amber if diffrence between eng master and valve
# TODO add transition state
# TODO fix amber/green at the same time when closed
if (getprop("/controls/engines/engine[0]/cutoff-switch") == 0) {
me["FUEL-ENG-Master-1"].setRotation(0);
me["FUEL-ENG-Master-1"].setColor(0.0509,0.7529,0.2941);
me["FUEL-ENG-1-pipe"].setColor(0.0509,0.7529,0.2941);
} else {
me["FUEL-ENG-Master-1"].setRotation(90 * D2R);
me["FUEL-ENG-Master-1"].setColor(0.7333,0.3803,0);
me["FUEL-ENG-1-pipe"].setColor(0.7333,0.3803,0);
}
# this is now bound to the ENG master switch
# TODO use the valve prop and add amber if diffrence between eng master and valve
# TODO add transition state
# TODO fix amber/green at the same time when closed
if (getprop("/controls/engines/engine[1]/cutoff-switch") == 0) {
me["FUEL-ENG-Master-2"].setRotation(0);
me["FUEL-ENG-Master-2"].setColor(0.0509,0.7529,0.2941);
me["FUEL-ENG-2-pipe"].setColor(0.0509,0.7529,0.2941);
} else {
me["FUEL-ENG-Master-2"].setRotation(90 * D2R);
me["FUEL-ENG-Master-2"].setColor(0.7333,0.3803,0);
me["FUEL-ENG-2-pipe"].setColor(0.7333,0.3803,0);
}
# this is now bound to the XFEED switch
# TODO use the valve prop
# TODO add amber when disagree between switch and btn
# TODO add transition state
if (getprop("/controls/fuel/x-feed") == 1) {
me["FUEL-XFEED"].setRotation(0);
me["FUEL-XFEED-pipes"].show();
} else {
me["FUEL-XFEED"].setRotation(90 * D2R);
me["FUEL-XFEED-pipes"].hide();
}
# TODO add LO indication
# TODO fix amber/green at the same time when closed
if (getprop("controls/fuel/tank0pump1") == 1) {
me["FUEL-Pump-Left-1-Open"].show();
me["FUEL-Pump-Left-1-Closed"].hide();
me["FUEL-Pump-Left-1"].setColor(0.0509,0.7529,0.2941);
} else {
me["FUEL-Pump-Left-1-Open"].hide();
me["FUEL-Pump-Left-1-Closed"].show();
me["FUEL-Pump-Left-1"].setColor(0.7333,0.3803,0);
}
# TODO add LO indication
# TODO fix amber/green at the same time when closed
if (getprop("controls/fuel/tank0pump2") == 1) {
me["FUEL-Pump-Left-2-Open"].show();
me["FUEL-Pump-Left-2-Closed"].hide();
me["FUEL-Pump-Left-2"].setColor(0.0509,0.7529,0.2941);
} else {
me["FUEL-Pump-Left-2-Open"].hide();
me["FUEL-Pump-Left-2-Closed"].show();
me["FUEL-Pump-Left-2"].setColor(0.7333,0.3803,0);
}
# TODO fix amber/green at the same time when closed
# TODO add functionality to match FCOM 1.28.20 "Amber: Transfer valve is open, whereas commanded closed in automatic or manual mode"
if (getprop("controls/fuel/tank1pump1") == 1) {
me["FUEL-Pump-Center-1-Open"].show();
me["FUEL-Pump-Center-1-Closed"].hide();
me["FUEL-Pump-Center-1"].setColor(0.0509,0.7529,0.2941);
} else {
me["FUEL-Pump-Center-1-Open"].hide();
me["FUEL-Pump-Center-1-Closed"].show();
me["FUEL-Pump-Center-1"].setColor(0.7333,0.3803,0);
}
# TODO add LO indication
# TODO fix amber/green at the same time when closed
if (getprop("controls/fuel/tank1pump2") == 1) {
me["FUEL-Pump-Center-2-Open"].show();
me["FUEL-Pump-Center-2-Closed"].hide();
me["FUEL-Pump-Center-2"].setColor(0.0509,0.7529,0.2941);
} else {
me["FUEL-Pump-Center-2-Open"].hide();
me["FUEL-Pump-Center-2-Closed"].show();
me["FUEL-Pump-Center-2"].setColor(0.7333,0.3803,0);
}
# TODO add LO indication
# TODO fix amber/green at the same time when closed
if (getprop("controls/fuel/tank2pump1") == 1) {
me["FUEL-Pump-Right-1-Open"].show();
me["FUEL-Pump-Right-1-Closed"].hide();
me["FUEL-Pump-Right-1"].setColor(0.0509,0.7529,0.2941);
} else {
me["FUEL-Pump-Right-1-Open"].hide();
me["FUEL-Pump-Right-1-Closed"].show();
me["FUEL-Pump-Right-1"].setColor(0.7333,0.3803,0);
}
# TODO add LO indication
# TODO fix amber/green at the same time when closed
if (getprop("controls/fuel/tank2pump2") == 1) {
me["FUEL-Pump-Right-2-Open"].show();
me["FUEL-Pump-Right-2-Closed"].hide();
me["FUEL-Pump-Right-2"].setColor(0.0509,0.7529,0.2941);
} else {
me["FUEL-Pump-Right-2-Open"].hide();
me["FUEL-Pump-Right-2-Closed"].show();
me["FUEL-Pump-Right-2"].setColor(0.7333,0.3803,0);
}
# Hide not yet implemented features
# TODO add them
me["FUEL-Left-blocked"].hide();
me["FUEL-Right-blocked"].hide();
me["FUEL-Center-blocked"].hide();
me["FUEL-Left-Outer-Inacc"].hide();
me["FUEL-Left-Inner-Inacc"].hide();
me["FUEL-Right-Outer-Inacc"].hide();
me["FUEL-Right-Inner-Inacc"].hide();
me["FUEL-Center-Inacc"].hide();
me["FUEL-Left-Tranfser"].hide();
me["FUEL-Right-Tranfser"].hide();
me["FUEL-Left-Outer-temp"].hide();
me["FUEL-Left-Inner-temp"].hide();
me["FUEL-Right-Outer-temp"].hide();
me["FUEL-Right-Inner-temp"].hide();
me.updateBottomStatus();
},
};
var canvas_lowerECAM_press = {
new: func(canvas_group, file) {
var m = {parents: [canvas_lowerECAM_press, canvas_lowerECAM_base]};
m.init(canvas_group, file);
return m;
},
getKeys: func() {
return ["TAT","SAT","GW","UTCh","UTCm"];
},
update: func() {
me.updateBottomStatus();
},
};
var canvas_lowerECAM_hyd = {
new: func(canvas_group, file) {
var m = {parents: [canvas_lowerECAM_hyd, canvas_lowerECAM_base]};
m.init(canvas_group, file);
return m;
},
getKeys: func() {
return ["TAT","SAT","GW","UTCh","UTCm","Green-Indicator","Blue-Indicator","Yellow-Indicator","Press-Green","Press-Blue","Press-Yellow","Green-Line","Blue-Line","Yellow-Line","PTU-Supply-Line","PTU-supply-yellow","PTU-supply-green","PTU-connection",
"PTU-Auto-or-off","RAT-label","RAT-stowed","RAT-not-stowed","ELEC-Yellow-off","ELEC-Yellow-on","ELEC-Yellow-label","ELEC-OVTH-Yellow","ELEC-Blue-label","ELEC-OVHT-Blue","ELEC-OVHT-Yellow","Pump-Green-label","Pump-Yellow-label","Pump-Green",
"Pump-LOPR-Green","Pump-Green-off","Pump-Green-on","Pump-Yellow","Pump-LOPR-Yellow","Pump-Yellow-off","Pump-Yellow-on","Pump-Blue","Pump-LOPR-Blue","Pump-Blue-off","Pump-Blue-on","Fire-Valve-Green","Fire-Valve-Yellow","LO-AIR-PRESS-Green",
"LO-AIR-PRESS-Yellow","LO-AIR-PRESS-Blue","OVHT-Green","OVHT-Blue","OVHT-Yellow","Quantity-Indicator-Green","Quantity-Indicator-Blue","Quantity-Indicator-Yellow","Green-label","Blue-label","Yellow-label"];
},
update: func() {
blue_psi = getprop("/systems/hydraulic/blue-psi");
green_psi = getprop("/systems/hydraulic/green-psi");
yellow_psi = getprop("/systems/hydraulic/yellow-psi");
me["Press-Green"].setText(sprintf("%s", green_psi));
me["Press-Blue"].setText(sprintf("%s", blue_psi));
me["Press-Yellow"].setText(sprintf("%s", yellow_psi));
if (blue_psi >= 1500) {
me["Blue-Line"].setColor(0.0509,0.7529,0.2941);
me["Blue-Line"].setColorFill(0.0509,0.7529,0.2941);
me["Blue-Indicator"].setColor(0.0509,0.7529,0.2941);
me["Press-Blue"].setColor(0.0509,0.7529,0.2941);
me["Blue-label"].setColor(0.8078,0.8039,0.8078);
} else {
me["Blue-Line"].setColor(0.7333,0.3803,0);
me["Blue-Line"].setColorFill(0.7333,0.3803,0);
me["Blue-Indicator"].setColor(0.7333,0.3803,0);
me["Press-Blue"].setColor(0.7333,0.3803,0);
me["Blue-label"].setColor(0.7333,0.3803,0);
}
if (yellow_psi >= 1500) {
me["Yellow-Line"].setColor(0.0509,0.7529,0.2941);
me["Yellow-Line"].setColorFill(0.0509,0.7529,0.2941);
me["Yellow-Indicator"].setColor(0.0509,0.7529,0.2941);
me["Press-Yellow"].setColor(0.0509,0.7529,0.2941);
me["Yellow-label"].setColor(0.8078,0.8039,0.8078);
} else {
me["Yellow-Line"].setColor(0.7333,0.3803,0);
me["Yellow-Line"].setColorFill(0.7333,0.3803,0);
me["Yellow-Indicator"].setColor(0.7333,0.3803,0);
me["Press-Yellow"].setColor(0.7333,0.3803,0);
me["Yellow-label"].setColor(0.7333,0.3803,0);
}
if (green_psi >= 1500) {
me["Green-Line"].setColor(0.0509,0.7529,0.2941);
me["Green-Line"].setColorFill(0.0509,0.7529,0.2941);
me["Green-Indicator"].setColor(0.0509,0.7529,0.2941);
me["Press-Green"].setColor(0.0509,0.7529,0.2941);
me["Green-label"].setColor(0.8078,0.8039,0.8078);
} else {
me["Green-Line"].setColor(0.7333,0.3803,0);
me["Green-Line"].setColorFill(0.7333,0.3803,0);
me["Green-Indicator"].setColor(0.7333,0.3803,0);
me["Press-Green"].setColor(0.7333,0.3803,0);
me["Green-label"].setColor(0.7333,0.3803,0);
}
if (getprop("/controls/hydraulic/ptu") == 1 and getprop("/systems/hydraulic/ptu-fault") == 0) {
me["PTU-connection"].setColor(0.0509,0.7529,0.2941);
me["PTU-Auto-or-off"].setColor(0.0509,0.7529,0.2941);
} else {
me["PTU-connection"].setColor(0.7333,0.3803,0);
me["PTU-Auto-or-off"].setColor(0.7333,0.3803,0);
}
if (getprop("/engines/engine[0]/n2-actual") >= 59) {
me["Pump-Green-label"].setColor(0.8078,0.8039,0.8078);
} else {
me["Pump-Green-label"].setColor(0.7333,0.3803,0);
}
if (getprop("/engines/engine[1]/n2-actual") >= 59) {
me["Pump-Yellow-label"].setColor(0.8078,0.8039,0.8078);
} else {
me["Pump-Yellow-label"].setColor(0.7333,0.3803,0);
}
if (getprop("/controls/hydraulic/eng1-pump") == 1) {
me["Pump-Green-off"].hide();
if (yellow_psi >= 1500) {
me["Pump-Green-on"].show();
me["Pump-LOPR-Green"].hide();
me["Pump-Green"].setColor(0.0509,0.7529,0.2941);
me["Pump-Green"].setColorFill(0.0509,0.7529,0.2941);
} else {
me["Pump-Green-on"].hide();
me["Pump-LOPR-Green"].show();
me["Pump-Green"].setColor(0.7333,0.3803,0);
me["Pump-Green"].setColorFill(0.7333,0.3803,0);
}
} else {
me["Pump-Green-off"].show();
me["Pump-Green-on"].hide();
me["Pump-LOPR-Green"].hide();
me["Pump-Green"].setColor(0.7333,0.3803,0);
}
if (getprop("/controls/hydraulic/eng2-pump") == 1) {
me["Pump-Yellow-off"].hide();
if (yellow_psi >= 1500) {
me["Pump-Yellow-on"].show();
me["Pump-LOPR-Yellow"].hide();
me["Pump-Yellow"].setColor(0.0509,0.7529,0.2941);
} else {
me["Pump-Yellow-on"].hide();
me["Pump-LOPR-Yellow"].show();
me["Pump-Yellow"].setColor(0.7333,0.3803,0);
}
} else {
me["Pump-Yellow-off"].show();
me["Pump-Yellow-on"].hide();
me["Pump-LOPR-Yellow"].hide();
me["Pump-Yellow"].setColor(0.7333,0.3803,0);
}
if (getprop("/controls/hydraulic/elec-pump-blue") == 1) {
me["Pump-Blue-off"].hide();
if (blue_psi >= 1500) {
me["Pump-Blue-on"].show();
me["Pump-LOPR-Blue"].hide();
me["Pump-Blue"].setColor(0.0509,0.7529,0.2941);
} else {
me["Pump-LOPR-Blue"].show();
me["Pump-Blue-on"].hide();
me["Pump-Blue"].setColor(0.7333,0.3803,0);
}
} else {
me["Pump-Blue-off"].show();
me["Pump-Blue-on"].hide();
me["Pump-LOPR-Blue"].hide();
me["Pump-Blue"].setColor(0.7333,0.3803,0);
}
if (getprop("/controls/hydraulic/elec-pump-yellow") == 0) {
me["ELEC-Yellow-on"].hide();
me["ELEC-Yellow-off"].show();
} else {
me["ELEC-Yellow-on"].show();
me["ELEC-Yellow-off"].hide();
}
# hiding elements which have no props in the tree yet and doesn't suite in in normal ops
# TODO add these when they are in the prop tree
me["LO-AIR-PRESS-Green"].hide();
me["LO-AIR-PRESS-Blue"].hide();
me["LO-AIR-PRESS-Yellow"].hide();
me["ELEC-OVHT-Yellow"].hide();
me["ELEC-OVHT-Blue"].hide();
me["RAT-not-stowed"].hide();
me["PTU-Supply-Line"].hide();
me["PTU-supply-yellow"].hide();
me["PTU-supply-green"].hide();
me["OVHT-Yellow"].hide();
me["OVHT-Green"].hide();
me["OVHT-Blue"].hide();
me.updateBottomStatus();
},
};
var canvas_lowerECAM_wheel = {
new: func(canvas_group, file) {
var m = {parents: [canvas_lowerECAM_wheel, canvas_lowerECAM_base]};
m.init(canvas_group, file);
return m;
},
getKeys: func() {
return ["TAT","SAT","GW","UTCh","UTCm","lgctltext","NORMbrk","NWStext","leftdoor","rightdoor","nosegeardoorL","nosegeardoorR","autobrk","autobrkind","NWS","NWSrect","normbrk-rect","altnbrk","normbrkhyd","spoiler1Rex","spoiler1Rrt","spoiler2Rex",
"spoiler2Rrt","spoiler3Rex","spoiler3Rrt","spoiler4Rex","spoiler4Rrt","spoiler5Rex","spoiler5Rrt","spoiler1Lex","spoiler1Lrt","spoiler2Lex","spoiler2Lrt","spoiler3Lex","spoiler3Lrt","spoiler4Lex","spoiler4Lrt","spoiler5Lex","spoiler5Lrt","spoiler1Rf",
"spoiler2Rf","spoiler3Rf","spoiler4Rf","spoiler5Rf","spoiler1Lf","spoiler2Lf","spoiler3Lf","spoiler4Lf","spoiler5Lf","ALTNbrk","altnbrkhyd","altnbrk-rect","antiskidtext","brakearrow","accupress_text","accuonlyarrow","accuonly","braketemp1","normbrkhyd",
"braketemp2","braketemp3","braketemp4","leftuplock","noseuplock","rightuplock","Triangle-Left1","Triangle-Left2","Triangle-Nose1","Triangle-Nose2","Triangle-Right1","Triangle-Right2","BSCUrect1","BSCUrect2","BSCU1","BSCU2"];
},
update: func() {
blue_psi = getprop("/systems/hydraulic/blue-psi");
green_psi = getprop("/systems/hydraulic/green-psi");
yellow_psi = getprop("/systems/hydraulic/yellow-psi");
autobrakemode = getprop("/controls/autobrake/mode");
nosegear = getprop("gear/gear[0]/position-norm");
leftgear = getprop("gear/gear[1]/position-norm");
rightgear = getprop("gear/gear[2]/position-norm");
leftdoor = getprop("/systems/hydraulic/gear/door-left");
rightdoor = getprop("/systems/hydraulic/gear/door-right");
nosedoor = getprop("/systems/hydraulic/gear/door-nose");
gearlvr = getprop("/controls/gear/gear-down");
askidsw = getprop("/systems/hydraulic/brakes/askidnwssw");
brakemode = getprop("/systems/hydraulic/brakes/mode");
accum = getprop("/systems/hydraulic/brakes/accumulator-pressure-psi");
# L/G CTL
if ((leftgear == 0 or nosegear == 0 or rightgear == 0 and gearlvr == 0) or (leftgear == 1 or nosegear == 1 or rightgear == 1 and gearlvr == 1)) {
me["lgctltext"].hide();
} else {
me["lgctltext"].show();
}
# NWS / Antiskid / Brakes
if (askidsw and yellow_psi >= 1500) {
me["NWStext"].hide();
me["NWS"].hide();
me["NWSrect"].hide();
me["antiskidtext"].hide();
me["BSCUrect1"].hide();
me["BSCUrect2"].hide();
me["BSCU1"].hide();
me["BSCU2"].hide();
} else if (!askidsw and yellow_psi >= 1500) {
me["NWStext"].show();
me["NWS"].show();
me["NWS"].setColor(0.0509,0.7529,0.2941);
me["NWSrect"].show();
me["antiskidtext"].show();
me["antiskidtext"].setColor(0.7333,0.3803,0);
me["BSCUrect1"].show();
me["BSCUrect2"].show();
me["BSCU1"].show();
me["BSCU2"].show();
} else {
me["NWStext"].show();
me["NWS"].show();
me["NWS"].setColor(0.7333,0.3803,0);
me["NWSrect"].show();
me["antiskidtext"].show();
me["antiskidtext"].setColor(0.7333,0.3803,0);
me["BSCUrect1"].show();
me["BSCUrect2"].show();
me["BSCU1"].show();
me["BSCU2"].show();
}
if (green_psi >= 1500 and brakemode == 1) {
me["NORMbrk"].hide();
me["normbrk-rect"].hide();
me["normbrkhyd"].hide();
} else if (green_psi >= 1500 and askidsw) {
me["NORMbrk"].show();
me["normbrk-rect"].show();
me["NORMbrk"].setColor(0.7333,0.3803,0);
me["normbrkhyd"].setColor(0.0509,0.7529,0.2941);
} else if (green_psi < 1500 or !askidsw) {
me["NORMbrk"].show();
me["normbrk-rect"].show();
me["NORMbrk"].setColor(0.7333,0.3803,0);
me["normbrkhyd"].setColor(0.7333,0.3803,0);
}
if (brakemode != 2) {
me["ALTNbrk"].hide();
me["altnbrk-rect"].hide();
me["altnbrkhyd"].hide();
} else if (yellow_psi >= 1500) {
me["ALTNbrk"].show();
me["altnbrk-rect"].show();
me["altnbrkhyd"].setColor(0.0509,0.7529,0.2941);
} else {
me["ALTNbrk"].show();
me["altnbrk-rect"].show();
me["altnbrkhyd"].setColor(0.7333,0.3803,0);
}
if (brakemode == 2 and accum < 200 and yellow_psi < 1500) {
me["accupress_text"].show();
me["brakearrow"].hide();
me["accupress_text"].setColor(0.7333,0.3803,0);
} else if (brakemode == 2 and accum > 200 and yellow_psi >= 1500){
me["accupress_text"].show();
me["brakearrow"].show();
me["accupress_text"].setColor(0.0509,0.7529,0.2941);
} else if (brakemode == 2 and accum > 200 and yellow_psi < 1500) {
me["accuonlyarrow"].show();
me["accuonly"].show();
me["brakearrow"].hide();
me["accupress_text"].hide();
} else {
me["accuonlyarrow"].hide();
me["accuonly"].hide();
me["brakearrow"].hide();
me["accupress_text"].hide();
}
# Gear Doors
me["leftdoor"].setRotation(getprop("/ECAM/Lower/door-left") * D2R);
me["rightdoor"].setRotation(getprop("/ECAM/Lower/door-right") * D2R);
me["nosegeardoorL"].setRotation(getprop("/ECAM/Lower/door-nose-left") * D2R);
me["nosegeardoorR"].setRotation(getprop("/ECAM/Lower/door-nose-right") * D2R);
if (nosedoor == 0) {
me["nosegeardoorL"].setColorFill(0.0509,0.7529,0.2941);
me["nosegeardoorR"].setColorFill(0.0509,0.7529,0.2941);
} else {
me["nosegeardoorL"].setColorFill(0.7333,0.3803,0);
me["nosegeardoorR"].setColorFill(0.7333,0.3803,0);
}
if (leftdoor == 0) {
me["leftdoor"].setColorFill(0.0509,0.7529,0.2941);
} else {
me["leftdoor"].setColorFill(0.7333,0.3803,0);
}
if (rightdoor == 0) {
me["rightdoor"].setColorFill(0.0509,0.7529,0.2941);
} else {
me["rightdoor"].setColorFill(0.7333,0.3803,0);
}
# Triangles
if (leftgear < 0.2 or leftgear > 0.8) {
me["Triangle-Left1"].hide();
me["Triangle-Left2"].hide();
} else {
me["Triangle-Left1"].show();
me["Triangle-Left2"].show();
}
if (leftgear == 1) {
me["Triangle-Left1"].setColor(0.0509,0.7529,0.2941);
me["Triangle-Left2"].setColor(0.0509,0.7529,0.2941);
} else {
me["Triangle-Left1"].setColor(1,0,0);
me["Triangle-Left2"].setColor(1,0,0);
}
if (nosegear < 0.2 or nosegear > 0.8) {
me["Triangle-Nose1"].hide();
me["Triangle-Nose2"].hide();
} else {
me["Triangle-Nose1"].show();
me["Triangle-Nose2"].show();
}
if (nosegear == 1) {
me["Triangle-Nose1"].setColor(0.0509,0.7529,0.2941);
me["Triangle-Nose2"].setColor(0.0509,0.7529,0.2941);
} else {
me["Triangle-Nose1"].setColor(1,0,0);
me["Triangle-Nose2"].setColor(1,0,0);
}
if (rightgear < 0.2 or rightgear > 0.8) {
me["Triangle-Right1"].hide();
me["Triangle-Right2"].hide();
} else {
me["Triangle-Right1"].show();
me["Triangle-Right2"].show();
}
if (rightgear == 1) {
me["Triangle-Right1"].setColor(0.0509,0.7529,0.2941);
me["Triangle-Right2"].setColor(0.0509,0.7529,0.2941);
} else {
me["Triangle-Right1"].setColor(1,0,0);
me["Triangle-Right2"].setColor(1,0,0);
}
# Autobrake
if (autobrakemode == 0) {
me["autobrkind"].hide();
} elsif (autobrakemode == 1) {
me["autobrkind"].show();
me["autobrkind"].setText(sprintf("%s", "LO"));
} elsif (autobrakemode == 2) {
me["autobrkind"].show();
me["autobrkind"].setText(sprintf("%s", "MED"));
} elsif (autobrakemode == 3) {
me["autobrkind"].show();
me["autobrkind"].setText(sprintf("%s", "MAX"));
}
if (getprop("/controls/autobrake/mode") != 0) {
me["autobrk"].show();
} elsif (getprop("/controls/autobrake/mode") == 0) {
me["autobrk"].hide();
}
# Spoilers
if (getprop("/controls/flight/spoiler-l1") < 0.033) {
me["spoiler1Lex"].hide();
me["spoiler1Lrt"].show();
} else {
me["spoiler1Lrt"].hide();
me["spoiler1Lex"].show();
}
if (getprop("/controls/flight/spoiler-l2") < 0.033) {
me["spoiler2Lex"].hide();
me["spoiler2Lrt"].show();
} else {
me["spoiler2Lrt"].hide();
me["spoiler2Lex"].show();
}
if (getprop("/controls/flight/spoiler-l3") < 0.033) {
me["spoiler3Lex"].hide();
me["spoiler3Lrt"].show();
} else {
me["spoiler3Lrt"].hide();
me["spoiler3Lex"].show();
}
if (getprop("/controls/flight/spoiler-l4") < 0.033) {
me["spoiler4Lex"].hide();
me["spoiler4Lrt"].show();
} else {
me["spoiler4Lrt"].hide();
me["spoiler4Lex"].show();
}
if (getprop("/controls/flight/spoiler-l5") < 0.033) {
me["spoiler5Lex"].hide();
me["spoiler5Lrt"].show();
} else {
me["spoiler5Lrt"].hide();
me["spoiler5Lex"].show();
}
if (getprop("/controls/flight/spoiler-r1") < 0.033) {
me["spoiler1Rex"].hide();
me["spoiler1Rrt"].show();
} else {
me["spoiler1Rrt"].hide();
me["spoiler1Rex"].show();
}
if (getprop("/controls/flight/spoiler-r2") < 0.033) {
me["spoiler2Rex"].hide();
me["spoiler2Rrt"].show();
} else {
me["spoiler2Rrt"].hide();
me["spoiler2Rex"].show();
}
if (getprop("/controls/flight/spoiler-r3") < 0.033) {
me["spoiler3Rex"].hide();
me["spoiler3Rrt"].show();
} else {
me["spoiler3Rrt"].hide();
me["spoiler3Rex"].show();
}
if (getprop("/controls/flight/spoiler-r4") < 0.033) {
me["spoiler4Rex"].hide();
me["spoiler4Rrt"].show();
} else {
me["spoiler4Rrt"].hide();
me["spoiler4Rex"].show();
}
if (getprop("/controls/flight/spoiler-r5") < 0.033) {
me["spoiler5Rex"].hide();
me["spoiler5Rrt"].show();
} else {
me["spoiler5Rrt"].hide();
me["spoiler5Rex"].show();
}
# Spoiler Fail
if (getprop("/controls/flight/spoiler-l1-failed") or green_psi < 1500) {
me["spoiler1Lex"].setColor(0.7333,0.3803,0);
me["spoiler1Lrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-l1") < 0.033) {
me["spoiler1Lf"].show();
} else {
me["spoiler1Lf"].hide();
}
} else {
me["spoiler1Lex"].setColor(0.0509,0.7529,0.2941);
me["spoiler1Lrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler1Lf"].hide();
}
if (getprop("/controls/flight/spoiler-l2-failed") or yellow_psi < 1500) {
me["spoiler2Lex"].setColor(0.7333,0.3803,0);
me["spoiler2Lrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-l2") < 0.033) {
me["spoiler2Lf"].show();
} else {
me["spoiler2Lf"].hide();
}
} else {
me["spoiler2Lex"].setColor(0.0509,0.7529,0.2941);
me["spoiler2Lrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler2Lf"].hide();
}
if (getprop("/controls/flight/spoiler-l3-failed") or blue_psi < 1500) {
me["spoiler3Lex"].setColor(0.7333,0.3803,0);
me["spoiler3Lrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-l3") < 0.033) {
me["spoiler3Lf"].show();
} else {
me["spoiler3Lf"].hide();
}
} else {
me["spoiler3Lex"].setColor(0.0509,0.7529,0.2941);
me["spoiler3Lrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler3Lf"].hide();
}
if (getprop("/controls/flight/spoiler-l4-failed") or yellow_psi < 1500) {
me["spoiler4Lex"].setColor(0.7333,0.3803,0);
me["spoiler4Lrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-l4") < 0.033) {
me["spoiler4Lf"].show();
} else {
me["spoiler4Lf"].hide();
}
} else {
me["spoiler4Lex"].setColor(0.0509,0.7529,0.2941);
me["spoiler4Lrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler4Lf"].hide();
}
if (getprop("/controls/flight/spoiler-l5-failed") or green_psi < 1500) {
me["spoiler5Lex"].setColor(0.7333,0.3803,0);
me["spoiler5Lrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-l5") < 0.033) {
me["spoiler5Lf"].show();
} else {
me["spoiler5Lf"].hide();
}
} else {
me["spoiler5Lex"].setColor(0.0509,0.7529,0.2941);
me["spoiler5Lrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler5Lf"].hide();
}
if (getprop("/controls/flight/spoiler-r1-failed") or green_psi < 1500) {
me["spoiler1Rex"].setColor(0.7333,0.3803,0);
me["spoiler1Rrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-r1") < 0.033) {
me["spoiler1Rf"].show();
} else {
me["spoiler1Rf"].hide();
}
} else {
me["spoiler1Rex"].setColor(0.0509,0.7529,0.2941);
me["spoiler1Rrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler1Rf"].hide();
}
if (getprop("/controls/flight/spoiler-r2-failed") or yellow_psi < 1500) {
me["spoiler2Rex"].setColor(0.7333,0.3803,0);
me["spoiler2Rrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-r2") < 0.033) {
me["spoiler2Rf"].show();
} else {
me["spoiler2Rf"].hide();
}
} else {
me["spoiler2Rex"].setColor(0.0509,0.7529,0.2941);
me["spoiler2Rrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler2Rf"].hide();
}
if (getprop("/controls/flight/spoiler-r3-failed") or blue_psi < 1500) {
me["spoiler3Rex"].setColor(0.7333,0.3803,0);
me["spoiler3Rrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-r3") < 0.033) {
me["spoiler3Rf"].show();
} else {
me["spoiler3Rf"].hide();
}
} else {
me["spoiler3Rex"].setColor(0.0509,0.7529,0.2941);
me["spoiler3Rrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler3Rf"].hide();
}
if (getprop("/controls/flight/spoiler-r4-failed") or yellow_psi < 1500) {
me["spoiler4Rex"].setColor(0.7333,0.3803,0);
me["spoiler4Rrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-r4") < 0.033) {
me["spoiler4Rf"].show();
} else {
me["spoiler4Rf"].hide();
}
} else {
me["spoiler4Rex"].setColor(0.0509,0.7529,0.2941);
me["spoiler4Rrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler4Rf"].hide();
}
if (getprop("/controls/flight/spoiler-r5-failed") or green_psi < 1500) {
me["spoiler5Rex"].setColor(0.7333,0.3803,0);
me["spoiler5Rrt"].setColor(0.7333,0.3803,0);
if (getprop("/controls/flight/spoiler-r5") < 0.033) {
me["spoiler5Rf"].show();
} else {
me["spoiler5Rf"].hide();
}
} else {
me["spoiler5Rex"].setColor(0.0509,0.7529,0.2941);
me["spoiler5Rrt"].setColor(0.0509,0.7529,0.2941);
me["spoiler5Rf"].hide();
}
# Hide not yet implemented stuff
me["braketemp1"].hide();
me["braketemp2"].hide();
me["braketemp3"].hide();
me["braketemp4"].hide();
me["leftuplock"].hide();
me["noseuplock"].hide();
me["rightuplock"].hide();
me.updateBottomStatus();
},
};
var canvas_lowerECAM_test = {
init: func(canvas_group, file) {
var font_mapper = func(family, weight) {
return "LiberationFonts/LiberationSans-Regular.ttf";
};
canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper});
var svg_keys = me.getKeys();
foreach(var key; svg_keys) {
me[key] = canvas_group.getElementById(key);
}
me.page = canvas_group;
return me;
},
new: func(canvas_group, file) {
var m = {parents: [canvas_lowerECAM_test]};
m.init(canvas_group, file);
return m;
},
getKeys: func() {
return ["Test_white","Test_text"];
},
update: func() {
if (getprop("/instrumentation/du/du4-test-time") + 1 >= elapsedtime) {
me["Test_white"].show();
me["Test_text"].hide();
} else {
me["Test_white"].hide();
me["Test_text"].show();
}
},
};
setlistener("sim/signals/fdm-initialized", func {
lowerECAM_display = canvas.new({
"name": "lowerECAM",
"size": [1024, 1024],
"view": [1024, 1024],
"mipmapping": 1
});
lowerECAM_display.addPlacement({"node": "lecam.screen"});
var groupApu = lowerECAM_display.createGroup();
var groupBleed = lowerECAM_display.createGroup();
var groupCond = lowerECAM_display.createGroup();
var groupDoor = lowerECAM_display.createGroup();
var groupElec = lowerECAM_display.createGroup();
var groupEng = lowerECAM_display.createGroup();
var groupFctl = lowerECAM_display.createGroup();
var groupFuel = lowerECAM_display.createGroup();
var groupPress = lowerECAM_display.createGroup();
var groupHyd = lowerECAM_display.createGroup();
var groupWheel = lowerECAM_display.createGroup();
var group_test = lowerECAM_display.createGroup();
lowerECAM_apu = canvas_lowerECAM_apu.new(groupApu, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/apu.svg");
lowerECAM_bleed = canvas_lowerECAM_bleed.new(groupBleed, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/bleed.svg");
lowerECAM_cond = canvas_lowerECAM_cond.new(groupCond, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/cond.svg");
lowerECAM_door = canvas_lowerECAM_door.new(groupDoor, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/door.svg");
lowerECAM_elec = canvas_lowerECAM_elec.new(groupElec, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/elec.svg");
lowerECAM_eng = canvas_lowerECAM_eng.new(groupEng, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/eng.svg");
lowerECAM_fctl = canvas_lowerECAM_fctl.new(groupFctl, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/fctl.svg");
lowerECAM_fuel = canvas_lowerECAM_fuel.new(groupFuel, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/fuel.svg");
lowerECAM_press = canvas_lowerECAM_press.new(groupPress, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/press.svg");
lowerECAM_hyd = canvas_lowerECAM_hyd.new(groupHyd, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/hyd.svg");
lowerECAM_wheel = canvas_lowerECAM_wheel.new(groupWheel, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/wheel.svg");
lowerECAM_test = canvas_lowerECAM_test.new(group_test, "Aircraft/IDG-A32X/Models/Instruments/Common/res/du-test.svg");
lowerECAM_update.start();
});
var lowerECAM_update = maketimer(0.05, func {
canvas_lowerECAM_base.update();
});
var showLowerECAM = func {
var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1);
dlg.setCanvas(lowerECAM_display);
}