Showing 1 changed files with 22 additions and 0 deletions
+22
Nasal/display.nas
... ...
@@ -19,6 +19,27 @@ var displayClass = {
19 19
         return m;
20 20
     },
21 21
 
22
+    timers : {},
23
+
24
+    timerTrigger : func {
25
+        var now = systime();
26
+        foreach (var id; keys(me.timers)) {
27
+            if (me.timers[id] < now) {
28
+                me.screenElements[id].hide();
29
+                delete(me.timers, id);
30
+            }
31
+        }
32
+        settimer(func me.timerTrigger(), 1);
33
+    },
34
+
35
+    addTimer : func (duration, element) {
36
+        if (typeof(element) == 'scalar')
37
+            element = [ element ];
38
+        var end = systime() + duration;
39
+        foreach (var e; element)
40
+            me.timers[e] = end;
41
+    },
42
+
22 43
     loadsvg : func () {
23 44
         me.screen = me.display.createGroup();
24 45
         me.screen.hide();
... ...
@@ -101,6 +122,7 @@ var displayClass = {
101 122
                 me.updateIAS(getprop('/velocities/airspeed-kt'));
102 123
                 me.updateALT(getprop('instrumentation/altimeter/indicated-altitude-ft'));
103 124
                 me.updateHSI(getprop('orientation/heading-deg'));
125
+                me.timerTrigger();
104 126
             }
105 127
             me._updateRadio({auto:'nav'});
106 128
             me._updateRadio({auto:'comm'});