zkv1000 / Nasal / softkeys.nas /
Newer Older
1279 lines | 66.933kb
massive code reorganisation ...
Sébastien MARQUE authored on 2017-05-01
1
# vim: set foldmethod=marker foldmarker={{{,}}} :
commit initial
Sébastien MARQUE authored on 2017-03-07
2
var softkeysClass = {
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
3
    new : func (device) {
commit initial
Sébastien MARQUE authored on 2017-03-07
4
        var m = { parents: [ softkeysClass ] };
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
5
        m.device = device;
6
        m.path = [];
improves softkeys coloring
Sébastien MARQUE authored on 2017-04-15
7
        m.colored = {};
commit initial
Sébastien MARQUE authored on 2017-03-07
8
        return m;
9
    },
10

            
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
11
    SoftKey : func (n, a) {
12
        # released key not yet managed
13
        if (a == 1)
14
            return;
15

            
16
        var key = me.device.display.screenElements[sprintf("SoftKey%02i-text",n)].get('text');
17
        if (key == '' or key == nil)
18
            return;
19

            
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
20
        var path = keyMap[me.device.role];
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
21
        foreach(var p; me.path) {
22
            if (contains(path, p))
23
                path = path[p];
24
            else
25
                break;
commit initial
Sébastien MARQUE authored on 2017-03-07
26
        }
27

            
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
28
        var bindings = me.bindings[me.device.role];
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
29
        foreach(var p; me.path) {
30
            if (contains(bindings, p))
31
                bindings = bindings[p];
32
            else
33
                break;
commit initial
Sébastien MARQUE authored on 2017-03-07
34
        }
35

            
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
36
        if (contains(path, key)) {
37
            append(me.path, key);
fix issue with some menus
Sébastien MARQUE authored on 2017-03-20
38
            if (contains(bindings, key))
39
                if (contains(bindings[key], 'hook'))
40
                    call(bindings[key].hook, [], me);
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
41
            me.device.display.updateSoftKeys();
commit initial
Sébastien MARQUE authored on 2017-03-07
42
        }
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
43
        elsif (contains(bindings, key)) {
44
            call(bindings[key], [], me);
commit initial
Sébastien MARQUE authored on 2017-03-07
45
        }
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
46
        elsif (key == 'BACK') {
47
            pop(me.path);
48
            me.device.display.updateSoftKeys();
commit initial
Sébastien MARQUE authored on 2017-03-07
49
        }
show the complete path menu ...
Sébastien MARQUE authored on 2017-03-20
50
        else {
51
            var list_path = '';
52
            foreach(var p; me.path) list_path ~= p ~ '/';
53
            print(me.device.role ~ ':' ~ list_path ~ key ~ ' : not yet implemented');
54
        }
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
55
    },
56

            
57
    bindings : {
58
        PFD : {
59
            INSET: {
60
                OFF: func {
separates maps code
Sébastien MARQUE authored on 2017-05-11
61
                    me.device.map.setVisible(0);
PFD INSET map available
Sébastien MARQUE authored on 2017-04-19
62
                    me.device.display.screenElements['PFD-Map-bg'].hide();
63
                },
improve the selection of dis...
Sébastien MARQUE authored on 2017-12-30
64
                ROUTE: func {
65
                    call(me.bindings.PFD.INSET.declutter, ['INSETROUTE', 'route', 3], me);
66
                },
67
                TERRAIN: func {
68
                    call(me.bindings.PFD.INSET.declutter, ['INSETTERRAIN', 'tiles', 5], me);
69
                },
70
                NAVAIDS: {
71
                    ALL: func (root_id = 'INSETNAVAIDS') {
72
                        if (contains(me.colored, root_id ~ 'ALL'))
73
                            foreach (var n; [ 'ALL', 'VOR', 'DME', 'NDB', 'TACAN', 'APT' ])
74
                                delete(me.colored, root_id ~ n);
75
                        else
76
                            foreach (var n; [ 'ALL', 'VOR', 'DME', 'NDB', 'TACAN', 'APT' ])
77
                                me.colored[root_id ~ n] = 1;
78
                        me.device.display.updateSoftKeys();
79
                        foreach (var n; [ 'VOR', 'TACAN', 'NDB', 'DME' ])
80
                            me.device.map.layers.navaids._can[n]
81
                                .setVisible(contains(me.colored, root_id ~ n));
82
                        me.device.map.layers.navaids._can.airport
83
                            .setVisible(contains(me.colored, root_id ~ 'APT'));
84
                    },
85
                    VOR: func {
86
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['INSETNAVAIDSVOR', 'VOR', 2], me);
87
                    },
88
                    TACAN: func {
89
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['INSETNAVAIDSTACAN', 'TACAN', 3], me);
90
                    },
91
                    NDB: func {
92
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['INSETNAVAIDSNDB', 'NDB', 4], me);
93
                    },
94
                    DME: func {
95
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['INSETNAVAIDSDME', 'DME', 5], me);
96
                    },
97
                    APT: func {
98
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['INSETNAVAIDSAPT', 'airport', 6], me);
99
                    },
100
                    declutter: func (id, type) {
101
                        if (contains(me.colored, id)) {
102
                            delete(me.colored, id);
103
                            if (me.device.role == 'PFD')
104
                                delete(me.colored, 'INSETNAVAIDSALL');
105
                            if (me.device.role == 'MFD')
106
                                delete(me.colored, 'MAPNAVAIDSALL');
107
                        }
108
                        else
109
                            me.colored[id] = 1;
110
                        me.device.display.updateSoftKeys();
111
                        me.device.map.layers.navaids._can[type]
112
                            .setVisible(contains(me.colored, id));
113
                    },
114
                },
115
                declutter: func (id, layer) {
116
                    if (contains(me.colored, id))
117
                        delete(me.colored, id);
add TCAS
Sébastien MARQUE authored on 2017-12-21
118
                    else
improve the selection of dis...
Sébastien MARQUE authored on 2017-12-30
119
                        me.colored[id] = 1;
add TCAS
Sébastien MARQUE authored on 2017-12-21
120
                    me.device.display.updateSoftKeys();
improve the selection of dis...
Sébastien MARQUE authored on 2017-12-30
121
                    me.device.map.layers[layer]
122
                        .setVisible(contains(me.colored, id));
add TCAS
Sébastien MARQUE authored on 2017-12-21
123
                },
PFD INSET map available
Sébastien MARQUE authored on 2017-04-19
124
                hook : func {
125
                    me.device.display.screenElements['PFD-Map-bg'].show();
separates maps code
Sébastien MARQUE authored on 2017-05-11
126
                    me.device.map.setVisible(1);
127
                    me.device.map.update();
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
128
                },
129
            },
