zkv1000 / Nasal / softkeys.nas /
Newer Older
1253 lines | 66.579kb
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
                },
252
                IN :  func {
253
                    me.device.display._baro_unit = 'inhg';
254
                    me.device.display.updateBARO();
255
                },
256
                HPA : func {
257
                    me.device.display._baro_unit = 'hpa';
258
                    me.device.display.updateBARO();
259
                },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
260
            },
261
            XPDR: {
adds transponder
Sébastien MARQUE authored on 2017-03-17
262
                STBY : func {
263
                    setprop('/instrumentation/transponder/ident', 0);
264
                    setprop('/instrumentation/transponder/knob-mode', 1);
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
265
                    radios.setValue('xpdr-mode', 'STBY');
adds transponder
Sébastien MARQUE authored on 2017-03-17
266
                    me.device.display.updateXPDR();
267
                },
268
                ON : func {
269
                    setprop('/instrumentation/transponder/ident', 1);
270
                    setprop('/instrumentation/transponder/knob-mode', 4);
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
271
                    radios.setValue('xpdr-mode', 'ON');
adds transponder
Sébastien MARQUE authored on 2017-03-17
272
                    me.device.display.updateXPDR();
273
                },
274
                ALT : func {
275
                    setprop('/instrumentation/transponder/ident', 1);
276
                    setprop('/instrumentation/transponder/knob-mode', 5);
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
277
                    radios.setValue('xpdr-mode', 'ALT');
adds transponder
Sébastien MARQUE authored on 2017-03-17
278
                    me.device.display.updateXPDR();
279
                },
280
                VFR : func {
281
                    setprop('/instrumentation/transponder/id-code', '1200');
282
                    me.device.display.updateXPDR();
283
                },
284
                IDENT : func {
285
                    call(me.bindings.PFD.IDENT, [], me);
286
                },
287
                CODE : {
288
                    '0' : func (n = 0) {
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
289
                        if (radios.getValue('xpdr-tuning-fms-method'))
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
290
                            return;
old timers2 removed
Sébastien MARQUE authored on 2020-05-15
291
                        me.device.display.timers.softkeys_inactivity.stop();
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
292
                        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
293
                        # disable FMS knob entering method
294
                        me.device.knobs.FmsInner = void;
295
                        # When entering the code, the next softkey in sequence
296
                        # must be pressed within 10 seconds, or the entry is cancelled
297
                        # and restored to the previous code
298
                        if (!contains(me.bindings.PFD.XPDR.CODE, 'on_change_inactivity')) {
299
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity = maketimer(10,
300
                                func {
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
301
                                    radios.setValue('xpdr-tuning-digit', 3);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
302
                                    me.device.knobs.FmsInner = me.device.knobs.XPDRCodeSetDigits;
303
                                    me.device.knobs.FmsOuter = me.device.knobs.XPDRCodeNextDigits;
304
                                    call(me.bindings.PFD.XPDR.CODE.restore, [], me);
305
                                });
306
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.singleShot = 1;
307
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.start();
308
                        }
309
                        else
310
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10);
adds transponder
Sébastien MARQUE authored on 2017-03-17
311
                        var tuning = radios.getNode('xpdr-tuning-digit');
312
                        var d = tuning.getValue();
313
                        setprop('/instrumentation/transponder/inputs/digit[' ~ d ~ ']', n);
fix not able to set 4th digi...
Sébastien MARQUE authored on 2020-04-30
314
                        if (d == 0) {
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
315
                            if (!contains(me.bindings.PFD.XPDR.CODE, 'on_change_auto_validation'))
316
                                me.bindings.PFD.XPDR.CODE.on_change_auto_validation = maketimer(5,
317
                                    func call(me.bindings.PFD.IDENT, [], me));
318
                            me.bindings.PFD.XPDR.CODE.on_change_auto_validation.singleShot = 1;
319
                            me.bindings.PFD.XPDR.CODE.on_change_auto_validation.start();
320
                        }
321
                        else {
322
                            d -= 1;
323
                            tuning.setValue(d);
324
                        }
adds transponder
Sébastien MARQUE authored on 2017-03-17
325
                        me.device.display.updateXPDR();
326
                    },
327
                    '1' : func {
328
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 1 ], me);
329
                    },
330
                    '2' : func {
331
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 2 ], me);
332
                    },
333
                    '3' : func {
334
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 3 ], me);
335
                    },
336
                    '4' : func {
337
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 4 ], me);
338
                    },
339
                    '5' : func {
340
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 5 ], me);
341
                    },
