Showing 6 changed files with 87 additions and 132 deletions
+9 -67
Models/PFD.svg
... ...
@@ -4153,83 +4153,25 @@
4153 4153
              sodipodi:role="line">110</tspan></text>
4154 4154
       </g>
4155 4155
       <g
4156
-         style="display:inline"
4157
-         id="IAS-Vglide"
4158
-         inkscape:label="IAS-Vglide">
4156
+         id="Vspeed"
4157
+         inkscape:label="Vspeed">
4159 4158
         <path
4160 4159
            inkscape:connector-curvature="0"
4161
-           id="path5945-6-5-1"
4160
+           id="Vspeed-pointer"
4162 4161
            d="m 240,284.52756 7.1477,-7.1477 h 7.55334 v 14.87397 h -7.32064 z"
4163
-           style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
4162
+           style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
4163
+           inkscape:label="Vspeed-pointer" />
4164 4164
         <text
4165
-           id="text5949-7-6-2"
4165
+           id="Vspeed-text"
4166 4166
            y="289.44748"
4167 4167
            x="245.35812"
4168 4168
            style="font-style:normal;font-weight:normal;font-size:13.33333397px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
4169
-           xml:space="preserve"><tspan
4170
-             y="289.44748"
4171
-             x="245.35812"
4172
-             id="tspan5947-5-2-7"
4173
-             sodipodi:role="line">G</tspan></text>
4174
-      </g>
4175
-      <g
4176
-         style="display:inline"
4177
-         id="IAS-Vr"
4178
-         inkscape:label="IAS-Vr">
4179
-        <path
4180
-           inkscape:connector-curvature="0"
4181
-           id="path5945-6-5"
4182
-           d="m 240,284.52756 7.1477,-7.1477 h 7.55334 v 14.87397 h -7.32064 z"
4183
-           style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
4184
-        <text
4185
-           id="text5949-7-6"
4186
-           y="289.44748"
4187
-           x="245.35812"
4188
-           style="font-style:normal;font-weight:normal;font-size:13.33333397px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
4189
-           xml:space="preserve"><tspan
4190
-             y="289.44748"
4191
-             x="245.35812"
4192
-             id="tspan5947-5-2"
4193
-             sodipodi:role="line">R</tspan></text>
4194
-      </g>
4195
-      <g
4196
-         style="display:inline"
4197
-         id="IAS-Vy"
4198
-         inkscape:label="IAS-Vy">
4199
-        <path
4200
-           inkscape:connector-curvature="0"
4201
-           id="path5945-6"
4202
-           d="m 240,284.52756 7.1477,-7.1477 h 7.55334 v 14.87397 h -7.32064 z"
4203
-           style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
4204
-        <text
4205
-           id="text5949-7"
4206
-           y="289.44748"
4207
-           x="245.35812"
4208
-           style="font-style:normal;font-weight:normal;font-size:13.33333397px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
4209
-           xml:space="preserve"><tspan
4210
-             y="289.44748"
4211
-             x="245.35812"
4212
-             id="tspan5947-5"
4213
-             sodipodi:role="line">Y</tspan></text>
4214
-      </g>
4215
-      <g
4216
-         id="IAS-Vx"
4217
-         inkscape:label="IAS-Vx">
4218
-        <path
4219
-           inkscape:connector-curvature="0"
4220
-           id="path5945"
4221
-           d="m 240,284.52756 7.1477,-7.1477 h 7.55334 v 14.87397 h -7.32064 z"
4222
-           style="fill:#ff00ff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
4223
-        <text
4224
-           id="text5949"
4225
-           y="289.44748"
4226
-           x="245.35812"
4227
-           style="font-style:normal;font-weight:normal;font-size:13.33333397px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
4228
-           xml:space="preserve"><tspan
4169
+           xml:space="preserve"
4170
+           inkscape:label="Vspeed-text"><tspan
4229 4171
              y="289.44748"
4230 4172
              x="245.35812"
4231 4173
              id="tspan5947"
4232
-             sodipodi:role="line">X</tspan></text>
4174
+             sodipodi:role="line">Vspeed</tspan></text>
4233 4175
       </g>
4234 4176
       <g
4235 4177
          id="VSI">
+2 -4
Nasal/buttons.nas
... ...
@@ -257,10 +257,8 @@ var buttonsClass = {
257 257
                     }
258 258
                     foreach (var from; keys(units.speed))
259 259
                         zkv.getNode('save/speed', 1).setDoubleValue(from, units.speed[from]);