130
            PFD: {
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
131
                'AOA/WIND' : {
adds AOA display
Sébastien MARQUE authored on 2017-04-15
132
                    AOA : {
133
                        'AOA ON' : func {
134
                            if (me.device.data['aoa-auto'])
135
                                return;
136
                            me.device.data.aoa = ! me.device.data.aoa;
nicer AOA display
Sébastien MARQUE authored on 2017-04-16
137
                            foreach (var e; ['AOA', 'AOA-needle', 'AOA-text'])
138
                                me.device.display.screenElements[e]
139
                                    .setVisible(me.device.data.aoa);
140
                            me.device.display.screenElements['AOA-approach']
141
                                .setVisible(me.device.data.aoa and contains(data, 'approach-aoa'));
adds AOA display
Sébastien MARQUE authored on 2017-04-15
142
                            me.device.display.updateAOA();
143
                            me.device.display.setSoftKeyColor(5 ,me.device.data.aoa);
144
                            if (me.device.data.aoa)
145
                                me.colored['PFDAOA/WINDAOAAOA ON'] = 1;
146
                            else
147
                                delete(me.colored, 'PFDAOA/WINDAOAAOA ON');
148
                        },
149
                        'AOA AUTO' : func {
150
                            if (me.device.data.aoa)
151
                                return;
152
                            me.device.data['aoa-auto'] = ! me.device.data['aoa-auto'];
153
                            me.device.display.setSoftKeyColor(6 ,me.device.data['aoa-auto']);
154
                            if (me.device.data['aoa-auto']) {
155
                                me.colored['PFDAOA/WINDAOAAOA AUTO'] = 1;
156
                                if (!contains(me.device.timers, 'aoa'))
157
                                    me.device.timers.aoa = maketimer(1,
158
                                            func {
159
                                                var v = getprop('/gear/gear/position-norm') == 1
160
                                                    and getprop('/surfaces-positions/flap-pos-norm') != 0;
nicer AOA display
Sébastien MARQUE authored on 2017-04-16
161
                                                foreach (var e; ['AOA', 'AOA-needle', 'AOA-text'])
162
                                                    me.device.display.screenElements[e]
163
                                                        .setVisible(v);
164
                                                me.device.display.screenElements['AOA-approach']
165
                                                    .setVisible(v and contains(data, 'approach-aoa'));
fix AOA not shown
Sébastien MARQUE authored on 2020-05-30
166
                                                me.device.display.updateAOA();
adds AOA display
Sébastien MARQUE authored on 2017-04-15
167
                                            }, me);
168
                                me.device.timers.aoa.start();
169
                            }
170
                            else {
171
                                delete(me.colored, 'PFDAOA/WINDAOAAOA AUTO');
172
                                me.device.timers.aoa.stop();
173
                                me.device.data.aoa = 0;
174
                                me.device.display.screenElements['AOA']
175
                                    .hide();
176
                            }
177
                        },
nicer AOA display
Sébastien MARQUE authored on 2017-04-16
178
                        hook : func {
179
                            if (contains(data,'approach-aoa'))
180
                                me.device.display.screenElements['AOA-approach']
181
                                    .setRotation(-data['approach-aoa']/data['stall-aoa']*math.pi);
182
                        },
adds AOA display
Sébastien MARQUE authored on 2017-04-15
183
                    },
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
184
                    WIND : {
185
                        OPTN1 : func {
186
                            me.device.display._winddata_optn = 1;
187
                            me.device.display.screenElements['WindData'].show();
188
                            me.device.display.screenElements['WindData-OPTN1'].show();
189
                            me.device.display.screenElements['WindData-OPTN1-HDG'].show();
190
                            me.device.display.screenElements['WindData-OPTN2'].hide();
191
                            me.device.display.updateWindData();
uses the new coloration for ...
Sébastien MARQUE authored on 2017-04-15
192
                            me.device.display.setSoftKeyColor(2, 1);
193
                            me.colored['PFDAOA/WINDWINDOPTN1'] = 1;
194
                            me.device.display.setSoftKeyColor(3, 0);
195
                            delete(me.colored, 'PFDAOA/WINDWINDOPTN2');
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
196
                        },
197
                        OPTN2 : func {
198
                            me.device.display._winddata_optn = 2;
199
                            me.device.display.screenElements['WindData'].show();
200
                            me.device.display.screenElements['WindData-OPTN1'].hide();
201
                            me.device.display.screenElements['WindData-OPTN2'].show();
202
                            me.device.display.screenElements['WindData-OPTN2-symbol'].show();
203
                            me.device.display.screenElements['WindData-OPTN2-headwind'].show();
204
                            me.device.display.screenElements['WindData-OPTN2-crosswind'].show();
205
                            me.device.display.updateWindData();
uses the new coloration for ...
Sébastien MARQUE authored on 2017-04-15
206
                            me.device.display.setSoftKeyColor(2, 0);
207
                            delete(me.colored, 'PFDAOA/WINDWINDOPTN1');
208
                            me.device.display.setSoftKeyColor(3, 1);
209
                            me.colored['PFDAOA/WINDWINDOPTN2'] = 1;
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
210
                        },
211
                        OFF : func {
212
                            me.device.display._winddata_optn = 0;
213
                            me.device.display.screenElements['WindData'].hide();
214
                            me.device.display.screenElements['WindData-OPTN1'].hide();
215
                            me.device.display.screenElements['WindData-OPTN2'].hide();
uses the new coloration for ...
Sébastien MARQUE authored on 2017-04-15
216
                            me.device.display.setSoftKeyColor(2, 0);
217
                            delete(me.colored, 'PFDAOA/WINDWINDOPTN1');
218
                            me.device.display.setSoftKeyColor(3, 0);
219
                            delete(me.colored, 'PFDAOA/WINDWINDOPTN2');
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
220
                        },
221
                    },
222
                },
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
223
                BRG1 : func (brg = 1){
224
                    var source = 'brg' ~ brg ~ '-source';
225
                    var list = ['NAV' ~ brg, 'GPS', 'ADF', 'OFF'];
226
                    var index = std.Vector
227
                                   .new(list)
228
                                   .index(radios.getNode(source).getValue());
229
                    var next = (index == size(list) -1) ?  0 : index + 1;
230
                    radios.getNode(source).setValue(list[next]);
uses the new coloration for ...
Sébastien MARQUE authored on 2017-04-15
231
                    if (list[next] != 'OFF') {
232
                        me.device.display.setSoftKeyColor(brg == 1 ? 4 : 6, 1);
233
                        me.colored['PFDBRG' ~ brg] = 1;
234
                    }
235
                    else {
236
                        me.device.display.setSoftKeyColor(brg == 1 ? 4 : 6, 0);
237
                        delete(me.colored, 'PFDBRG' ~ brg);
238
                    }
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
239
                },
240
                BRG2 : func {
241
                    call(me.bindings.PFD.PFD.BRG1, [ 2 ], me);
242
                },
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
243
                'STD BARO' : func {
244
                    setprop('/instrumentation/altimeter/setting-inhg', 29.92);
245
                    me.device.display.updateBARO();
246
                    pop(me.path);
247
                    me.device.display.updateSoftKeys();
248
                },
correct softkey entries for ...
Sébastien MARQUE authored on 2020-06-12
249
                'ALT UNIT' : {
250
                    IN :  func {
251
                        data.settings.units.pressure = 'inhg';
252
                        me.device.display.updateBARO();
253
                    },
254
                    HPA : func {
255
                        data.settings.units.pressure = 'hpa';
256
                        me.device.display.updateBARO();
257
                    },
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
258
                },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
259
            },
260
            XPDR: {
adds transponder
Sébastien MARQUE authored on 2017-03-17
261
                STBY : func {
262
                    setprop('/instrumentation/transponder/ident', 0);
263
                    setprop('/instrumentation/transponder/knob-mode', 1);
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
264
                    radios.setValue('xpdr-mode', 'STBY');
adds transponder
Sébastien MARQUE authored on 2017-03-17
265
                    me.device.display.updateXPDR();
266
                },
267
                ON : func {
268
                    setprop('/instrumentation/transponder/ident', 1);
269
                    setprop('/instrumentation/transponder/knob-mode', 4);
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
270
                    radios.setValue('xpdr-mode', 'ON');
adds transponder
Sébastien MARQUE authored on 2017-03-17
271
                    me.device.display.updateXPDR();
272
                },
273
                ALT : func {
274
                    setprop('/instrumentation/transponder/ident', 1);
275
                    setprop('/instrumentation/transponder/knob-mode', 5);
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
276
                    radios.setValue('xpdr-mode', 'ALT');
adds transponder
Sébastien MARQUE authored on 2017-03-17
277
                    me.device.display.updateXPDR();
278
                },
279
                VFR : func {
280
                    setprop('/instrumentation/transponder/id-code', '1200');
281
                    me.device.display.updateXPDR();
282
                },
283
                IDENT : func {
284
                    call(me.bindings.PFD.IDENT, [], me);
285
                },
286
                CODE : {
287
                    '0' : func (n = 0) {
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
288
                        if (radios.getValue('xpdr-tuning-fms-method'))
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
289
                            return;
old timers2 removed
Sébastien MARQUE authored on 2020-05-15
290
                        me.device.display.timers.softkeys_inactivity.stop();
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
291
                        me.bindings.PFD.XPDR.CODE.inactivity.restart(me.device.display.softkeys_inactivity_delay);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
292
                        # disable FMS knob entering method
293
                        me.device.knobs.FmsInner = void;
294
                        # When entering the code, the next softkey in sequence
295
                        # must be pressed within 10 seconds, or the entry is cancelled
296
                        # and restored to the previous code
297
                        if (!contains(me.bindings.PFD.XPDR.CODE, 'on_change_inactivity')) {
298
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity = maketimer(10,
299
                                func {
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
300
                                    radios.setValue('xpdr-tuning-digit', 3);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
301
                                    me.device.knobs.FmsInner = me.device.knobs.XPDRCodeSetDigits;
302
                                    me.device.knobs.FmsOuter = me.device.knobs.XPDRCodeNextDigits;
303
                                    call(me.bindings.PFD.XPDR.CODE.restore, [], me);
304
                                });
305
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.singleShot = 1;
306
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.start();
307
                        }
308
                        else
309
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10);
adds transponder
Sébastien MARQUE authored on 2017-03-17
310
                        var tuning = radios.getNode('xpdr-tuning-digit');
311
                        var d = tuning.getValue();
312
                        setprop('/instrumentation/transponder/inputs/digit[' ~ d ~ ']', n);
fix not able to set 4th digi...
Sébastien MARQUE authored on 2020-04-30
313
                        if (d == 0) {
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
314
                            if (!contains(me.bindings.PFD.XPDR.CODE, 'on_change_auto_validation'))
315
                                me.bindings.PFD.XPDR.CODE.on_change_auto_validation = maketimer(5,
316
                                    func call(me.bindings.PFD.IDENT, [], me));
317
                            me.bindings.PFD.XPDR.CODE.on_change_auto_validation.singleShot = 1;
318
                            me.bindings.PFD.XPDR.CODE.on_change_auto_validation.start();
319
                        }
320
                        else {
321
                            d -= 1;
322
                            tuning.setValue(d);
323
                        }
adds transponder
Sébastien MARQUE authored on 2017-03-17
324
                        me.device.display.updateXPDR();
325
                    },
326
                    '1' : func {
327
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 1 ], me);
328
                    },
