Showing 4 changed files with 209 additions and 13 deletions
+3
Nasal/core.nas
... ...
@@ -84,6 +84,9 @@ var setListeners = func {
84 84
                     device[0].display.updateSelectedALT();
85 85
                 }
86 86
             }, 0, 2);
87
+    setlistener('/gear/gear/wow',
88
+            func device[0].display.updateXPDR(),
89
+            0, 0);
87 90
 }
88 91
 
89 92
 var deviceClass = {
+37
Nasal/display.nas
... ...
@@ -150,6 +150,7 @@ var displayClass = {
150 150
                     'BRG2-pointer', 'BRG2-SRC-text', 'BRG2-DST-text', 'BRG2-WPID-text',
151 151
                     'WindData-OPTN1-HDG-text', 'WindData-OPTN1-SPD-text',
152 152
                     'WindData-OPTN2-crosswind-text', 'WindData-OPTN2-headwind-text',
153
+                    'XPDR-MODE-text', 'XPDR-DIGIT-3-text', 'XPDR-DIGIT-2-text', 'XPDR-DIGIT-1-text', 'XPDR-DIGIT-0-text',
153 154
                     'AltBigC', 'AltSmallC'
154 155
                 );
155 156
                 for (var place = 1; place <= 6; place +=1) {
... ...
@@ -177,6 +178,7 @@ var displayClass = {
177 178
                 me.updateOAT();
178 179
                 me.updateTAS();
179 180
                 me.updateBRG();
181
+                me.updateXPDR();
180 182
                 me.timerTrigger();
181 183
             }
182 184
             me._updateRadio({auto:'nav'});
... ...
@@ -784,6 +786,41 @@ var displayClass = {
784 786
     },
785 787
 #}}}
786 788
 
789
+    updateXPDR : func {
790
+# updates transponder display {{{
791
+        for (var d = 0; d < 4; d+=1)
792
+            me.screenElements['XPDR-DIGIT-' ~ d ~ '-text']
793
+                .setText(sprintf('%i', getprop('/instrumentation/transponder/inputs/digit[' ~ d ~ ']')));
794
+        var tuning = getprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit');
795
+        if (tuning != nil)
796
+            for (var d = 0; d < 4; d+=1) {
797
+                if (d != tuning)
798
+                    me.screenElements['XPDR-DIGIT-' ~ d ~ '-text']
799
+                        .setColor(1,1,1);
800
+                else
801
+                    me.screenElements['XPDR-DIGIT-' ~ d ~ '-text']
802
+                        .setColor(0,1,1);
803
+            }
804
+        else {
805
+            if (getprop('/instrumentation/transponder/ident'))
806
+                var mode = 'IDENT';
807
+            else
808
+                var mode = getprop('/instrumentation/zkv1000/radio/xpdr-mode');
809
+            var wow = getprop('/gear/gear/wow');
810
+            if (! wow and mode != 'STBY')
811
+                var color = [0, 1, 0];
812
+            else
813
+                var color = [1, 1, 1];
814
+            for (var d = 0; d < 4; d+=1)
815
+                me.screenElements['XPDR-DIGIT-' ~ d ~ '-text']
816
+                    .setColor(color);
817
+            me.screenElements['XPDR-MODE-text']
818
+                .setColor(color)
819
+                .setText(mode);
820
+        }
821
+},
822
+#}}}
823
+
787 824
     updateOAT : func {
788 825
 # update OAT display on normal and reversionnary modes (every 3s) {{{
789 826
         var tmp = getprop('/environment/temperature-deg' ~ me._oat_unit);
+114 -5
Nasal/softkeys.nas
... ...
@@ -112,16 +112,125 @@ var softkeysClass = {
112 112
                 },
113 113
             },
114 114
             XPDR: {
115
-                CODE: {
115
+                STBY : func {
116
+                    me.bindings.PFD.XPDR.inactivity.restart(45);
117
+                    setprop('/instrumentation/transponder/ident', 0);
118
+                    setprop('/instrumentation/transponder/knob-mode', 1);
119
+                    setprop('/instrumentation/zkv1000/radio/xpdr-mode', 'STBY');
120
+                    me.device.display.updateXPDR();
121
+                },
122
+                ON : func {
123
+                    me.bindings.PFD.XPDR.inactivity.restart(45);
124
+                    setprop('/instrumentation/transponder/ident', 1);
125
+                    setprop('/instrumentation/transponder/knob-mode', 4);
126
+                    setprop('/instrumentation/zkv1000/radio/xpdr-mode', 'ON');
127
+                    me.device.display.updateXPDR();
128
+                },
129
+                ALT : func {
130
+                    me.bindings.PFD.XPDR.inactivity.restart(45);
131
+                    setprop('/instrumentation/transponder/ident', 1);
132
+                    setprop('/instrumentation/transponder/knob-mode', 5);
133
+                    setprop('/instrumentation/zkv1000/radio/xpdr-mode', 'ALT');
134
+                    me.device.display.updateXPDR();
135
+                },
136
+                VFR : func {
137
+                    me.bindings.PFD.XPDR.inactivity.restart(45);
138
+                    setprop('/instrumentation/transponder/id-code', '1200');
139
+                    me.device.display.updateXPDR();
140
+                },
141
+                IDENT : func {
142
+                    me.bindings.PFD.XPDR.inactivity.restart(45);
143
+                    call(me.bindings.PFD.IDENT, [], me);
144
+                },
145
+                CODE : {
146
+                    '0' : func (n = 0) {
147
+                        me.bindings.PFD.XPDR.inactivity.restart(45);
148
+                        var tuning = radios.getNode('xpdr-tuning-digit');
149
+                        var d = tuning.getValue();
150
+                        setprop('/instrumentation/transponder/inputs/digit[' ~ d ~ ']', n);
151
+                        d += (d > 0) ? -1 : 3;
152
+                        tuning.setValue(d);
153
+                        me.device.display.updateXPDR();
154
+                    },
155
+                    '1' : func {
156
+                        call(me.bindings.PFD.XPDR.CODE['0'], [ 1 ], me);
157
+                    },
158
+                    '2' : func {
159
+                        call(me.bindings.PFD.XPDR.CODE['0'], [ 2 ], me);
160
+                    },
161
+                    '3' : func {
162
+                        call(me.bindings.PFD.XPDR.CODE['0'], [ 3 ], me);
163
+                    },
164
+                    '4' : func {
165
+                        call(me.bindings.PFD.XPDR.CODE['0'], [ 4 ], me);
166
+                    },
167
+                    '5' : func {
168
+                        call(me.bindings.PFD.XPDR.CODE['0'], [ 5 ], me);
169
+                    },
170
+                    '6' : func {
171
+                        call(me.bindings.PFD.XPDR.CODE['0'], [ 6 ], me);
172
+                    },
173
+                    '7' : func {
174
+                        call(me.bindings.PFD.XPDR.CODE['0'], [ 7 ], me);
175
+                    },
116 176
                     IDENT: func {
117
-                        me.path = [];
118
-                        me.device.display.updateSoftKeys();
177
+                        me.bindings.PFD.XPDR.inactivity.restart(45);
178
+                        call(me.bindings.PFD.IDENT, [], me);
179
+                    },
180
+                    BKSP: func {
181
+                        me.bindings.PFD.XPDR.inactivity.restart(45);
182
+                        var tuning = radios.getNode('xpdr-tuning-digit');
183
+                        var d = tuning.getValue();
184
+                        d += (d < 3) ? 1 : -3;
185
+                        tuning.setValue(d);
186
+                        me.device.display.updateXPDR();
119 187
                     },
120
-                    BACK: func {
121
-                        me.path = [];
188
+                    BACK : func (inactive = 0) {
189
+                        var code = sprintf('%i', getprop('/instrumentation/zkv1000/radios/xpdr-backup-code'));
190
+                        for (var i = 0; i < 4; i += 1)
191
+                            setprop('/instrumentation/transponder/inputs/digit[' ~ (3 - i) ~ ']',
192
+                                    substr(code, i, 1));
193
+                        pop(me.path);
194
+                        call(me.bindings.PFD.XPDR.CODE.exit, inactive ? [[]] : [me.path], me);
195
+                    },
196
+                    exit : func (p) {
197
+                        if (contains(me.bindings.PFD.XPDR, 'inactivity')) # does not exists if IDENT pressed from top-level
198
+                            me.bindings.PFD.XPDR.inactivity.stop();
199
+                        radios.removeChild('xpdr-tuning-digit', 0);
200
+                        radios.removeChild('xpdr-backup-code', 0);
201
+                        me.path = p;
202
+                        me.device.display.updateXPDR();
122 203
                         me.device.display.updateSoftKeys();
123 204
                     },
205
+                    hook : func {
206
+                        me.bindings.PFD.XPDR.inactivity.restart(45);
207
+                        var tuning = getprop('/instrument/zkv1000/radios/xpdr-tuning-digit');
208
+                        if (tuning == nil) {
209
+                            radios.getNode('xpdr-tuning-digit', 1).setValue(3);
210
+                            radios.getNode('xpdr-backup-code', 1).setValue(getprop('/instrumentation/transponder/id-code'));
211
+                            me.device.display.updateXPDR();
212
+                        }
213
+                    },
124 214
                 },
215
+                hook : func {
216
+                    me.bindings.PFD.XPDR.inactivity = maketimer(45,
217
+                        func call(me.bindings.PFD.XPDR.CODE.BACK, [1], me));
218
+                    me.bindings.PFD.XPDR.inactivity.singleShot = 1;
219
+                    me.bindings.PFD.XPDR.inactivity.start();
220
+                },
221
+            },
222
+            IDENT : func {
223
+                if (getprop('/instrumentation/zkv1000/radio/xpdr-mode') == 'STBY')
224
+                    return;
225
+                setprop('/instrumentation/transponder/ident', 1);
226
+                me.bindings.PFD.XPDR.ident = maketimer(18,
227
+                        func {
228
+                            setprop('/instrumentation/transponder/ident', 0);
229
+                            me.device.display.updateXPDR();
230
+                        });
231
+                me.bindings.PFD.XPDR.ident.singleShot = 1;
232
+                me.bindings.PFD.XPDR.ident.start();
233
+                call(me.bindings.PFD.XPDR.CODE.exit, [[]], me);
125 234
             },
126 235
         },
127 236
         MFD : {
+55 -8
Systems/screen.svg
... ...
@@ -6796,7 +6796,6 @@
6796 6796
        inkscape:label="nav-freq-switch" />
6797 6797
   </g>
6798 6798
   <g
6799
-     transform="translate(-1e-6)"
6800 6799
      style="display:inline"
6801 6800
      id="XPDR-TIME"
6802 6801
      inkscape:label="XPDR-TIME">
... ...
@@ -6825,16 +6824,16 @@
6825 6824
          id="tspan6081-5"
6826 6825
          sodipodi:role="line">XPDR</tspan></text>
6827 6826
     <text
6828
-       inkscape:label="XPDR-text"
6829
-       id="XPDR-text"
6830
-       y="737.37213"
6831
-       x="772.21875"
6827
+       inkscape:label="XPDR-MODE-text"
6828
+       id="XPDR-MODE-text"
6829
+       y="737.75244"
6830
+       x="830.02325"
6832 6831
        style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:21.33333397px;line-height:125%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans Bold';letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
6833 6832
        xml:space="preserve"><tspan
6834
-         y="737.37213"
6835
-         x="772.21875"
6833
+         y="737.75244"
6834
+         x="830.02325"
6836 6835
          id="tspan6085-3"
6837
-         sodipodi:role="line">1200 STBY</tspan></text>
6836
+         sodipodi:role="line">STBY</tspan></text>
6838 6837
     <text
6839 6838
        inkscape:label="TIME-text"
6840 6839
        id="TIME-text"
... ...
@@ -6856,6 +6855,54 @@
6856 6855
          x="896.71527"
6857 6856
          id="tspan6093"
6858 6857
          sodipodi:role="line">LCL</tspan></text>
6858
+    <text
6859
+       xml:space="preserve"
6860
+       style="font-style:normal;font-weight:normal;font-size:21.33333397px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
6861
+       x="772.37451"
6862
+       y="737.76672"
6863
+       id="XPDR-DIGIT-3-text"
6864
+       inkscape:label="XPDR-DIGIT-3-text"><tspan
6865
+         sodipodi:role="line"
6866
+         id="tspan5853"
6867
+         x="772.37451"
6868
+         y="737.76672"
6869
+         style="fill:#ffffff">1</tspan></text>
6870
+    <text
6871
+       xml:space="preserve"
6872
+       style="font-style:normal;font-weight:normal;font-size:21.33333397px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
6873
+       x="785.93634"
6874
+       y="737.74677"
6875
+       id="XPDR-DIGIT-2-text"
6876
+       inkscape:label="XPDR-DIGIT-2-text"><tspan
6877
+         sodipodi:role="line"
6878
+         id="tspan5853-6"
6879
+         x="785.93634"
6880
+         y="737.74677"
6881
+         style="fill:#ffffff">2</tspan></text>
6882
+    <text
6883
+       xml:space="preserve"
6884
+       style="font-style:normal;font-weight:normal;font-size:21.33333397px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
6885
+       x="799.62689"
6886
+       y="737.93695"
6887
+       id="XPDR-DIGIT-1-text"
6888
+       inkscape:label="XPDR-DIGIT-1-text"><tspan
6889
+         sodipodi:role="line"
6890
+         id="tspan5853-6-5"
6891
+         x="799.62689"
6892
+         y="737.93695"
6893
+         style="fill:#ffffff">0</tspan></text>
6894
+    <text
6895
+       xml:space="preserve"
6896
+       style="font-style:normal;font-weight:normal;font-size:21.33333397px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
6897
+       x="813.50757"
6898
+       y="737.74677"
6899
+       id="XPDR-DIGIT-0-text"
6900
+       inkscape:label="XPDR-DIGIT-0-text"><tspan
6901
+         sodipodi:role="line"
6902
+         id="tspan5853-6-56"
6903
+         x="813.50757"
6904
+         y="737.74677"
6905
+         style="fill:#ffffff">0</tspan></text>
6859 6906
   </g>
6860 6907
   <g
6861 6908
      transform="translate(-2.8722382e-6,1.8800354e-6)"