Showing 1 changed files with 48 additions and 0 deletions
+48
Nasal/MFD.pages.nas
... ...
@@ -47,6 +47,54 @@ displayClass.MFD = {
47 47
             me.device.buttons.ENT = me.device.buttons.ValidateTMRREF;
48 48
         },
49 49
     },
50
+    FPL : {
51
+        'ACTIVE FLIGHT PLAN' : func {
52
+            me.device.windows.del(id);
53
+            var flightplan = props.globals.getNode('/autopilot/route-manager');
54
+            var route = flightplan.getNode('route');
55
+            var obj_infos = [
56
+                {text: 'ACTIVE FLIGTHPLAN', type: 'title'},
57
+                {type: 'separator'},
58
+            ];
59
+            if (route.getValue('num')) {
60
+                append(obj_infos, {text: sprintf('DEP: %s', flightplan.getNode('departure').getValue('airport')), type: 'normal|end-of-line'});
61
+                append(obj_infos, {text: sprintf('ARR: %s', flightplan.getNode('destination').getValue('airport')), type: 'normal|end-of-line'});
62
+                append(obj_infos, {text: sprintf('DIS: %dnm', flightplan.getValue('total-distance')), type: 'normal|end-of-line'});
63
+                append(obj_infos, {type: 'separator'});
64
+                var current_wp = flightplan.getValue('current-wp');
65
+                var firstEntry = 1;
66
+                for (var n = 1; n < route.getValue('num'); n += 1) {
67
+                    var wp = route.getChild('wp', n);
68
+                    append(obj_infos, {text: sprintf('%1s %-7s  %3d°  %3dnm %s',
69
+                                                    n == current_wp ? utf8.chstr(9658) : ' ',
70
+                                                    wp.getValue('id'),
71
+                                                    math.round(wp.getValue('leg-bearing-true-deg')),
72
+                                                    math.round(wp.getValue('leg-distance-nm')),
73
+                                                    wp.getValue('altitude-ft') > -100 ? ' ' ~ wp.getValue('altitude-ft') ~ 'ft': ''
74
+                                            ),
75
+                                       type: (firstEntry ? 'selected' : 'editable') ~ '|end-of-line',
76
+                                       scrollgroup: n
77
+                    });
78
+                    firstEntry = 0;
79
+                }
80
+                append(obj_infos, {type: 'separator'});
81
+            }
82
+            else {
83
+                append(obj_infos, {text: 'NO FP LOADED', type: 'normal|end-of-line'});
84
+            }
85
+            var windowId = 'ACTIVE FLIGTH PLAN';
86
+            me.device.windows.draw( windowId, obj_infos, {lines: 6, columns: 1} );
87
+            me.device.buttons.CLR = func {
88
+                me.device.windows.del(windowId);
89
+                me.device.buttons.ENT = func;
90
+                me.device.buttons.CLR = func;
91
+                me.device.knobs.FmsInner = func;
92
+                me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group;
93
+            }
94
+            me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
95
+            me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
96
+        },
97
+    },
50 98
     NRST : {
51 99
         'NEAREST AIRPORTS': func {
52 100
             var airports = findAirportsWithinRange(99.99);