zkv1000 / Nasal / softkeys.nas /
Newer Older
1252 lines | 66.507kb
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 Vspeed_visiblity = func (id, selected, Vspeed)
463
                        me.device.data[Vspeed ~ '-visible'] =
464
                            me.device.windows.state[id].objects[selected].text
465
                            ==
466
                            me.device.windows.state[id].objects[selected].choices[0];
467
                    var GenericTimer = func (id, selected) {
468
                        var action = me.device.windows.state[id].objects[selected].text;
469
                        if (action == 'START?') {
470
                            me.device.data.TMRrevert = 0;
471
                            me.device.data.TMRlast = getprop('/sim/time/elapsed-sec') - 1;
472
                            me.device.data.TMRreset = me.device.windows.state[id].objects[selected - 2].text;
473
                            me.device.data.TMRtimer = maketimer(1, func {
474
                                    var (hh, mm, ss) = split(':',
475
                                            me.device.windows.state[id].objects[selected - 2].text);
476
                                    var direction = -1;
477
                                    if ((me.device.windows.state[id].objects[selected - 1].text
478
                                            ==
479
                                        me.device.windows.state[id].objects[selected - 1].choices[0])
480
                                    or me.device.data.TMRrevert)
481
                                        direction = 1;
482
                                    var now = getprop('/sim/time/elapsed-sec');
483
                                    var dt = int(now - me.device.data.TMRlast) * direction;
484
                                    me.device.data.TMRlast = now;
485
                                    var val = HMS(hh, mm, ss, dt);
486
                                    me.device.windows.state[id].objects[selected - 2].text = val;
487
                                    me.device.windows.window[id ~ '-' ~ (selected -2)]
488
                                        .setText(val);
489
                                    if (val == '00:00:00' and direction == -1)
490
                                        me.device.data.TMRrevert = 1;
491
                                }, me);
492
                            me.device.data.TMRtimer.start();
493
                            action = 'STOP?';
494
                        }
495
                        elsif (action == 'STOP?') {
496
                            me.device.data.TMRtimer.stop();
497
                            action = 'RESET?';
498
                        }
499
                        elsif (action == 'RESET?') {
500
                            action = 'START?';
501
                            if ((me.device.windows.state[id].objects[selected - 1].text
502
                                        ==
503
                                me.device.windows.state[id].objects[selected - 1].choices[1])
504
                            and !me.device.data.TMRrevert)
505
                                var val = me.device.data.TMRreset;
506
                            else
507
                                var val = '00:00:00';
508
                            me.device.windows.state[id].objects[selected - 2].text = val;
509
                            me.device.windows.window[id ~ '-' ~ (selected -2)]
510
                                .setText(val);
511
                        }
512
                        me.device.windows.window[me.device.windows.selected]
513
                            .setText(action);
514
                        me.device.windows.state[id].objects[selected].text = action;
515
                    };
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
516
                    me.device.windows.draw(
517
                        'TMR/REF',
518
                        {x: 720, y: 535, w: 300, l: 5, sep: 3},
TMR/REF window adaptation
Sébastien MARQUE authored on 2017-04-02
519
                        [ # objects infos
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
520
                            {text: 'REFERENCES', type: 'title'},
521
                            {type: 'separator'},
522
                            {text: 'TIMER', type: 'normal'},
523
                            {text: '00:00:00', type: 'selected|time', },
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
524
                            {text: '  UP >', type: 'editable', choices: ['  UP >', '<DOWN ']},
525
                            {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
526
                            {type: 'separator'},
fix non-set values
Sébastien MARQUE authored on 2020-04-27
527
                            {text: sprintf('Vx     %3iKT',
528
                                            alerts.getNode('Vx') != nil ? alerts.getValue('Vx') : 0), type: 'normal', scrollgroup:0},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
529
                            {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
530
                            {text: sprintf('Vy     %3iKT',
531
                                            alerts.getNode('Vy') != nil ? alerts.getValue('Vy') : 0), type: 'normal', scrollgroup:1},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
532
                            {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
533
                            {text: sprintf('Vr     %3iKT',
534
                                            alerts.getNode('Vr') != nil ? alerts.getValue('Vr') : 0), type: 'normal', scrollgroup:2},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
535
                            {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
536
                            {text: sprintf('Vglide %3iKT',
537
                                            alerts.getNode('Vglide') != nil ? alerts.getValue('Vglide') : 0), type: 'normal', scrollgroup:3},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
538
                            {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
539
                            {type: 'separator'},
540
                            {text: 'MINIMUMS', type: 'normal'},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
541
                            {text: '   OFF   >', type: 'editable', choices: ['   OFF   >', '<  BARO  >','<TEMP COMP'], callback: func},
TMR/REF window adaptation
Sébastien MARQUE authored on 2017-04-02
542
                            {text: ' 1000FT', type: 'editable', format: '% 5iFT', factor: 100, callback: func},
543
                        ],
544
                        { # scrolling info, see menu.nas
545
                            lines : 3,
546
                            columns : 2,
547
                        }
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
548
                    );
549
                    me.device.knobs.FmsInner = me.device.knobs.MenuSettings;
550
                    me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
551
                    me.device.buttons.ENT = me.device.buttons.ValidateTMRREF;
552
                    me.device.buttons.FMS = me.device.buttons.ValidateTMRREF;
553
                    me.device.buttons.CLR = me.device.buttons.ClearTMRREF;
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
554
                }
555
                else {
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
556
                    me.device.buttons.ClearTMRREF();
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
557
                }
558
            },
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
559
            NRST: {
560
                _displayNearest: func (type, where) {
561
                    var id = 'PFD NRST';
562
                    me.device.display.updateSoftKeys();
563
                    me.device.windows.del(id);
564
                    var results = [];
565
                    var list = [];
566
                    if (type == 'apt') {
567
                        results = findAirportsWithinRange(100);
568
                    }
569
                    else {
570
                        results = findNavaidsWithinRange(100, type);
571
                    }
simplifies NRST code
Sébastien MARQUE authored on 2020-05-18
572
                    var norm_360 = func (a) return math.periodic(0, 360, a);
573
                    if    (where == 'OMNI')  var side = -1;
574
                    elsif (where == 'FRONT') var side = norm_360(data.hdg);
575
                    elsif (where == 'RIGHT') var side = norm_360(data.hdg + 90);
576
                    elsif (where == 'LEFT')  var side = norm_360(data.hdg - 90);
577
                    elsif (where == 'REAR')  var side = norm_360(data.hdg + 180);
578
                    foreach (var n; results) {
579
                        var (course, dist) = courseAndDistance(n);
580
                        if (side > -1) {
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
581
                            var angle = 180 - abs(abs(course - side) - 180);
simplifies NRST code
Sébastien MARQUE authored on 2020-05-18
582
                            if (angle > 50)
583
                                continue;
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
584
                        }
simplifies NRST code
Sébastien MARQUE authored on 2020-05-18
585
                        append(list, [n, course, dist]);
586
                        if (size(list) == 5)
587
                            break;
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
588
                    }
589
                    var obj_infos = [
590
                        { text: sprintf('NEAREST %s (%s)', string.uc(type), where), type: 'title' },
591
                        { type: 'separator' }
592
                    ];
593
                    var firstEntry = 1;
594
                    foreach (var n; list) {
595
                        append(obj_infos, {
596
                            text: sprintf('%s (%s)', n[0].id, n[0].name),
597
                            type: (firstEntry ? 'selected' : 'editable') ~ '|end-of-line',
598
                            dto: n[0],
599
                        });
adds NAV freq if VOR selecte...
Sébastien MARQUE authored on 2020-05-18
600
                        if (type == 'vor') {
601
                            var idx = size(obj_infos) - 1;
602
                            obj_infos[idx]._freq = n[0].frequency;
603
                            obj_infos[idx].callback = func (id, selected) radios.getNode('nav-freq-mhz').setValue(me.device.windows.state[id].objects[selected]._freq / 100);
604
                        }
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
605
                        append(obj_infos, {
606
                            text: sprintf('%s %03i° %3iNM', utf8.chstr(9658), n[1], n[2]),
607
                            type: 'normal|end-of-line'
608
                        });
609
                        firstEntry = 0;
610
                    }
611
                    me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
612
                    me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
613
                    me.device.buttons.ENT    = me.device.buttons.ValidateTMRREF;
614
                    me.device.buttons.CLR = func {
615
                        me.device.windows.del(id);
616
                        me.device.knobs.FmsOuter = func;
617
                        me.device.knobs.FmsInner = func;
fix MENU issue
Sébastien MARQUE authored on 2020-05-23
618
                        me.device.buttons.MENU = me.device.buttons.GlobalParams;
619
                        foreach (var b; ['ENT', 'CLR'])
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
620
                            me.device.buttons[b] = func;
621
                    }
fix MENU issue
Sébastien MARQUE authored on 2020-05-23
622
                    me.device.buttons.MENU = func;
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
623
                    me.device.windows.draw( id, {autogeom: 1}, obj_infos );
624
                },
adds NRST/COMMS
Sébastien MARQUE authored on 2020-05-18
625
                _displayNearestCOMM: func (where) {
626
                    var id = 'PFD NRST';
627
                    me.device.display.updateSoftKeys();
628
                    me.device.windows.del(id);
629
                    var results = [];
630
                    var ATIS_list = [];
631
                    var TRAFFIC_list = [];
632
                    var TWR_list = [];
633
                    results = findAirportsWithinRange(100);
634
                    var norm_360 = func (a) return math.periodic(0, 360, a);
635
                    if    (where == 'OMNI')  var side = -1;
636
                    elsif (where == 'FRONT') var side = norm_360(data.hdg);
637
                    elsif (where == 'RIGHT') var side = norm_360(data.hdg + 90);
638
                    elsif (where == 'LEFT')  var side = norm_360(data.hdg - 90);
639
                    elsif (where == 'REAR')  var side = norm_360(data.hdg + 180);
640
                    foreach (var r; results) {
641
                        var (course, dist) = courseAndDistance(r);
642
                        if (side > -1) {
643
                            var bearing = 180 - abs(abs(course - side) - 180);
644
                            if (bearing > 50)
645
                                continue;
646
                        }
647
                        foreach (var c; r.comms()) {
648
                            if (size(ATIS_list) < 4
649
                            and (string.match(c.ident, '*ATIS*') or string.match(c.ident, '*A[SW]OS*')))
650
                                append(ATIS_list, [r.id, c.frequency, course, dist]);
651

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

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

            
803
                    var groupIndex     = me.device.windows.state[id].objects[selected].groupIndex;
804
                    var checklistIndex = me.device.windows.state[id].objects[selected].checklistIndex;
805

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

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

            
817
                    me.device.windows.del(id);
818

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

            
827
                    var pages = checklistNode.getChildren('page');
828

            
829
                    if (size(pages) and pageIndex == -1)
830
                        pageIndex = 0;
831

            
832
                    _previous_text = ' < PREVIOUS ';
833
                    _next_text     = ' NEXT > ';
834

            
835
                    var obj_infos = [];
836
                    var length = size(_previous_text ~ _next_text);
837
                    var length_cache = [];
838
                    if (size(pages))
839
                        checklistNode = pages[pageIndex];
840

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

            
850
                    append(obj_infos, {type: 'separator'});
851

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

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

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

            
879
                    append(obj_infos, {type: 'separator'});
880

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

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

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

            
932
                        me.device.windows.del(id);
933

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

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

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

            
986
                    var windowId = 'CHKLIST LIST';
987
                    if (contains(me.device.windows.state, windowId))
988
                        me.device.windows.del(windowId);
989

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

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

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

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

            
1092
                    var windowId = 'CHKLIST EMERGCY';
1093
                    if (contains(me.device.windows.state, windowId))
1094
                        me.device.windows.del(windowId);
1095

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

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

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

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