260
-                    foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide', 'Vne']) {
261
-                        var speed = alerts.getValue(v) * units.speed.from_kt;
262
-                        data[v] = speed != nil ? speed : 9999;
263
-                    }
260
+                    foreach (var v; keys(data.Vspeeds))
261
+                        data.Vspeeds[v] *= units.speed.from_kt;
264 262
                 }
265 263
             },
266 264
             {text: 'Vert. Spd :', type: 'normal', scrollgroup: 4},
+1 -1
Nasal/core.nas
... ...
@@ -138,7 +138,7 @@ var deviceClass = {
138 138
         m.node = zkv.getNode(name, 1);
139 139
         m.data = {};
140 140
         m.timers = {};
141
-        foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide'])
141
+        foreach (var v; keys(data.Vspeeds))
142 142
             m.data[v ~ '-visible'] = 1;
143 143
         foreach (var v; ['screen-object', 'screen-view', 'screen-size'])
144 144
             m.data[v] = getprop(zkv.getPath() ~ '/' ~ name ~ '/' ~ v);
+24 -11
Nasal/display.nas
... ...
@@ -70,7 +70,6 @@ var displayClass = {
70 70
                 'GSPD',
71 71
                 'BARO-bg',
72 72
                 'SlipSkid',
73
-                'IAS-Vx', 'IAS-Vy', 'IAS-Vr', 'IAS-Vglide',
74 73
                 'VDI', 'GS-ILS', 'VDI-scale',
75 74
 # }}}
76 75
             );
... ...
@@ -523,6 +522,19 @@ var displayClass = {
523 522
                     setMethod(id, todo);
524 523
             }
525 524
         }
525
+        if (me.device.role == 'PFD') {
526
+            var Vsource = me.screen.getElementById('Vspeed');
527
+            foreach (var V; keys(data.Vspeeds)) {
528
+                me.screenElements[V] = me.screen.createChild('group', V);
529
+                props.copy( Vsource.parents[1]._node, me.screenElements[V].parents[1]._node);
530
+                me.screenElements[V].parents[1]._node.setValue('id', V);
531
+                me.screenElements[V].parents[1]._node.setValue('text/id', V);
532
+                me.screenElements[V].parents[1]._node.setValue('text/text', V);
533
+            }
534
+            Vsource.hide();
535
+            Vsource.removeAllChildren();
536
+            Vsource.del();
537
+        }
526 538
     },
527 539
 #}}}
528 540
 
