From 6431d36166619f84a65eea3921887d0075c380a1 Mon Sep 17 00:00:00 2001 From: Richard Harrison Date: Sun, 29 Apr 2018 19:06:38 +0200 Subject: [PATCH] Generic MFD: Nav display optimisation Change the NavDisplay so that the updates are paused when not being displayed. --- Nasal/canvas/MFD_Generic.nas | 8 ++++++++ Nasal/canvas/map/navdisplay.mfd | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Nasal/canvas/MFD_Generic.nas b/Nasal/canvas/MFD_Generic.nas index 98791620d..218b3e374 100644 --- a/Nasal/canvas/MFD_Generic.nas +++ b/Nasal/canvas/MFD_Generic.nas @@ -432,6 +432,14 @@ var PFD_NavDisplay = { if (!me.nd_initialised) me.nd_init(); + #2018.2 - manage the timer so that the nav display is only updated when visibile + me.NDCpt.onDisplay(); + }; + obj.offdisplay = func + { + #2018.2 - manage the timer so that the nav display is only updated when visibile + if (me.nd_initialised) + me.NDCpt.offDisplay(); }; # # most updates performed by the canvas nav display directly. diff --git a/Nasal/canvas/map/navdisplay.mfd b/Nasal/canvas/map/navdisplay.mfd index 89996f4c0..fc1066e6e 100644 --- a/Nasal/canvas/map/navdisplay.mfd +++ b/Nasal/canvas/map/navdisplay.mfd @@ -175,7 +175,8 @@ var NavDisplay = { }, # of connectAI setTimerInterval: func(update_time=0.05) me.update_timer.restart(update_time), - + onDisplay: func {me.setTimerInterval();}, + offDisplay: func {me.update_timer.stop();}, # TODO: the ctor should allow customization, for different aircraft # especially properties and SVG files/handles (747, 757, 777 etc) new : func(prop1, switches=default_switches, style='Boeing') {