2021-07-08 14:38:24 +00:00
|
|
|
# A3XX Lower ECAM Canvas
|
2022-01-11 02:17:41 +00:00
|
|
|
# Copyright (c) 2022 Josh Davidson (Octal450) and Jonathan Redpath
|
2021-07-08 14:38:24 +00:00
|
|
|
|
|
|
|
var canvas_lowerECAMPageCruise =
|
|
|
|
{
|
|
|
|
new: func(svg,name) {
|
|
|
|
var obj = {parents: [canvas_lowerECAMPageCruise,canvas_lowerECAM_base] };
|
|
|
|
obj.group = obj.canvas.createGroup();
|
|
|
|
obj.name = name;
|
|
|
|
|
|
|
|
canvas.parsesvg(obj.group, svg, {"font-mapper": obj.font_mapper} );
|
|
|
|
|
|
|
|
foreach(var key; obj.getKeys()) {
|
|
|
|
obj[key] = obj.group.getElementById(key);
|
|
|
|
};
|
|
|
|
|
|
|
|
foreach(var key; obj.getKeysBottom()) {
|
|
|
|
obj[key] = obj.group.getElementById(key);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
# init
|
2022-05-05 18:13:09 +00:00
|
|
|
obj.quantity = [0, 0];
|
2021-07-08 14:38:24 +00:00
|
|
|
|
|
|
|
obj.update_items = [
|
2022-05-08 19:01:49 +00:00
|
|
|
props.UpdateManager.FromHashList(["engOilQT1", "acconfigUnits"], 0.005, func(val) {
|
2022-05-05 18:13:09 +00:00
|
|
|
if (val.acconfigUnits) {
|
2022-05-08 19:01:49 +00:00
|
|
|
obj.quantity[0] = sprintf("%2.1f", math.clamp((0.1 * math.round(val.engOilQT1 * QT2LTR * 10, 5)), 0, 99.5));
|
2021-07-16 16:10:56 +00:00
|
|
|
} else {
|
2022-05-08 19:01:49 +00:00
|
|
|
obj.quantity[0] = sprintf("%2.1f", math.clamp((0.1 * math.round(val.engOilQT1 * 10, 5)), 0, 99.5));
|
2021-07-16 16:10:56 +00:00
|
|
|
}
|
|
|
|
}),
|
2022-05-08 19:01:49 +00:00
|
|
|
props.UpdateManager.FromHashList(["engOilQT2", "acconfigUnits"], 0.005, func(val) {
|
2022-05-05 18:13:09 +00:00
|
|
|
if (val.acconfigUnits) {
|
2022-05-08 19:01:49 +00:00
|
|
|
obj.quantity[1] = sprintf("%2.1f", math.clamp((0.1 * math.round(val.engOilQT2 * QT2LTR * 10, 5)), 0, 99.5));
|
2021-07-16 16:10:56 +00:00
|
|
|
} else {
|
2022-05-08 19:01:49 +00:00
|
|
|
obj.quantity[1] = sprintf("%2.1f", math.clamp((0.1 * math.round(val.engOilQT2 * 10, 5)), 0, 99.5));
|
2021-07-16 16:10:56 +00:00
|
|
|
}
|
|
|
|
}),
|
2022-05-05 18:13:09 +00:00
|
|
|
props.UpdateManager.FromHashValue("acconfigUnits", 1, func(val) {
|
2021-07-16 16:10:56 +00:00
|
|
|
if (val) {
|
|
|
|
obj["Fused-weight-unit"].setText("KG");
|
|
|
|
obj["OilUnit"].setText("LTR");
|
|
|
|
} else {
|
|
|
|
obj["Fused-weight-unit"].setText("LBS");
|
|
|
|
obj["OilUnit"].setText("QT");
|
|
|
|
}
|
|
|
|
}),
|
2022-05-05 18:13:09 +00:00
|
|
|
props.UpdateManager.FromHashList(["engFuelUsed1","acconfigUnits"], 1, func(val) {
|
|
|
|
if (val.acconfigUnits) {
|
|
|
|
obj["FUsed1"].setText(sprintf("%s", math.round(val.engFuelUsed1 * LBS2KGS, 10)));
|
2021-07-16 16:10:56 +00:00
|
|
|
} else {
|
2022-05-05 18:13:09 +00:00
|
|
|
obj["FUsed1"].setText(sprintf("%s", math.round(val.engFuelUsed1, 10)));
|
2021-07-16 16:10:56 +00:00
|
|
|
}
|
|
|
|
}),
|
2022-05-05 18:13:09 +00:00
|
|
|
props.UpdateManager.FromHashList(["engFuelUsed2","acconfigUnits"], 1, func(val) {
|
|
|
|
if (val.acconfigUnits) {
|
|
|
|
obj["FUsed2"].setText(sprintf("%s", math.round(val.engFuelUsed2 * LBS2KGS, 10)));
|
2021-07-16 16:10:56 +00:00
|
|
|
} else {
|
2022-05-05 18:13:09 +00:00
|
|
|
obj["FUsed2"].setText(sprintf("%s", math.round(val.engFuelUsed2, 10)));
|
2021-07-16 16:10:56 +00:00
|
|
|
}
|
|
|
|
}),
|
2022-05-05 18:13:09 +00:00
|
|
|
props.UpdateManager.FromHashList(["engFuelUsed1","engFuelUsed2","acconfigUnits"], 1, func(val) {
|
|
|
|
if (val.acconfigUnits) {
|
2021-07-16 16:10:56 +00:00
|
|
|
obj["FUsed"].setText(sprintf("%s", math.round((val.engFuelUsed1 + val.engFuelUsed2) * LBS2KGS, 10)));
|
|
|
|
} else {
|
|
|
|
obj["FUsed"].setText(sprintf("%s", math.round((val.engFuelUsed1 + val.engFuelUsed2), 10)));
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
props.UpdateManager.FromHashValue("pressDelta", 0.05, func(val) {
|
2022-04-20 20:22:33 +00:00
|
|
|
obj["deltaPSI"].setText(sprintf("%2.1f", math.clamp(val, -9.9, 31.9)));
|
2021-07-16 19:49:01 +00:00
|
|
|
|
|
|
|
if (val < -0.4 or val > 8.5) {
|
|
|
|
obj["deltaPSI"].setColor(0.7333,0.3803,0);
|
|
|
|
} else {
|
|
|
|
obj["deltaPSI"].setColor(0.0509,0.7529,0.2941);
|
|
|
|
}
|
2021-07-16 16:10:56 +00:00
|
|
|
}),
|
|
|
|
props.UpdateManager.FromHashValue("pressVS", 25, func(val) {
|
2022-04-20 20:22:33 +00:00
|
|
|
obj["CABVS"].setText(sprintf("%-4.0f", math.clamp(math.round(val,50), -9950, 9950)));
|
2021-07-16 19:49:01 +00:00
|
|
|
|
|
|
|
if (val >= 25) {
|
|
|
|
obj["VS-Arrow-UP"].show();
|
|
|
|
obj["VS-Arrow-DN"].hide();
|
|
|
|
} elsif (val <= -25) {
|
|
|
|
obj["VS-Arrow-UP"].hide();
|
|
|
|
obj["VS-Arrow-DN"].show();
|
|
|
|
} else {
|
|
|
|
obj["VS-Arrow-UP"].hide();
|
|
|
|
obj["VS-Arrow-DN"].hide();
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
props.UpdateManager.FromHashValue("pressAlt", 25, func(val) {
|
2022-04-20 20:22:33 +00:00
|
|
|
obj["CABALT"].setText(sprintf("%5.0f", math.clamp(math.round(val,50), -9950, 32750)));
|
2021-07-16 19:49:01 +00:00
|
|
|
|
|
|
|
if (val > 9550) {
|
|
|
|
obj["CABALT"].setColor(1,0,0);
|
|
|
|
} else {
|
|
|
|
obj["CABALT"].setColor(0.0509,0.7529,0.2941);
|
|
|
|
}
|
2021-07-16 16:10:56 +00:00
|
|
|
}),
|
|
|
|
props.UpdateManager.FromHashValue("condTempCockpit", 0.5, func(val) {
|
|
|
|
obj["CKPT-TEMP"].setText(sprintf("%2.0f",val));
|
|
|
|
}),
|
|
|
|
props.UpdateManager.FromHashValue("condTempAft", 0.5, func(val) {
|
|
|
|
obj["AFT-TEMP"].setText(sprintf("%2.0f",val));
|
|
|
|
}),
|
|
|
|
props.UpdateManager.FromHashValue("condTempFwd", 0.5, func(val) {
|
|
|
|
obj["FWD-TEMP"].setText(sprintf("%2.0f",val));
|
|
|
|
}),
|
2021-07-08 14:38:24 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
obj.updateItemsBottom = [
|
2022-05-05 18:13:09 +00:00
|
|
|
props.UpdateManager.FromHashValue("acconfigUnits", 1, func(val) {
|
2021-07-08 14:38:24 +00:00
|
|
|
if (val) {
|
|
|
|
obj["GW-weight-unit"].setText("KG");
|
|
|
|
} else {
|
|
|
|
obj["GW-weight-unit"].setText("LBS");
|
|
|
|
}
|
|
|
|
}),
|
2022-04-19 17:15:23 +00:00
|
|
|
props.UpdateManager.FromHashValue("hour", 1, func(val) {
|
2021-07-08 14:38:24 +00:00
|
|
|
obj["UTCh"].setText(sprintf("%02d", val));
|
|
|
|
}),
|
2022-04-19 17:15:23 +00:00
|
|
|
props.UpdateManager.FromHashValue("minute", 1, func(val) {
|
2021-07-08 14:38:24 +00:00
|
|
|
obj["UTCm"].setText(sprintf("%02d", val));
|
|
|
|
}),
|
|
|
|
props.UpdateManager.FromHashValue("gForce", 0.05, func(val) {
|
2022-04-19 17:15:23 +00:00
|
|
|
obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val));
|
2021-07-08 14:38:24 +00:00
|
|
|
}),
|
|
|
|
props.UpdateManager.FromHashValue("gForceDisplay", nil, func(val) {
|
2022-04-19 17:15:23 +00:00
|
|
|
if (val) {
|
2021-07-08 14:38:24 +00:00
|
|
|
obj["GLoad"].show();
|
|
|
|
} else {
|
|
|
|
obj["GLoad"].hide();
|
|
|
|
}
|
|
|
|
}),
|
2022-04-19 17:15:23 +00:00
|
|
|
props.UpdateManager.FromHashValue("satTemp", 0.5, func(val) {
|
|
|
|
obj["SAT"].setText(sprintf("%+2.0f", val));
|
|
|
|
}),
|
|
|
|
props.UpdateManager.FromHashValue("tatTemp", 0.5, func(val) {
|
|
|
|
obj["TAT"].setText(sprintf("%+2.0f", val));
|
|
|
|
}),
|
2021-07-08 14:38:24 +00:00
|
|
|
];
|
|
|
|
return obj;
|
|
|
|
},
|
|
|
|
getKeysBottom: func() {
|
|
|
|
return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit"];
|
|
|
|
},
|
|
|
|
getKeys: func() {
|
2021-07-16 19:49:01 +00:00
|
|
|
return["Oil1","Oil2","OilUnit","FUsed1","FUsed2","FUsed","VIB1N1","VIB1N2","VIB2N1","VIB2N2","deltaPSI","LDGELEV-AUTO","LDGELEV","CABVS","CABALT","VS-Arrow-UP","VS-Arrow-DN","CKPT-TEMP","FWD-TEMP","AFT-TEMP","Fused-weight-unit"];
|
2021-07-16 16:10:56 +00:00
|
|
|
},
|
2021-07-08 14:38:24 +00:00
|
|
|
updateBottom: func(notification) {
|
|
|
|
if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and notification.FWCPhase != 1) {
|
2022-05-05 18:13:09 +00:00
|
|
|
if (notification.acconfigUnits) {
|
2021-07-08 14:38:24 +00:00
|
|
|
me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100)));
|
|
|
|
} else {
|
|
|
|
me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000, 100)));
|
|
|
|
}
|
|
|
|
me["GW"].setColor(0.0509,0.7529,0.2941);
|
|
|
|
} else {
|
2021-07-27 15:38:00 +00:00
|
|
|
me["GW"].setText(sprintf("%s", " -- "));
|
2021-07-08 14:38:24 +00:00
|
|
|
me["GW"].setColor(0.0901,0.6039,0.7176);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dmc.DMController.DMCs[1].outputs[4] != nil) {
|
2022-04-19 17:15:23 +00:00
|
|
|
notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue();
|
2021-07-08 14:38:24 +00:00
|
|
|
me["SAT"].setColor(0.0509,0.7529,0.2941);
|
|
|
|
} else {
|
2022-04-19 21:10:54 +00:00
|
|
|
me["SAT"].setText("XX");
|
2021-07-08 14:38:24 +00:00
|
|
|
me["SAT"].setColor(0.7333,0.3803,0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dmc.DMController.DMCs[1].outputs[5] != nil) {
|
2022-04-19 17:15:23 +00:00
|
|
|
notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue();
|
2021-07-08 14:38:24 +00:00
|
|
|
me["TAT"].setColor(0.0509,0.7529,0.2941);
|
|
|
|
} else {
|
2022-04-19 21:10:54 +00:00
|
|
|
me["TAT"].setText("XX");
|
2021-07-08 14:38:24 +00:00
|
|
|
me["TAT"].setColor(0.7333,0.3803,0);
|
|
|
|
}
|
2022-04-19 17:15:23 +00:00
|
|
|
|
|
|
|
foreach(var update_item_bottom; me.updateItemsBottom)
|
|
|
|
{
|
|
|
|
update_item_bottom.update(notification);
|
|
|
|
}
|
2021-07-08 14:38:24 +00:00
|
|
|
},
|
|
|
|
update: func(notification) {
|
|
|
|
me.updatePower();
|
|
|
|
|
|
|
|
if (me.test.getVisible() == 1) {
|
|
|
|
me.updateTest(notification);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (me.group.getVisible() == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach(var update_item; me.update_items)
|
|
|
|
{
|
|
|
|
update_item.update(notification);
|
|
|
|
}
|
|
|
|
|
2022-05-05 18:13:09 +00:00
|
|
|
if (notification.dc1 >= 25) {
|
|
|
|
me["Oil1"].setText(me.quantity[0]);
|
2022-05-08 19:06:23 +00:00
|
|
|
me["Oil1"].setColor(0.0509,0.7529,0.2941);
|
2022-05-05 18:13:09 +00:00
|
|
|
} else {
|
|
|
|
me["Oil1"].setText("XX");
|
2022-05-08 19:06:23 +00:00
|
|
|
me["Oil1"].setColor(0.7333,0.3803,0);
|
2022-05-05 18:13:09 +00:00
|
|
|
}
|
|
|
|
if (notification.dc2 >= 25) {
|
|
|
|
me["Oil2"].setText(me.quantity[1]);
|
2022-05-08 19:06:23 +00:00
|
|
|
me["Oil2"].setColor(0.0509,0.7529,0.2941);
|
2022-05-05 18:13:09 +00:00
|
|
|
} else {
|
|
|
|
me["Oil2"].setText("XX");
|
2022-05-08 19:06:23 +00:00
|
|
|
me["Oil2"].setColor(0.7333,0.3803,0);
|
2022-05-05 18:13:09 +00:00
|
|
|
}
|
|
|
|
|
2021-07-08 14:38:24 +00:00
|
|
|
me.updateBottom(notification);
|
|
|
|
},
|
|
|
|
updatePower: func() {
|
|
|
|
if (me.name == ecam.SystemDisplayController.displayedPage.name) {
|
|
|
|
if (du4_lgt.getValue() > 0.01 and systems.ELEC.Bus.ac2.getValue() >= 110) {
|
|
|
|
if (du4_test_time.getValue() + du4_test_amount.getValue() >= pts.Sim.Time.elapsedSec.getValue()) {
|
|
|
|
me.group.setVisible(0);
|
|
|
|
me.test.setVisible(1);
|
|
|
|
} else {
|
|
|
|
me.group.setVisible(1);
|
|
|
|
me.test.setVisible(0);
|
|
|
|
}
|
|
|
|
} else {
|
2021-07-27 17:55:36 +00:00
|
|
|
if (pts.Modes.EcamDuXfr.getBoolValue()) {
|
|
|
|
if (du3_lgt.getValue() > 0.01 and systems.ELEC.Bus.acEss.getValue() >= 110) {
|
|
|
|
if (du3_test_time.getValue() + du3_test_amount.getValue() >= pts.Sim.Time.elapsedSec.getValue()) {
|
|
|
|
me.group.setVisible(0);
|
|
|
|
me.test.setVisible(1);
|
|
|
|
} else {
|
|
|
|
me.group.setVisible(1);
|
|
|
|
me.test.setVisible(0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
me.group.setVisible(0);
|
|
|
|
me.test.setVisible(0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
me.group.setVisible(0);
|
|
|
|
me.test.setVisible(0);
|
|
|
|
}
|
2021-07-08 14:38:24 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
me.group.setVisible(0);
|
2021-07-08 16:19:27 +00:00
|
|
|
# don't hide the test group; just let whichever page is active control it
|
2021-07-08 14:38:24 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
var input = {
|
|
|
|
};
|
|
|
|
|
|
|
|
foreach (var name; keys(input)) {
|
|
|
|
emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 System Display", name, input[name]));
|
|
|
|
}
|