Showing 2 changed files with 45 additions and 2 deletions
+23
Nasal/core.nas
... ...
@@ -15,6 +15,29 @@ var setListeners = func {
15 15
                     flightdeck[c].display.updateNAV({'nav-id': 2, val: val});
16 16
             }, 1, 2);
17 17
 
18
+    prop = '/instrumentation/nav/has-gs';
19
+    data.listeners[prop] = setlistener(prop,
20
+            func (n) {
21
+                if (n.getValue()) {
22
+                    foreach (var c; keys(flightdeck)) {
23
+                        if (flightdeck[c].role == 'PFD') {
24
+                            flightdeck[c].display.screenElements['VDI-scale'].show();
25
+                            flightdeck[c].display.screenElements['GS-ILS'].show();
26
+                            flightdeck[c].display.timers.updateGS.start();
27
+                        }
28
+                    }
29
+                }
30
+                else {
31
+                    foreach (var c; keys(flightdeck)) {
32
+                        if (flightdeck[c].role == 'PFD') {
33
+                            flightdeck[c].display.screenElements['VDI-scale'].hide();
34
+                            flightdeck[c].display.screenElements['GS-ILS'].hide();
35
+                            flightdeck[c].display.timers.updateGS.stop();
36
+                        }
37
+                    }
38
+                }
39
+            }, 1, 0);
40
+
18 41
     # keep this listener as long as the code is to heavy to be modified in multiple places
19 42
     prop = afcs.getNode('selected-alt-ft').getPath();
20 43
     data.listeners[prop] = setlistener(prop,
+22 -2
Nasal/display.nas
... ...
@@ -71,6 +71,7 @@ var displayClass = {
71 71
                 'BARO-bg',
72 72
                 'SlipSkid',
73 73
                 'IAS-Vx', 'IAS-Vy', 'IAS-Vr', 'IAS-Vglide',
74
+                'VDI', 'GS-ILS', 'VDI-scale',
74 75
 # }}}
75 76
             );
76 77
             append(groups.hide,
... ...
@@ -78,7 +79,6 @@ var displayClass = {
78 79
                 'EIS',
79 80
                 'CDI',
80 81
                 'OMI', 'MarkerBG', 'MarkerText',
81
-                'VDI',
82 82
                 'NAV1-pointer', 'NAV1-CDI', 'NAV1-FROM', 'NAV1-TO',
83 83
                 'NAV2-pointer', 'NAV2-CDI', 'NAV2-FROM', 'NAV2-TO',
84 84
                 'GPS-pointer', 'GPS-CDI', 'GPS-CTI', 'GPS-CTI-diamond', 'GPS-FROM', 'GPS-TO',
... ...
@@ -107,6 +107,7 @@ var displayClass = {
107 107
                 'AOA', 'AOA-needle', 'AOA-text', 'AOA-approach',
108 108
                 'MFD-navbox',
109 109
                 'Traffic',
110
+                'VDI-type-bg',
110 111
 # }}}
111 112
             );
112 113
             append(groups.clip,
... ...
@@ -440,6 +441,8 @@ var displayClass = {
440 441
 
441 442
         foreach (var timer; keys(me.timers))
442 443
             me.timers[timer].start();
444
+
445
+        me.timers.updateGS = maketimer(0.2, me, me.updateGS);
443 446
     },
444 447
 #}}}
445 448
 
... ...
@@ -1078,7 +1081,15 @@ var displayClass = {
1078 1081
                 else
1079 1082
                     me.screenElements['CDI-GPS-XTK-text']
1080 1083
                         .hide();
1081
-                me.screenElements['CDI-GPS-ANN-text'].hide();
1084
+                if (source == 'NAV1' and getprop('/instrumentation/nav/nav-loc')) {
1085
+                    me.screenElements['CDI-GPS-ANN-text']
1086
+                        .setColor(me.colors.green)
1087
+                        .setText('LOC')
1088
+                        .show();
1089
+                    cdi.setValue('course', int(getprop('/instrumentation/nav/radials/target-radial-deg')));
1090
+                }
1091
+                else
1092
+                    me.screenElements['CDI-GPS-ANN-text'].hide();
1082 1093
             }
1083 1094
             else { # GPS
1084 1095
                 # TODO: deviation depending of the flight phase
... ...
@@ -1089,6 +1100,7 @@ var displayClass = {
1089 1100
                 if (getprop('/instrumentation/gps/mode') == 'obs') {
1090 1101
                     abs_deflection_max = 0.1;
1091 1102
                     me.screenElements['CDI-GPS-ANN-text']
1103
+                        .setColor(me.colors.magenta)
1092 1104
                         .setText('OBS')
1093 1105
                         .show();
1094 1106
                 }
... ...
@@ -1450,4 +1462,12 @@ var displayClass = {
1450 1462
         'inner':  {t: 'I', bg: [1,1,0]},
1451 1463
     },
1452 1464
 #}}}
1465
+
1466
+    updateGS : func {
1467
+# display glide-slope on ILS approach {{{
1468
+        var deflection = getprop('/instrumentation/nav/gs-needle-deflection-norm');
1469
+        me.screenElements['GS-ILS']
1470
+            .setTranslation(0, deflection * 100);
1471
+    },
1472
+#}}}
1453 1473
 };