Showing 8 changed files with 44 additions and 44 deletions
+1 -1
Nasal/EIS/single-prop.nas
... ...
@@ -33,7 +33,7 @@ displayClass.updateEIS = func {
33 33
                 .setText(psi == nil ? '--' : sprintf('%u', psi));
34 34
             me.screenElements['OIL-TEMP-text']
35 35
                 .setText(sprintf('%i', getprop('/engines/engine/oil-temperature-degf')));
36
-            var full = getprop('/instrumentation/zkv1000/eis/fuel-qty-at-start');
36
+            var full = eis.getValue('fuel-qty-at-start');
37 37
             var right = getprop('/consumables/fuel/tank/level-gal_us');
38 38
             var left = getprop('/consumables/fuel/tank[1]/level-gal_us');
39 39
             var used_fuel = full - (right + left);
+5 -5
Nasal/buttons.nas
... ...
@@ -9,7 +9,7 @@ var buttonsClass = {
9 9
     },
10 10
 
11 11
     AsSwitchNAV : func {
12
-        var n = getprop('/instrumentation/zkv1000/radios/nav-tune');
12
+        var n = radios.getValue('nav-tune');
13 13
         var tmp = getprop('/instrumentation/nav[' ~ n ~ ']/frequencies/selected-mhz');
14 14
         setprop('/instrumentation/nav[' ~ n ~ ']/frequencies/selected-mhz', getprop('/instrumentation/nav[' ~ n ~ ']/frequencies/standby-mhz'));
15 15
         setprop('/instrumentation/nav[' ~ n ~ ']/frequencies/standby-mhz', tmp);
... ...
@@ -26,8 +26,8 @@ var buttonsClass = {
26 26
             var pressed = getprop('/sim/time/elapsed-sec') - me.AsSwitchCOM_pushed;
27 27
             if (pressed > 2) {
28 28
                 setprop('/instrumentation/comm/frequencies/selected-mhz', 121.500);
29
-                setprop('/instrumentation/zkv1000/radios/comm1-selected', 1);
30
-                setprop('/instrumentation/zkv1000/radios/comm2-selected', 0);
29
+                radios.setValue('comm1-selected', 1);
30
+                radios.setValue('comm2-selected', 0);
31 31
                 foreach (var d; keys(flightdeck))
32 32
                     if (contains(flightdeck[d], 'display')) {
33 33
                         flightdeck[d].display.updateCOMM({refresh: 1});
... ...
@@ -35,7 +35,7 @@ var buttonsClass = {
35 35
                     }
36 36
             }
37 37
             else {
38
-                var c = getprop('/instrumentation/zkv1000/radios/comm-tune');
38
+                var c = radios.getValue('comm-tune');
39 39
                 var tmp = getprop('/instrumentation/comm[' ~ c ~ ']/frequencies/selected-mhz');
40 40
                 setprop('/instrumentation/comm[' ~ c ~ ']/frequencies/selected-mhz', getprop('/instrumentation/comm[' ~ c ~ ']/frequencies/standby-mhz'));
41 41
                 setprop('/instrumentation/comm[' ~ c ~ ']/frequencies/standby-mhz', tmp);
... ...
@@ -48,7 +48,7 @@ var buttonsClass = {
48 48
 
49 49
     ALT : func () {
50 50
         var alt = getprop('instrumentation/altimeter/indicated-altitude-ft');
51
-        setprop('/instrumentation/zkv1000/afcs/selected-alt-ft', math.round(alt, 10));
51
+        afcs.setIntValue('selected-alt-ft', math.round(alt, 10));
52 52
     },
53 53
 
54 54
     ValidateTMRREF : func (a = 0) {
+3 -3
Nasal/core.nas
... ...
@@ -16,7 +16,7 @@ var setListeners = func {
16 16
             }, 1, 2);
17 17
 
18 18
     # keep this listener as long as the code is to heavy to be modified in multiple places
19
-    prop = '/instrumentation/zkv1000/afcs/selected-alt-ft';
19
+    prop = afcs.getNode('selected-alt-ft').getPath();
20 20
     data.listeners[prop] = setlistener(prop,
21 21
             func (n) {
22 22
                 var val = n.getValue();
... ...
@@ -77,7 +77,7 @@ var deviceClass = {
77 77
         foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide'])
78 78
             m.data[v ~ '-visible'] = 1;
79 79
         foreach (var v; ['screen-object', 'screen-view', 'screen-size'])
80
-            m.data[v] = getprop('/instrumentation/zkv1000/' ~ name ~ '/' ~ v);
80
+            m.data[v] = getprop(zkv.getPath() ~ '/' ~ name ~ '/' ~ v);
81 81
 
82 82
         m.display  = displayClass.new(m);
83 83
         m.softkeys = softkeysClass.new(m);
... ...
@@ -149,7 +149,7 @@ var deviceClass = {
149 149
         }
150 150
         m.display.showInitProgress();
151 151
 
152
-        setprop('/instrumentation/zkv1000/' ~ m.name ~ '/status', 1);
152
+        setprop(zkv.getPath() ~ '/' ~ m.name ~ '/status', 1);
153 153
         msg(m.name ~ ' switched on!');
154 154
         return m;
155 155
     },
+14 -14
Nasal/display.nas
... ...
@@ -151,9 +151,9 @@ var displayClass = {
151 151
                 canvas.parsesvg(m.screen, data.zkv1000_reldir ~ 'Models/PFD.svg');
152 152
             }
153 153
             else {
154
-                var eis_file = getprop('/instrumentation/zkv1000/eis/type');
154
+                var eis_file = eis.getValue('type');
155 155
                 if (eis_file == nil)
156
-                    eis_file = getprop('/instrumentation/zkv1000/eis/file');
156
+                    eis_file = eis.getValue('file');
157 157
 
158 158
                 if (eis_file != nil) {
159 159
                     if (find('/', eis_file) == -1)
... ...
@@ -829,7 +829,7 @@ var displayClass = {
829 829
 # moves the heading bug and display heading-deg for 3 seconds (PFD) {{{
830 830
         if (me.device.role == 'MFD')
831 831
             return;
832
-        var hdg = getprop('/instrumentation/zkv1000/afcs/heading-bug-deg');
832
+        var hdg = afcs.getValue('heading-bug-deg');
833 833
         me.screenElements['Heading-bug']
834 834
             .setRotation(hdg * D2R);
835 835
         me.screenElements['SelectedHDG-bg']
... ...
@@ -847,10 +847,10 @@ var displayClass = {
847 847
 # TODO: update display for NAV/GPS/BRG courses {{{
848 848
         if (me.device.role == 'MFD')
849 849
             return;
850
-        var source = getprop('/instrumentation/zkv1000/cdi/source');
850
+        var source = cdi.getValue('source');
851 851
         if (source == 'OFF')
852 852
             return;
853
-        var crs = getprop('/instrumentation/zkv1000/cdi/course');
853
+        var crs = cdi.getValue('course');
854 854
         if (crs == nil)
855 855
             return;
856 856
         me.screenElements['SelectedCRS-bg']
... ...
@@ -869,7 +869,7 @@ var displayClass = {
869 869
 # animation for altitude section, called via updatedALT {{{
870 870
         if (! me.screenElements['SelectedALT'].getVisible())
871 871
             return;
872
-        var selected_alt = getprop('/instrumentation/zkv1000/afcs/selected-alt-ft');
872
+        var selected_alt = afcs.getValue('selected-alt-ft');
873 873
         var delta_alt = data.alt - selected_alt;
874 874
         if (abs(delta_alt) > 300)
875 875
             delta_alt = 300 * abs(delta_alt)/delta_alt;
... ...
@@ -887,7 +887,7 @@ var displayClass = {
887 887
 
888 888
     updateCDI : func {
889 889
 # animation for CDI {{{
890
-        var source = getprop('/instrumentation/zkv1000/cdi/source');
890
+        var source = cdi.getValue('source');
891 891
         if (source == 'OFF') {
892 892
             foreach (var s; ['GPS', 'NAV1', 'NAV2'])
893 893
                 foreach (var t; ['pointer', 'CDI'])
... ...
@@ -898,7 +898,7 @@ var displayClass = {
898 898
             me.screenElements['CDI'].hide();
899 899
         }
900 900
         else {
901
-            var course = getprop('/instrumentation/zkv1000/cdi/course');
901
+            var course = cdi.getValue('course');
902 902
             var rot = (course - data.hdg) * D2R;
903 903
             me.screenElements['CDI']
904 904
                 .setRotation(rot)
... ...
@@ -917,13 +917,13 @@ var displayClass = {
917 917
                     .setVisible(source == s);
918 918
                 foreach (var f; ['FROM', 'TO'])
919 919
                     me.screenElements[s ~ '-' ~ f]
920
-                        .setVisible(s == source and getprop('/instrumentation/zkv1000/cdi/' ~ f ~ '-flag'));
920
+                        .setVisible(s == source and cdi.getValue(f ~ '-flag'));
921 921
                 me.screenElements['CDI-SRC-text']
922 922
                     .setText(source)
923 923
                     .setColor(source == 'GPS' ? me.colors.magenta : me.colors.green)
924 924
                     .show();
925 925
             }
926
-            var deflection = getprop('/instrumentation/zkv1000/cdi/course-deflection');
926
+            var deflection = cdi.getValue('course-deflection');
927 927
             if (left(source, 3) == 'NAV')
928 928
                 var scale = deflection / 4;
929 929
             else { # GPS
... ...
@@ -982,7 +982,7 @@ var displayClass = {
982 982
         }
983 983
         if (contains(arg[0], 'set')) {
984 984
             # positionne la valeur modifiée, les listeners "trigguent" en permanence ces propriétés, donc exit
985
-            var n = getprop('/instrumentation/zkv1000/radios/' ~ arg[0]._r ~ '-tune');
985
+            var n = radios.getValue(arg[0]._r ~ '-tune');
986 986
             var fmt = (arg[0]._r == 'nav') ? '%.2f' : '%.3f';
987 987
             me.screenElements[arg[0]._r ~ (n + 1) ~ '-standby-freq']
988 988
                 .setText(sprintf(fmt, getprop('/instrumentation/' ~ arg[0]._r ~ '[' ~ n ~ ']/frequencies/standby-mhz')));
... ...
@@ -1065,8 +1065,8 @@ var displayClass = {
1065 1065
         for (var d = 0; d < 4; d+=1)
1066 1066
             me.screenElements['XPDR-DIGIT-' ~ d ~ '-text']
1067 1067
                 .setText(sprintf('%i', getprop('/instrumentation/transponder/inputs/digit[' ~ d ~ ']')));
1068
-        var tuning = getprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit');
1069
-        var fms = getprop('/instrumentation/zkv1000/radios/xpdr-tuning-fms-method');
1068
+        var tuning = radios.getValue('xpdr-tuning-digit');
1069
+        var fms = radios.getValue('xpdr-tuning-fms-method');
1070 1070
         for (var d = 0; d < 4; d+=1)
1071 1071
             me.screenElements['XPDR-DIGIT-' ~ d ~ '-text']
1072 1072
                 .setColor(1,1,1);
... ...
@@ -1081,7 +1081,7 @@ var displayClass = {
1081 1081
             if (getprop('/instrumentation/transponder/ident'))
1082 1082
                 var mode = 'IDENT';
1083 1083
             else
1084
-                var mode = getprop('/instrumentation/zkv1000/radio/xpdr-mode');
1084
+                var mode = radios.getValue('xpdr-mode');
1085 1085
             var wow = getprop('/gear/gear/wow');
1086 1086
             if (! wow and mode != 'STBY')
1087 1087
                 var color = [0, 1, 0];
+6 -6
Nasal/knobs.nas
... ...
@@ -7,12 +7,12 @@ var knobsClass = {
7 7
 
8 8
     XPDRCodeSetDigits : func (d) {
9 9
         # disable SoftKey entering method
10
-        setprop('/instrumentation/zkv1000/radios/xpdr-tuning-fms-method', 1);
10
+        radios.setValue('xpdr-tuning-fms-method', 1);
11 11
         if (!contains(me.device.softkeys.bindings.PFD.XPDR.CODE, 'on_change_inactivity')) {
12 12
             me.device.softkeys.bindings.PFD.XPDR.CODE.inactivity.stop();
13 13
             me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity = maketimer(10,
14 14
                 func {
15
-                    setprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit', 3);
15
+                    radios.setValue('xpdr-tuning-digit', 3);
16 16
                     call(me.device.softkeys.bindings.PFD.XPDR.CODE.restore, [], me);
17 17
                 });
18 18
             me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.singleShot = 1;
... ...
@@ -20,7 +20,7 @@ var knobsClass = {
20 20
         }
21 21
         else
22 22
             me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10);
23
-        var digit = getprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit');
23
+        var digit = radios.getValue('xpdr-tuning-digit');
24 24
         var code = getprop('/instrumentation/transponder/id-code');
25 25
         if (digit == 3)
26 26
             var val = int(code/100) + d;
... ...
@@ -46,12 +46,12 @@ var knobsClass = {
46 46
     },
47 47
 
48 48
     XPDRCodeNextDigits : func {
49
-        setprop('/instrumentation/zkv1000/radios/xpdr-tuning-fms-method', 1);
49
+        radios.setValue('xpdr-tuning-fms-method', 1);
50 50
         if (!contains(me.device.softkeys.bindings.PFD.XPDR.CODE, 'on_change_inactivity')) {
51 51
             me.device.softkeys.bindings.PFD.XPDR.CODE.inactivity.stop();
52 52
             me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity = maketimer(10,
53 53
                 func {
54
-                    setprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit', 3);
54
+                    radios.setValue('xpdr-tuning-digit', 3);
55 55
                     call(me.device.softkeys.bindings.PFD.XPDR.CODE.restore, [], me);
56 56
                 });
57 57
             me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.singleShot = 1;
... ...
@@ -59,7 +59,7 @@ var knobsClass = {
59 59
         }
60 60
         else
61 61
             me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10);
62
-        setprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit', 1);
62
+        radios.setValue('xpdr-tuning-digit', 1);
63 63
         me.device.display.updateXPDR();
64 64
     },
65 65
 
+2 -2
Nasal/radios.nas
... ...
@@ -16,13 +16,13 @@ var radios_list = [
16 16
 var setNavTune = func {
17 17
     var freq = radios.getNode('nav-freq-mhz', 1);
18 18
     freq.unalias();
19
-    freq.alias(radios_list[getprop('/instrumentation/zkv1000/radios/nav-tune')]);
19
+    freq.alias(radios_list[radios.getValue('nav-tune')]);
20 20
 }
21 21
 
22 22
 var setCommTune = func {
23 23
     var freq = radios.getNode('comm-freq-mhz', 1);
24 24
     freq.unalias();
25
-    freq.alias(radios_list[getprop('/instrumentation/zkv1000/radios/comm-tune') + 4]);
25
+    freq.alias(radios_list[radios.getValue('comm-tune') + 4]);
26 26
 }
27 27
 
28 28
 var aliases = {
+9 -9
Nasal/softkeys.nas
... ...
@@ -261,19 +261,19 @@ var softkeysClass = {
261 261
                 STBY : func {
262 262
                     setprop('/instrumentation/transponder/ident', 0);
263 263
                     setprop('/instrumentation/transponder/knob-mode', 1);
264
-                    setprop('/instrumentation/zkv1000/radio/xpdr-mode', 'STBY');
264
+                    radios.setValue('xpdr-mode', 'STBY');
265 265
                     me.device.display.updateXPDR();
266 266
                 },
267 267
                 ON : func {
268 268
                     setprop('/instrumentation/transponder/ident', 1);
269 269
                     setprop('/instrumentation/transponder/knob-mode', 4);
270
-                    setprop('/instrumentation/zkv1000/radio/xpdr-mode', 'ON');
270
+                    radios.setValue('xpdr-mode', 'ON');
271 271
                     me.device.display.updateXPDR();
272 272
                 },
273 273
                 ALT : func {
274 274
                     setprop('/instrumentation/transponder/ident', 1);
275 275
                     setprop('/instrumentation/transponder/knob-mode', 5);
276
-                    setprop('/instrumentation/zkv1000/radio/xpdr-mode', 'ALT');
276
+                    radios.setValue('xpdr-mode', 'ALT');
277 277
                     me.device.display.updateXPDR();
278 278
                 },
279 279
                 VFR : func {
... ...
@@ -285,7 +285,7 @@ var softkeysClass = {
285 285
                 },
286 286
                 CODE : {
287 287
                     '0' : func (n = 0) {
288
-                        if (getprop('/instrumentation/zkv1000/radios/xpdr-tuning-fms-method'))
288
+                        if (radios.getValue('xpdr-tuning-fms-method'))
289 289
                             return;
290 290
                         me.device.display.timers2.softkeys_inactivity.stop();
291 291
                         me.bindings.PFD.XPDR.CODE.inactivity.restart(me.device.display.softkeys_inactivity_delay);
... ...
@@ -297,7 +297,7 @@ var softkeysClass = {
297 297
                         if (!contains(me.bindings.PFD.XPDR.CODE, 'on_change_inactivity')) {
298 298
                             me.bindings.PFD.XPDR.CODE.on_change_inactivity = maketimer(10,
299 299
                                 func {
300
-                                    setprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit', 3);
300
+                                    radios.setValue('xpdr-tuning-digit', 3);
301 301
                                     me.device.knobs.FmsInner = me.device.knobs.XPDRCodeSetDigits;
302 302
                                     me.device.knobs.FmsOuter = me.device.knobs.XPDRCodeNextDigits;
303 303
                                     call(me.bindings.PFD.XPDR.CODE.restore, [], me);
... ...
@@ -350,7 +350,7 @@ var softkeysClass = {
350 350
                         call(me.bindings.PFD.IDENT, [], me);
351 351
                     },
352 352
                     BKSP: func {
353
-                        if (getprop('/instrumentation/zkv1000/radios/xpdr-tuning-fms-method'))
353
+                        if (radios.getValue('xpdr-tuning-fms-method'))
354 354
                             return;
355 355
                         if (contains(me.bindings.PFD.XPDR.CODE, 'on_change_inactivity'))
356 356
                             me.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10);
... ...
@@ -371,7 +371,7 @@ var softkeysClass = {
371 371
                     },
372 372
                     restore : func {
373 373
                         setprop('/instrumentation/transponder/id-code',
374
-                            sprintf('%s', getprop('/instrumentation/zkv1000/radios/xpdr-backup-code')));
374
+                            sprintf('%s', radios.getValue('xpdr-backup-code')));
375 375
                         me.device.display.updateXPDR();
376 376
                     },
377 377
                     exit : func (p) {
... ...
@@ -395,7 +395,7 @@ var softkeysClass = {
395 395
                             func call(me.bindings.PFD.XPDR.CODE.BACK, [], me));
396 396
                         me.bindings.PFD.XPDR.CODE.inactivity.singleShot = 1;
397 397
                         me.bindings.PFD.XPDR.CODE.inactivity.start();
398
-                        var tuning = getprop('/instrument/zkv1000/radios/xpdr-tuning-digit');
398
+                        var tuning = radios.getValue('xpdr-tuning-digit');
399 399
                         if (tuning == nil) {
400 400
                             radios.getNode('xpdr-tuning-digit', 1).setValue(3);
401 401
                             radios.getNode('xpdr-backup-code', 1).setValue(getprop('/instrumentation/transponder/id-code'));
... ...
@@ -408,7 +408,7 @@ var softkeysClass = {
408 408
                 },
409 409
             },
410 410
             IDENT : func {
411
-                if (getprop('/instrumentation/zkv1000/radio/xpdr-mode') == 'STBY')
411
+                if (radios.getValue('xpdr-mode') == 'STBY')
412 412
                     return;
413 413
                 setprop('/instrumentation/transponder/ident', 1);
414 414
                 me.bindings.PFD.XPDR.ident = maketimer(18,
+4 -4
zkv1000.nas
... ...
@@ -105,12 +105,12 @@ var init_props = func {
105 105
     alerts.getNode('alert', 1).setBoolValue(0);
106 106
     alerts.getNode('message', 1).setValue('');
107 107
     foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide', 'Vne']) {
108
-        var speed = getprop('/instrumentation/zkv1000/alerts/' ~ v);
108
+        var speed = alerts.getValue(v);
109 109
         data[v] = speed != nil ? speed : 9999;
110 110
     }
111
-    var aoa = getprop('/instrumentation/zkv1000/alerts/stall-aoa');
111
+    var aoa = alerts.getValue('stall-aoa');
112 112
     data['stall-aoa'] = (aoa == nil or aoa == 0) ? 9999 : aoa;
113
-    aoa = getprop('/instrumentation/zkv1000/alerts/approach-aoa');
113
+    aoa = alerts.getValue('approach-aoa');
114 114
     if (aoa != nil)
115 115
         data['approach-aoa'] = aoa;
116 116
 
... ...
@@ -157,7 +157,7 @@ var init_props = func {
157 157
 
158 158
     props.globals.getNode('/instrumentation/transponder/id-code',1).setIntValue(1200);
159 159
     props.globals.getNode('/instrumentation/transponder/serviceable',1).setBoolValue(1);
160
-    props.globals.getNode('/autopilot/settings/heading-bug-deg', 1).alias('/instrumentation/zkv1000/afcs/heading-bug-deg');
160
+    props.globals.getNode('/autopilot/settings/heading-bug-deg', 1).alias(afcs.getNode('heading-bug-deg').getPath());
161 161
     props.globals.getNode('/autopilot/settings/target-altitude-ft',1).setDoubleValue(0.0);
162 162
     props.globals.getNode('/autopilot/settings/target-speed-kt',1).setDoubleValue(0.0);
163 163
     props.globals.getNode('/autopilot/settings/vertical-speed-fpm',1).setDoubleValue(0.0);