Showing 1 changed files with 12 additions and 3 deletions
+12 -3
Nasal/display.nas
... ...
@@ -289,12 +289,21 @@ var displayClass = {
289 289
             TAS: [func return sprintf('%i', getprop('/instrumentation/airspeed-indicator/true-speed-kt')), 'True Air Speed'],
290 290
             FOB: [func return sprintf('%3ilbs', getprop('/consumables/fuel/total-fuel-lbs')), 'Fuel on Board'],
291 291
             XTK: [func {
292
+                var xtk = nil;
292 293
                 var source = cdi.getValue('source');
293 294
                 if (source == 'NAV1')
294
-                    var xtk = sprintf('/instrumentation/nav[0]/crosstrack-error-m');
295
+                    var xtk = abs(getprop('/instrumentation/nav[0]/crosstrack-error-m')) * M2NM;
296
+                elsif (source == 'NAV2')
297
+                    var xtk = abs(getprop('/instrumentation/nav[1]/crosstrack-error-m')) * M2NM;
295 298
                 elsif (source == 'GPS')
296
-                    var xtk = sprintf('/instrumentation/gps/wp/wp[1]/course-error-nm');
297
-                return ' ---NM'
299
+                    var xtk = abs(getprop('/instrumentation/gps/wp/wp[1]/course-error-nm'));
300
+
301
+                if (xtk == nil)
302
+                    return ' ---NM';
303
+                elsif (xtk > 99.9)
304
+                    return ' ++.+NM';
305
+                else
306
+                    return sprintf('%2.1fNM', xtk);
298 307
             }, 'Crosstrack Error'],
299 308
             MSA: [func {
300 309
                 data._msa_spd        = getprop('/velocities/groundspeed-kt');