1
0
Fork 0

Updates and improvements to Emesary code. Fix bugs. Everything ported for CFM. All works. Add memoized update to ensure efficiency is maximum.

This commit is contained in:
legoboyvdlp R 2020-10-28 16:03:20 +00:00
parent 29459ee55f
commit def546d04f
5 changed files with 404 additions and 395 deletions

View file

@ -622,6 +622,26 @@
<SlatXtrans type="double">0</SlatXtrans>
<SlatYtrans type="double">0</SlatYtrans>
</Upper>
<msg>
<line1 type="string"></line1>
<line2 type="string"></line2>
<line3 type="string"></line3>
<line4 type="string"></line4>
<line5 type="string"></line5>
<line6 type="string"></line6>
<line7 type="string"></line7>
<line8 type="string"></line8>
</msg>
<rightmsg>
<line1 type="string"></line1>
<line2 type="string"></line2>
<line3 type="string"></line3>
<line4 type="string"></line4>
<line5 type="string"></line5>
<line6 type="string"></line6>
<line7 type="string"></line7>
<line8 type="string"></line8>
</rightmsg>
</ECAM>
<environment>

View file

@ -98,22 +98,7 @@ var canvas_upperECAM_base = {
# set font
obj["ECAML1"].setFont("LiberationMonoCustom.ttf");
obj["ECAML2"].setFont("LiberationMonoCustom.ttf");
obj["ECAML3"].setFont("LiberationMonoCustom.ttf");
obj["ECAML4"].setFont("LiberationMonoCustom.ttf");
obj["ECAML5"].setFont("LiberationMonoCustom.ttf");
obj["ECAML6"].setFont("LiberationMonoCustom.ttf");
obj["ECAML7"].setFont("LiberationMonoCustom.ttf");
obj["ECAML8"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR1"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR2"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR3"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR4"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR5"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR6"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR7"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR8"].setFont("LiberationMonoCustom.ttf");
me.page = canvas_group;
@ -178,33 +163,6 @@ var canvas_upperECAM_base = {
}
}
},
updateBase: func(notification) {
# ECAM Messages
var canvas_upperECAM_cfm_eis2 = {
new: func(canvas_group, file) {
var m = {parents: [canvas_upperECAM_cfm_eis2, canvas_upperECAM_base]};
m.init(canvas_group, file);
m.updateAFloor();
m.updateFlx();
return m;
},
update: func(notification) {
fadecPower1 = fadecpower_1.getValue();
fadecPower2 = fadecpower_2.getValue();
fadecPowerStart = fadecpowerup.getValue();
me.updateBase(notification);
},
};
var canvas_upperECAM_iae_eis2 = {
new: func(canvas_group, file) {
@ -573,57 +531,9 @@ var canvas_upperECAM_test = {
return m;
},
getKeys: func() {
return ["Test_white","Test_text"];
return [];
},
update: func() {
elapsedtime = pts.Sim.Time.elapsedSec.getValue();
if (du3_test_time.getValue() + 1 >= elapsedtime) {
obj["Test_white"].show();
obj["Test_text"].hide();
} else {
obj["Test_white"].hide();
obj["Test_text"].show();
}
},
};
var createListenerForLine = func(prop, node, key) {
setlistener(prop, func() {
if (eng_option.getValue() == "IAE") {
upperECAM_iae_eis2[key].setColor(upperECAM_iae_eis2.getColorString(node.getValue()));
} else {
upperECAM_cfm_eis2[key].setColor(upperECAM_cfm_eis2.getColorString(node.getValue()));
}
}, 0, 0);
};
setlistener("sim/signals/fdm-initialized", func {
if (!_init) {
}
upperECAM_update.start();
if (rate.getValue() > 1) {
u_rateApply();
}
});
var u_rateApply = func {
upperECAM_update.restart(0.05 * rate.getValue());
}
var upperECAM_update = maketimer(0.05, func {
canvas_upperECAM_base.update();
});
var showUpperECAM = func {
var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1);
dlg.setCanvas(upperECAM_display);
}
setlistener("/systems/electrical/bus/ac-ess", func() {
canvas_upperECAM_base.updateDu3();
}, 0, 0);
},
};

View file

