zkv1000 / Nasal / softkeys.nas /
Newer Older
1255 lines | 66.661kb
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
                },
add TCAS
Sébastien MARQUE authored on 2017-12-21
64
                TRAFFIC: func {
improve the selection of dis...
Sébastien MARQUE authored on 2017-12-30
65
                    call(me.bindings.PFD.INSET.declutter, ['INSETTRAFFIC', 'tcas', 2], me);
66
                },
67
                ROUTE: func {
68
                    call(me.bindings.PFD.INSET.declutter, ['INSETROUTE', 'route', 3], me);
69
                },
70
                TERRAIN: func {
71
                    call(me.bindings.PFD.INSET.declutter, ['INSETTERRAIN', 'tiles', 5], me);
72
                },
73
                NAVAIDS: {
74
                    ALL: func (root_id = 'INSETNAVAIDS') {
75
                        if (contains(me.colored, root_id ~ 'ALL'))
76
                            foreach (var n; [ 'ALL', 'VOR', 'DME', 'NDB', 'TACAN', 'APT' ])
77
                                delete(me.colored, root_id ~ n);
78
                        else
79
                            foreach (var n; [ 'ALL', 'VOR', 'DME', 'NDB', 'TACAN', 'APT' ])
80
                                me.colored[root_id ~ n] = 1;
81
                        me.device.display.updateSoftKeys();
82
                        foreach (var n; [ 'VOR', 'TACAN', 'NDB', 'DME' ])
83
                            me.device.map.layers.navaids._can[n]
84
                                .setVisible(contains(me.colored, root_id ~ n));
85
                        me.device.map.layers.navaids._can.airport
86
                            .setVisible(contains(me.colored, root_id ~ 'APT'));
87
                    },
88
                    VOR: func {
89
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['INSETNAVAIDSVOR', 'VOR', 2], me);
90
                    },
91
                    TACAN: func {
92
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['INSETNAVAIDSTACAN', 'TACAN', 3], me);
93
                    },
94
                    NDB: func {
95
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['INSETNAVAIDSNDB', 'NDB', 4], me);
96
                    },
97
                    DME: func {
98
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['INSETNAVAIDSDME', 'DME', 5], me);
99
                    },
100
                    APT: func {
101
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['INSETNAVAIDSAPT', 'airport', 6], me);
102
                    },
103
                    declutter: func (id, type) {
104
                        if (contains(me.colored, id)) {
105
                            delete(me.colored, id);
106
                            if (me.device.role == 'PFD')
107
                                delete(me.colored, 'INSETNAVAIDSALL');
108
                            if (me.device.role == 'MFD')
109
                                delete(me.colored, 'MAPNAVAIDSALL');
110
                        }
111
                        else
112
                            me.colored[id] = 1;
113
                        me.device.display.updateSoftKeys();
114
                        me.device.map.layers.navaids._can[type]
115
                            .setVisible(contains(me.colored, id));
116
                    },
117
                },
118
                declutter: func (id, layer) {
119
                    if (contains(me.colored, id))
120
                        delete(me.colored, id);
add TCAS
Sébastien MARQUE authored on 2017-12-21
121
                    else
improve the selection of dis...
Sébastien MARQUE authored on 2017-12-30
122
                        me.colored[id] = 1;
add TCAS
Sébastien MARQUE authored on 2017-12-21
123
                    me.device.display.updateSoftKeys();
improve the selection of dis...
Sébastien MARQUE authored on 2017-12-30
124
                    me.device.map.layers[layer]
125
                        .setVisible(contains(me.colored, id));
add TCAS
Sébastien MARQUE authored on 2017-12-21
126
                },
PFD INSET map available
Sébastien MARQUE authored on 2017-04-19
127
                hook : func {
128
                    me.device.display.screenElements['PFD-Map-bg'].show();
separates maps code
Sébastien MARQUE authored on 2017-05-11
129
                    me.device.map.setVisible(1);
130
                    me.device.map.update();
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
131
                },
132
            },
