Showing 3 changed files with 9 additions and 19 deletions
+1 -3
Nasal/core.nas
... ...
@@ -46,10 +46,8 @@ var deviceClass = {
46 46
         m.role = substr(name, 0, 3);
47 47
         m.node = zkv.getNode(name, 1);
48 48
         m.data = {};
49
-        foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide']) {
50
-            m.data[v] = alerts.getNode(v).getValue();
49
+        foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide'])
51 50
             m.data[v ~ '-visible'] = 1;
52
-        }
53 51
         m.display  = displayClass.new(m);
54 52
         m.display.showInitProgress(m.name);
55 53
         m.softkeys = softkeysClass.new(m);
+4 -6
Nasal/display.nas
... ...
@@ -35,8 +35,6 @@ var displayClass = {
35 35
             io.load_nasal(eis_dir ~ eis_type ~ '.nas', 'zkv1000');
36 36
         }
37 37
 
38
-        m._ias_vne = getprop('/instrumentation/zkv1000/alerts/Vne');
39
-
40 38
         return m;
41 39
     },
42 40
 #}}}
... ...
@@ -501,20 +499,20 @@ var displayClass = {
501 499
             .setTranslation(0,(math.mod(ias,10) + (ias >= 10)*10) * 36);
502 500
         me.screenElements.SpeedTape
503 501
             .setTranslation(0,ias * 5.711);
504
-        if (ias > me._ias_vne and ! me._ias_already_exceeded) { # easier than .getColorFill
502
+        if (ias > data.Vne and ! me._ias_already_exceeded) { # easier than .getColorFill
505 503
             me._ias_already_exceeded = 1;
506 504
             me.screenElements['IAS-bg']
507 505
                 .setColorFill(1,0,0);
508 506
         }
509
-        elsif (ias < me._ias_vne and me._ias_already_exceeded) { # easier than .getColorFill
507
+        elsif (ias < data.Vne and me._ias_already_exceeded) { # easier than .getColorFill
510 508
             me._ias_already_exceeded = 0;
511 509
             me.screenElements['IAS-bg']
512 510
                 .setColorFill(0,0,0);
513 511
         }
514 512
         foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide']) {
515
-            if (me.device.data[v ~ '-visible'] and abs(me.device.data[v] - ias) < 30)
513
+            if (me.device.data[v ~ '-visible'] and abs(data[v] - ias) < 30)
516 514
                 me.screenElements['IAS-' ~ v]
517
-                    .setTranslation(0, (ias - me.device.data[v]) * 5.711)
515
+                    .setTranslation(0, (ias - data[v]) * 5.711)
518 516
                     .show();
519 517
             else
520 518
                 me.screenElements['IAS-' ~ v]
+4 -10
zkv1000.nas
... ...
@@ -92,16 +92,10 @@ var init_props = func {
92 92
     alerts.getNode('warning', 1).setBoolValue(0);
93 93
     alerts.getNode('alert', 1).setBoolValue(0);
94 94
     alerts.getNode('message', 1).setValue('');
95
-    var v = getprop('/instrumentation/zkv1000/alerts/Vx');
96
-    alerts.getNode('Vx', 1).setIntValue(v != nil ? v : 999);
97
-    v = getprop('/instrumentation/zkv1000/alerts/Vy');
98
-    alerts.getNode('Vy', 1).setIntValue(v != nil ? v : 999);
99
-    v = getprop('/instrumentation/zkv1000/alerts/Vr');
100
-    alerts.getNode('Vr', 1).setIntValue(v != nil ? v : 999);
101
-    v = getprop('/instrumentation/zkv1000/alerts/Vglide');
102
-    alerts.getNode('Vglide', 1).setIntValue(v != nil ? v : 999);
103
-    v = getprop('/instrumentation/zkv1000/alerts/Vne');
104
-    alerts.getNode('Vne', 1).setIntValue(v != nil ? v : 999);
95
+    foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide', 'Vne']) {
96
+        var speed = getprop('/instrumentation/zkv1000/alerts/' ~ v);
97
+        data[v] = speed != nil ? speed : 9999;
98
+    }
105 99
 
106 100
     afcs = zkv.getNode('afcs',1);
107 101
     afcs.getNode('fd-bars-visible',1).setBoolValue(0);