From 5264de9b7f3ab79e4d7ed9f6829ef28ae994f561 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 16 Nov 2020 22:55:11 +0000 Subject: [PATCH] Use framecount technique to improve performance --- Models/Instruments/IESI/IESI.nas | 4 +++- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 14 +++++++------- Nasal/ECAM/ECAM-main.nas | 9 +++++---- Nasal/emesary/exec.nas | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index 9142a3cb..b0432cc8 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -240,7 +240,9 @@ var IESIRecipient = NewIESIRecipient.MainScreen = canvas_IESI.new("Aircraft/A320-family/Models/Instruments/IESI/res/iesi.svg", "A320 IESI"); } - NewIESIRecipient.MainScreen.update(notification); + if (math.mod(notifications.frameNotification.FrameCount,2) == 0) { + NewIESIRecipient.MainScreen.update(notification); + } return emesary.Transmitter.ReceiptStatus_OK; } return emesary.Transmitter.ReceiptStatus_NotProcessed; diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 4f9aa916..cdc8609d 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -972,13 +972,13 @@ var UpperECAMRecipient = EWDRecipient.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg", "A320 E/WD CFM", "CFM"); } } - - - if (EWDRecipient.type) { - EWDRecipient.MainScreen.updateIAE(notification); - } else { - EWDRecipient.MainScreen.updateCFM(notification); - + if (math.mod(notifications.frameNotification.FrameCount,2) == 0) { + if (EWDRecipient.type) { + EWDRecipient.MainScreen.updateIAE(notification); + } else { + EWDRecipient.MainScreen.updateCFM(notification); + + } } return emesary.Transmitter.ReceiptStatus_OK; } diff --git a/Nasal/ECAM/ECAM-main.nas b/Nasal/ECAM/ECAM-main.nas index 2a20d236..26b86e2a 100644 --- a/Nasal/ECAM/ECAM-main.nas +++ b/Nasal/ECAM/ECAM-main.nas @@ -352,12 +352,13 @@ var ECAMRecipient = { if (notification.NotificationType == "FrameNotification") { - debug.dump(notifications.frameNotification.FrameCount); - if (notifications.frameNotification.FrameCount == 5){ + if (math.mod(notifications.frameNotification.FrameCount,5) == 0) { ECAM.loop(notification); - } elsif (notifications.frameNotification.FrameCount == 7){ + } + if (math.mod(notifications.frameNotification.FrameCount,10) == 0) { phaseLoop(); - } elsif (notifications.frameNotification.FrameCount == 10){ + } + if (math.mod(notifications.frameNotification.FrameCount,10) == 5) { ECAM_controller.loop(notification); } return emesary.Transmitter.ReceiptStatus_OK; diff --git a/Nasal/emesary/exec.nas b/Nasal/emesary/exec.nas index 0f5460b6..1e4ca7fd 100644 --- a/Nasal/emesary/exec.nas +++ b/Nasal/emesary/exec.nas @@ -24,7 +24,7 @@ var cur_frame_inc = 0.05; var execLoop = func { notifications.frameNotification.fetchvars(); - if (notifications.frameNotification.FrameCount > 10) { + if (notifications.frameNotification.FrameCount > 20) { notifications.frameNotification.FrameCount = 0; } emesary.GlobalTransmitter.NotifyAll(notifications.frameNotification);