329
                    '2' : func {
330
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 2 ], me);
331
                    },
332
                    '3' : func {
333
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 3 ], me);
334
                    },
335
                    '4' : func {
336
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 4 ], me);
337
                    },
338
                    '5' : func {
339
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 5 ], me);
340
                    },
341
                    '6' : func {
342
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 6 ], me);
343
                    },
344
                    '7' : func {
345
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 7 ], me);
346
                    },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
347
                    IDENT: func {
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
348
                        me.bindings.PFD.XPDR.CODE.inactivity.restart(me.device.display.softkeys_inactivity_delay);
old timers2 removed
Sébastien MARQUE authored on 2020-05-15
349
                        me.device.display.timers.softkeys_inactivity.restart(me.device.display.softkeys_inactivity_delay);
adds transponder
Sébastien MARQUE authored on 2017-03-17
350
                        call(me.bindings.PFD.IDENT, [], me);
351
                    },
352
                    BKSP: func {
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
353
                        if (radios.getValue('xpdr-tuning-fms-method'))
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
354
                            return;
355
                        if (contains(me.bindings.PFD.XPDR.CODE, 'on_change_inactivity'))
356
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10);
357
                        if (contains(me.bindings.PFD.XPDR.CODE, 'on_change_auto_validation'))
358
                                me.bindings.PFD.XPDR.CODE.on_change_auto_validation.stop();
adds transponder
Sébastien MARQUE authored on 2017-03-17
359
                        var tuning = radios.getNode('xpdr-tuning-digit');
360
                        var d = tuning.getValue();
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
361
                        if (d < 3) {
362
                            d += 1;
363
                            tuning.setValue(d);
364
                        }
adds transponder
Sébastien MARQUE authored on 2017-03-17
365
                        me.device.display.updateXPDR();
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
366
                    },
adds transponder
Sébastien MARQUE authored on 2017-03-17
367
                    BACK : func (inactive = 0) {
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
368
                        call(me.bindings.PFD.XPDR.CODE.restore, [], me);
adds transponder
Sébastien MARQUE authored on 2017-03-17
369
                        pop(me.path);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
370
                        call(me.bindings.PFD.XPDR.CODE.exit, [me.path], me);
371
                    },
372
                    restore : func {
373
                        setprop('/instrumentation/transponder/id-code',
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
374
                            sprintf('%s', radios.getValue('xpdr-backup-code')));
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
375
                        me.device.display.updateXPDR();
adds transponder
Sébastien MARQUE authored on 2017-03-17
376
                    },
377
                    exit : func (p) {
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
378
                        if (contains(me.bindings.PFD.XPDR.CODE, 'inactivity')) # does not exists if IDENT pressed from top-level
379
                            me.bindings.PFD.XPDR.CODE.inactivity.stop();
adds transponder
Sébastien MARQUE authored on 2017-03-17
380
                        radios.removeChild('xpdr-tuning-digit', 0);
381
                        radios.removeChild('xpdr-backup-code', 0);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
382
                        radios.removeChild('xpdr-tuning-fms-method', 0);
adds transponder
Sébastien MARQUE authored on 2017-03-17
383
                        me.path = p;
384
                        me.device.display.updateXPDR();
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
385
                        me.device.display.updateSoftKeys();
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
386
                        me.device.knobs.FmsInner = void;
387
                        me.device.knobs.FmsOuter = void;
old timers2 removed
Sébastien MARQUE authored on 2020-05-15
388
                        me.device.display.timers.softkeys_inactivity.restart(me.device.display.softkeys_inactivity_delay);
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
389
                    },
adds transponder
Sébastien MARQUE authored on 2017-03-17
390
                    hook : func {
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
391
                        # this level has its own timer as we may need to revert changes, and got different timers
old timers2 removed
Sébastien MARQUE authored on 2020-05-15
392
                        me.device.display.timers.softkeys_inactivity.stop();
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
393
                        me.bindings.PFD.XPDR.CODE.inactivity = maketimer(
394
                            me.device.display.softkeys_inactivity_delay,
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
395
                            func call(me.bindings.PFD.XPDR.CODE.BACK, [], me));
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
396
                        me.bindings.PFD.XPDR.CODE.inactivity.singleShot = 1;
397
                        me.bindings.PFD.XPDR.CODE.inactivity.start();
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
398
                        var tuning = radios.getValue('xpdr-tuning-digit');
adds transponder
Sébastien MARQUE authored on 2017-03-17
399
                        if (tuning == nil) {
400
                            radios.getNode('xpdr-tuning-digit', 1).setValue(3);
401
                            radios.getNode('xpdr-backup-code', 1).setValue(getprop('/instrumentation/transponder/id-code'));
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
402
                            radios.getNode('xpdr-tuning-fms-method', 1).setValue(0);
adds transponder
Sébastien MARQUE authored on 2017-03-17
403
                            me.device.display.updateXPDR();
404
                        }
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
405
                        me.device.knobs.FmsInner = me.device.knobs.XPDRCodeSetDigits;
406
                        me.device.knobs.FmsOuter = me.device.knobs.XPDRCodeNextDigits;
adds transponder
Sébastien MARQUE authored on 2017-03-17
407
                    },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
408
                },
adds transponder
Sébastien MARQUE authored on 2017-03-17
409
            },
410
            IDENT : func {
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
411
                if (radios.getValue('xpdr-mode') == 'STBY')
adds transponder
Sébastien MARQUE authored on 2017-03-17
412
                    return;
413
                setprop('/instrumentation/transponder/ident', 1);
414
                me.bindings.PFD.XPDR.ident = maketimer(18,
415
                        func {
416
                            setprop('/instrumentation/transponder/ident', 0);
417
                            me.device.display.updateXPDR();
418
                        });
419
                me.bindings.PFD.XPDR.ident.singleShot = 1;
420
                me.bindings.PFD.XPDR.ident.start();
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
421
                call(me.bindings.PFD.XPDR.CODE.exit, [], me);
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
422
            },
adds GPS OBS mode
Sébastien MARQUE authored on 2020-05-30
423
            OBS : func {
424
                if (cdi.getValue('source') != 'GPS')
425
                    return;
426
                var cmd  = props.globals.getNode('/instrumentation/gps/command');
427
                var mode = getprop('/instrumentation/gps/mode');
428
                if (mode == 'dto') mode = 'direct';
429
                if (mode != 'obs') {
430
                    data._previous_gps_mode = mode;
431
                    cmd.setValue('obs');
432
                    aliases.GPS.course = 'selected-course-deg';
433
                    setprop('/instrumentation/gps/selected-course-deg', int(getprop('/instrumentation/gps/desired-course-deg')));
434
                    me.colored['OBS'] = 1;
435
                }
436
                else {
437
                    cmd.setValue(data._previous_gps_mode);
438
                    delete(data, '_previous_gps_mode');
439
                    aliases.GPS.course = 'desired-course-deg';
440
                    me.colored['OBS'] = 0;
441
                }
442
                me.device.display.setSoftKeyColor(4, me.colored['OBS'], 1);
443
            },
