1
0
Fork 0
A320-family/Models/Instruments/Lower-ECAM/Lower-ECAM.nas

82 lines
3.9 KiB
Text
Raw Normal View History

2019-10-14 16:48:35 +00:00
# A3XX Lower ECAM Canvas
2022-01-11 02:17:41 +00:00
# Copyright (c) 2022 Josh Davidson (Octal450) and Jonathan Redpath
2019-10-14 16:48:35 +00:00
2021-07-05 21:17:20 +00:00
var SystemDisplayPageRecipient =
{
2021-07-06 13:00:27 +00:00
new: func(_ident)
2021-07-05 21:17:20 +00:00
{
var SDRecipient = emesary.Recipient.new(_ident);
2021-07-06 13:00:27 +00:00
SDRecipient.MainScreen = canvas_lowerECAM_base;
SDRecipient.Page = nil;
2021-07-05 21:17:20 +00:00
SDRecipient.Receive = func(notification)
{
2021-07-05 21:17:20 +00:00
if (notification.NotificationType == "FrameNotification")
{
2021-07-06 13:00:27 +00:00
if (SDRecipient.Page == nil) {
SDRecipient.Page = SystemDisplayPageRecipient.pageList.door;
2021-07-05 21:17:20 +00:00
}
if (math.mod(notifications.frameNotification.FrameCount,2) == 0) {
SystemDisplayPageRecipient.pageList.apu.update(notification);
SystemDisplayPageRecipient.pageList.bleed.update(notification);
SystemDisplayPageRecipient.pageList.cond.update(notification);
2021-07-08 15:27:43 +00:00
SystemDisplayPageRecipient.pageList.cruise.update(notification);
SystemDisplayPageRecipient.pageList.door.update(notification);
SystemDisplayPageRecipient.pageList.elec.update(notification);
SystemDisplayPageRecipient.pageList.eng.update(notification);
SystemDisplayPageRecipient.pageList.fctl.update(notification);
SystemDisplayPageRecipient.pageList.fuel.update(notification);
SystemDisplayPageRecipient.pageList.hyd.update(notification);
SystemDisplayPageRecipient.pageList.press.update(notification);
SystemDisplayPageRecipient.pageList.sts.update(notification);
SystemDisplayPageRecipient.pageList.wheel.update(notification);
2021-07-05 21:17:20 +00:00
}
return emesary.Transmitter.ReceiptStatus_OK;
}
2021-07-05 21:17:20 +00:00
return emesary.Transmitter.ReceiptStatus_NotProcessed;
2019-10-14 16:48:35 +00:00
};
2021-07-05 21:17:20 +00:00
return SDRecipient;
2019-10-14 16:48:35 +00:00
},
2021-07-06 13:00:27 +00:00
pageList: {
apu: canvas_lowerECAMPageApu.new("Aircraft/A320-family/Models/Instruments/Lower-ECAM/res/apu.svg","apu"),
bleed: canvas_lowerECAMPageBleed.new("Aircraft/A320-family/Models/Instruments/Lower-ECAM/res/bleed.svg","bleed"),
cond: canvas_lowerECAMPageCond.new("Aircraft/A320-family/Models/Instruments/Lower-ECAM/res/cond.svg","cond"),
cruise: canvas_lowerECAMPageCruise.new("Aircraft/A320-family/Models/Instruments/Lower-ECAM/res/crz.svg","cruise"),
door: canvas_lowerECAMPageDoor.new("Aircraft/A320-family/Models/Instruments/Lower-ECAM/res/door.svg","door"),
elec: canvas_lowerECAMPageElec.new("Aircraft/A320-family/Models/Instruments/Lower-ECAM/res/elec.svg","elec"),
eng: canvas_lowerECAMPageEng.new("Aircraft/A320-family/Models/Instruments/Lower-ECAM/res/eng.svg","eng"),
fctl: canvas_lowerECAMPageFctl.new("Aircraft/A320-family/Models/Instruments/Lower-ECAM/res/fctl.svg","fctl"),
fuel: canvas_lowerECAMPageFuel.new("Aircraft/A320-family/Models/Instruments/Lower-ECAM/res/fuel.svg","fuel"),
hyd: canvas_lowerECAMPageHyd.new("Aircraft/A320-family/Models/Instruments/Lower-ECAM/res/hyd.svg","hyd"),
press: canvas_lowerECAMPagePress.new("Aircraft/A320-family/Models/Instruments/Lower-ECAM/res/press.svg","press"),
sts: canvas_lowerECAMPageSts.new("Aircraft/A320-family/Models/Instruments/Lower-ECAM/res/status.svg","sts"),
wheel: canvas_lowerECAMPageWheel.new("Aircraft/A320-family/Models/Instruments/Lower-ECAM/res/wheel.svg","wheel")
2021-07-06 13:00:27 +00:00
},
2019-10-14 16:48:35 +00:00
};
2021-07-06 13:00:27 +00:00
var A320SD = SystemDisplayPageRecipient.new("A320 SD");
emesary.GlobalTransmitter.Register(A320SD);
2021-07-05 21:17:20 +00:00
var input = {
2021-07-06 11:37:18 +00:00
gForce: "/accelerations/pilot-gdamped",
gForceDisplay: "/ECAM/Lower/g-force-display",
hour: "/sim/time/utc/hour",
minute: "/sim/time/utc/minute",
2022-04-30 15:52:58 +00:00
du3Power: "/instrumentation/displays/du3/power-on",
du4Power: "/instrumentation/displays/du4/power-on",
du3InTest: "/instrumentation/displays/du3/test-active",
du4InTest: "/instrumentation/displays/du4/test-active",
ecamDuXfr: "/modes/ecam-du-xfr",
2021-07-05 21:17:20 +00:00
};
2019-10-14 16:48:35 +00:00
2021-07-05 21:17:20 +00:00
foreach (var name; keys(input)) {
2021-07-06 13:00:27 +00:00
emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 System Display", name, input[name]));
2019-10-14 16:48:35 +00:00
}
var showLowerECAM = func {
var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1);
dlg.setCanvas(canvas_lowerECAM_base.canvas);
}
setlistener("/systems/electrical/bus/ac-2", func() {
2021-07-06 13:00:27 +00:00
A320SD.MainScreen.powerTransient();
2021-07-05 21:17:20 +00:00
}, 0, 0);