... ...
@@ -746,23 +758,23 @@ var displayClass = {
746 758
             .setTranslation(0,(math.mod(ias,10) + (ias >= 10)*10) * 36);
747 759
         me.screenElements.SpeedTape
748 760
             .setTranslation(0,ias * 5.711);
749
-        if (ias > data.Vne and ! me._ias_already_exceeded) { # easier than .getColorFill
761
+        if (ias > me._Vne and ! me._ias_already_exceeded) { # easier than .getColorFill
750 762
             me._ias_already_exceeded = 1;
751 763
             me.screenElements['IAS-bg']
752 764
                 .setColorFill(1,0,0);
753 765
         }
754
-        elsif (ias < data.Vne and me._ias_already_exceeded) { # easier than .getColorFill
766
+        elsif (ias < me._Vne and me._ias_already_exceeded) { # easier than .getColorFill
755 767
             me._ias_already_exceeded = 0;
756 768
             me.screenElements['IAS-bg']
757 769
                 .setColorFill(0,0,0);
758 770
         }
759
-        foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide']) {
760
-            if (me.device.data[v ~ '-visible'] and abs(data[v] - ias) * units.speed.from_kt < 30 * units.speed.from_kt)
761
-                me.screenElements['IAS-' ~ v]
762
-                    .setTranslation(0, (ias - data[v]) * 5.711)
771
+        foreach (var v; keys(data.Vspeeds)) {
772
+            if (me.device.data[v ~ '-visible'] and abs(data.Vspeeds[v] - ias) < 30)
773
+                me.screenElements[v]
774
+                    .setTranslation(0, (ias - data.Vspeeds[v]) * 5.711)
763 775
                     .show();
764 776
             else
765
-                me.screenElements['IAS-' ~ v]
777
+                me.screenElements[v]
766 778
                     .hide();
767 779
         }
768 780
 
... ...
@@ -771,7 +783,7 @@ var displayClass = {
771 783
             me._last_ias_Sy[i+1] = me._last_ias_Sy[i];
772 784
         var now = systime();
773 785
         # estimated speed in 6s
774
-        me._last_ias_Sy[0] = 6 * (ias - me._last_ias_kt) / (now - me._last_ias_s);
786
+        me._last_ias_Sy[0] = 6 * (ias - me._last_ias) / (now - me._last_ias_s);
775 787
         foreach (var _Sy; me._last_ias_Sy)
776 788
             Sy += _Sy;
777 789
         Sy /= 10;
... ...
@@ -780,10 +792,11 @@ var displayClass = {
780 792
         me.screenElements['Airspeed-Trend-Indicator']
781 793
             .setScale(1,Sy)
782 794
             .setTranslation(0, -284.5 * (Sy - 1));
783
-        me._last_ias_kt = ias;
795
+        me._last_ias = ias;
784 796
         me._last_ias_s = now;
785 797
     },
786
-    _last_ias_kt : 0,
798
+    _Vne : contains(data.Vspeeds, 'Vne') ? data.Vspeeds.Vne : 999,
799
+    _last_ias : 0,
787 800
     _last_ias_s : systime(),
788 801
     _last_ias_Sy : [0,0,0,0,0,0,0,0,0,0],
789 802
     _ias_already_exceeded : 0,
+44 -41
Nasal/softkeys.nas
... ...
@@ -518,57 +518,60 @@ var softkeysClass = {
518 518
                             {type: 'separator'},
519 519
                     ];
520 520
                     var scrollgroup = 0;
521
-                    foreach (var V; ['x', 'y', 'r', 'glide']) {
522
-                        V = 'V' ~ V;
523
-                        var speed = alerts.getNode(V) != nil ? alerts.getValue(V) * units.speed.from_kt : 0;
524
-                        append(obj_infos, {
525
-                            text: sprintf('%-7s', V),
526
-                            type: 'normal',
527
-                            scrollgroup: scrollgroup
528
-                        });
529
-                        append(obj_infos, {
530
-                            text: sprintf('%3i%s',
531
-                                alerts.getNode(V) != nil ? alerts.getValue(V) * units.speed.from_kt : 0,
532
-                                units.speed.from_kt == 1 ? 'KT' : 'km/h'),
533
-                            type: 'editable|immediate',
534
-                            scrollgroup: scrollgroup,
535
-                            range: {min: 0, max: 999},
536
-                            format: '%3i' ~ (units.speed.from_kt == 1 ? 'KT' : 'km/h'),
537
-                            _v: V,
538
-                            callback: func (id, selected,) {
539
-                                string.scanf(string.trim(me.device.windows.state[id].objects[selected].text, -1),
540
-                                             '%3u' ~ (units.speed.from_kt == 1 ? 'KT' : 'km/h'), var r = []);
541
-                                data[me.device.windows.state[id].objects[selected]._v] = r[0];
542
-                            }
521
+                    if (size(keys(data.Vspeeds))) {
522
+                        var sort_smallest_first = func (a, b) {
523
+                            if   (data.Vspeeds[a] <  data.Vspeeds[b]) return -1;
524
+                            elsif(data.Vspeeds[a] == data.Vspeeds[b]) return 0;
525
+                            else return 1;
526
+                        }
527
+                        foreach (var V; sort(keys(data.Vspeeds), sort_smallest_first)) {
528
+                            append(obj_infos, {
529
+                                text: sprintf('%-7s', V),
530
+                                type: 'normal',
531
+                                scrollgroup: scrollgroup
532
+                            });
533
+                            append(obj_infos, {
534
+                                text: sprintf('%3i%s', data.Vspeeds[V], units.speed.from_kt == 1 ? 'KT' : 'km/h'),
535
+                                type: (V == 'Vne' ? 'normal' : 'editable') ~ '|immediate',
536
+                                scrollgroup: scrollgroup,
537
+                                range: {min: 0, max: 999},
538
+                                format: '%3i' ~ (units.speed.from_kt == 1 ? 'KT' : 'km/h'),
539
+                                _v: V,
540
+                                callback: func (id, selected,) {
541
+                                    string.scanf(string.trim(me.device.windows.state[id].objects[selected].text, -1),
542
+                                                 '%3u' ~ (units.speed.from_kt == 1 ? 'KT' : 'km/h'), var r = []);
543
+                                    data.Vspeeds[me.device.windows.state[id].objects[selected]._v] = r[0];
544
+                                }
543 545
 
544
-                        });
545
-                        append(obj_infos, {
546
-                            text: me.device.data[V ~ '-visible'] ? '   ON >' : '< OFF  ',
547
-                            type: 'editable|immediate|end-of-line',
548
-                            scrollgroup: scrollgroup,
549
-                            _v: V,
550
-                            choices: ['   ON >', '< OFF  '],
551
-                            callback: func (id, selected) {
552
-                                var Vspeed = me.device.windows.state[id].objects[selected]._v;
553
-                                me.device.data[Vspeed ~ '-visible'] =
554
-                                    me.device.windows.state[id].objects[selected].text
555
-                                    ==
556
-                                    me.device.windows.state[id].objects[selected].choices[0];
557
-                            }
558
-                        });
559
-                        scrollgroup += 1;
546
+                            });
547
+                            append(obj_infos, {
548
+                                text: me.device.data[V ~ '-visible'] ? '   ON >' : '< OFF  ',
549
+                                type: 'editable|immediate|end-of-line',
550
+                                scrollgroup: scrollgroup,
551
+                                _v: V,
552
+                                choices: ['   ON >', '< OFF  '],
553
+                                callback: func (id, selected) {
554
+                                    var Vspeed = me.device.windows.state[id].objects[selected]._v;
555
+                                    me.device.data[Vspeed ~ '-visible'] =
556
+                                        me.device.windows.state[id].objects[selected].text
557
+                                        ==
558
+                                        me.device.windows.state[id].objects[selected].choices[0];
559
+                                }
560
+                            });
561
+                            scrollgroup += 1;
562
+                        }
563
+                        append(obj_infos, {type: 'separator'});
560 564
                     }
561 565
                     append(obj_infos,
562
-                            {type: 'separator'},
563 566
                             {text: 'MINIMUMS', type: 'normal'},
564 567
                             {text: '   OFF   >', type: 'editable', choices: ['   OFF   >', '<  BARO  >','<TEMP COMP'], callback: func},
565 568
                             {text: ' 1000FT', type: 'editable', format: '% 5iFT', factor: 100, callback: func}
566 569
                           );
567 570
                     me.device.windows.draw(
568 571
                         'TMR/REF',
569
-                        {x: 720, y: 535, w: 300, l: 5, sep: 3},
572
+                        {x: 720, y: 535, w: 300, l: 5, sep: scrollgroup ? 3 : 2},
570 573
                         obj_infos,
571
-                        { lines : 3, columns : 3 }
574
+                        scrollgroup > 2 ? { lines : 3, columns : 3 } : nil
572 575
                     );
573 576
                     me.device.knobs.FmsInner = me.device.knobs.MenuSettings;
574 577
                     me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
+7 -8
zkv1000.nas
... ...
@@ -70,6 +70,7 @@ var data = { # set of data common to all devices
70 70
     fpSize : 0,
71 71
     tcas: [],
72 72
     tcas_level: 0,
73
+    Vspeeds : {},
73 74
     settings: {
74 75
         units: {
75 76
             pressure: 'inhg',
... ...
@@ -158,10 +159,10 @@ var init_props = func {
158 159
     alerts.getNode('warning', 1).setBoolValue(0);
159 160
     alerts.getNode('alert', 1).setBoolValue(0);
160 161
     alerts.getNode('message', 1).setValue('');
161
-    foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide', 'Vne']) {
162
-        var speed = alerts.getValue(v) * units.speed.from_kt;
163
-        data[v] = speed != nil ? speed : 9999;
164
-    }
162
+    foreach (var v; alerts.getChildren())
163
+        if (string.match(v.getName(), 'V[a-z0-9]*'))
164
+            data.Vspeeds[v.getName()] = v.getValue();
165
+
165 166
     var aoa = alerts.getValue('stall-aoa');
166 167
     data['stall-aoa'] = (aoa == nil or aoa == 0) ? 9999 : aoa;
167 168
     aoa = alerts.getValue('approach-aoa');
... ...
@@ -274,11 +275,9 @@ var load_settings = func {
274 275
             data.settings.units.pressure = xmlsettings.getNode('pressure').getValue();
275 276
         }
276 277
         zkv.getNode('save').remove();
277
-        foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide', 'Vne']) {
278
-            var speed = alerts.getValue(v) * units.speed.from_kt;
279
-            data[v] = speed != nil ? speed : 9999;
280
-        }
281 278
     }
279
+    foreach (var V; keys(data.Vspeeds))
280
+        data.Vspeeds[V] *= units.speed.from_kt;
282 281
 }
283 282
 
284 283
 var zkv1000_init = func {