342
                    '6' : func {
343
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 6 ], me);
344
                    },
345
                    '7' : func {
346
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 7 ], me);
347
                    },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
348
                    IDENT: func {
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
349
                        me.bindings.PFD.XPDR.CODE.inactivity.restart(me.device.display.softkeys_inactivity_delay);
old timers2 removed
Sébastien MARQUE authored on 2020-05-15
350
                        me.device.display.timers.softkeys_inactivity.restart(me.device.display.softkeys_inactivity_delay);
adds transponder
Sébastien MARQUE authored on 2017-03-17
351
                        call(me.bindings.PFD.IDENT, [], me);
352
                    },
353
                    BKSP: func {
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
354
                        if (radios.getValue('xpdr-tuning-fms-method'))
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
355
                            return;
356
                        if (contains(me.bindings.PFD.XPDR.CODE, 'on_change_inactivity'))
357
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10);
358
                        if (contains(me.bindings.PFD.XPDR.CODE, 'on_change_auto_validation'))
359
                                me.bindings.PFD.XPDR.CODE.on_change_auto_validation.stop();
adds transponder
Sébastien MARQUE authored on 2017-03-17
360
                        var tuning = radios.getNode('xpdr-tuning-digit');
361
                        var d = tuning.getValue();
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
362
                        if (d < 3) {
363
                            d += 1;
364
                            tuning.setValue(d);
365
                        }
adds transponder
Sébastien MARQUE authored on 2017-03-17
366
                        me.device.display.updateXPDR();
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
367
                    },
adds transponder
Sébastien MARQUE authored on 2017-03-17
368
                    BACK : func (inactive = 0) {
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
369
                        call(me.bindings.PFD.XPDR.CODE.restore, [], me);
adds transponder
Sébastien MARQUE authored on 2017-03-17
370
                        pop(me.path);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
371
                        call(me.bindings.PFD.XPDR.CODE.exit, [me.path], me);
372
                    },
373
                    restore : func {
374
                        setprop('/instrumentation/transponder/id-code',
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
375
                            sprintf('%s', radios.getValue('xpdr-backup-code')));
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
376
                        me.device.display.updateXPDR();
adds transponder
Sébastien MARQUE authored on 2017-03-17
377
                    },
378
                    exit : func (p) {
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
379
                        if (contains(me.bindings.PFD.XPDR.CODE, 'inactivity')) # does not exists if IDENT pressed from top-level
380
                            me.bindings.PFD.XPDR.CODE.inactivity.stop();
adds transponder
Sébastien MARQUE authored on 2017-03-17
381
                        radios.removeChild('xpdr-tuning-digit', 0);
382
                        radios.removeChild('xpdr-backup-code', 0);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
383
                        radios.removeChild('xpdr-tuning-fms-method', 0);
adds transponder
Sébastien MARQUE authored on 2017-03-17
384
                        me.path = p;
385
                        me.device.display.updateXPDR();
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
386
                        me.device.display.updateSoftKeys();
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
387
                        me.device.knobs.FmsInner = void;
388
                        me.device.knobs.FmsOuter = void;
old timers2 removed
Sébastien MARQUE authored on 2020-05-15
389
                        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
390
                    },
adds transponder
Sébastien MARQUE authored on 2017-03-17
391
                    hook : func {
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
392
                        # 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
393
                        me.device.display.timers.softkeys_inactivity.stop();
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
394
                        me.bindings.PFD.XPDR.CODE.inactivity = maketimer(
395
                            me.device.display.softkeys_inactivity_delay,
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
396
                            func call(me.bindings.PFD.XPDR.CODE.BACK, [], me));
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
397
                        me.bindings.PFD.XPDR.CODE.inactivity.singleShot = 1;
398
                        me.bindings.PFD.XPDR.CODE.inactivity.start();
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
399
                        var tuning = radios.getValue('xpdr-tuning-digit');
adds transponder
Sébastien MARQUE authored on 2017-03-17
400
                        if (tuning == nil) {
401
                            radios.getNode('xpdr-tuning-digit', 1).setValue(3);
402
                            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
403
                            radios.getNode('xpdr-tuning-fms-method', 1).setValue(0);
adds transponder
Sébastien MARQUE authored on 2017-03-17
404
                            me.device.display.updateXPDR();
405
                        }
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
406
                        me.device.knobs.FmsInner = me.device.knobs.XPDRCodeSetDigits;
407
                        me.device.knobs.FmsOuter = me.device.knobs.XPDRCodeNextDigits;
adds transponder
Sébastien MARQUE authored on 2017-03-17
408
                    },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