@ -2,22 +2,6 @@ var flapsPos = nil;
var slatLockFlash = props.globals.initNode("/instrumentation/du/slat-lock-flash", 0, "BOOL");
var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1);
var ECAM_line1 = props.globals.getNode("/ECAM/msg/line1", 1);
var ECAM_line2 = props.globals.getNode("/ECAM/msg/line2", 1);
var ECAM_line3 = props.globals.getNode("/ECAM/msg/line3", 1);
var ECAM_line4 = props.globals.getNode("/ECAM/msg/line4", 1);
var ECAM_line5 = props.globals.getNode("/ECAM/msg/line5", 1);
var ECAM_line6 = props.globals.getNode("/ECAM/msg/line6", 1);
var ECAM_line7 = props.globals.getNode("/ECAM/msg/line7", 1);
var ECAM_line8 = props.globals.getNode("/ECAM/msg/line8", 1);
var ECAM_line1r = props.globals.getNode("/ECAM/rightmsg/line1", 1);
var ECAM_line2r = props.globals.getNode("/ECAM/rightmsg/line2", 1);
var ECAM_line3r = props.globals.getNode("/ECAM/rightmsg/line3", 1);
var ECAM_line4r = props.globals.getNode("/ECAM/rightmsg/line4", 1);
var ECAM_line5r = props.globals.getNode("/ECAM/rightmsg/line5", 1);
var ECAM_line6r = props.globals.getNode("/ECAM/rightmsg/line6", 1);
var ECAM_line7r = props.globals.getNode("/ECAM/rightmsg/line7", 1);
var ECAM_line8r = props.globals.getNode("/ECAM/rightmsg/line8", 1);
var ECAM_line1c = props.globals.getNode("/ECAM/msg/linec1", 1);
var ECAM_line2c = props.globals.getNode("/ECAM/msg/linec2", 1);
var ECAM_line3c = props.globals.getNode("/ECAM/msg/linec3", 1);
@ -47,12 +31,15 @@ var canvas_upperECAM = {
obj.canvas.addPlacement({"node": "uecam.screen"});
obj.group = obj.canvas.createGroup();
obj.test = obj.canvas.createGroup();
obj.font_mapper = func(family, weight) {
return "LiberationFonts/LiberationSans-Regular.ttf";
};
canvas.parsesvg(obj.group, svg, {"font-mapper": obj.font_mapper} );
canvas.parsesvg(obj.test, "Aircraft/A320-family/Models/Instruments/Common/res/du-test.svg", {"font-mapper": obj.font_mapper} );
obj.test.setVisible(0);
foreach(var key; obj.getKeys()) {
obj[key] = obj.group.getElementById(key);
@ -72,126 +59,17 @@ var canvas_upperECAM = {
}
};
obj.update_items_fadec_powered_n1 = [
props.UpdateManager.FromHashValue("N1_1", 0.0001, func(val) {
obj["N11-needle"].setRotation((val + 90) * D2R);
}),
props.UpdateManager.FromHashValue("N1_2", 0.0001, func(val) {
obj["N12-needle"].setRotation((val + 90) * D2R);
}),
props.UpdateManager.FromHashValue("N1_actual_1", 0.001, func(val) {
obj["N11"].setText(sprintf("%s", math.floor(val + 0.05)));
obj["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1))));
}),
props.UpdateManager.FromHashValue("N1_actual_2", 0.001, func(val) {
obj["N12"].setText(sprintf("%s", math.floor(val + 0.05)));
obj["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1))));
}),
props.UpdateManager.FromHashValue("N1_lim", 0.0001, func(val) {
obj["N11-ylim"].setRotation((val + 90) * D2R);
obj["N12-ylim"].setRotation((val + 90) * D2R);
}),
props.UpdateManager.FromHashValue("N1thr_1", 0.0001, func(val) {
obj["N11-thr"].setRotation((val + 90) * D2R);
}),
props.UpdateManager.FromHashValue("N1thr_2", 0.0001, func(val) {
obj["N12-thr"].setRotation((val + 90) * D2R);
}),
props.UpdateManager.FromHashValue("reverser_1", 0.0001, func(val) {
if (val < 0.01 and fadec.FADEC.Eng1.n1 == 1) {
obj["N11-thr"].show();
} else {
obj["N11-thr"].hide();
}
if (val >= 0.01 and fadec.FADEC.Eng1.n1 == 1) {
obj["REV1"].show();
obj["REV1-box"].show();
} else {
obj["REV1"].hide();
obj["REV1-box"].hide();
}
if (val >= 0.95) {
obj["REV2"].setColor(0.0509,0.7529,0.2941);
} else {
obj["REV2"].setColor(0.7333,0.3803,0);
}
}),
props.UpdateManager.FromHashValue("reverser_2", 0.0001, func(val) {
if (val < 0.01 and fadec.FADEC.Eng2.n1 == 1) {
obj["N12-thr"].show();
} else {
obj["N12-thr"].hide();
}
if (val >= 0.01 and fadec.FADEC.Eng2.n1 == 1) {
obj["REV2"].show();
obj["REV2-box"].show();
} else {
obj["REV2"].hide();
obj["REV2-box"].hide();
}
if (val >= 0.95) {
obj["REV1"].setColor(0.0509,0.7529,0.2941);
} else {
obj["REV1"].setColor(0.7333,0.3803,0);
}
}),
];
obj.units = acconfig_weight_kgs.getValue();
obj.update_items_fadec_powered_n2 = [
props.UpdateManager.FromHashValue("N2_actual_1", 0.001, func(val) {
obj["N21"].setText(sprintf("%s", math.floor(val + 0.05)));
obj["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1))));
}),
props.UpdateManager.FromHashValue("N2_actual_2", 0.001, func(val) {
obj["N22"].setText(sprintf("%s", math.floor(val + 0.05)));
obj["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1))));
}),
];
obj.update_items_fadec_powered_egt = [
props.UpdateManager.FromHashValue("egt_1", 0.5, func(val) {
obj["EGT1"].setText(sprintf("%s", math.round(val)));
}),
props.UpdateManager.FromHashValue("egt_1_needle", 0.01, func(val) {
obj["EGT1-needle"].setRotation((val + 90) * D2R);
}),
props.UpdateManager.FromHashValue("egt_2", 0.5, func(val) {
obj["EGT2"].setText(sprintf("%s", math.round(val)));
}),
props.UpdateManager.FromHashValue("egt_2_needle", 0.01, func(val) {
obj["EGT2-needle"].setRotation((val + 90) * D2R);
}),
];
obj.update_items_fadec_powered_ff = [
props.UpdateManager.FromHashValue("fuelflow_1", 0.5, func(val) {
if (acconfig_weight_kgs.getValue()) {
obj["FF1"].setText(sprintf("%s", math.round(val * LBS2KGS, 10)));
} else {
obj["FF1"].setText(sprintf("%s", math.round(val, 10)));
}
}),
props.UpdateManager.FromHashValue("fuelflow_2", 0.5, func(val) {
if (acconfig_weight_kgs.getValue()) {
obj["FF2"].setText(sprintf("%s", math.round(val * LBS2KGS, 10)));
} else {
obj["FF2"].setText(sprintf("%s", math.round(val, 10)));
}
}),
];
obj.powerItem = props.UpdateManager.FromHashList(["AcEssBus", "DisplayBrightness"], 0.01, func(val) {
if (val.DisplayBrightness > 0.01 and val.AcEssBus >= 110) {
obj.group.setVisible(1);
} else {
obj.group.setVisible(0);
}
});
obj.update_items = [
props.UpdateManager.FromHashList(["AcEssBus", "DisplayBrightness"], 0.01, func(val) {
if (val.DisplayBrightness > 0.01 and val.AcEssBus >= 110) {
obj.group.setVisible(1);
} else {
obj.group.setVisible(0);
}
}),
props.UpdateManager.FromHashValue("acconfigUnits", 1, func(val) {
if (val) {
obj["FOB-weight-unit"].setText("KG");
@ -200,13 +78,14 @@ var canvas_upperECAM = {
obj["FOB-weight-unit"].setText("LBS");
obj["FFlow-weight-unit"].setText("LBS/H");
}
obj.units = val;
}),
props.UpdateManager.FromHashValue("fuelTotalLbs", 1, func(val) {
if (acconfig_weight_kgs.getValue())
props.UpdateManager.FromHashList(["fuelTotalLbs","acconfigUnits"], 1, func(val) {
if (obj.units)
{
obj["FOB-LBS"].setText(sprintf("%s", math.round(val * LBS2KGS, 10)));
obj["FOB-LBS"].setText(sprintf("%s", math.round(val.fuelTotalLbs * LBS2KGS, 10)));
} else {
obj["FOB-LBS"].setText(sprintf("%s", math.round(val, 10)));
obj["FOB-LBS"].setText(sprintf("%s", math.round(val.fuelTotalLbs, 10)));
}
}),
props.UpdateManager.FromHashList(["flapxOffset", "flapyOffset"], 0.01, func(val) {
@ -250,14 +129,7 @@ var canvas_upperECAM = {
obj["FlapDots"].hide();
}
}),
props.UpdateManager.FromHashValue("thrustLimit", 1, func(val) {
if (val == "FLX") {
obj["FlxLimDegreesC"].show();
obj["FlxLimTemp"].show();
} else {
obj["FlxLimDegreesC"].hide();
obj["FlxLimTemp"].hide();
}
props.UpdateManager.FromHashValue("thrustLimit", nil, func(val) {
obj["N1Lim-mode"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("n1Limit", 0.01, func(val) {
@ -267,7 +139,7 @@ var canvas_upperECAM = {
props.UpdateManager.FromHashValue("flexTemp", 1, func(val) {
obj["FlxLimTemp"].setText(sprintf("%2.0d",val));
}),
props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart","thrustLimit"], 1, func(val) {
props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart","thrustLimit"], nil, func(val) {
if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) {
obj["N1Lim-mode"].show();
obj["N1Lim-XX"].hide();
@ -289,56 +161,176 @@ var canvas_upperECAM = {
obj["N1Lim-decimal"].hide();
obj["N1Lim-percent"].hide();
}
if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit == "FLX") {
obj["FlxLimDegreesC"].show();
obj["FlxLimTemp"].show();
} else {
obj["FlxLimDegreesC"].hide();
obj["FlxLimTemp"].hide();
}
}),
];
obj.update_items_fadec_powered_n1 = [
props.UpdateManager.FromHashValue("N1_1", 0.01, func(val) {
obj["N11-needle"].setRotation((val + 90) * D2R);
}),
props.UpdateManager.FromHashValue("N1_2", 0.01, func(val) {
obj["N12-needle"].setRotation((val + 90) * D2R);
}),
props.UpdateManager.FromHashValue("N1_actual_1", 0.025, func(val) {
obj["N11"].setText(sprintf("%s", math.floor(val + 0.05)));
obj["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1))));
}),
props.UpdateManager.FromHashValue("N1_actual_2", 0.025, func(val) {
obj["N12"].setText(sprintf("%s", math.floor(val + 0.05)));
obj["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1))));
}),
props.UpdateManager.FromHashValue("N1_lim", 0.01, func(val) {
obj["N11-ylim"].setRotation((val + 90) * D2R);
obj["N12-ylim"].setRotation((val + 90) * D2R);
}),
props.UpdateManager.FromHashValue("N1thr_1", 0.01, func(val) {
obj["N11-thr"].setRotation((val + 90) * D2R);
}),
props.UpdateManager.FromHashValue("N1thr_2", 0.01, func(val) {
obj["N12-thr"].setRotation((val + 90) * D2R);
}),
props.UpdateManager.FromHashValue("reverser_1", 0.005, func(val) {
if (val < 0.01 and fadec.FADEC.Eng1.n1 == 1) {
obj["N11-thr"].show();
} else {
obj["N11-thr"].hide();
}
if (val >= 0.01 and fadec.FADEC.Eng1.n1 == 1) {
obj["REV1"].show();
obj["REV1-box"].show();
} else {
obj["REV1"].hide();
obj["REV1-box"].hide();
}
if (val >= 0.95) {
obj["REV2"].setColor(0.0509,0.7529,0.2941);
} else {
obj["REV2"].setColor(0.7333,0.3803,0);
}
}),
props.UpdateManager.FromHashValue("reverser_2", 0.005, func(val) {
if (val < 0.01 and fadec.FADEC.Eng2.n1 == 1) {
obj["N12-thr"].show();
} else {
obj["N12-thr"].hide();
}
if (val >= 0.01 and fadec.FADEC.Eng2.n1 == 1) {
obj["REV2"].show();
obj["REV2-box"].show();
} else {
obj["REV2"].hide();
obj["REV2-box"].hide();
}
if (val >= 0.95) {
obj["REV1"].setColor(0.0509,0.7529,0.2941);
} else {
obj["REV1"].setColor(0.7333,0.3803,0);
}
}),
];
obj.update_items_fadec_powered_n2 = [
props.UpdateManager.FromHashValue("N2_actual_1", 0.025, func(val) {
obj["N21"].setText(sprintf("%s", math.floor(val + 0.05)));
obj["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1))));
}),
props.UpdateManager.FromHashValue("N2_actual_2", 0.025, func(val) {
obj["N22"].setText(sprintf("%s", math.floor(val + 0.05)));
obj["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1))));
}),
];
obj.update_items_fadec_powered_egt = [
props.UpdateManager.FromHashValue("egt_1", 0.5, func(val) {
obj["EGT1"].setText(sprintf("%s", math.round(val)));
}),
props.UpdateManager.FromHashValue("egt_1_needle", 0.01, func(val) {
obj["EGT1-needle"].setRotation((val + 90) * D2R);
}),
props.UpdateManager.FromHashValue("egt_2", 0.5, func(val) {
obj["EGT2"].setText(sprintf("%s", math.round(val)));
}),
props.UpdateManager.FromHashValue("egt_2_needle", 0.01, func(val) {
obj["EGT2-needle"].setRotation((val + 90) * D2R);
}),
];
obj.update_items_fadec_powered_ff = [
props.UpdateManager.FromHashList(["fuelflow_1","acconfigUnits"], 1, func(val) {
if (obj.units) {
obj["FF1"].setText(sprintf("%s", math.round(val.fuelflow_1 * LBS2KGS, 10)));
} else {
obj["FF1"].setText(sprintf("%s", math.round(val.fuelflow_1, 10)));
}
}),
props.UpdateManager.FromHashList(["fuelflow_2","acconfigUnits"], 1, func(val) {
if (obj.units) {
obj["FF2"].setText(sprintf("%s", math.round(val.fuelflow_2 * LBS2KGS, 10)));
} else {
obj["FF2"].setText(sprintf("%s", math.round(val.fuelflow_2, 10)));
}
}),
];
obj.ecam_update = [
props.UpdateManager.FromHashValue("ecamMsg1", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg1", nil, func(val) {
obj["ECAML1"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("ecamMsg2", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg2", nil, func(val) {
obj["ECAML2"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("ecamMsg3", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg3", nil, func(val) {
obj["ECAML3"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("ecamMsg4", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg4", nil, func(val) {
obj["ECAML4"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("ecamMsg5", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg5", nil, func(val) {
obj["ECAML5"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("ecamMsg6", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg6", nil, func(val) {
obj["ECAML6"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("ecamMsg7", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg7", nil, func(val) {
obj["ECAML7"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("ecamMsg8", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg8", nil, func(val) {
obj["ECAML8"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("ecamMsg1R", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg1R", nil, func(val) {
obj["ECAMR1"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("ecamMsg2R", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg2R", nil, func(val) {
obj["ECAMR2"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("ecamMsg3R", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg3R", nil, func(val) {
obj["ECAMR3"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("ecamMsg4R", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg4R", nil, func(val) {
obj["ECAMR4"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("ecamMsg5R", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg5R", nil, func(val) {
obj["ECAMR5"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("ecamMsg6R", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg6R", nil, func(val) {
obj["ECAMR6"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("ecamMsg7R", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg7R", nil, func(val) {
obj["ECAMR7"].setText(sprintf("%s", val));
}),
props.UpdateManager.FromHashValue("ecamMsg8R", 1, func(val) {
props.UpdateManager.FromHashValue("ecamMsg8R", nil, func(val) {
obj["ECAMR8"].setText(sprintf("%s", val));
}),
];
@ -361,7 +353,31 @@ var canvas_upperECAM = {
obj.createListenerForLine("/ECAM/rightmsg/linec7", ECAM_line7rc, "ECAMR7");
obj.createListenerForLine("/ECAM/rightmsg/linec8", ECAM_line8rc, "ECAMR8");
obj["ECAML1"].setFont("LiberationMonoCustom.ttf");
obj["ECAML2"].setFont("LiberationMonoCustom.ttf");
obj["ECAML3"].setFont("LiberationMonoCustom.ttf");
obj["ECAML4"].setFont("LiberationMonoCustom.ttf");
obj["ECAML5"].setFont("LiberationMonoCustom.ttf");
obj["ECAML6"].setFont("LiberationMonoCustom.ttf");
obj["ECAML7"].setFont("LiberationMonoCustom.ttf");
obj["ECAML8"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR1"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR2"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR3"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR4"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR5"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR6"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR7"].setFont("LiberationMonoCustom.ttf");
obj["ECAMR8"].setFont("LiberationMonoCustom.ttf");
obj.page = obj.group;
# cache
obj._cachedN1 = [nil, nil];
obj._cachedN2 = [nil, nil];
obj._cachedEGT = [nil, nil];
obj._cachedFF = [nil, nil];
return obj;
},
getKeys: func() {
@ -369,7 +385,7 @@ var canvas_upperECAM = {
"EGT1-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal","N12-box","N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N12-XX2","N12-XX-box","EGT2-needle","EGT2",
"EGT2-scale","EGT2-box","EGT2-scale2","EGT2-scaletick","EGT2-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","N1Lim-mode","N1Lim","N1Lim-decpnt","N1Lim-decimal","N1Lim-percent","N1Lim-XX","N1Lim-XX2","REV1",
"REV1-box","REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8","ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right",
"FOB-weight-unit","FFlow-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"];
"FOB-weight-unit","FFlow-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp","Test_white","Test_text"];
},
getColorString: func(color) {
if (color == "w") {
@ -394,149 +410,43 @@ var canvas_upperECAM = {
}, 0, 0);
},
update: func(notification) {
foreach(var update_item; me.update_items)
{
update_item.update(notification);
}
me.powerItem.update(notification);
if (me.group.getVisible == 0) {
return;
}
if (fadec.FADEC.Eng1.n1 == 1) {
me["N11-scale"].setColor(0.8078,0.8039,0.8078);
me["N11-scale2"].setColor(1,0,0);
me["N11"].show();
me["N11-decimal"].show();
me["N11-decpnt"].show();
me["N11-needle"].show();
me["N11-ylim"].show();
me["N11-scaletick"].show();
me["N11-scalenum"].show();
me["N11-box"].show();
me["N11-XX"].hide();
me["N11-XX2"].hide();
me["N11-XX-box"].hide();
} else {
me["N11-scale"].setColor(0.7333,0.3803,0);
me["N11-scale2"].setColor(0.7333,0.3803,0);
me["N11"].hide();
me["N11-decimal"].hide();
me["N11-decpnt"].hide();
me["N11-needle"].hide();
me["N11-ylim"].hide();
me["N11-scaletick"].hide();
me["N11-scalenum"].hide();
me["N11-box"].hide();
me["N11-XX"].show();
me["N11-XX2"].show();
me["N11-XX-box"].show();
foreach(var update_item; me.update_items)
{
update_item.update(notification);
}
if (fadec.FADEC.Eng1.n1 != me._cachedN1[0]) {
me.updateN11();
}
if (fadec.FADEC.Eng2.n1 != me._cachedN1[1]) {
me.updateN12();
}
if (fadec.FADEC.Eng2.n1 == 1) {
me["N12-scale"].setColor(0.8078,0.8039,0.8078);
me["N12-scale2"].setColor(1,0,0);
me["N12"].show();
me["N12-decimal"].show();
me["N12-decpnt"].show();
me["N12-needle"].show();
me["N12-ylim"].show();
me["N12-scaletick"].show();
me["N12-scalenum"].show();
me["N12-box"].show();
me["N12-XX"].hide();
me["N12-XX2"].hide();
me["N12-XX-box"].hide();
} else {
me["N12-scale"].setColor(0.7333,0.3803,0);
me["N12-scale2"].setColor(0.7333,0.3803,0);
me["N12"].hide();
me["N12-decimal"].hide();
me["N12-decpnt"].hide();
me["N12-needle"].hide();
me["N12-ylim"].hide();
me["N12-scaletick"].hide();
me["N12-scalenum"].hide();
me["N12-box"].hide();
me["N12-XX"].show();
me["N12-XX2"].show();
me["N12-XX-box"].show();
if (fadec.FADEC.Eng1.n2 != me._cachedN2[0]) {
me.updateN21();
}
if (fadec.FADEC.Eng2.n2 != me._cachedN2[1]) {
me.updateN22();
}
if (fadec.FADEC.Eng1.egt == 1) {
me["EGT1-scale"].setColor(0.8078,0.8039,0.8078);
me["EGT1-scale2"].setColor(1,0,0);
me["EGT1"].show();
me["EGT1-needle"].show();
me["EGT1-scaletick"].show();
me["EGT1-box"].show();
me["EGT1-XX"].hide();
} else {
me["EGT1-scale"].setColor(0.7333,0.3803,0);
me["EGT1-scale2"].setColor(0.7333,0.3803,0);
me["EGT1"].hide();
me["EGT1-needle"].hide();
me["EGT1-scaletick"].hide();
me["EGT1-box"].hide();
me["EGT1-XX"].show();
if (fadec.FADEC.Eng1.egt != me._cachedEGT[0]) {
me.updateEGT1();
}
if (fadec.FADEC.Eng2.egt != me._cachedEGT[1]) {
me.updateEGT2();
}
if (fadec.FADEC.Eng2.egt == 1) {
me["EGT2-scale"].setColor(0.8078,0.8039,0.8078);
me["EGT2-scale2"].setColor(1,0,0);
me["EGT2"].show();
me["EGT2-needle"].show();
me["EGT2-scaletick"].show();
me["EGT2-box"].show();
me["EGT2-XX"].hide();
} else {
me["EGT2-scale"].setColor(0.7333,0.3803,0);
me["EGT2-scale2"].setColor(0.7333,0.3803,0);
me["EGT2"].hide();
me["EGT2-needle"].hide();
me["EGT2-scaletick"].hide();
me["EGT2-box"].hide();
me["EGT2-XX"].show();
if (fadec.FADEC.Eng1.ff != me._cachedFF[0]) {
me.updateFF1();
}
if (fadec.FADEC.Eng1.n2 == 1) {
me["N21"].show();
me["N21-decimal"].show();
me["N21-decpnt"].show();
me["N21-XX"].hide();
} else {
me["N21"].hide();
me["N21-decimal"].hide();
me["N21-decpnt"].hide();
me["N21-XX"].show();
}
if (fadec.FADEC.Eng2.n2 == 1) {
me["N22"].show();
me["N22-decimal"].show();
me["N22-decpnt"].show();
me["N22-XX"].hide();
} else {
me["N22"].hide();
me["N22-decimal"].hide();
me["N22-decpnt"].hide();
me["N22-XX"].show();
}
if (fadec.FADEC.Eng1.ff == 1) {
me["FF1"].show();
me["FF1-XX"].hide();
} else {
me["FF1"].hide();
me["FF1-XX"].show();
}
if (fadec.FADEC.Eng2.ff == 1) {
me["FF2"].show();
me["FF2-XX"].hide();
} else {
me["FF2"].hide();
me["FF2-XX"].show();
if (fadec.FADEC.Eng2.ff != me._cachedFF[1]) {
me.updateFF2();
}
if (pts.Fdm.JSBsim.Fcs.slatLocked.getValue()) {
@ -590,6 +500,169 @@ var canvas_upperECAM = {
update_item.update(notification);
}
},
updateN11: func() {
me._cachedN1[0] = fadec.FADEC.Eng1.n1;
if (fadec.FADEC.Eng1.n1 == 1) {
me["N11-scale"].setColor(0.8078,0.8039,0.8078);
me["N11-scale2"].setColor(1,0,0);
me["N11"].show();
me["N11-decimal"].show();
me["N11-decpnt"].show();
me["N11-needle"].show();
me["N11-ylim"].show();
me["N11-scaletick"].show();
me["N11-scalenum"].show();
me["N11-box"].show();
me["N11-XX"].hide();
me["N11-XX2"].hide();
me["N11-XX-box"].hide();
} else {
me["N11-scale"].setColor(0.7333,0.3803,0);
me["N11-scale2"].setColor(0.7333,0.3803,0);
me["N11"].hide();
me["N11-decimal"].hide();
me["N11-decpnt"].hide();
me["N11-needle"].hide();
me["N11-ylim"].hide();
me["N11-scaletick"].hide();
me["N11-scalenum"].hide();
me["N11-box"].hide();
me["N11-XX"].show();
me["N11-XX2"].show();
me["N11-XX-box"].show();
}
},
updateN12: func() {
me._cachedN1[1] = fadec.FADEC.Eng2.n1;
if (fadec.FADEC.Eng2.n1 == 1) {
me["N12-scale"].setColor(0.8078,0.8039,0.8078);
me["N12-scale2"].setColor(1,0,0);
me["N12"].show();
me["N12-decimal"].show();
me["N12-decpnt"].show();
me["N12-needle"].show();
me["N12-ylim"].show();
me["N12-scaletick"].show();
me["N12-scalenum"].show();
me["N12-box"].show();
me["N12-XX"].hide();
me["N12-XX2"].hide();
me["N12-XX-box"].hide();
} else {
me["N12-scale"].setColor(0.7333,0.3803,0);
me["N12-scale2"].setColor(0.7333,0.3803,0);
me["N12"].hide();
me["N12-decimal"].hide();
me["N12-decpnt"].hide();
me["N12-needle"].hide();
me["N12-ylim"].hide();
me["N12-scaletick"].hide();
me["N12-scalenum"].hide();
me["N12-box"].hide();
me["N12-XX"].show();
me["N12-XX2"].show();
me["N12-XX-box"].show();
}
},
updateN21: func() {
me._cachedN2[0] = fadec.FADEC.Eng1.n2;
if (fadec.FADEC.Eng1.n2 == 1) {
me["N21"].show();
me["N21-decimal"].show();
me["N21-decpnt"].show();
me["N21-XX"].hide();
} else {
me["N21"].hide();
me["N21-decimal"].hide();
me["N21-decpnt"].hide();
me["N21-XX"].show();
}
},
updateN22: func() {
me._cachedN2[1] = fadec.FADEC.Eng2.n2;
if (fadec.FADEC.Eng2.n2 == 1) {
me["N22"].show();
me["N22-decimal"].show();
me["N22-decpnt"].show();
me["N22-XX"].hide();
} else {
me["N22"].hide();
me["N22-decimal"].hide();
me["N22-decpnt"].hide();
me["N22-XX"].show();
}
},
updateEGT1: func() {
me._cachedEGT[0] = fadec.FADEC.Eng1.egt;
if (fadec.FADEC.Eng1.egt == 1) {
me["EGT1-scale"].setColor(0.8078,0.8039,0.8078);
me["EGT1-scale2"].setColor(1,0,0);
me["EGT1"].show();
me["EGT1-needle"].show();
me["EGT1-scaletick"].show();
me["EGT1-box"].show();
me["EGT1-XX"].hide();
} else {
me["EGT1-scale"].setColor(0.7333,0.3803,0);
me["EGT1-scale2"].setColor(0.7333,0.3803,0);
me["EGT1"].hide();
me["EGT1-needle"].hide();
me["EGT1-scaletick"].hide();
me["EGT1-box"].hide();
me["EGT1-XX"].show();
}
},
updateEGT2: func() {
me._cachedEGT[1] = fadec.FADEC.Eng2.egt;
if (fadec.FADEC.Eng2.egt == 1) {
me["EGT2-scale"].setColor(0.8078,0.8039,0.8078);
me["EGT2-scale2"].setColor(1,0,0);
me["EGT2"].show();
me["EGT2-needle"].show();
me["EGT2-scaletick"].show();
me["EGT2-box"].show();
me["EGT2-XX"].hide();
} else {
me["EGT2-scale"].setColor(0.7333,0.3803,0);
me["EGT2-scale2"].setColor(0.7333,0.3803,0);
me["EGT2"].hide();
me["EGT2-needle"].hide();
me["EGT2-scaletick"].hide();
me["EGT2-box"].hide();
me["EGT2-XX"].show();
}
},
updateFF1: func() {
me._cachedFF[0] = fadec.FADEC.Eng1.ff;
if (fadec.FADEC.Eng1.ff == 1) {
me["FF1"].show();
me["FF1-XX"].hide();
} else {
me["FF1"].hide();
me["FF1-XX"].show();
}
},
updateFF2: func() {
me._cachedFF[1] = fadec.FADEC.Eng2.ff;
if (fadec.FADEC.Eng2.ff == 1) {
me["FF2"].show();
me["FF2-XX"].hide();
} else {
me["FF2"].hide();
me["FF2-XX"].show();
}
},
updateTest: func() {
elapsedtime = pts.Sim.Time.elapsedSec.getValue();
if (du3_test_time.getValue() + 1 >= elapsedtime) {
obj["Test_white"].show();
obj["Test_text"].hide();
} else {
obj["Test_white"].hide();
obj["Test_text"].show();
}
},
};
var UpperECAMRecipient =
@ -603,7 +676,7 @@ var UpperECAMRecipient =
if (notification.NotificationType == "FrameNotification")
{
if (new_class.MainScreen == nil)
new_class.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg", "A320 Upper ECAM CFM");
new_class.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg", "A320 E/WD CFM");
if (!math.mod(notifications.frameNotification.FrameCount,2)){
new_class.MainScreen.update(notification);
}
@ -615,7 +688,8 @@ var UpperECAMRecipient =
},
};
emesary.GlobalTransmitter.Register(UpperECAMRecipient.new("A320 Upper ECAM"));
var A320EWD = UpperECAMRecipient.new("A320 E/WD");
emesary.GlobalTransmitter.Register(A320EWD);
input = {
fuelTotalLbs: "/consumables/fuel/total-fuel-lbs",
@ -666,8 +740,8 @@ input = {
thrustLimit: "/controls/engines/thrust-limit",
n1Limit: "/controls/engines/n1-limit",
flexTemp: "/FMGC/internal/flex",
fadecPower1: "/systems/fadec/power1",
fadecPower2: "/systems/fadec/power2",
fadecPower1: "/systems/fadec/powered1",
fadecPower2: "/systems/fadec/powered2",
fadecPowerStart: "/systems/fadec/powerup",
# ecam
@ -693,6 +767,14 @@ foreach (var name; keys(input)) {
emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Upper ECAM", name, input[name]));
}
emesary.GlobalTransmitter.OverrunDetection(9);
var showUpperECAM = func {
var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1);
dlg.setCanvas(A320EWD.MainScreen.canvas);
}
setlistener("/sim/signals/fdm-initialized", func() {
execLoop();
}, 0, 0);

View file

@ -61,7 +61,6 @@ var FrameNotification =
new_class.monitored[notification.variable] = root_node.getNode(notification.property,1);
new_class.properties[notification.property] = notification.variable;
print("[INFO]: (",notification.module,") FrameNotification.",notification.variable, " = ",notification.property, " -> ", new_class.monitored[notification.variable].getPath() );
return emesary.Transmitter.ReceiptStatus_OK;
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;

View file

@ -74,9 +74,7 @@ var execLoop = func
# setup the properties to monitor for this system
input = {
FrameRate : "/sim/frame-rate",
frame_rate : "/sim/frame-rate",
frame_rate_worst : "/sim/frame-rate-worst",
elapsed_seconds : "/sim/time/elapsed-sec",
};