1
0
Fork 0

Switch ECAM controller to Emesary

This commit is contained in:
legoboyvdlp R 2020-11-16 21:59:47 +00:00
parent b171018c27
commit d8a962d969
6 changed files with 35 additions and 36 deletions

View file

@ -240,9 +240,7 @@ var IESIRecipient =
NewIESIRecipient.MainScreen = canvas_IESI.new("Aircraft/A320-family/Models/Instruments/IESI/res/iesi.svg", "A320 IESI"); NewIESIRecipient.MainScreen = canvas_IESI.new("Aircraft/A320-family/Models/Instruments/IESI/res/iesi.svg", "A320 IESI");
} }
#if (!math.mod(notifications.frameNotification.FrameCount,2)){
NewIESIRecipient.MainScreen.update(notification); NewIESIRecipient.MainScreen.update(notification);
#}
return emesary.Transmitter.ReceiptStatus_OK; return emesary.Transmitter.ReceiptStatus_OK;
} }
return emesary.Transmitter.ReceiptStatus_NotProcessed; return emesary.Transmitter.ReceiptStatus_NotProcessed;

View file

@ -973,14 +973,13 @@ var UpperECAMRecipient =
} }
} }
#if (!math.mod(notifications.frameNotification.FrameCount,2)){
if (EWDRecipient.type) { if (EWDRecipient.type) {
EWDRecipient.MainScreen.updateIAE(notification); EWDRecipient.MainScreen.updateIAE(notification);
} else { } else {
EWDRecipient.MainScreen.updateCFM(notification); EWDRecipient.MainScreen.updateCFM(notification);
} }
#}
return emesary.Transmitter.ReceiptStatus_OK; return emesary.Transmitter.ReceiptStatus_OK;
} }
return emesary.Transmitter.ReceiptStatus_NotProcessed; return emesary.Transmitter.ReceiptStatus_NotProcessed;

View file

