Showing 2 changed files with 21 additions and 17 deletions
+19 -15
Nasal/display.nas
... ...
@@ -806,14 +806,15 @@ var displayClass = {
806 806
         }
807 807
         else {
808 808
             var course = getprop('/instrumentation/zkv1000/cdi/course');
809
+            var rot = (course - me._updated_hdg) * D2R;
809 810
             me.screenElements['CDI']
811
+                .setRotation(rot)
810 812
                 .show();
811 813
             me.screenElements['GPS-CTI']
812 814
                 .setVisible(source == 'GPS');
813 815
             me.screenElements['GPS-CTI-diamond']
814 816
                 .setVisible(source == 'GPS');
815 817
             foreach (var s; ['GPS', 'NAV1', 'NAV2']) {
816
-                var rot = (course - me._updated_hdg) * D2R;
817 818
                 me.screenElements[s ~ '-pointer']
818 819
                     .setRotation(rot)
819 820
                     .setVisible(source == s);
... ...
@@ -821,25 +822,28 @@ var displayClass = {
821 822
                     .setVisible(source == s);
822 823
                 foreach (var f; ['FROM', 'TO'])
823 824
                     me.screenElements[s ~ '-' ~ f]
824
-                        .setVisible(s == source and getprop('/instrumentation/zkv1000/cdi/', f, '-flag'));
825
+                        .setVisible(s == source and getprop('/instrumentation/zkv1000/cdi/' ~ f ~ '-flag'));
825 826
                 me.screenElements['CDI-SRC-text']
826 827
                     .setText(source)
827 828
                     .setColor(source == 'GPS' ? me.colors.magenta : me.colors.green)
828 829
                     .show();
829
-                var deflection = getprop('/instrumentation/zkv1000/cdi/course-deflection');
830
-                if (left(source, 3) == 'NAV') {
831
-                    var scale = deflection / 4;
832
-                    scale = (abs(scale) > 1.2) ? 1.2 : scale;
833
-                }
834
-                else {
835
-                    me.screenElements['CDI-SRC-text']
836
-                        .setText('GPS')
837
-                        .setColor(1,0,1);
838
-                }
839
-                me.screenElements[source ~ '-CDI']
840
-                    .setTranslation(65 * scale, 0);
841 830
             }
842
-            settimer(func me.updateCDI(), 0.5);
831
+            var deflection = getprop('/instrumentation/zkv1000/cdi/course-deflection');
832
+            if (left(source, 3) == 'NAV')
833
+                var scale = deflection / 4;
834
+            else { # GPS
835
+                # TODO: deviation depending of the flight phase
836
+                # for now fixed 1 dot = 1 nm course error
837
+                var abs_deflection = abs(deflection);
838
+                me.screenElements['CDI-GPS-XTK-text']
839
+                    .setText(sprintf('XTK %iNM', abs_deflection))
840
+                    .setVisible(abs_deflection > 2.4);
841
+                var scale = deflection / 2;
842
+            }
843
+            scale = (abs(scale) > 1.2) ? 1.2 : scale;
844
+            me.screenElements[source ~ '-CDI']
845
+                .setTranslation(65 * scale, 0);
846
+            settimer(func me.updateCDI(), 0.3);
843 847
         }
844 848
     },
845 849
 #}}}
+2 -2
README.md
... ...
@@ -67,10 +67,10 @@ Please report bug at <seb.marque@free.fr>.
67 67
     * not yet implemented function are logged in console
68 68
     * softkeys colorized when active
69 69
     * alerts with white backgroud and black text available
70
+  * CDI
70 71
 * ![][90%]
71 72
   * Radio stack, including ID for NAV (bug: NAV1 ID isn't displayed ![][paused])
72 73
   * Bearing needs some checks to be sure it shows the correct information
73
-  * CDI ![][ongoing], lacks information about the scale
74 74
   * XPDR: emergency code depending of the country (eg.: 1200 for US, 7700 for Europe), should be set in settings
75 75
 * ![][80%]
76 76
   * EIS: texts displayed ![][done], animations for fuel ![][ongoing]
... ...
@@ -86,7 +86,7 @@ Please report bug at <seb.marque@free.fr>.
86 86
 * ![][10%]
87 87
   * multikey for every part of the device (actually only power on)
88 88
 * ![][0%] (TODO list, unsorted)
89
-  * rotating online map on inflight page
89
+  * CDI/GPS: scale depending of the flight phase
90 90
   * some aircraft specific data to retrieve from aircraft XML files (VNE, etc)
91 91
   * display of specific speeds in ruler
92 92
   * angle of attack display