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

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

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

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

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

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

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

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

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

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

            
830
                    var groupIndex     = me.device.windows.state[id].objects[selected].groupIndex;
831
                    var checklistIndex = me.device.windows.state[id].objects[selected].checklistIndex;
832

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

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

            
844
                    me.device.windows.del(id);
845

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

            
854
                    var pages = checklistNode.getChildren('page');
855

            
856
                    if (size(pages) and pageIndex == -1)
857
                        pageIndex = 0;
858

            
859
                    _previous_text = ' < PREVIOUS ';
860
                    _next_text     = ' NEXT > ';
861

            
862
                    var obj_infos = [];
863
                    var length = size(_previous_text ~ _next_text);
864
                    var length_cache = [];
865
                    if (size(pages))
866
                        checklistNode = pages[pageIndex];
867

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

            
877
                    append(obj_infos, {type: 'separator'});
878

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

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

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

            
906
                    append(obj_infos, {type: 'separator'});
907

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

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

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

            
959
                        me.device.windows.del(id);
960

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

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

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

            
1013
                    var windowId = 'CHKLIST LIST';
1014
                    if (contains(me.device.windows.state, windowId))
1015
                        me.device.windows.del(windowId);
1016

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

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

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

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

            
1119
                    var windowId = 'CHKLIST EMERGCY';
1120
                    if (contains(me.device.windows.state, windowId))
1121
                        me.device.windows.del(windowId);
1122

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

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

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

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