adds CDI
Sébastien MARQUE authored on 2017-03-18
444
            CDI : func {
445
                var list = ['OFF'];
446
                if (getprop('/instrumentation/gps/route-distance-nm') != nil)
447
                    append(list, 'GPS');
448
                if (getprop('/instrumentation/nav/in-range') != nil)
449
                    append(list, 'NAV1');
450
                if (getprop('/instrumentation/nav[1]/in-range') != nil)
451
                    append(list, 'NAV2');
452
                var index = std.Vector
453
                               .new(list)
454
                               .index(cdi.getNode('source').getValue());
455
                var next = (index == size(list) -1) ?  0 : index + 1;
456
                cdi.getNode('source').setValue(list[next]);
457
                CDIfromSOURCE(list[next]);
458
                me.device.display.updateCDI();
459
            },
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
460
            'TMR/REF' : func {
461
                if (!contains(me.device.windows.state, 'TMR/REF')) {
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
462
                    var GenericTimer = func (id, selected) {
463
                        var action = me.device.windows.state[id].objects[selected].text;
464
                        if (action == 'START?') {
465
                            me.device.data.TMRrevert = 0;
466
                            me.device.data.TMRlast = getprop('/sim/time/elapsed-sec') - 1;
467
                            me.device.data.TMRreset = me.device.windows.state[id].objects[selected - 2].text;
468
                            me.device.data.TMRtimer = maketimer(1, func {
469
                                    var (hh, mm, ss) = split(':',
470
                                            me.device.windows.state[id].objects[selected - 2].text);
471
                                    var direction = -1;
472
                                    if ((me.device.windows.state[id].objects[selected - 1].text
473
                                            ==
474
                                        me.device.windows.state[id].objects[selected - 1].choices[0])
475
                                    or me.device.data.TMRrevert)
476
                                        direction = 1;
477
                                    var now = getprop('/sim/time/elapsed-sec');
478
                                    var dt = int(now - me.device.data.TMRlast) * direction;
479
                                    me.device.data.TMRlast = now;
480
                                    var val = HMS(hh, mm, ss, dt);
481
                                    me.device.windows.state[id].objects[selected - 2].text = val;
482
                                    me.device.windows.window[id ~ '-' ~ (selected -2)]
483
                                        .setText(val);
484
                                    if (val == '00:00:00' and direction == -1)
485
                                        me.device.data.TMRrevert = 1;
486
                                }, me);
487
                            me.device.data.TMRtimer.start();
488
                            action = 'STOP?';
489
                        }
490
                        elsif (action == 'STOP?') {
491
                            me.device.data.TMRtimer.stop();
492
                            action = 'RESET?';
493
                        }
494
                        elsif (action == 'RESET?') {
495
                            action = 'START?';
496
                            if ((me.device.windows.state[id].objects[selected - 1].text
497
                                        ==
498
                                me.device.windows.state[id].objects[selected - 1].choices[1])
499
                            and !me.device.data.TMRrevert)
500
                                var val = me.device.data.TMRreset;
501
                            else
502
                                var val = '00:00:00';
503
                            me.device.windows.state[id].objects[selected - 2].text = val;
504
                            me.device.windows.window[id ~ '-' ~ (selected -2)]
505
                                .setText(val);
506
                        }
507
                        me.device.windows.window[me.device.windows.selected]
508
                            .setText(action);
509
                        me.device.windows.state[id].objects[selected].text = action;
510
                    };
make Vspeeds adaptable
Sébastien MARQUE authored on 2020-06-15
511
                    var obj_infos = [ # objects infos
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
512
                            {text: 'REFERENCES', type: 'title'},
513
                            {type: 'separator'},
514
                            {text: 'TIMER', type: 'normal'},
515
                            {text: '00:00:00', type: 'selected|time', },
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
516
                            {text: '  UP >', type: 'editable', choices: ['  UP >', '<DOWN ']},
517
                            {text: 'START?', type: 'editable|end-of-line', callback: func (id, selected) GenericTimer(id, selected)},
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
518
                            {type: 'separator'},
make Vspeeds adaptable
Sébastien MARQUE authored on 2020-06-15
519
                    ];
520
                    var scrollgroup = 0;
521
                    foreach (var V; ['x', 'y', 'r', 'glide']) {
522
                        V = 'V' ~ V;
523
                        var speed = alerts.getNode(V) != nil ? alerts.getValue(V) * units.speed.from_kt : 0;
524
                        append(obj_infos, {
525
                            text: sprintf('%-7s', V),
526
                            type: 'normal',
527
                            scrollgroup: scrollgroup
528
                        });
529
                        append(obj_infos, {
530
                            text: sprintf('%3i%s',
531
                                alerts.getNode(V) != nil ? alerts.getValue(V) * units.speed.from_kt : 0,
532
                                units.speed.from_kt == 1 ? 'KT' : 'km/h'),
533
                            type: 'editable|immediate',
534
                            scrollgroup: scrollgroup,
535
                            range: {min: 0, max: 999},
536
                            format: '%3i' ~ (units.speed.from_kt == 1 ? 'KT' : 'km/h'),
537
                            _v: V,
538
                            callback: func (id, selected,) {
539
                                string.scanf(string.trim(me.device.windows.state[id].objects[selected].text, -1),
540
                                             '%3u' ~ (units.speed.from_kt == 1 ? 'KT' : 'km/h'), var r = []);
541
                                data[me.device.windows.state[id].objects[selected]._v] = r[0];
542
                            }
543

            
544
                        });
545
                        append(obj_infos, {
546
                            text: me.device.data[V ~ '-visible'] ? '   ON >' : '< OFF  ',
547
                            type: 'editable|immediate|end-of-line',
548
                            scrollgroup: scrollgroup,
549
                            _v: V,
550
                            choices: ['   ON >', '< OFF  '],
551
                            callback: func (id, selected) {
552
                                var Vspeed = me.device.windows.state[id].objects[selected]._v;
553
                                me.device.data[Vspeed ~ '-visible'] =
554
                                    me.device.windows.state[id].objects[selected].text
555
                                    ==
556
                                    me.device.windows.state[id].objects[selected].choices[0];
557
                            }
558
                        });
559
                        scrollgroup += 1;
560
                    }
561
                    append(obj_infos,
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
562
                            {type: 'separator'},
563
                            {text: 'MINIMUMS', type: 'normal'},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
564
                            {text: '   OFF   >', type: 'editable', choices: ['   OFF   >', '<  BARO  >','<TEMP COMP'], callback: func},
make Vspeeds adaptable
Sébastien MARQUE authored on 2020-06-15
565
                            {text: ' 1000FT', type: 'editable', format: '% 5iFT', factor: 100, callback: func}
566
                          );
567
                    me.device.windows.draw(
568
                        'TMR/REF',
569
                        {x: 720, y: 535, w: 300, l: 5, sep: 3},
570
                        obj_infos,
571
                        { lines : 3, columns : 3 }
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
572
                    );
573
                    me.device.knobs.FmsInner = me.device.knobs.MenuSettings;
574
                    me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
575
                    me.device.buttons.ENT = me.device.buttons.ValidateTMRREF;
576
                    me.device.buttons.FMS = me.device.buttons.ValidateTMRREF;
577
                    me.device.buttons.CLR = me.device.buttons.ClearTMRREF;
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
578
                }
579
                else {
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
580
                    me.device.buttons.ClearTMRREF();
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
581
                }
582
            },
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
583
            NRST: {
584
                _displayNearest: func (type, where) {
585
                    var id = 'PFD NRST';
586
                    me.device.display.updateSoftKeys();
587
                    me.device.windows.del(id);
588
                    var results = [];
589
                    var list = [];
590
                    if (type == 'apt') {
591
                        results = findAirportsWithinRange(100);
592
                    }
593
                    else {
594
                        results = findNavaidsWithinRange(100, type);
595
                    }
simplifies NRST code
Sébastien MARQUE authored on 2020-05-18
596
                    var norm_360 = func (a) return math.periodic(0, 360, a);
597
                    if    (where == 'OMNI')  var side = -1;
598
                    elsif (where == 'FRONT') var side = norm_360(data.hdg);
599
                    elsif (where == 'RIGHT') var side = norm_360(data.hdg + 90);
600
                    elsif (where == 'LEFT')  var side = norm_360(data.hdg - 90);
601
                    elsif (where == 'REAR')  var side = norm_360(data.hdg + 180);
602
                    foreach (var n; results) {
603
                        var (course, dist) = courseAndDistance(n);
604
                        if (side > -1) {
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
605
                            var angle = 180 - abs(abs(course - side) - 180);
simplifies NRST code
Sébastien MARQUE authored on 2020-05-18
606
                            if (angle > 50)
607
                                continue;
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
608
                        }
simplifies NRST code
Sébastien MARQUE authored on 2020-05-18
609
                        append(list, [n, course, dist]);
610
                        if (size(list) == 5)
611
                            break;
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
612
                    }
613
                    var obj_infos = [
614
                        { text: sprintf('NEAREST %s (%s)', string.uc(type), where), type: 'title' },
615
                        { type: 'separator' }
616
                    ];
617
                    var firstEntry = 1;
618
                    foreach (var n; list) {
619
                        append(obj_infos, {
620
                            text: sprintf('%s (%s)', n[0].id, n[0].name),
621
                            type: (firstEntry ? 'selected' : 'editable') ~ '|end-of-line',
622
                            dto: n[0],
623
                        });
adds NAV freq if VOR selecte...
Sébastien MARQUE authored on 2020-05-18
624
                        if (type == 'vor') {
625
                            var idx = size(obj_infos) - 1;
626
                            obj_infos[idx]._freq = n[0].frequency;
627
                            obj_infos[idx].callback = func (id, selected) radios.getNode('nav-freq-mhz').setValue(me.device.windows.state[id].objects[selected]._freq / 100);
628
                        }
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
629
                        append(obj_infos, {
630
                            text: sprintf('%s %03i° %3iNM', utf8.chstr(9658), n[1], n[2]),
631
                            type: 'normal|end-of-line'
632
                        });
633
                        firstEntry = 0;
634
                    }
635
                    me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
636
                    me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
637
                    me.device.buttons.ENT    = me.device.buttons.ValidateTMRREF;
638
                    me.device.buttons.CLR = func {
639
                        me.device.windows.del(id);
640
                        me.device.knobs.FmsOuter = func;
641
                        me.device.knobs.FmsInner = func;
fix MENU issue
Sébastien MARQUE authored on 2020-05-23
642
                        me.device.buttons.MENU = me.device.buttons.GlobalParams;
643
                        foreach (var b; ['ENT', 'CLR'])
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
644
                            me.device.buttons[b] = func;
645
                    }
fix MENU issue
Sébastien MARQUE authored on 2020-05-23
646
                    me.device.buttons.MENU = func;
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
647
                    me.device.windows.draw( id, {autogeom: 1}, obj_infos );
648
                },
adds NRST/COMMS
Sébastien MARQUE authored on 2020-05-18
649
                _displayNearestCOMM: func (where) {
650
                    var id = 'PFD NRST';
651
                    me.device.display.updateSoftKeys();
652
                    me.device.windows.del(id);
653
                    var results = [];
654
                    var ATIS_list = [];
655
                    var TRAFFIC_list = [];
656
                    var TWR_list = [];
657
                    results = findAirportsWithinRange(100);
658
                    var norm_360 = func (a) return math.periodic(0, 360, a);
659
                    if    (where == 'OMNI')  var side = -1;
660
                    elsif (where == 'FRONT') var side = norm_360(data.hdg);
661
                    elsif (where == 'RIGHT') var side = norm_360(data.hdg + 90);
662
                    elsif (where == 'LEFT')  var side = norm_360(data.hdg - 90);
663
                    elsif (where == 'REAR')  var side = norm_360(data.hdg + 180);
664
                    foreach (var r; results) {
665
                        var (course, dist) = courseAndDistance(r);
666
                        if (side > -1) {
667
                            var bearing = 180 - abs(abs(course - side) - 180);
668
                            if (bearing > 50)
669
                                continue;
670
                        }
671
                        foreach (var c; r.comms()) {
672
                            if (size(ATIS_list) < 4
673
                            and (string.match(c.ident, '*ATIS*') or string.match(c.ident, '*A[SW]OS*')))
674
                                append(ATIS_list, [r.id, c.frequency, course, dist]);
675

            
676
                            if (size(TWR_list) < 4
677
                            and string.match(c.ident, '*TWR*'))
678
                                append(TWR_list, [r.id, c.frequency, course, dist]);
679

            
680
                            if (size(TRAFFIC_list) < 4
681
                            and (string.match(c.ident, '*CTAF*') or string.match(c.ident, '*UNICOM*') or string.match(c.ident, '*MULTICOM*')))
682
                                append(TRAFFIC_list, [r.id, c.frequency, course, dist]);
683
                        }
684
                    }
685
                    var obj_infos = [];
686
                    firstEntry = 1;
687
                    if (size(ATIS_list) > 0) {
688
                        append(obj_infos, {text: 'ATIS', type: 'title'});
689
                        append(obj_infos, {type: 'separator'});
690
                        foreach (var atis; ATIS_list) {
691
                            append(obj_infos, {
692
                                text: atis[0],
693
                                _freq: atis[1],
694
                                type: firstEntry ? 'selected' : 'editable',
695
                                callback: func (id, selected) radios.getNode('comm-freq-mhz').setValue(me.device.windows.state[id].objects[selected]._freq),
696
                            });
697
                            append(obj_infos, {
698
                                text: sprintf(' (%.3fMHz) %3i° %2iNM', atis[1], atis[2], atis[3]),
699
                                type: 'normal|end-of-line'
700
                            });
701
                            firstEntry = 0;
702
                        }
703
                    }
704
                    if (size(TRAFFIC_list) > 0) {
705
                        append(obj_infos, {text: 'TRAFFIC', type: 'title'});
706
                        append(obj_infos, {type: 'separator'});
707
                        foreach (var traffic; TRAFFIC_list) {
708
                            append(obj_infos, {
709
                                text: traffic[0],
710
                                _freq: traffic[1],
711
                                type: firstEntry ? 'selected' : 'editable',
712
                                callback: func (id, selected) radios.getNode('comm-freq-mhz').setValue(me.device.windows.state[id].objects[selected]._freq),
713
                            });
714
                            append(obj_infos, {
715
                                text: sprintf(' (%.3fMHz) %3i° %2iNM', traffic[1], traffic[2], traffic[3]),
716
                                type: 'normal|end-of-line'
717
                            });
718
                            firstEntry = 0;
719
                        }
720
                    }
721
                    if (size(TWR_list) > 0) {
722
                        append(obj_infos, {text: 'TOWER', type: 'title'});
723
                        append(obj_infos, {type: 'separator'});
724
                        foreach (var tower; TWR_list) {
725
                            append(obj_infos, {
726
                                text: tower[0],
727
                                _freq: tower[1],
728
                                type: firstEntry ? 'selected' : 'editable',
729
                                callback: func (id, selected) radios.getNode('comm-freq-mhz').setValue(me.device.windows.state[id].objects[selected]._freq),
730
                            });
731
                            append(obj_infos, {
732
                                text: sprintf(' (%.3fMHz) %3i° %2iNM', tower[1], tower[2], tower[3]),
733
                                type: 'normal|end-of-line'
734
                            });
735
                            firstEntry = 0;
736
                        }
737
                    }
738
                    me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
739
                    me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
fix MENU issue
Sébastien MARQUE authored on 2020-05-23
740
                    me.device.buttons.MENU = func;
adds NRST/COMMS
Sébastien MARQUE authored on 2020-05-18
741
                    me.device.buttons.CLR = func {
742
                        me.device.windows.del(id);
743
                        me.device.knobs.FmsOuter = func;
744
                        me.device.knobs.FmsInner = func;
fix MENU issue
Sébastien MARQUE authored on 2020-05-23
745
                        me.device.buttons.MENU = me.device.buttons.GlobalParams;
746
                        foreach (var b; ['ENT', 'CLR'])
adds NRST/COMMS
Sébastien MARQUE authored on 2020-05-18
747
                            me.device.buttons[b] = func;
748
                    }
749
                    me.device.buttons.ENT    = me.device.buttons.ValidateTMRREF;
750
                    me.device.windows.draw( id, {autogeom: 1}, obj_infos );
751
                },
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
752
############################################################################################################
753
# THIS CODE SHOULD REPLACE THE LINES BELOW (in new()), but it makes all call with the same args (apt, RIGHT)
754
############################################################################################################
755
#        if (m.device.role == 'PFD')
756
#            foreach (var dir; keyMap.PFD.NRST.texts) {
757
#                m.bindings.PFD.NRST[dir] = {};
758
#                foreach (var type; keyMap.PFD.NRST.OMNI.texts) {
759
#                    m.bindings.PFD.NRST[dir][type] = func {
760
#                        call(m.bindings.PFD.NRST._displayNearest, [string.lc(type), dir], m)
761
#                    };
762
#                }
763
#            }
764
############################################################################################################
765
                OMNI: {
766
                    APT: func { call(me.bindings.PFD.NRST._displayNearest, ['apt', 'OMNI'], me) },
767
                    VOR: func { call(me.bindings.PFD.NRST._displayNearest, ['vor', 'OMNI'], me) },
768
                    NDB: func { call(me.bindings.PFD.NRST._displayNearest, ['ndb', 'OMNI'], me) },
769
                    FIX: func { call(me.bindings.PFD.NRST._displayNearest, ['fix', 'OMNI'], me) },
adds NRST/COMMS
Sébastien MARQUE authored on 2020-05-18
770
                    COMM:func { call(me.bindings.PFD.NRST._displayNearestCOMM,    ['OMNI'], me) },
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
771
                },
772
                FRONT: {
773
                    APT: func { call(me.bindings.PFD.NRST._displayNearest, ['apt', 'FRONT'], me) },
774
                    VOR: func { call(me.bindings.PFD.NRST._displayNearest, ['vor', 'FRONT'], me) },
775
                    NDB: func { call(me.bindings.PFD.NRST._displayNearest, ['ndb', 'FRONT'], me) },
776
                    FIX: func { call(me.bindings.PFD.NRST._displayNearest, ['fix', 'FRONT'], me) },
adds NRST/COMMS
Sébastien MARQUE authored on 2020-05-18
777
                    COMM:func { call(me.bindings.PFD.NRST._displayNearestCOMM,    ['FRONT'], me) },
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
778
                },
779
                RIGHT: {
780
                    APT: func { call(me.bindings.PFD.NRST._displayNearest, ['apt', 'RIGHT'], me) },
781
                    VOR: func { call(me.bindings.PFD.NRST._displayNearest, ['vor', 'RIGHT'], me) },
782
                    NDB: func { call(me.bindings.PFD.NRST._displayNearest, ['ndb', 'RIGHT'], me) },
783
                    FIX: func { call(me.bindings.PFD.NRST._displayNearest, ['fix', 'RIGHT'], me) },
adds NRST/COMMS
Sébastien MARQUE authored on 2020-05-18
784
                    COMM:func { call(me.bindings.PFD.NRST._displayNearestCOMM,    ['RIGHT'], me) },
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
785
                },
786
                REAR: {
787
                    APT: func { call(me.bindings.PFD.NRST._displayNearest, ['apt', 'REAR'], me) },
788
                    VOR: func { call(me.bindings.PFD.NRST._displayNearest, ['vor', 'REAR'], me) },
789
                    NDB: func { call(me.bindings.PFD.NRST._displayNearest, ['ndb', 'REAR'], me) },
790
                    FIX: func { call(me.bindings.PFD.NRST._displayNearest, ['fix', 'REAR'], me) },
adds NRST/COMMS
Sébastien MARQUE authored on 2020-05-18
791
                    COMM:func { call(me.bindings.PFD.NRST._displayNearestCOMM,    ['REAR'], me) },
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
792
                },
793
                LEFT: {
794
                    APT: func { call(me.bindings.PFD.NRST._displayNearest, ['apt', 'LEFT'], me) },
795
                    VOR: func { call(me.bindings.PFD.NRST._displayNearest, ['vor', 'LEFT'], me) },
796
                    NDB: func { call(me.bindings.PFD.NRST._displayNearest, ['ndb', 'LEFT'], me) },
797
                    FIX: func { call(me.bindings.PFD.NRST._displayNearest, ['fix', 'LEFT'], me) },
adds NRST/COMMS
Sébastien MARQUE authored on 2020-05-18
798
                    COMM:func { call(me.bindings.PFD.NRST._displayNearestCOMM,    ['LEFT'], me) },
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
799
                },
800
            },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