409
                },
adds transponder
Sébastien MARQUE authored on 2017-03-17
410
            },
411
            IDENT : func {
remove hardcoded properties ...
Sébastien MARQUE authored on 2020-04-27
412
                if (radios.getValue('xpdr-mode') == 'STBY')
adds transponder
Sébastien MARQUE authored on 2017-03-17
413
                    return;
414
                setprop('/instrumentation/transponder/ident', 1);
415
                me.bindings.PFD.XPDR.ident = maketimer(18,
416
                        func {
417
                            setprop('/instrumentation/transponder/ident', 0);
418
                            me.device.display.updateXPDR();
419
                        });
420
                me.bindings.PFD.XPDR.ident.singleShot = 1;
421
                me.bindings.PFD.XPDR.ident.start();
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
422
                call(me.bindings.PFD.XPDR.CODE.exit, [], me);
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
423
            },
adds GPS OBS mode
Sébastien MARQUE authored on 2020-05-30
424
            OBS : func {
425
                if (cdi.getValue('source') != 'GPS')
426
                    return;
427
                var cmd  = props.globals.getNode('/instrumentation/gps/command');
428
                var mode = getprop('/instrumentation/gps/mode');
429
                if (mode == 'dto') mode = 'direct';
430
                if (mode != 'obs') {
431
                    data._previous_gps_mode = mode;
432
                    cmd.setValue('obs');
433
                    aliases.GPS.course = 'selected-course-deg';
434
                    setprop('/instrumentation/gps/selected-course-deg', int(getprop('/instrumentation/gps/desired-course-deg')));
435
                    me.colored['OBS'] = 1;
436
                }
437
                else {
438
                    cmd.setValue(data._previous_gps_mode);
439
                    delete(data, '_previous_gps_mode');
440
                    aliases.GPS.course = 'desired-course-deg';
441
                    me.colored['OBS'] = 0;
442
                }
443
                me.device.display.setSoftKeyColor(4, me.colored['OBS'], 1);
444
            },
