Showing 1 changed files with 21 additions and 29 deletions
+21 -29
Nasal/afcs.nas
... ...
@@ -218,23 +218,23 @@ var APClass = {
218 218
                 setprop('/it-stec55x/input/ap-master-sw', 1);
219 219
             },
220 220
             updateDisplay: func {
221
-                var armed     = '';
222
-                var active    = '';
223
-                var reference = '';
221
+                var vert_armed     = '';
222
+                var vert_active    = '';
223
+                var vert_reference = '';
224 224
                 if (stec55x.ALT_annun.getBoolValue()) {
225
-                    active    = 'ALT';
226
-                    reference = sprintf('%5d ft', abs(data.alt - afcs.getValue('selected-alt-ft')) < 150 ? afcs.getValue('selected-alt-ft') : math.round(data.alt, 10));
227
-                    armed     = sprintf('%.2f inHg', stec55x.alt.getValue());
225
+                    vert_active    = 'ALT';
226
+                    vert_reference = sprintf('%.2f inHg', stec55x.alt.getValue());
227
+                    vert_armed     = sprintf('%5d ft', abs(data.alt - afcs.getValue('selected-alt-ft')) < 150 ? afcs.getValue('selected-alt-ft') : math.round(data.alt, 10));
228 228
                 }
229 229
                 elsif (stec55x.VS_annun.getBoolValue()) {
230
-                    active    = 'VS';
231
-                    reference = sprintf('%s%4d fpm',
230
+                    vert_active    = 'VS';
231
+                    vert_reference = sprintf('%s%4d fpm',
232 232
                                     utf8.chstr(stec55x.vs.getValue() > 0 ? 9650 : 9660),
233 233
                                     math.abs(math.round(stec55x.vs.getValue(), 10)));
234 234
                 }
235 235
                 elsif (stec55x.GSArmed.getBoolValue()) {
236
-                    armed  = 'VPATH';
237
-                    active = 'GS';
236
+                    vert_armed  = 'GS';
237
+                    vert_active = 'VPATH';
238 238
                 }
239 239
 
240 240
                 var ap_state = [];
... ...
@@ -247,32 +247,24 @@ var APClass = {
247 247
                 else
248 248
                     ap_state = ["", "black", "black"];
249 249
 
250
+                var lat_active = '';
251
+                foreach (var m; ['HDG', 'NAV', 'APR'])
252
+                    if (stec55x[m ~ "_annun"].getBoolValue()) {
253
+                        lat_active = m;
254
+                        break;
255
+                    }
256
+
250 257
                 foreach (var terminal; me.terminals) {
251 258
                     var se = flightdeck[terminal].display.screenElements;
252
-                    se['VERMOD-Active-text'].setVisible(size(active)).setText(active);
253
-                    se['VERMOD-Armed-text'].setVisible(size(armed)).setText(armed);
254
-                    se['VERMOD-Reference-text'].setVisible(size(reference)).setText(reference);
259
+                    se['VERMOD-Active-text'].setVisible(size(vert_active)).setText(vert_active);
260
+                    se['VERMOD-Armed-text'].setVisible(size(vert_armed)).setText(vert_armed);
261
+                    se['VERMOD-Reference-text'].setVisible(size(vert_reference)).setText(vert_reference);
255 262
                     se['AP-Status-text'].setColorFill(flightdeck[terminal].display.colors[ap_state[2]])
256 263
                                         .setColor(ap_state[1])
257 264
                                         .setVisible(size(ap_state[0]))
258 265
                                         .setText(ap_state[0]);
259 266
                     se['YD-Status-text'].setVisible(stec55x.yaw.getValue() != -1);
260
-                    if (stec55x.rollMode  != -1) {
261
-                        se['LATMOD-Active-text'].setVisible(1).setText('ROL');
262
-                        var armed = '';
263
-                        foreach (var m; [ 'NAV', 'CNAV', 'REV', 'CREV' ])
264
-                            if (stec55x[m]) armed = m;
265
-                        if (stec55x.roll.getValue() == 0) armed = 'HDG';
266
-                        elsif (stec55x.roll.getValue() == 2) armed = 'GPS';
267
-                        elsif (stec55x.APR_annun.getValue()) armed = 'LOC';
268
-                        se['LATMOD-Armed-text']
269
-                            .setVisible(size(armed))
270
-                            .setText(armed);
271
-                    }
272
-                    else {
273
-                        se['LATMOD-Active-text'].setVisible(0);
274
-                        se['LATMOD-Armed-text'].setVisible(0);
275
-                    }
267
+                    se['LATMOD-Active-text'].setVisible(size(lat_active)).setText(lat_active);
276 268
                 }
277 269
 
278 270
             },