133
            PFD: {
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
134
                'AOA/WIND' : {
adds AOA display
Sébastien MARQUE authored on 2017-04-15
135
                    AOA : {
136
                        'AOA ON' : func {
137
                            if (me.device.data['aoa-auto'])
138
                                return;
139
                            me.device.data.aoa = ! me.device.data.aoa;
nicer AOA display
Sébastien MARQUE authored on 2017-04-16
140
                            foreach (var e; ['AOA', 'AOA-needle', 'AOA-text'])
141
                                me.device.display.screenElements[e]
142
                                    .setVisible(me.device.data.aoa);
143
                            me.device.display.screenElements['AOA-approach']
144
                                .setVisible(me.device.data.aoa and contains(data, 'approach-aoa'));
adds AOA display
Sébastien MARQUE authored on 2017-04-15
145
                            me.device.display.updateAOA();
146
                            me.device.display.setSoftKeyColor(5 ,me.device.data.aoa);
147
                            if (me.device.data.aoa)
148
                                me.colored['PFDAOA/WINDAOAAOA ON'] = 1;
149
                            else
150
                                delete(me.colored, 'PFDAOA/WINDAOAAOA ON');
151
                        },
152
                        'AOA AUTO' : func {
153
                            if (me.device.data.aoa)
154
                                return;
155
                            me.device.data['aoa-auto'] = ! me.device.data['aoa-auto'];
156
                            me.device.display.setSoftKeyColor(6 ,me.device.data['aoa-auto']);
157
                            if (me.device.data['aoa-auto']) {
158
                                me.colored['PFDAOA/WINDAOAAOA AUTO'] = 1;
159
                                if (!contains(me.device.timers, 'aoa'))
160
                                    me.device.timers.aoa = maketimer(1,
161
                                            func {
162
                                                var v = getprop('/gear/gear/position-norm') == 1
163
                                                    and getprop('/surfaces-positions/flap-pos-norm') != 0;
nicer AOA display
Sébastien MARQUE authored on 2017-04-16
164
                                                foreach (var e; ['AOA', 'AOA-needle', 'AOA-text'])
165
                                                    me.device.display.screenElements[e]
166
                                                        .setVisible(v);
167
                                                me.device.display.screenElements['AOA-approach']
168
                                                    .setVisible(v and contains(data, 'approach-aoa'));
fix AOA not shown
Sébastien MARQUE authored on 2020-05-30
169
                                                me.device.display.updateAOA();
adds AOA display
Sébastien MARQUE authored on 2017-04-15
170
                                            }, me);
171
                                me.device.timers.aoa.start();
172
                            }
173
                            else {
174
                                delete(me.colored, 'PFDAOA/WINDAOAAOA AUTO');
175
                                me.device.timers.aoa.stop();
176
                                me.device.data.aoa = 0;
177
                                me.device.display.screenElements['AOA']
178
                                    .hide();
179
                            }
180
                        },
nicer AOA display
Sébastien MARQUE authored on 2017-04-16
181
                        hook : func {
182
                            if (contains(data,'approach-aoa'))
183
                                me.device.display.screenElements['AOA-approach']
184
                                    .setRotation(-data['approach-aoa']/data['stall-aoa']*math.pi);
185
                        },
adds AOA display
Sébastien MARQUE authored on 2017-04-15
186
                    },
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
187
                    WIND : {
188
                        OPTN1 : func {
189
                            me.device.display._winddata_optn = 1;
190
                            me.device.display.screenElements['WindData'].show();
191
                            me.device.display.screenElements['WindData-OPTN1'].show();
192
                            me.device.display.screenElements['WindData-OPTN1-HDG'].show();
193
                            me.device.display.screenElements['WindData-OPTN2'].hide();
194
                            me.device.display.updateWindData();
uses the new coloration for ...
Sébastien MARQUE authored on 2017-04-15
195
                            me.device.display.setSoftKeyColor(2, 1);
196
                            me.colored['PFDAOA/WINDWINDOPTN1'] = 1;
197
                            me.device.display.setSoftKeyColor(3, 0);
198
                            delete(me.colored, 'PFDAOA/WINDWINDOPTN2');
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
199
                        },
200
                        OPTN2 : func {
201
                            me.device.display._winddata_optn = 2;
202
                            me.device.display.screenElements['WindData'].show();
203
                            me.device.display.screenElements['WindData-OPTN1'].hide();
204
                            me.device.display.screenElements['WindData-OPTN2'].show();
205
                            me.device.display.screenElements['WindData-OPTN2-symbol'].show();
206
                            me.device.display.screenElements['WindData-OPTN2-headwind'].show();
207
                            me.device.display.screenElements['WindData-OPTN2-crosswind'].show();
208
                            me.device.display.updateWindData();
uses the new coloration for ...
Sébastien MARQUE authored on 2017-04-15
209
                            me.device.display.setSoftKeyColor(2, 0);
210
                            delete(me.colored, 'PFDAOA/WINDWINDOPTN1');
211
                            me.device.display.setSoftKeyColor(3, 1);
212
                            me.colored['PFDAOA/WINDWINDOPTN2'] = 1;
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
213
                        },
214
                        OFF : func {
215
                            me.device.display._winddata_optn = 0;
216
                            me.device.display.screenElements['WindData'].hide();
217
                            me.device.display.screenElements['WindData-OPTN1'].hide();
218
                            me.device.display.screenElements['WindData-OPTN2'].hide();
uses the new coloration for ...
Sébastien MARQUE authored on 2017-04-15
219
                            me.device.display.setSoftKeyColor(2, 0);
220
                            delete(me.colored, 'PFDAOA/WINDWINDOPTN1');
221
                            me.device.display.setSoftKeyColor(3, 0);
222
                            delete(me.colored, 'PFDAOA/WINDWINDOPTN2');
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
223
                        },
224
                    },
225
                },
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
226
                BRG1 : func (brg = 1){
227
                    var source = 'brg' ~ brg ~ '-source';
228
                    var list = ['NAV' ~ brg, 'GPS', 'ADF', 'OFF'];
229
                    var index = std.Vector
230
                                   .new(list)
231
                                   .index(radios.getNode(source).getValue());
232
                    var next = (index == size(list) -1) ?  0 : index + 1;
233
                    radios.getNode(source).setValue(list[next]);
uses the new coloration for ...
Sébastien MARQUE authored on 2017-04-15
234
                    if (list[next] != 'OFF') {
235
                        me.device.display.setSoftKeyColor(brg == 1 ? 4 : 6, 1);
236
                        me.colored['PFDBRG' ~ brg] = 1;
237
                    }
238
                    else {
239
                        me.device.display.setSoftKeyColor(brg == 1 ? 4 : 6, 0);
240
                        delete(me.colored, 'PFDBRG' ~ brg);
241
                    }
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
242
                },
243
                BRG2 : func {
244
                    call(me.bindings.PFD.PFD.BRG1, [ 2 ], me);
245
                },
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
246
                'STD BARO' : func {
247
                    setprop('/instrumentation/altimeter/setting-inhg', 29.92);
248
                    me.device.display.updateBARO();
249
                    pop(me.path);
250
                    me.device.display.updateSoftKeys();
251
                },
correct softkey entries for ...
Sébastien MARQUE authored on 2020-06-12
252
                'ALT UNIT' : {
253
                    IN :  func {
254
                        data.settings.units.pressure = 'inhg';
255
                        me.device.display.updateBARO();
256
                    },
257
                    HPA : func {
258
                        data.settings.units.pressure = 'hpa';
259
                        me.device.display.updateBARO();
260
                    },
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
261
                },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
262
            },