@ -26,6 +26,7 @@ var flash = 0;
var hasCleared = 0; var hasCleared = 0;
var statusFlag = 0; var statusFlag = 0;
var counter = 0; var counter = 0;
var counterClear = 0;
var noMainMsg = 0; var noMainMsg = 0;
var storeFirstWarning = nil; var storeFirstWarning = nil;
@ -260,22 +261,16 @@ var status = {
var ECAM_controller = { var ECAM_controller = {
_recallCounter: 0, _recallCounter: 0,
_noneActive: 0, _noneActive: 0,
counter: 0, _ready: 0,
init: func() { init: func() {
ECAMloopTimer.start();
me.counter = 0;
me.reset(); me.reset();
me._ready = 1;
}, },
loop: func() { loop: func(notification) {
if ((systems.ELEC.Bus.acEss.getValue() >= 110 or systems.ELEC.Bus.ac2.getValue() >= 110) and !pts.Acconfig.running.getBoolValue()) { if (!me._ready) {
# update FWC phases
if (me.counter == 0) {
phaseLoop();
me.counter = 1;
return; return;
} }
me.counter = 0; if ((systems.ELEC.Bus.acEss.getValue() >= 110 or systems.ELEC.Bus.ac2.getValue() >= 110) and !pts.Acconfig.running.getBoolValue()) {
# check active messages # check active messages
messages_priority_3(); messages_priority_3();
messages_priority_2(); messages_priority_2();
@ -303,7 +298,7 @@ var ECAM_controller = {
} }
# write to ECAM # write to ECAM
var counter = 0; counter = 0;
if (!pts.Acconfig.running.getBoolValue()) { if (!pts.Acconfig.running.getBoolValue()) {
foreach (var w; warnings.vector) { foreach (var w; warnings.vector) {
@ -352,6 +347,7 @@ var ECAM_controller = {
} }
}, },
reset: func() { reset: func() {
me._ready = 0;
foreach (var w; warnings.vector) { foreach (var w; warnings.vector) {
if (w.active == 1) { if (w.active == 1) {
w.active = 0; w.active = 0;
@ -390,15 +386,15 @@ var ECAM_controller = {
}, },
clear: func() { clear: func() {
hasCleared = 0; hasCleared = 0;
counter = 0; counterClear = 0;
noMainMsg = 0; noMainMsg = 0;
storeFirstWarning = nil; storeFirstWarning = nil;
# first go through the first eight, see how many mainMsg there are # first go through the first eight, see how many mainMsg there are
foreach (var w; warnings.vector) { foreach (var w; warnings.vector) {
if (counter >= 8) { break; } if (counterClear >= 8) { break; }
if (w.active == 1 and w.clearFlag != 1 and w.isMemo != 1) { if (w.active == 1 and w.clearFlag != 1 and w.isMemo != 1) {
counter += 1; counterClear += 1;
if (w.isMainMsg == 1) { if (w.isMainMsg == 1) {
if (noMainMsg == 0) { if (noMainMsg == 0) {
storeFirstWarning = w; storeFirstWarning = w;
@ -410,11 +406,11 @@ var ECAM_controller = {
# then, if there is an overflow and noMainMsg == 1, we clear the first shown ones # then, if there is an overflow and noMainMsg == 1, we clear the first shown ones
if (leftOverflow.getBoolValue() and noMainMsg == 1) { if (leftOverflow.getBoolValue() and noMainMsg == 1) {
counter = 0; counterClear = 0;
foreach (var w; warnings.vector) { foreach (var w; warnings.vector) {
if (counter >= 8) { break; } if (counterClear >= 8) { break; }
if (w.active == 1 and w.clearFlag != 1 and w.isMemo != 1) { if (w.active == 1 and w.clearFlag != 1 and w.isMemo != 1) {
counter += 1; counterClear += 1;
if (w.isMainMsg == 1) { continue; } if (w.isMainMsg == 1) { continue; }
w.clearFlag = 1; w.clearFlag = 1;
hasCleared = 1; hasCleared = 1;
@ -482,10 +478,6 @@ setlistener("/systems/electrical/bus/dc-ess", func {
} }
}, 0, 0); }, 0, 0);
var ECAMloopTimer = maketimer(0.15, func {
ECAM_controller.loop();
});
# Flash Master Warning Light # Flash Master Warning Light
var shutUpYou = func() { var shutUpYou = func() {
lights[0].setBoolValue(0); lights[0].setBoolValue(0);

View file

@ -352,8 +352,13 @@ var ECAMRecipient =
{ {
if (notification.NotificationType == "FrameNotification") if (notification.NotificationType == "FrameNotification")
{ {
if (!math.mod(notifications.frameNotification.FrameCount,2)){ debug.dump(notifications.frameNotification.FrameCount);
if (notifications.frameNotification.FrameCount == 5){
ECAM.loop(notification); ECAM.loop(notification);
} elsif (notifications.frameNotification.FrameCount == 7){
phaseLoop();
} elsif (notifications.frameNotification.FrameCount == 10){
ECAM_controller.loop(notification);
} }
return emesary.Transmitter.ReceiptStatus_OK; return emesary.Transmitter.ReceiptStatus_OK;
} }

View file

@ -96,3 +96,8 @@ var FrameNotificationAddProperty =
# #
var frameNotification = FrameNotification.new(1); var frameNotification = FrameNotification.new(1);
# Frame count
# 5 = ECAM
# 7 = FWC phases
# 10 = ECAM messages

View file

@ -24,7 +24,7 @@ var cur_frame_inc = 0.05;
var execLoop = func var execLoop = func
{ {
notifications.frameNotification.fetchvars(); notifications.frameNotification.fetchvars();
if (notifications.frameNotification.FrameCount >= 1) { if (notifications.frameNotification.FrameCount > 10) {
notifications.frameNotification.FrameCount = 0; notifications.frameNotification.FrameCount = 0;
} }
emesary.GlobalTransmitter.NotifyAll(notifications.frameNotification); emesary.GlobalTransmitter.NotifyAll(notifications.frameNotification);