adds CDI
Sébastien MARQUE authored on 2017-03-18
445
            CDI : func {
446
                var list = ['OFF'];
447
                if (getprop('/instrumentation/gps/route-distance-nm') != nil)
448
                    append(list, 'GPS');
449
                if (getprop('/instrumentation/nav/in-range') != nil)
450
                    append(list, 'NAV1');
451
                if (getprop('/instrumentation/nav[1]/in-range') != nil)
452
                    append(list, 'NAV2');
453
                var index = std.Vector
454
                               .new(list)
455
                               .index(cdi.getNode('source').getValue());
456
                var next = (index == size(list) -1) ?  0 : index + 1;
457
                cdi.getNode('source').setValue(list[next]);
458
                CDIfromSOURCE(list[next]);
459
                me.device.display.updateCDI();
460
            },
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
461
            'TMR/REF' : func {
462
                if (!contains(me.device.windows.state, 'TMR/REF')) {
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
463
                    var Vspeed_visiblity = func (id, selected, Vspeed)
464
                        me.device.data[Vspeed ~ '-visible'] =
465
                            me.device.windows.state[id].objects[selected].text
466
                            ==
467
                            me.device.windows.state[id].objects[selected].choices[0];
468
                    var GenericTimer = func (id, selected) {
469
                        var action = me.device.windows.state[id].objects[selected].text;
470
                        if (action == 'START?') {
471
                            me.device.data.TMRrevert = 0;
472
                            me.device.data.TMRlast = getprop('/sim/time/elapsed-sec') - 1;
473
                            me.device.data.TMRreset = me.device.windows.state[id].objects[selected - 2].text;
474
                            me.device.data.TMRtimer = maketimer(1, func {
475
                                    var (hh, mm, ss) = split(':',
476
                                            me.device.windows.state[id].objects[selected - 2].text);
477
                                    var direction = -1;
478
                                    if ((me.device.windows.state[id].objects[selected - 1].text
479
                                            ==
480
                                        me.device.windows.state[id].objects[selected - 1].choices[0])
481
                                    or me.device.data.TMRrevert)
482
                                        direction = 1;
483
                                    var now = getprop('/sim/time/elapsed-sec');
484
                                    var dt = int(now - me.device.data.TMRlast) * direction;
485
                                    me.device.data.TMRlast = now;
486
                                    var val = HMS(hh, mm, ss, dt);
487
                                    me.device.windows.state[id].objects[selected - 2].text = val;
488
                                    me.device.windows.window[id ~ '-' ~ (selected -2)]
489
                                        .setText(val);
490
                                    if (val == '00:00:00' and direction == -1)
491
                                        me.device.data.TMRrevert = 1;
492
                                }, me);
493
                            me.device.data.TMRtimer.start();
494
                            action = 'STOP?';
495
                        }
496
                        elsif (action == 'STOP?') {
497
                            me.device.data.TMRtimer.stop();
498
                            action = 'RESET?';
499
                        }
500
                        elsif (action == 'RESET?') {
501
                            action = 'START?';
502
                            if ((me.device.windows.state[id].objects[selected - 1].text
503
                                        ==
504
                                me.device.windows.state[id].objects[selected - 1].choices[1])
505
                            and !me.device.data.TMRrevert)
506
                                var val = me.device.data.TMRreset;
507
                            else
508
                                var val = '00:00:00';
509
                            me.device.windows.state[id].objects[selected - 2].text = val;
510
                            me.device.windows.window[id ~ '-' ~ (selected -2)]
511
                                .setText(val);
512
                        }
513
                        me.device.windows.window[me.device.windows.selected]
514
                            .setText(action);
515
                        me.device.windows.state[id].objects[selected].text = action;
516
                    };
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
517
                    me.device.windows.draw(
518
                        'TMR/REF',
519
                        {x: 720, y: 535, w: 300, l: 5, sep: 3},
TMR/REF window adaptation
Sébastien MARQUE authored on 2017-04-02
520
                        [ # objects infos
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
521
                            {text: 'REFERENCES', type: 'title'},
522
                            {type: 'separator'},
523
                            {text: 'TIMER', type: 'normal'},
524
                            {text: '00:00:00', type: 'selected|time', },
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
525
                            {text: '  UP >', type: 'editable', choices: ['  UP >', '<DOWN ']},
526
                            {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
527
                            {type: 'separator'},
fix non-set values
Sébastien MARQUE authored on 2020-04-27
528
                            {text: sprintf('Vx     %3iKT',
529
                                            alerts.getNode('Vx') != nil ? alerts.getValue('Vx') : 0), type: 'normal', scrollgroup:0},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
530
                            {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
531
                            {text: sprintf('Vy     %3iKT',
532
                                            alerts.getNode('Vy') != nil ? alerts.getValue('Vy') : 0), type: 'normal', scrollgroup:1},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
533
                            {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
534
                            {text: sprintf('Vr     %3iKT',
535
                                            alerts.getNode('Vr') != nil ? alerts.getValue('Vr') : 0), type: 'normal', scrollgroup:2},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
536
                            {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
537
                            {text: sprintf('Vglide %3iKT',
538
                                            alerts.getNode('Vglide') != nil ? alerts.getValue('Vglide') : 0), type: 'normal', scrollgroup:3},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
539
                            {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
540
                            {type: 'separator'},
541
                            {text: 'MINIMUMS', type: 'normal'},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
542
                            {text: '   OFF   >', type: 'editable', choices: ['   OFF   >', '<  BARO  >','<TEMP COMP'], callback: func},
TMR/REF window adaptation
Sébastien MARQUE authored on 2017-04-02
543
                            {text: ' 1000FT', type: 'editable', format: '% 5iFT', factor: 100, callback: func},
544
                        ],
545
                        { # scrolling info, see menu.nas
546
                            lines : 3,
547
                            columns : 2,
548
                        }
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
549
                    );
550
                    me.device.knobs.FmsInner = me.device.knobs.MenuSettings;
551
                    me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
552
                    me.device.buttons.ENT = me.device.buttons.ValidateTMRREF;
553
                    me.device.buttons.FMS = me.device.buttons.ValidateTMRREF;
554
                    me.device.buttons.CLR = me.device.buttons.ClearTMRREF;
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
555
                }
556
                else {
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
557
                    me.device.buttons.ClearTMRREF();
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
558
                }
559
            },
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
560
            NRST: {
561
                _displayNearest: func (type, where) {
562
                    var id = 'PFD NRST';
563
                    me.device.display.updateSoftKeys();
564
                    me.device.windows.del(id);
565
                    var results = [];
566
                    var list = [];
567
                    if (type == 'apt') {
568
                        results = findAirportsWithinRange(100);
569
                    }
570
                    else {
571
                        results = findNavaidsWithinRange(100, type);
572
                    }
simplifies NRST code
Sébastien MARQUE authored on 2020-05-18
573
                    var norm_360 = func (a) return math.periodic(0, 360, a);
574
                    if    (where == 'OMNI')  var side = -1;
575
                    elsif (where == 'FRONT') var side = norm_360(data.hdg);
576
                    elsif (where == 'RIGHT') var side = norm_360(data.hdg + 90);
577
                    elsif (where == 'LEFT')  var side = norm_360(data.hdg - 90);
578
                    elsif (where == 'REAR')  var side = norm_360(data.hdg + 180);
579
                    foreach (var n; results) {
580
                        var (course, dist) = courseAndDistance(n);
581
                        if (side > -1) {
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
582
                            var angle = 180 - abs(abs(course - side) - 180);
simplifies NRST code
Sébastien MARQUE authored on 2020-05-18
583
                            if (angle > 50)
584
                                continue;
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
585
                        }
simplifies NRST code
Sébastien MARQUE authored on 2020-05-18
586
                        append(list, [n, course, dist]);
587
                        if (size(list) == 5)
588
                            break;
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
589
                    }
590
                    var obj_infos = [
591
                        { text: sprintf('NEAREST %s (%s)', string.uc(type), where), type: 'title' },
592
                        { type: 'separator' }
593
                    ];
594
                    var firstEntry = 1;
595
                    foreach (var n; list) {
596
                        append(obj_infos, {
597
                            text: sprintf('%s (%s)', n[0].id, n[0].name),
598
                            type: (firstEntry ? 'selected' : 'editable') ~ '|end-of-line',
599
                            dto: n[0],
600
                        });
adds NAV freq if VOR selecte...
Sébastien MARQUE authored on 2020-05-18
601
                        if (type == 'vor') {
602
                            var idx = size(obj_infos) - 1;
603
                            obj_infos[idx]._freq = n[0].frequency;
604
                            obj_infos[idx].callback = func (id, selected) radios.getNode('nav-freq-mhz').setValue(me.device.windows.state[id].objects[selected]._freq / 100);
605
                        }
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
606
                        append(obj_infos, {
607
                            text: sprintf('%s %03i° %3iNM', utf8.chstr(9658), n[1], n[2]),
608
                            type: 'normal|end-of-line'
609
                        });
610
                        firstEntry = 0;
611
                    }
612
                    me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
613
                    me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
614
                    me.device.buttons.ENT    = me.device.buttons.ValidateTMRREF;
615
                    me.device.buttons.CLR = func {
616
                        me.device.windows.del(id);
617
                        me.device.knobs.FmsOuter = func;
618
                        me.device.knobs.FmsInner = func;
fix MENU issue
Sébastien MARQUE authored on 2020-05-23
619
                        me.device.buttons.MENU = me.device.buttons.GlobalParams;
620
                        foreach (var b; ['ENT', 'CLR'])
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
621
                            me.device.buttons[b] = func;
622
                    }
fix MENU issue
Sébastien MARQUE authored on 2020-05-23
623
                    me.device.buttons.MENU = func;
add PFD/NRST softkey
Sébastien MARQUE authored on 2020-05-16
624
                    me.device.windows.draw( id, {autogeom: 1}, obj_infos );
625
                },
adds NRST/COMMS
Sébastien MARQUE authored on 2020-05-18
626
                _displayNearestCOMM: func (where) {
627
                    var id = 'PFD NRST';
628
                    me.device.display.updateSoftKeys();
629
                    me.device.windows.del(id);
630
                    var results = [];
631
                    var ATIS_list = [];
632
                    var TRAFFIC_list = [];
633
                    var TWR_list = [];
634
                    results = findAirportsWithinRange(100);
635
                    var norm_360 = func (a) return math.periodic(0, 360, a);
636
                    if    (where == 'OMNI')  var side = -1;
637
                    elsif (where == 'FRONT') var side = norm_360(data.hdg);
638
                    elsif (where == 'RIGHT') var side = norm_360(data.hdg + 90);
639
                    elsif (where == 'LEFT')  var side = norm_360(data.hdg - 90);
640
                    elsif (where == 'REAR')  var side = norm_360(data.hdg + 180);
641
                    foreach (var r; results) {
642
                        var (course, dist) = courseAndDistance(r);
643
                        if (side > -1) {
644
                            var bearing = 180 - abs(abs(course - side) - 180);
645
                            if (bearing > 50)
646
                                continue;
647
                        }
648
                        foreach (var c; r.comms()) {
649
                            if (size(ATIS_list) < 4
650
                            and (string.match(c.ident, '*ATIS*') or string.match(c.ident, '*A[SW]OS*')))
651
                                append(ATIS_list, [r.id, c.frequency, course, dist]);
652

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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