263
            XPDR: {
adds transponder
Sébastien MARQUE authored on 2017-03-17
264
                STBY : func {
265
                    setprop('/instrumentation/transponder/ident', 0);
266
                    setprop('/instrumentation/transponder/knob-mode', 1);
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
267
                    radios.setValue('xpdr-mode', 'STBY');
adds transponder
Sébastien MARQUE authored on 2017-03-17
268
                    me.device.display.updateXPDR();
269
                },
270
                ON : func {
271
                    setprop('/instrumentation/transponder/ident', 1);
272
                    setprop('/instrumentation/transponder/knob-mode', 4);
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
273
                    radios.setValue('xpdr-mode', 'ON');
adds transponder
Sébastien MARQUE authored on 2017-03-17
274
                    me.device.display.updateXPDR();
275
                },
276
                ALT : func {
277
                    setprop('/instrumentation/transponder/ident', 1);
278
                    setprop('/instrumentation/transponder/knob-mode', 5);
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
279
                    radios.setValue('xpdr-mode', 'ALT');
adds transponder
Sébastien MARQUE authored on 2017-03-17
280
                    me.device.display.updateXPDR();
281
                },
282
                VFR : func {
283
                    setprop('/instrumentation/transponder/id-code', '1200');
284
                    me.device.display.updateXPDR();
285
                },
286
                IDENT : func {
287
                    call(me.bindings.PFD.IDENT, [], me);
288
                },
289
                CODE : {
290
                    '0' : func (n = 0) {
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
291
                        if (radios.getValue('xpdr-tuning-fms-method'))
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
292
                            return;
old timers2 removed
Sébastien MARQUE authored on 2020-05-15
293
                        me.device.display.timers.softkeys_inactivity.stop();
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
294
                        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
295
                        # disable FMS knob entering method
296
                        me.device.knobs.FmsInner = void;
297
                        # When entering the code, the next softkey in sequence
298
                        # must be pressed within 10 seconds, or the entry is cancelled
299
                        # and restored to the previous code
300
                        if (!contains(me.bindings.PFD.XPDR.CODE, 'on_change_inactivity')) {
301
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity = maketimer(10,
302
                                func {
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
303
                                    radios.setValue('xpdr-tuning-digit', 3);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
304
                                    me.device.knobs.FmsInner = me.device.knobs.XPDRCodeSetDigits;
305
                                    me.device.knobs.FmsOuter = me.device.knobs.XPDRCodeNextDigits;
306
                                    call(me.bindings.PFD.XPDR.CODE.restore, [], me);
307
                                });
308
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.singleShot = 1;
309
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.start();
310
                        }
311
                        else
312
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10);
adds transponder
Sébastien MARQUE authored on 2017-03-17
313
                        var tuning = radios.getNode('xpdr-tuning-digit');
314
                        var d = tuning.getValue();
315
                        setprop('/instrumentation/transponder/inputs/digit[' ~ d ~ ']', n);
fix not able to set 4th digi...
Sébastien MARQUE authored on 2020-04-30
316
                        if (d == 0) {
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
317
                            if (!contains(me.bindings.PFD.XPDR.CODE, 'on_change_auto_validation'))
318
                                me.bindings.PFD.XPDR.CODE.on_change_auto_validation = maketimer(5,
319
                                    func call(me.bindings.PFD.IDENT, [], me));
320
                            me.bindings.PFD.XPDR.CODE.on_change_auto_validation.singleShot = 1;
321
                            me.bindings.PFD.XPDR.CODE.on_change_auto_validation.start();
322
                        }
323
                        else {
324
                            d -= 1;
325
                            tuning.setValue(d);
326
                        }
adds transponder
Sébastien MARQUE authored on 2017-03-17
327
                        me.device.display.updateXPDR();
328
                    },
329
                    '1' : func {
330
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 1 ], me);
331
                    },
332
                    '2' : func {
333
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 2 ], me);
334
                    },
335
                    '3' : func {
336
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 3 ], me);
337
                    },
338
                    '4' : func {
339
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 4 ], me);
340
                    },
341
                    '5' : func {
342
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 5 ], me);
343
                    },
344
                    '6' : func {
345
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 6 ], me);
346
                    },
347
                    '7' : func {
348
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 7 ], me);
349
                    },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
350
                    IDENT: func {
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
351
                        me.bindings.PFD.XPDR.CODE.inactivity.restart(me.device.display.softkeys_inactivity_delay);
old timers2 removed
Sébastien MARQUE authored on 2020-05-15
352
                        me.device.display.timers.softkeys_inactivity.restart(me.device.display.softkeys_inactivity_delay);
adds transponder
Sébastien MARQUE authored on 2017-03-17
353
                        call(me.bindings.PFD.IDENT, [], me);
354
                    },
355
                    BKSP: func {
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
356
                        if (radios.getValue('xpdr-tuning-fms-method'))
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
357
                            return;
358
                        if (contains(me.bindings.PFD.XPDR.CODE, 'on_change_inactivity'))
359
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10);
360
                        if (contains(me.bindings.PFD.XPDR.CODE, 'on_change_auto_validation'))
361
                                me.bindings.PFD.XPDR.CODE.on_change_auto_validation.stop();
adds transponder
Sébastien MARQUE authored on 2017-03-17
362
                        var tuning = radios.getNode('xpdr-tuning-digit');
363
                        var d = tuning.getValue();
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
364
                        if (d < 3) {
365
                            d += 1;
366
                            tuning.setValue(d);
367
                        }
adds transponder
Sébastien MARQUE authored on 2017-03-17
368
                        me.device.display.updateXPDR();
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
369
                    },
adds transponder
Sébastien MARQUE authored on 2017-03-17
370
                    BACK : func (inactive = 0) {
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
371
                        call(me.bindings.PFD.XPDR.CODE.restore, [], me);
adds transponder
Sébastien MARQUE authored on 2017-03-17
372
                        pop(me.path);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
373
                        call(me.bindings.PFD.XPDR.CODE.exit, [me.path], me);
374
                    },
375
                    restore : func {
376
                        setprop('/instrumentation/transponder/id-code',
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
377
                            sprintf('%s', radios.getValue('xpdr-backup-code')));
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
378
                        me.device.display.updateXPDR();
adds transponder
Sébastien MARQUE authored on 2017-03-17
379
                    },
380
                    exit : func (p) {
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
381
                        if (contains(me.bindings.PFD.XPDR.CODE, 'inactivity')) # does not exists if IDENT pressed from top-level
382
                            me.bindings.PFD.XPDR.CODE.inactivity.stop();
adds transponder
Sébastien MARQUE authored on 2017-03-17
383
                        radios.removeChild('xpdr-tuning-digit', 0);
384
                        radios.removeChild('xpdr-backup-code', 0);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
385
                        radios.removeChild('xpdr-tuning-fms-method', 0);
adds transponder
Sébastien MARQUE authored on 2017-03-17
386
                        me.path = p;
387
                        me.device.display.updateXPDR();
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
388
                        me.device.display.updateSoftKeys();
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
389
                        me.device.knobs.FmsInner = void;
390
                        me.device.knobs.FmsOuter = void;
old timers2 removed
Sébastien MARQUE authored on 2020-05-15
391
                        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
392
                    },