801
        },
802
        MFD : {
803
            ENGINE: {
804
                FUEL: {
805
                    UNDO: func {
806
                        pop(me.path);
807
                        me.device.display.updateSoftKeys();
808
                    },
809
                    ENTER: func {
810
                        pop(me.path);
811
                        me.device.display.updateSoftKeys();
812
                    },
813
                },
814
                ENGINE: func {
815
                    me.path = [];
816
                    me.device.display.updateSoftKeys();
817
                },
818
            },
add missing exit to MFD/CHKL...
Sébastien MARQUE authored on 2017-03-20
819
            CHKLIST : {
add checklists management
Sébastien MARQUE authored on 2020-04-30
820
                _showCheckList: func (id, selected) {
821
                    var tabulate = func (l, r, t = 3, c = '.') {
822
                        var s = '';
823
                        for (var i = 0; i < (l - r) + t; i += 1) s ~= c;
824
                        return s;
825
                    }
826

            
827
                    var groupIndex     = me.device.windows.state[id].objects[selected].groupIndex;
828
                    var checklistIndex = me.device.windows.state[id].objects[selected].checklistIndex;
829

            
830
                    if (contains(me.device.windows.state[id].objects[selected], 'pageIndex'))
831
                        pageIndex = me.device.windows.state[id].objects[selected].pageIndex;
832
                    else
833
                        pageIndex = -1;
834

            
835
                    var title = '';
836
                    if (contains(me.device.windows.state[id].objects[selected], 'checklistTitle'))
837
                        title = me.device.windows.state[id].objects[selected].checklistTitle;
838
                    else
839
                        title = me.device.windows.state[id].objects[selected].text;
840

            
841
                    me.device.windows.del(id);
842

            
843
                    if (groupIndex < 0)
844
                         checklistNode = props.globals.getNode("/sim/checklists")
845
                                    .getChild('checklist', checklistIndex);
846
                    else
847
                         checklistNode = props.globals.getNode("/sim/checklists")
848
                                    .getChild("group", groupIndex)
849
                                    .getChild('checklist', checklistIndex);
850

            
851
                    var pages = checklistNode.getChildren('page');
852

            
853
                    if (size(pages) and pageIndex == -1)
854
                        pageIndex = 0;
855

            
856
                    _previous_text = ' < PREVIOUS ';
857
                    _next_text     = ' NEXT > ';
858

            
859
                    var obj_infos = [];
860
                    var length = size(_previous_text ~ _next_text);
861
                    var length_cache = [];
862
                    if (size(pages))
863
                        checklistNode = pages[pageIndex];
864

            
865
                    append(obj_infos, {
866
                        text: sprintf('%s%s',
867
                                      title,
868
                                      size(pages) > 1 ? sprintf(' %d / %d',
869
                                                                pageIndex + 1,
870
                                                                size(pages)) : ''),
871
                        type: 'title'
872
                    });
873

            
874
                    append(obj_infos, {type: 'separator'});
875

            
876
                    forindex (var i; checklistNode.getChildren('item')) {
877
                        var l = size(checklistNode.getChild('item', i).getValue('name'));
878
                        if (checklistNode.getChild('item', i).getChild('value') != nil)
879
                            l += size(checklistNode.getChild('item', i).getValue('value'));
880
                        append(length_cache, l);
881
                        if (l > length)
882
                            length = l;
883
                    }
884

            
885
                    forindex (var i; checklistNode.getChildren('item')) {
886
                        var text = pages[pageIndex].getChild('item', i).getValue('name');
887
                        var item_val = '';
888
                        if (pages[pageIndex].getChild('item', i).getChild('value') != nil)
889
                            item_val = pages[pageIndex].getChild('item', i).getValue('value');
890
                        if (item_val != '')
891
                            text ~= tabulate(length, length_cache[i]);
892
                        text ~= item_val;
893

            
894
                        append(obj_infos, {
895
                            text: text,
896
                            groupIndex: groupIndex,
897
                            checklistIndex: checklistIndex,
898
                            pageIndex: pageIndex,
899
                            type: 'normal|end-of-line'
900
                        });
901
                    }
902

            
903
                    append(obj_infos, {type: 'separator'});
904

            
905
                    if (pageIndex and size(pages))
906
                        append(obj_infos, {
907
                                text: _previous_text,
908
                                groupIndex: groupIndex,
909
                                checklistIndex: checklistIndex,
910
                                pageIndex: pageIndex - 1,
911
                                checklistTitle: title,
912
                                type: (pageIndex + 1 < size(pages)) ? 'editable' : 'selected',
913
                                callback: func (id, selected) call(me.device.softkeys.bindings.MFD.CHKLIST._showCheckList, [id, selected], me)
914
                        });
915
                    else
916
                        append(obj_infos, {
917
                            text: tabulate(length, size(_next_text), 0, ' '),
918
                            type: 'normal'
919
                        });
920

            
921
                    if (pageIndex + 1 < size(pages)) {
922
                        if (pageIndex and size(pages))
923
                            append(obj_infos, {
924
                                text: tabulate(length, size(_previous_text ~ _next_text), 0, ' '),
925
                                type: 'normal',
926
                            });
927
                        append(obj_infos, {
928
                                text: _next_text,
929
                                groupIndex: groupIndex,
930
                                checklistIndex: checklistIndex,
931
                                pageIndex: pageIndex + 1,
932
                                checklistTitle: title,
933
                                type: 'selected|end-of-line',
934
                                callback: func (id, selected) call(me.device.softkeys.bindings.MFD.CHKLIST._showCheckList, [id, selected], me)
935
                        });
936
                    }
937

            
938
                    me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
939
                    me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
940
                    me.device.buttons.ENT    = me.device.buttons.ValidateTMRREF;
941
                    me.device.buttons.CLR = func {
942
                        me.device.windows.del(id);
943
                        me.device.knobs.FmsOuter = func;
944
                        me.device.knobs.FmsInner = func;
945
                        foreach (var b; ['ENT', 'CLR'])
946
                            me.device.buttons[b] = func;
947
                        me.device.buttons.MENU = func;
948
                    }
949
                    me.device.windows.draw( id, {autogeom: 1}, obj_infos );
950
                },
951
                LIST: func {
952
                    # nested function as checklist lists may be organized by group
953
                    var listChecklists = func (id, selected) {
954
                        var groupIndex = me.device.windows.state[id].objects[selected].groupIndex;
955

            
956
                        me.device.windows.del(id);
957

            
958
                        var checklists = [];
959
                        var firstEntry = 1;
960
                        if (groupIndex == -1)
961
                            checklists = props.globals.getNode("/sim/checklists")
962
                                            .getChildren('checklist');
963
                        else
964
                            checklists = props.globals.getNode("/sim/checklists")
965
                                            .getChild("group", groupIndex)
966
                                            .getChildren('checklist');
967
                        var checklistsQty = size(checklists);
968
                        var obj_infos = [];
969

            
970
                        if (checklistsQty) {
971
                            forindex (var c; checklists) {
972
                                if (string.uc(checklists[c].getValue('title')) == 'EMERGENCY') {
973
                                    checklistsQty -= 1;
974
                                    continue;
975
                                }
976
                                var title = checklists[c].getValue('title');
977
                                append(obj_infos, {
978
                                    text: title,
979
                                    groupIndex: groupIndex,
980
                                    checklistIndex: c,
981
                                    checklistTitle: title,
982
                                    type: (firstEntry ? 'selected' : 'editable') ~ '|end-of-line',
983
                                    callback: func (id, selected) call(me.device.softkeys.bindings.MFD.CHKLIST._showCheckList, [id, selected], me)
984
                                });
985
                                if (checklistsQty == 1) { # see comments below for groups
986
                                    call(me.device.softkeys.bindings.MFD.CHKLIST._showCheckList, [groupIndex, 0], me);
987
                                    return;
988
                                }
989
                                elsif (checklistsQty == 0)
990
                                    return;
991
                                firstEntry = 0;
992
                            }
993
                        }
994

            
995
                        id ~= ' CHECKLISTS';
996
                        me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
997
                        me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
998
                        me.device.buttons.ENT    = me.device.buttons.ValidateTMRREF;
999
                        me.device.buttons.CLR = func {
1000
                            me.device.windows.del(id);
1001
                            me.device.knobs.FmsOuter = func;
1002
                            me.device.knobs.FmsInner = func;
1003
                            foreach (var b; ['ENT', 'CLR'])
1004
                                me.device.buttons[b] = func;
1005
                            me.device.buttons.MENU = func;
1006
                        }
1007
                        me.device.windows.draw(id, {autogeom: 1}, obj_infos);
1008
                    }
1009

            
1010
                    var windowId = 'CHKLIST LIST';
1011
                    if (contains(me.device.windows.state, windowId))
1012
                        me.device.windows.del(windowId);
1013

            
1014
                    var obj_infos = [];
1015
                    var firstEntry = 1;
1016
                    var groups = props.globals.getNode("/sim/checklists").getChildren("group");
1017
                    var groupsQty = size(groups);
1018

            
1019
                    if (groupsQty) {
1020
                        forindex (var g; groups) {
1021
                            # emergency checklists are listed in their own menu
1022
                            if (string.uc(groups[g].getValue('name')) == 'EMERGENCY') {
1023
                                groupsQty -= 1;
1024
                                continue;
1025
                            }
1026
                            # the key groupIndex isn't used by the display system
1027
                            # we use it to keep the information of group node's index
1028
                            append(obj_infos, {
1029
                                text: groups[g].getValue('name'),
1030
                                groupIndex: g,
1031
                                type: (firstEntry ? 'selected' : 'editable') ~ '|end-of-line',
1032
                                callback: func (id, selected) listChecklists(id, selected) });
1033
                            firstEntry = 0;
1034
                            # if there are only one group left, let display it directly
1035
                            if (groupsQty == 1) {
1036
                                listChecklists(windowId, 0);
1037
                                return;
1038
                            }
1039
                            elsif (groupsQty == 0) {
1040
                                return;
1041
                            }
1042
                        }
1043
                    }
1044
                    else {
1045
                        listChecklists(windowId, -1);
1046
                        return;
1047
                    }
1048

            
1049
                    me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
1050
                    me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
1051
                    me.device.buttons.ENT    = me.device.buttons.ValidateTMRREF;
1052
                    me.device.buttons.CLR = func {
1053
                        me.device.windows.del(windowId);
1054
                        me.device.knobs.FmsOuter = func;
1055
                        me.device.knobs.FmsInner = func;
1056
                        foreach (var b; ['ENT', 'CLR'])
1057
                            me.device.buttons[b] = func;
1058
                        me.device.buttons.MENU = func;
1059
                    }
1060
                    me.device.windows.draw(windowId, {autogeom: 1}, obj_infos);
1061
                },
1062
                EMERGCY: func {
1063
                    # nested function as checklist lists may be organized by group
1064
                    var listChecklists = func (groupIndex) {
1065
                        var checklists = [];
1066
                        var firstEntry = 1;
1067
                        if (groupIndex == -1)
1068
                            checklists = props.globals.getNode("/sim/checklists")
1069
                                            .getChildren('checklist');
1070
                        else
1071
                            checklists = props.globals.getNode("/sim/checklists")
1072
                                            .getChild("group", groupIndex)
1073
                                            .getChildren('checklist');
1074
                        var checklistsQty = size(checklists);
1075
                        var obj_infos = [];
1076
                        var firstEntry = 1;
1077

            
1078
                        if (checklistsQty) {
1079
                            forindex (var c; checklists) {
1080
                                if (groupIndex < 0 and string.uc(checklists[c].getValue('title')) != 'EMERGENCY') {
1081
                                    checklistsQty -= 1;
1082
                                    continue;
1083
                                }
1084
                                append(obj_infos, {
1085
                                    text: checklists[c].getValue('title'),
1086
                                    groupIndex: groupIndex,
1087
                                    checklistIndex: c,
1088
                                    type: (firstEntry ? 'selected' : 'editable') ~ '|end-of-line',
1089
                                    callback: func (id, selected) call(me.device.softkeys.bindings.MFD.CHKLIST._showCheckList, [id, selected], me)
1090
                                });
1091
                                firstEntry = 0;
1092
                            }
1093
                        }
1094
                        id = 'EMERGENCY CHECKLISTS';
1095
                        me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
1096
                        me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
1097
                        me.device.buttons.ENT    = me.device.buttons.ValidateTMRREF;
1098
                        me.device.buttons.CLR = func {
1099
                            me.device.windows.del(id);
1100
                            me.device.knobs.FmsOuter = func;
1101
                            me.device.knobs.FmsInner = func;
1102
                            foreach (var b; ['ENT', 'CLR'])
1103
                                me.device.buttons[b] = func;
1104
                            me.device.buttons.MENU = func;
1105
                        }
1106
                        me.device.windows.draw(id, {autogeom: 1}, obj_infos);
1107
                        if (checklistsQty == 1) { # see comments below for groups
1108
                            call(me.device.softkeys.bindings.MFD.CHKLIST._showCheckList, [groupIndex, 0], me);
1109
                            return;
1110
                        }
1111
                        elsif (checklistsQty == 0)
1112
                            call(me.device.buttons.CLR, [0], me);
1113
                            return;
1114
                    }
1115

            
1116
                    var windowId = 'CHKLIST EMERGCY';
1117
                    if (contains(me.device.windows.state, windowId))
1118
                        me.device.windows.del(windowId);
1119

            
1120
                    var groups = props.globals.getNode("/sim/checklists").getChildren("group");
1121

            
1122
                    var emergency_group_found = 0;
1123
                    if (size(groups)) {
1124
                        forindex (var g; groups) {
1125
                            # emergency checklists are listed in their own menu
1126
                            # we support only one emergency checklists group named EMERGENCY (case insensitive)
1127
                            if (string.uc(groups[g].getValue('name')) != 'EMERGENCY')
1128
                                continue;
1129
                            listChecklists(g);
1130
                            emergency_group_found = !emergency_group_found;
1131
                            break;
1132
                        }
1133
                    }
1134

            
1135
                    if (!emergency_group_found)
1136
                        listChecklists(-1);
1137
                },
add missing exit to MFD/CHKL...
Sébastien MARQUE authored on 2017-03-20
1138
                EXIT: func {
1139
                    me.path = [];
1140
                    me.device.display.updateSoftKeys();
1141
                },
1142
            },
add TCAS
Sébastien MARQUE authored on 2017-12-21
1143
            MAP: {
1144
                TRAFFIC: func {
improve the selection of dis...
Sébastien MARQUE authored on 2017-12-30
1145
                    call(me.bindings.PFD.INSET.declutter, ['MAPTRAFFIC', 'tcas', 0], me);
1146
                },
1147
                ROUTE: func {
1148
                    call(me.bindings.PFD.INSET.declutter, ['MAPROUTE', 'route', 1], me);
1149
                },
1150
                TERRAIN: func {
1151
                    call(me.bindings.PFD.INSET.declutter, ['MAPTERRAIN', 'tiles', 3], me);
1152
                },
topo display is now availabl...
Sébastien MARQUE authored on 2020-06-14
1153
                TOPO: func {
1154
                    call(me.bindings.PFD.INSET.declutter, ['MAPTOPO', 'topo', 7], me);
1155
                },
improve the selection of dis...
Sébastien MARQUE authored on 2017-12-30
1156
                NAVAIDS: {
1157
                    ALL: func {
1158
                        call(me.bindings.PFD.INSET.NAVAIDS.ALL, [ 'MAPNAVAIDS' ], me);
1159
                    },
1160
                    VOR: func {
1161
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['MAPNAVAIDSVOR', 'VOR', 2], me);
1162
                    },
1163
                    TACAN: func {
1164
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['MAPNAVAIDSTACAN', 'TACAN', 3], me);
1165
                    },
1166
                    NDB: func {
1167
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['MAPNAVAIDSNDB', 'NDB', 4], me);
1168
                    },
