Showing 1 changed files with 35 additions and 32 deletions
+35 -32
Nasal/afcs.nas
... ...
@@ -91,20 +91,20 @@ var APClass = {
91 91
 # Many thanks to the great work on the FG1000
92 92
             _blink_count: 0,
93 93
             updateDisplay: func {
94
+                var annunciator = props.globals.getNode('/autopilot/annunciator');
95
+                var ap_enabled  = annunciator.getValue('autopilot-enabled');
96
+
97
+                var latmod         = annunciator.getValue('lateral-mode');
98
+                var latmod_armed   = annunciator.getValue('lateral-mode-armed');
99
+                var vertmod        = annunciator.getValue('vertical-mode');
100
+                var vertmod_armed  = annunciator.getValue('vertical-mode-armed');
101
+                var vertmod_target = annunciator.getValue('vertical-mode-target');
102
+                if (vertmod_target != nil) {
103
+                    vertmod_target = string.replace(vertmod_target, '+', utf8.chstr(9650));
104
+                    vertmod_target = string.replace(vertmod_target, '-', utf8.chstr(9660));
105
+                }
94 106
                 foreach (var terminal; me.terminals) {
95 107
                     var se = flightdeck[terminal].display.screenElements;
96
-                    var annunciator = props.globals.getNode('/autopilot/annunciator');
97
-                    var ap_enabled  = annunciator.getValue('autopilot-enabled');
98
-
99
-                    var latmod         = annunciator.getValue('lateral-mode');
100
-                    var latmod_armed   = annunciator.getValue('lateral-mode-armed');
101
-                    var vertmod        = annunciator.getValue('vertical-mode');
102
-                    var vertmod_armed  = annunciator.getValue('vertical-mode-armed');
103
-                    var vertmod_target = annunciator.getValue('vertical-mode-target');
104
-                    if (vertmod_target != nil) {
105
-                        vertmod_target = string.replace(vertmod_target, '+', utf8.chstr(9650));
106
-                        vertmod_target = string.replace(vertmod_target, '-', utf8.chstr(9660));
107
-                    }
108 108
 
109 109
                     se['LATMOD-Active-text'].setVisible(latmod != nil and ap_enabled).setText(latmod);
110 110
                     se['LATMOD-Armed-text'].setVisible(latmod_armed != nil and ap_enabled).setText(latmod_armed);
... ...
@@ -207,26 +207,6 @@ var APClass = {
207 207
                 setprop('/it-stec55x/input/ap-master-sw', 1);
208 208
             },
209 209
             updateDisplay: func {
210
-                var se = flightdeck[me.terminal].display.screenElements;
211
-                se['AP-Status-text'].setVisible(stec55x.rollMode  != -1 or stec55x.pitchMode != -1);
212
-                se['YD-Status-text'].setVisible(stec55x.yaw.getValue() != -1);
213
-                if (stec55x.rollMode  != -1) {
214
-                    se['LATMOD-Active-text'].setVisible(1).setText('ROL');
215
-                    var armed = '';
216
-                    foreach (var m; [ 'NAV', 'CNAV', 'REV', 'CREV' ])
217
-                        if (stec55x[m]) armed = m;
218
-                    if (stec55x.roll.getValue() == 0) armed = 'HDG';
219
-                    elsif (stec55x.roll.getValue() == 2) armed = 'GPS';
220
-                    elsif (stec55x.APR_annun.getValue()) armed = 'APR';
221
-                    se['LATMOD-Armed-text']
222
-                        .setVisible(size(armed))
223
-                        .setText(armed);
224
-                }
225
-                else {
226
-                    se['LATMOD-Active-text'].setVisible(0);
227
-                    se['LATMOD-Armed-text'].setVisible(0);
228
-                }
229
-
230 210
                 if (stec55x.pitchMode != 1) {
231 211
                     var armed     = '';
232 212
                     var active    = '';
... ...
@@ -259,10 +239,33 @@ var APClass = {
259 239
 #                        active = 'ALT';
260 240
 #                        reference = sprintf("%d°", autopilot.systems.STEC55X.trim);
261 241
 #                    }
242
+                }
243
+
244
+                foreach (var terminal; me.terminals) {
245
+                    var se = flightdeck[me.terminal].display.screenElements;
262 246
                     se['VERMOD-Active-text'].setVisible(size(active)).setText(active);
263 247
                     se['VERMOD-Armed-text'].setVisible(size(armed)).setText(armed);
264 248
                     se['VERMOD-Reference-text'].setVisible(size(reference)).setText(reference);
249
+                    se['AP-Status-text'].setVisible(stec55x.rollMode  != -1 or stec55x.pitchMode != -1);
250
+                    se['YD-Status-text'].setVisible(stec55x.yaw.getValue() != -1);
251
+                    if (stec55x.rollMode  != -1) {
252
+                        se['LATMOD-Active-text'].setVisible(1).setText('ROL');
253
+                        var armed = '';
254
+                        foreach (var m; [ 'NAV', 'CNAV', 'REV', 'CREV' ])
255
+                            if (stec55x[m]) armed = m;
256
+                        if (stec55x.roll.getValue() == 0) armed = 'HDG';
257
+                        elsif (stec55x.roll.getValue() == 2) armed = 'GPS';
258
+                        elsif (stec55x.APR_annun.getValue()) armed = 'APR';
259
+                        se['LATMOD-Armed-text']
260
+                            .setVisible(size(armed))
261
+                            .setText(armed);
262
+                    }
263
+                    else {
264
+                        se['LATMOD-Active-text'].setVisible(0);
265
+                        se['LATMOD-Armed-text'].setVisible(0);
266
+                    }
265 267
                 }
268
+
266 269
             },
267 270
             L: [
268 271
                 func,