adds transponder
Sébastien MARQUE authored on 2017-03-17
393
                    hook : func {
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
394
                        # 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
395
                        me.device.display.timers.softkeys_inactivity.stop();
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
396
                        me.bindings.PFD.XPDR.CODE.inactivity = maketimer(
397
                            me.device.display.softkeys_inactivity_delay,
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
398
                            func call(me.bindings.PFD.XPDR.CODE.BACK, [], me));
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
399
                        me.bindings.PFD.XPDR.CODE.inactivity.singleShot = 1;
400
                        me.bindings.PFD.XPDR.CODE.inactivity.start();
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
401
                        var tuning = radios.getValue('xpdr-tuning-digit');
adds transponder
Sébastien MARQUE authored on 2017-03-17
402
                        if (tuning == nil) {
403
                            radios.getNode('xpdr-tuning-digit', 1).setValue(3);
404
                            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
405
                            radios.getNode('xpdr-tuning-fms-method', 1).setValue(0);
adds transponder
Sébastien MARQUE authored on 2017-03-17
406
                            me.device.display.updateXPDR();
407
                        }
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
408
                        me.device.knobs.FmsInner = me.device.knobs.XPDRCodeSetDigits;
409
                        me.device.knobs.FmsOuter = me.device.knobs.XPDRCodeNextDigits;
adds transponder
Sébastien MARQUE authored on 2017-03-17
410
                    },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
411
                },
adds transponder
Sébastien MARQUE authored on 2017-03-17
412
            },
413
            IDENT : func {
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
414
                if (radios.getValue('xpdr-mode') == 'STBY')
adds transponder
Sébastien MARQUE authored on 2017-03-17
415
                    return;
416
                setprop('/instrumentation/transponder/ident', 1);
417
                me.bindings.PFD.XPDR.ident = maketimer(18,
418
                        func {
419
                            setprop('/instrumentation/transponder/ident', 0);
420
                            me.device.display.updateXPDR();
421
                        });
422
                me.bindings.PFD.XPDR.ident.singleShot = 1;
423
                me.bindings.PFD.XPDR.ident.start();
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
424
                call(me.bindings.PFD.XPDR.CODE.exit, [], me);
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
425
            },
adds GPS OBS mode
Sébastien MARQUE authored on 2020-05-30
426
            OBS : func {
427
                if (cdi.getValue('source') != 'GPS')
428
                    return;
429
                var cmd  = props.globals.getNode('/instrumentation/gps/command');
430
                var mode = getprop('/instrumentation/gps/mode');
431
                if (mode == 'dto') mode = 'direct';
432
                if (mode != 'obs') {
433
                    data._previous_gps_mode = mode;
434
                    cmd.setValue('obs');
435
                    aliases.GPS.course = 'selected-course-deg';
436
                    setprop('/instrumentation/gps/selected-course-deg', int(getprop('/instrumentation/gps/desired-course-deg')));
437
                    me.colored['OBS'] = 1;
438
                }
439
                else {
440
                    cmd.setValue(data._previous_gps_mode);
441
                    delete(data, '_previous_gps_mode');
442
                    aliases.GPS.course = 'desired-course-deg';
443
                    me.colored['OBS'] = 0;
444
                }
445
                me.device.display.setSoftKeyColor(4, me.colored['OBS'], 1);
446
            },