1169
                    DME: func {
1170
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['MAPNAVAIDSDME', 'DME', 5], me);
1171
                    },
1172
                    APT: func {
1173
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['MAPNAVAIDSAPT', 'airport', 6], me);
1174
                    },
add TCAS
Sébastien MARQUE authored on 2017-12-21
1175
                },
1176
            },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
1177
        },
commit initial
Sébastien MARQUE authored on 2017-03-07
1178
    },
1179
};
massive code reorganisation ...
Sébastien MARQUE authored on 2017-05-01
1180

            
1181
var keyMap = {
vim folds
Sébastien MARQUE authored on 2017-12-21
1182
# softkeys map for PFD and MFD {{{1
1183
# PFD {{{2
massive code reorganisation ...
Sébastien MARQUE authored on 2017-05-01
1184
    PFD : {
1185
        first : 1,
1186
        texts : ['INSET', 'SENSOR', 'PFD', 'OBS', 'CDI', 'DME', 'XPDR', 'IDENT', 'TMR/REF', 'NRST' ],
1187
        INSET : {
removes traffic from PFD ins...
Sébastien MARQUE authored on 2020-06-14
1188
            texts : ['OFF', '', '', 'ROUTE', '', 'TERRAIN', 'NAVAIDS', 'METAR'],
improve the selection of dis...
Sébastien MARQUE authored on 2017-12-30
1189
            NAVAIDS : {
1190
                first : 2,
1191
                texts : ['VOR', 'TACAN', 'NDB', 'DME', 'APT', '', 'ALL'],
1192
            },
massive code reorganisation ...
Sébastien MARQUE authored on 2017-05-01
1193
        },
1194
        SENSOR : {
1195
            first : 2,
1196
            texts : [ 'ADC1', 'ADC2', '', 'AHRS1', 'AHRS2'],
1197
        },
1198
        PFD : {
1199
            texts : [ 'SYN VIS', 'DFLTS', 'AOA/WIND', 'DME', 'BRG1', 'HSI FMT', 'BRG2', '', 'ALT UNIT', 'STD BARO' ],
1200
            'SYN VIS' : {
1201
                texts : [ 'PATHWAY', 'SYN TERR', 'HR2NHDG', 'APTSIGNS', 'FPM'],
1202
            },
1203
            'AOA/WIND' : {
1204
                first : 4,
1205
                texts : ['AOA', 'WIND'],
1206
                AOA : {
1207
                    first : 5,
1208
                    texts : ['AOA ON', 'AOA AUTO'],
1209
                },
1210
                WIND : {
1211
                    first : 2,
1212
                    texts : ['OPTN1', 'OPTN2', '', 'OFF'],
1213
                },
1214
            },
1215
            'HSI FMT' : {
1216
                first : 6,
1217
                texts : ['360 HSI', 'ARC HSI'],
1218
            },
1219
            'ALT UNIT' : {
1220
                first : 5,
1221
                texts : ['METERS', '', 'IN', 'HPA'],
1222
            },
1223
        },
1224
        XPDR : {
1225
            first : 2,
1226
            texts : ['STBY', 'ON', 'ALT', '', 'VFR', 'CODE', 'IDENT'],
1227
            CODE : {
1228
                texts : ['0', '1', '2', '3', '4', '5', '6', '7', 'IDENT', 'BKSP'],
1229
            },
1230
        },
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
1231
        NRST : {
1232
            first : 4,
1233
            texts : ['OMNI', 'REAR', 'FRONT', 'LEFT', 'RIGHT', 'RANGE'],
1234
            RANGE : {
1235
                first : 7,
1236
                texts : ['MIN', 'MAX' ],
1237
                MIN : { first: 3, texts : ['0NM',   '10NM',  '30NM',  '50NM'] },
fix typo
Sébastien MARQUE authored on 2020-06-11
1238
                MAX : { first: 3, texts : ['200NM', '150NM', '100NM', '50NM'] },
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
1239
            },
adds NRST/COMMS
Sébastien MARQUE authored on 2020-05-18
1240
            OMNI : { texts: ['NDB', 'FIX', 'VOR', 'APT', '', '', '', '', '', 'COMM'] }, # that will be mirrored later
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
1241
        },
massive code reorganisation ...
Sébastien MARQUE authored on 2017-05-01
1242
    },
vim folds
Sébastien MARQUE authored on 2017-12-21
1243
#}}}2
1244
# MFD {{{2
massive code reorganisation ...
Sébastien MARQUE authored on 2017-05-01
1245
    MFD : {
1246
        texts : ['ENGINE', '', 'MAP', '', '', '', '', '', '', 'DCLTR', 'SHW CHRT', 'CHKLIST'],
1247
        MAP : {
improve the selection of dis...
Sébastien MARQUE authored on 2017-12-30
1248
            texts : ['TRAFFIC', 'ROUTE', 'TOPO', 'TERRAIN', 'NAVAIDS', '','', '', '', '', 'BACK'],
1249
            NAVAIDS : {
1250
                first : 2,
1251
                texts : ['VOR', 'TACAN', 'NDB', 'DME', 'APT', '', 'ALL', '', '', 'BACK' ],
1252
            },
massive code reorganisation ...
Sébastien MARQUE authored on 2017-05-01
1253
        },
1254
        CHKLIST : {
add checklists management
Sébastien MARQUE authored on 2020-04-30
1255
            texts : ['ENGINE', '', '', '', 'LIST', 'DONE', '', '', '', '', 'EXIT', 'EMERGCY'],
massive code reorganisation ...
Sébastien MARQUE authored on 2017-05-01
1256
        },
1257
        ENGINE : {
1258
            texts : ['ENGINE', 'ANTI-ICE', '', 'DCLTR', '', 'ASSIST', '', '', '', '', 'FUEL'],
1259
            'ANTI-ICE' : {
1260
                texts : ['LEFT', 'AUTO', 'RIGHT', '', '', '', '', '', '', '', '', 'BACK'],
1261
            },
1262
            FUEL : {
1263
                first : 1,
1264
                texts : ['FULL', 'TABS', '', '', '', '', '', '', '', 'UNDO', 'ENTER'],
1265
            },
1266
        },
1267
    },
vim folds
Sébastien MARQUE authored on 2017-12-21
1268
#}}}2
massive code reorganisation ...
Sébastien MARQUE authored on 2017-05-01
1269
};
1270
if (data['stall-aoa'] == 9999)
1271
    keyMap.PFD.PFD['AOA/WIND'].texts = ['', 'WIND'];
add checklists management
Sébastien MARQUE authored on 2020-04-30
1272
if (props.globals.getNode('/sim/checklists') == nil) {
1273
    keyMap.MFD.texts[11] = '';
1274
    delete(keyMap.MFD, 'CHKLIST');
1275
}
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
1276
foreach (var d; ['FRONT', 'REAR', 'LEFT', 'RIGHT']) {
1277
    keyMap.PFD.NRST[d] = keyMap.PFD.NRST.OMNI;
1278
}
vim folds
Sébastien MARQUE authored on 2017-12-21
1279
#}}}1