adds CDI
Sébastien MARQUE authored on 2017-03-18
447
            CDI : func {
448
                var list = ['OFF'];
449
                if (getprop('/instrumentation/gps/route-distance-nm') != nil)
450
                    append(list, 'GPS');
451
                if (getprop('/instrumentation/nav/in-range') != nil)
452
                    append(list, 'NAV1');
453
                if (getprop('/instrumentation/nav[1]/in-range') != nil)
454
                    append(list, 'NAV2');
455
                var index = std.Vector
456
                               .new(list)
457
                               .index(cdi.getNode('source').getValue());
458
                var next = (index == size(list) -1) ?  0 : index + 1;
459
                cdi.getNode('source').setValue(list[next]);
460
                CDIfromSOURCE(list[next]);
461
                me.device.display.updateCDI();
462
            },
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
463
            'TMR/REF' : func {
464
                if (!contains(me.device.windows.state, 'TMR/REF')) {
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
465
                    var Vspeed_visiblity = func (id, selected, Vspeed)
466
                        me.device.data[Vspeed ~ '-visible'] =
467
                            me.device.windows.state[id].objects[selected].text
468
                            ==
469
                            me.device.windows.state[id].objects[selected].choices[0];
470
                    var GenericTimer = func (id, selected) {
471
                        var action = me.device.windows.state[id].objects[selected].text;
472
                        if (action == 'START?') {
473
                            me.device.data.TMRrevert = 0;
474
                            me.device.data.TMRlast = getprop('/sim/time/elapsed-sec') - 1;
475
                            me.device.data.TMRreset = me.device.windows.state[id].objects[selected - 2].text;
476
                            me.device.data.TMRtimer = maketimer(1, func {
477
                                    var (hh, mm, ss) = split(':',
478
                                            me.device.windows.state[id].objects[selected - 2].text);
479
                                    var direction = -1;
480
                                    if ((me.device.windows.state[id].objects[selected - 1].text
481
                                            ==
482
                                        me.device.windows.state[id].objects[selected - 1].choices[0])
483
                                    or me.device.data.TMRrevert)
484
                                        direction = 1;
485
                                    var now = getprop('/sim/time/elapsed-sec');
486
                                    var dt = int(now - me.device.data.TMRlast) * direction;
487
                                    me.device.data.TMRlast = now;
488
                                    var val = HMS(hh, mm, ss, dt);
489
                                    me.device.windows.state[id].objects[selected - 2].text = val;
490
                                    me.device.windows.window[id ~ '-' ~ (selected -2)]
491
                                        .setText(val);
492
                                    if (val == '00:00:00' and direction == -1)
493
                                        me.device.data.TMRrevert = 1;
494
                                }, me);
495
                            me.device.data.TMRtimer.start();
496
                            action = 'STOP?';
497
                        }
498
                        elsif (action == 'STOP?') {
499
                            me.device.data.TMRtimer.stop();
500
                            action = 'RESET?';
501
                        }
502
                        elsif (action == 'RESET?') {
503
                            action = 'START?';
504
                            if ((me.device.windows.state[id].objects[selected - 1].text
505
                                        ==
506
                                me.device.windows.state[id].objects[selected - 1].choices[1])
507
                            and !me.device.data.TMRrevert)
508
                                var val = me.device.data.TMRreset;
509
                            else
510
                                var val = '00:00:00';
511
                            me.device.windows.state[id].objects[selected - 2].text = val;
512
                            me.device.windows.window[id ~ '-' ~ (selected -2)]
513
                                .setText(val);
514
                        }
515
                        me.device.windows.window[me.device.windows.selected]
516
                            .setText(action);
517
                        me.device.windows.state[id].objects[selected].text = action;
518
                    };
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
519
                    me.device.windows.draw(
520
                        'TMR/REF',
521
                        {x: 720, y: 535, w: 300, l: 5, sep: 3},
TMR/REF window adaptation
Sébastien MARQUE authored on 2017-04-02
522
                        [ # objects infos
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
523
                            {text: 'REFERENCES', type: 'title'},
524
                            {type: 'separator'},
525
                            {text: 'TIMER', type: 'normal'},
526
                            {text: '00:00:00', type: 'selected|time', },
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
527
                            {text: '  UP >', type: 'editable', choices: ['  UP >', '<DOWN ']},
528
                            {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
529
                            {type: 'separator'},
fix non-set values
Sébastien MARQUE authored on 2020-04-27
530
                            {text: sprintf('Vx     %3iKT',
531
                                            alerts.getNode('Vx') != nil ? alerts.getValue('Vx') : 0), type: 'normal', scrollgroup:0},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
532
                            {text: me.device.data['Vx-visible'] ? '   ON >' : '< OFF  ', type: 'editable|immediate|end-of-line', choices: ['   ON >', '< OFF  '], scrollgroup:0, callback: func (id, selected) Vspeed_visiblity(id, selected, 'Vx')},
fix non-set values
Sébastien MARQUE authored on 2020-04-27
533
                            {text: sprintf('Vy     %3iKT',
534
                                            alerts.getNode('Vy') != nil ? alerts.getValue('Vy') : 0), type: 'normal', scrollgroup:1},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
535
                            {text: me.device.data['Vy-visible'] ? '   ON >' : '< OFF  ', type: 'editable|immediate|end-of-line', choices: ['   ON >', '< OFF  '], scrollgroup:1, callback: func (id, selected) Vspeed_visiblity(id, selected, 'Vy')},
fix non-set values
Sébastien MARQUE authored on 2020-04-27
536
                            {text: sprintf('Vr     %3iKT',
537
                                            alerts.getNode('Vr') != nil ? alerts.getValue('Vr') : 0), type: 'normal', scrollgroup:2},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
538
                            {text: me.device.data['Vr-visible'] ? '   ON >' : '< OFF  ', type: 'editable|immediate|end-of-line', choices: ['   ON >', '< OFF  '], scrollgroup:2, callback: func (id, selected) Vspeed_visiblity(id, selected, 'Vr')},
fix non-set values
Sébastien MARQUE authored on 2020-04-27
539
                            {text: sprintf('Vglide %3iKT',
540
                                            alerts.getNode('Vglide') != nil ? alerts.getValue('Vglide') : 0), type: 'normal', scrollgroup:3},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
541
                            {text: me.device.data['Vglide-visible'] ? '   ON >' : '< OFF  ', type: 'editable|immediate|end-of-line', choices: ['   ON >', '< OFF  '], scrollgroup:3, callback: func (id, selected) Vspeed_visiblity(id, selected, 'Vglide')},
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
542
                            {type: 'separator'},
543
                            {text: 'MINIMUMS', type: 'normal'},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
544
                            {text: '   OFF   >', type: 'editable', choices: ['   OFF   >', '<  BARO  >','<TEMP COMP'], callback: func},
TMR/REF window adaptation
Sébastien MARQUE authored on 2017-04-02
545
                            {text: ' 1000FT', type: 'editable', format: '% 5iFT', factor: 100, callback: func},
546
                        ],
547
                        { # scrolling info, see menu.nas
548
                            lines : 3,
549
                            columns : 2,
550
                        }
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
551
                    );
552
                    me.device.knobs.FmsInner = me.device.knobs.MenuSettings;
553
                    me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
554
                    me.device.buttons.ENT = me.device.buttons.ValidateTMRREF;
555
                    me.device.buttons.FMS = me.device.buttons.ValidateTMRREF;
556
                    me.device.buttons.CLR = me.device.buttons.ClearTMRREF;
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
557
                }
558
                else {
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
559
                    me.device.buttons.ClearTMRREF();
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
560
                }
561
            },
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
562
            NRST: {
563
                _displayNearest: func (type, where) {
564
                    var id = 'PFD NRST';
565
                    me.device.display.updateSoftKeys();
566
                    me.device.windows.del(id);
567
                    var results = [];
568
                    var list = [];
569
                    if (type == 'apt') {
570
                        results = findAirportsWithinRange(100);
571
                    }
572
                    else {
573
                        results = findNavaidsWithinRange(100, type);
574
                    }
simplifies NRST code
Sébastien MARQUE authored on 2020-05-18
575
                    var norm_360 = func (a) return math.periodic(0, 360, a);
576
                    if    (where == 'OMNI')  var side = -1;
577
                    elsif (where == 'FRONT') var side = norm_360(data.hdg);
578
                    elsif (where == 'RIGHT') var side = norm_360(data.hdg + 90);
579
                    elsif (where == 'LEFT')  var side = norm_360(data.hdg - 90);
580
                    elsif (where == 'REAR')  var side = norm_360(data.hdg + 180);
581
                    foreach (var n; results) {
582
                        var (course, dist) = courseAndDistance(n);
583
                        if (side > -1) {
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
584
                            var angle = 180 - abs(abs(course - side) - 180);
simplifies NRST code
Sébastien MARQUE authored on 2020-05-18
585
                            if (angle > 50)
586
                                continue;
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
587
                        }
simplifies NRST code
Sébastien MARQUE authored on 2020-05-18
588
                        append(list, [n, course, dist]);
589
                        if (size(list) == 5)
590
                            break;
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
591
                    }
592
                    var obj_infos = [
593
                        { text: sprintf('NEAREST %s (%s)', string.uc(type), where), type: 'title' },
594
                        { type: 'separator' }
595
                    ];
596
                    var firstEntry = 1;
597
                    foreach (var n; list) {
598
                        append(obj_infos, {
599
                            text: sprintf('%s (%s)', n[0].id, n[0].name),
600
                            type: (firstEntry ? 'selected' : 'editable') ~ '|end-of-line',
601
                            dto: n[0],
602
                        });
adds NAV freq if VOR selecte...
Sébastien MARQUE authored on 2020-05-18
603
                        if (type == 'vor') {
604
                            var idx = size(obj_infos) - 1;
605
                            obj_infos[idx]._freq = n[0].frequency;
606
                            obj_infos[idx].callback = func (id, selected) radios.getNode('nav-freq-mhz').setValue(me.device.windows.state[id].objects[selected]._freq / 100);
607
                        }
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
608
                        append(obj_infos, {
609
                            text: sprintf('%s %03i° %3iNM', utf8.chstr(9658), n[1], n[2]),
610
                            type: 'normal|end-of-line'
611
                        });
612
                        firstEntry = 0;
613
                    }
614
                    me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
615
                    me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
616
                    me.device.buttons.ENT    = me.device.buttons.ValidateTMRREF;
617
                    me.device.buttons.CLR = func {
618
                        me.device.windows.del(id);
619
                        me.device.knobs.FmsOuter = func;
620
                        me.device.knobs.FmsInner = func;
fix MENU issue
Sébastien MARQUE authored on 2020-05-23
621
                        me.device.buttons.MENU = me.device.buttons.GlobalParams;
622
                        foreach (var b; ['ENT', 'CLR'])
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
623
                            me.device.buttons[b] = func;
624
                    }
fix MENU issue
Sébastien MARQUE authored on 2020-05-23
625
                    me.device.buttons.MENU = func;
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
626
                    me.device.windows.draw( id, {autogeom: 1}, obj_infos );
627
                },
adds NRST/COMMS
Sébastien MARQUE authored on 2020-05-18
628
                _displayNearestCOMM: func (where) {
629
                    var id = 'PFD NRST';
630
                    me.device.display.updateSoftKeys();
631
                    me.device.windows.del(id);
632
                    var results = [];
633
                    var ATIS_list = [];
634
                    var TRAFFIC_list = [];
635
                    var TWR_list = [];
636
                    results = findAirportsWithinRange(100);
637
                    var norm_360 = func (a) return math.periodic(0, 360, a);
638
                    if    (where == 'OMNI')  var side = -1;
639
                    elsif (where == 'FRONT') var side = norm_360(data.hdg);
640
                    elsif (where == 'RIGHT') var side = norm_360(data.hdg + 90);
641
                    elsif (where == 'LEFT')  var side = norm_360(data.hdg - 90);
642
                    elsif (where == 'REAR')  var side = norm_360(data.hdg + 180);
643
                    foreach (var r; results) {
644
                        var (course, dist) = courseAndDistance(r);
645
                        if (side > -1) {
646
                            var bearing = 180 - abs(abs(course - side) - 180);
647
                            if (bearing > 50)
648
                                continue;
649
                        }
650
                        foreach (var c; r.comms()) {
651
                            if (size(ATIS_list) < 4
652
                            and (string.match(c.ident, '*ATIS*') or string.match(c.ident, '*A[SW]OS*')))
653
                                append(ATIS_list, [r.id, c.frequency, course, dist]);
654

            
655
                            if (size(TWR_list) < 4
656
                            and string.match(c.ident, '*TWR*'))
657
                                append(TWR_list, [r.id, c.frequency, course, dist]);
658

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

            
806
                    var groupIndex     = me.device.windows.state[id].objects[selected].groupIndex;
807
                    var checklistIndex = me.device.windows.state[id].objects[selected].checklistIndex;
808

            
809
                    if (contains(me.device.windows.state[id].objects[selected], 'pageIndex'))
810
                        pageIndex = me.device.windows.state[id].objects[selected].pageIndex;
811
                    else
812
                        pageIndex = -1;
813

            
814
                    var title = '';
815
                    if (contains(me.device.windows.state[id].objects[selected], 'checklistTitle'))
816
                        title = me.device.windows.state[id].objects[selected].checklistTitle;
817
                    else
818
                        title = me.device.windows.state[id].objects[selected].text;
819

            
820
                    me.device.windows.del(id);
821

            
822
                    if (groupIndex < 0)
823
                         checklistNode = props.globals.getNode("/sim/checklists")
824
                                    .getChild('checklist', checklistIndex);
825
                    else
826
                         checklistNode = props.globals.getNode("/sim/checklists")
827
                                    .getChild("group", groupIndex)
828
                                    .getChild('checklist', checklistIndex);
829

            
830
                    var pages = checklistNode.getChildren('page');
831

            
832
                    if (size(pages) and pageIndex == -1)
833
                        pageIndex = 0;
834

            
835
                    _previous_text = ' < PREVIOUS ';
836
                    _next_text     = ' NEXT > ';
837

            
838
                    var obj_infos = [];
839
                    var length = size(_previous_text ~ _next_text);
840
                    var length_cache = [];
841
                    if (size(pages))
842
                        checklistNode = pages[pageIndex];
843

            
844
                    append(obj_infos, {
845
                        text: sprintf('%s%s',
846
                                      title,
847
                                      size(pages) > 1 ? sprintf(' %d / %d',
848
                                                                pageIndex + 1,
849
                                                                size(pages)) : ''),
850
                        type: 'title'
851
                    });
852

            
853
                    append(obj_infos, {type: 'separator'});
854

            
855
                    forindex (var i; checklistNode.getChildren('item')) {
856
                        var l = size(checklistNode.getChild('item', i).getValue('name'));
857
                        if (checklistNode.getChild('item', i).getChild('value') != nil)
858
                            l += size(checklistNode.getChild('item', i).getValue('value'));
859
                        append(length_cache, l);
860
                        if (l > length)
861
                            length = l;
862
                    }
863

            
864
                    forindex (var i; checklistNode.getChildren('item')) {
865
                        var text = pages[pageIndex].getChild('item', i).getValue('name');
866
                        var item_val = '';
867
                        if (pages[pageIndex].getChild('item', i).getChild('value') != nil)
868
                            item_val = pages[pageIndex].getChild('item', i).getValue('value');
869
                        if (item_val != '')
870
                            text ~= tabulate(length, length_cache[i]);
871
                        text ~= item_val;
872

            
873
                        append(obj_infos, {
874
                            text: text,
875
                            groupIndex: groupIndex,
876
                            checklistIndex: checklistIndex,
877
                            pageIndex: pageIndex,
878
                            type: 'normal|end-of-line'
879
                        });
880
                    }
881

            
882
                    append(obj_infos, {type: 'separator'});
883

            
884
                    if (pageIndex and size(pages))
885
                        append(obj_infos, {
886
                                text: _previous_text,
887
                                groupIndex: groupIndex,
888
                                checklistIndex: checklistIndex,
889
                                pageIndex: pageIndex - 1,
890
                                checklistTitle: title,
891
                                type: (pageIndex + 1 < size(pages)) ? 'editable' : 'selected',
892
                                callback: func (id, selected) call(me.device.softkeys.bindings.MFD.CHKLIST._showCheckList, [id, selected], me)
893
                        });
894
                    else
895
                        append(obj_infos, {
896
                            text: tabulate(length, size(_next_text), 0, ' '),
897
                            type: 'normal'
898
                        });
899

            
900
                    if (pageIndex + 1 < size(pages)) {
901
                        if (pageIndex and size(pages))
902
                            append(obj_infos, {
903
                                text: tabulate(length, size(_previous_text ~ _next_text), 0, ' '),
904
                                type: 'normal',
905
                            });
906
                        append(obj_infos, {
907
                                text: _next_text,
908
                                groupIndex: groupIndex,
909
                                checklistIndex: checklistIndex,
910
                                pageIndex: pageIndex + 1,
911
                                checklistTitle: title,
912
                                type: 'selected|end-of-line',
913
                                callback: func (id, selected) call(me.device.softkeys.bindings.MFD.CHKLIST._showCheckList, [id, selected], me)
914
                        });
915
                    }
916

            
917
                    me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
918
                    me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
919
                    me.device.buttons.ENT    = me.device.buttons.ValidateTMRREF;
920
                    me.device.buttons.CLR = func {
921
                        me.device.windows.del(id);
922
                        me.device.knobs.FmsOuter = func;
923
                        me.device.knobs.FmsInner = func;
924
                        foreach (var b; ['ENT', 'CLR'])
925
                            me.device.buttons[b] = func;
926
                        me.device.buttons.MENU = func;
927
                    }
928
                    me.device.windows.draw( id, {autogeom: 1}, obj_infos );
929
                },
930
                LIST: func {
931
                    # nested function as checklist lists may be organized by group
932
                    var listChecklists = func (id, selected) {
933
                        var groupIndex = me.device.windows.state[id].objects[selected].groupIndex;
934

            
935
                        me.device.windows.del(id);
936

            
937
                        var checklists = [];
938
                        var firstEntry = 1;
939
                        if (groupIndex == -1)
940
                            checklists = props.globals.getNode("/sim/checklists")
941
                                            .getChildren('checklist');
942
                        else
943
                            checklists = props.globals.getNode("/sim/checklists")
944
                                            .getChild("group", groupIndex)
945
                                            .getChildren('checklist');
946
                        var checklistsQty = size(checklists);
947
                        var obj_infos = [];
948

            
949
                        if (checklistsQty) {
950
                            forindex (var c; checklists) {
951
                                if (string.uc(checklists[c].getValue('title')) == 'EMERGENCY') {
952
                                    checklistsQty -= 1;
953
                                    continue;
954
                                }
955
                                var title = checklists[c].getValue('title');
956
                                append(obj_infos, {
957
                                    text: title,
958
                                    groupIndex: groupIndex,
959
                                    checklistIndex: c,
960
                                    checklistTitle: title,
961
                                    type: (firstEntry ? 'selected' : 'editable') ~ '|end-of-line',
962
                                    callback: func (id, selected) call(me.device.softkeys.bindings.MFD.CHKLIST._showCheckList, [id, selected], me)
963
                                });
964
                                if (checklistsQty == 1) { # see comments below for groups
965
                                    call(me.device.softkeys.bindings.MFD.CHKLIST._showCheckList, [groupIndex, 0], me);
966
                                    return;
967
                                }
968
                                elsif (checklistsQty == 0)
969
                                    return;
970
                                firstEntry = 0;
971
                            }
972
                        }
973

            
974
                        id ~= ' CHECKLISTS';
975
                        me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
976
                        me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
977
                        me.device.buttons.ENT    = me.device.buttons.ValidateTMRREF;
978
                        me.device.buttons.CLR = func {
979
                            me.device.windows.del(id);
980
                            me.device.knobs.FmsOuter = func;
981
                            me.device.knobs.FmsInner = func;
982
                            foreach (var b; ['ENT', 'CLR'])
983
                                me.device.buttons[b] = func;
984
                            me.device.buttons.MENU = func;
985
                        }
986
                        me.device.windows.draw(id, {autogeom: 1}, obj_infos);
987
                    }
988

            
989
                    var windowId = 'CHKLIST LIST';
990
                    if (contains(me.device.windows.state, windowId))
991
                        me.device.windows.del(windowId);
992

            
993
                    var obj_infos = [];
994
                    var firstEntry = 1;
995
                    var groups = props.globals.getNode("/sim/checklists").getChildren("group");
996
                    var groupsQty = size(groups);
997

            
998
                    if (groupsQty) {
999
                        forindex (var g; groups) {
1000
                            # emergency checklists are listed in their own menu
1001
                            if (string.uc(groups[g].getValue('name')) == 'EMERGENCY') {
1002
                                groupsQty -= 1;
1003
                                continue;
1004
                            }
1005
                            # the key groupIndex isn't used by the display system
1006
                            # we use it to keep the information of group node's index
1007
                            append(obj_infos, {
1008
                                text: groups[g].getValue('name'),
1009
                                groupIndex: g,
1010
                                type: (firstEntry ? 'selected' : 'editable') ~ '|end-of-line',
1011
                                callback: func (id, selected) listChecklists(id, selected) });
1012
                            firstEntry = 0;
1013
                            # if there are only one group left, let display it directly
1014
                            if (groupsQty == 1) {
1015
                                listChecklists(windowId, 0);
1016
                                return;
1017
                            }
1018
                            elsif (groupsQty == 0) {
1019
                                return;
1020
                            }
1021
                        }
1022
                    }
1023
                    else {
1024
                        listChecklists(windowId, -1);
1025
                        return;
1026
                    }
1027

            
1028
                    me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
1029
                    me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
1030
                    me.device.buttons.ENT    = me.device.buttons.ValidateTMRREF;
1031
                    me.device.buttons.CLR = func {
1032
                        me.device.windows.del(windowId);
1033
                        me.device.knobs.FmsOuter = func;
1034
                        me.device.knobs.FmsInner = func;
1035
                        foreach (var b; ['ENT', 'CLR'])
1036
                            me.device.buttons[b] = func;
1037
                        me.device.buttons.MENU = func;
1038
                    }
1039
                    me.device.windows.draw(windowId, {autogeom: 1}, obj_infos);
1040
                },
1041
                EMERGCY: func {
1042
                    # nested function as checklist lists may be organized by group
1043
                    var listChecklists = func (groupIndex) {
1044
                        var checklists = [];
1045
                        var firstEntry = 1;
1046
                        if (groupIndex == -1)
1047
                            checklists = props.globals.getNode("/sim/checklists")
1048
                                            .getChildren('checklist');
1049
                        else
1050
                            checklists = props.globals.getNode("/sim/checklists")
1051
                                            .getChild("group", groupIndex)
1052
                                            .getChildren('checklist');
1053
                        var checklistsQty = size(checklists);
1054
                        var obj_infos = [];
1055
                        var firstEntry = 1;
1056

            
1057
                        if (checklistsQty) {
1058
                            forindex (var c; checklists) {
1059
                                if (groupIndex < 0 and string.uc(checklists[c].getValue('title')) != 'EMERGENCY') {
1060
                                    checklistsQty -= 1;
1061
                                    continue;
1062
                                }
1063
                                append(obj_infos, {
1064
                                    text: checklists[c].getValue('title'),
1065
                                    groupIndex: groupIndex,
1066
                                    checklistIndex: c,
1067
                                    type: (firstEntry ? 'selected' : 'editable') ~ '|end-of-line',
1068
                                    callback: func (id, selected) call(me.device.softkeys.bindings.MFD.CHKLIST._showCheckList, [id, selected], me)
1069
                                });
1070
                                firstEntry = 0;
1071
                            }
1072
                        }
1073
                        id = 'EMERGENCY CHECKLISTS';
1074
                        me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
1075
                        me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
1076
                        me.device.buttons.ENT    = me.device.buttons.ValidateTMRREF;
1077
                        me.device.buttons.CLR = func {
1078
                            me.device.windows.del(id);
1079
                            me.device.knobs.FmsOuter = func;
1080
                            me.device.knobs.FmsInner = func;
1081
                            foreach (var b; ['ENT', 'CLR'])
1082
                                me.device.buttons[b] = func;
1083
                            me.device.buttons.MENU = func;
1084
                        }
1085
                        me.device.windows.draw(id, {autogeom: 1}, obj_infos);
1086
                        if (checklistsQty == 1) { # see comments below for groups
1087
                            call(me.device.softkeys.bindings.MFD.CHKLIST._showCheckList, [groupIndex, 0], me);
1088
                            return;
1089
                        }
1090
                        elsif (checklistsQty == 0)
1091
                            call(me.device.buttons.CLR, [0], me);
1092
                            return;
1093
                    }
1094

            
1095
                    var windowId = 'CHKLIST EMERGCY';
1096
                    if (contains(me.device.windows.state, windowId))
1097
                        me.device.windows.del(windowId);
1098

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

            
1101
                    var emergency_group_found = 0;
1102
                    if (size(groups)) {
1103
                        forindex (var g; groups) {
1104
                            # emergency checklists are listed in their own menu
1105
                            # we support only one emergency checklists group named EMERGENCY (case insensitive)
1106
                            if (string.uc(groups[g].getValue('name')) != 'EMERGENCY')
1107
                                continue;
1108
                            listChecklists(g);
1109
                            emergency_group_found = !emergency_group_found;
1110
                            break;
1111
                        }
1112
                    }
1113

            
1114
                    if (!emergency_group_found)
1115
                        listChecklists(-1);
1116
                },
add missing exit to MFD/CHKL...
Sébastien MARQUE authored on 2017-03-20
1117
                EXIT: func {
1118
                    me.path = [];
1119
                    me.device.display.updateSoftKeys();
1120
                },
1121
            },
add TCAS
Sébastien MARQUE authored on 2017-12-21
1122
            MAP: {
1123
                TRAFFIC: func {
improve the selection of dis...
Sébastien MARQUE authored on 2017-12-30
1124
                    call(me.bindings.PFD.INSET.declutter, ['MAPTRAFFIC', 'tcas', 0], me);
1125
                },
1126
                ROUTE: func {
1127
                    call(me.bindings.PFD.INSET.declutter, ['MAPROUTE', 'route', 1], me);
1128
                },
1129
                TERRAIN: func {
1130
                    call(me.bindings.PFD.INSET.declutter, ['MAPTERRAIN', 'tiles', 3], me);
1131
                },
1132
                NAVAIDS: {
1133
                    ALL: func {
1134
                        call(me.bindings.PFD.INSET.NAVAIDS.ALL, [ 'MAPNAVAIDS' ], me);
1135
                    },
1136
                    VOR: func {
1137
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['MAPNAVAIDSVOR', 'VOR', 2], me);
1138
                    },
1139
                    TACAN: func {
1140
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['MAPNAVAIDSTACAN', 'TACAN', 3], me);
1141
                    },
1142
                    NDB: func {
1143
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['MAPNAVAIDSNDB', 'NDB', 4], me);
1144
                    },
1145
                    DME: func {
1146
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['MAPNAVAIDSDME', 'DME', 5], me);
1147
                    },
1148
                    APT: func {
1149
                        call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['MAPNAVAIDSAPT', 'airport', 6], me);
1150
                    },
add TCAS
Sébastien MARQUE authored on 2017-12-21
1151
                },
1152
            },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
1153
        },
commit initial
Sébastien MARQUE authored on 2017-03-07
1154
    },
1155
};
massive code reorganisation ...
Sébastien MARQUE authored on 2017-05-01
1156

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