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

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

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

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

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

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

            
56
    bindings : {
57
        PFD : {
58
            INSET: {
59
                OFF: func {
60
                    pop(me.path);
61
                    me.device.display.updateSoftKeys();
62
                },
63
            },
64
            PFD: {
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
65
                'AOA/WIND' : {
adds AOA display
Sébastien MARQUE authored on 2017-04-15
66
                    AOA : {
67
                        'AOA ON' : func {
68
                            if (me.device.data['aoa-auto'])
69
                                return;
70
                            me.device.data.aoa = ! me.device.data.aoa;
71
                            me.device.display.screenElements['AOA']
72
                                .setVisible(me.device.data.aoa);
73
                            me.device.display.screenElements['AOA-needle']
74
                                .setVisible(me.device.data.aoa);
75
                            me.device.display.updateAOA();
76
                            me.device.display.setSoftKeyColor(5 ,me.device.data.aoa);
77
                            if (me.device.data.aoa)
78
                                me.colored['PFDAOA/WINDAOAAOA ON'] = 1;
79
                            else
80
                                delete(me.colored, 'PFDAOA/WINDAOAAOA ON');
81
                        },
82
                        'AOA AUTO' : func {
83
                            if (me.device.data.aoa)
84
                                return;
85
                            me.device.data['aoa-auto'] = ! me.device.data['aoa-auto'];
86
                            me.device.display.setSoftKeyColor(6 ,me.device.data['aoa-auto']);
87
                            if (me.device.data['aoa-auto']) {
88
                                me.colored['PFDAOA/WINDAOAAOA AUTO'] = 1;
89
                                if (!contains(me.device.timers, 'aoa'))
90
                                    me.device.timers.aoa = maketimer(1,
91
                                            func {
92
                                                var v = getprop('/gear/gear/position-norm') == 1
93
                                                    and getprop('/surfaces-positions/flap-pos-norm') != 0;
94
                                                me.device.display.screenElements['AOA']
95
                                                    .setVisible(v);
96
                                                me.device.display.screenElements['AOA-needle']
97
                                                    .setVisible(v);
98
                                            }, me);
99
                                me.device.timers.aoa.start();
100
                            }
101
                            else {
102
                                delete(me.colored, 'PFDAOA/WINDAOAAOA AUTO');
103
                                me.device.timers.aoa.stop();
104
                                me.device.data.aoa = 0;
105
                                me.device.display.screenElements['AOA']
106
                                    .hide();
107
                            }
108
                        },
109
                    },
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
110
                    WIND : {
111
                        OPTN1 : func {
112
                            me.device.display._winddata_optn = 1;
113
                            me.device.display.screenElements['WindData'].show();
114
                            me.device.display.screenElements['WindData-OPTN1'].show();
115
                            me.device.display.screenElements['WindData-OPTN1-HDG'].show();
116
                            me.device.display.screenElements['WindData-OPTN2'].hide();
117
                            me.device.display.updateWindData();
uses the new coloration for ...
Sébastien MARQUE authored on 2017-04-15
118
                            me.device.display.setSoftKeyColor(2, 1);
119
                            me.colored['PFDAOA/WINDWINDOPTN1'] = 1;
120
                            me.device.display.setSoftKeyColor(3, 0);
121
                            delete(me.colored, 'PFDAOA/WINDWINDOPTN2');
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
122
                        },
123
                        OPTN2 : func {
124
                            me.device.display._winddata_optn = 2;
125
                            me.device.display.screenElements['WindData'].show();
126
                            me.device.display.screenElements['WindData-OPTN1'].hide();
127
                            me.device.display.screenElements['WindData-OPTN2'].show();
128
                            me.device.display.screenElements['WindData-OPTN2-symbol'].show();
129
                            me.device.display.screenElements['WindData-OPTN2-headwind'].show();
130
                            me.device.display.screenElements['WindData-OPTN2-crosswind'].show();
131
                            me.device.display.updateWindData();
uses the new coloration for ...
Sébastien MARQUE authored on 2017-04-15
132
                            me.device.display.setSoftKeyColor(2, 0);
133
                            delete(me.colored, 'PFDAOA/WINDWINDOPTN1');
134
                            me.device.display.setSoftKeyColor(3, 1);
135
                            me.colored['PFDAOA/WINDWINDOPTN2'] = 1;
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
136
                        },
137
                        OFF : func {
138
                            me.device.display._winddata_optn = 0;
139
                            me.device.display.screenElements['WindData'].hide();
140
                            me.device.display.screenElements['WindData-OPTN1'].hide();
141
                            me.device.display.screenElements['WindData-OPTN2'].hide();
uses the new coloration for ...
Sébastien MARQUE authored on 2017-04-15
142
                            me.device.display.setSoftKeyColor(2, 0);
143
                            delete(me.colored, 'PFDAOA/WINDWINDOPTN1');
144
                            me.device.display.setSoftKeyColor(3, 0);
145
                            delete(me.colored, 'PFDAOA/WINDWINDOPTN2');
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
146
                        },
147
                    },
148
                },
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
149
                BRG1 : func (brg = 1){
150
                    var source = 'brg' ~ brg ~ '-source';
151
                    var list = ['NAV' ~ brg, 'GPS', 'ADF', 'OFF'];
152
                    var index = std.Vector
153
                                   .new(list)
154
                                   .index(radios.getNode(source).getValue());
155
                    var next = (index == size(list) -1) ?  0 : index + 1;
156
                    radios.getNode(source).setValue(list[next]);
uses the new coloration for ...
Sébastien MARQUE authored on 2017-04-15
157
                    if (list[next] != 'OFF') {
158
                        me.device.display.setSoftKeyColor(brg == 1 ? 4 : 6, 1);
159
                        me.colored['PFDBRG' ~ brg] = 1;
160
                    }
161
                    else {
162
                        me.device.display.setSoftKeyColor(brg == 1 ? 4 : 6, 0);
163
                        delete(me.colored, 'PFDBRG' ~ brg);
164
                    }
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
165
                },
166
                BRG2 : func {
167
                    call(me.bindings.PFD.PFD.BRG1, [ 2 ], me);
168
                },
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
169
                'STD BARO' : func {
170
                    setprop('/instrumentation/altimeter/setting-inhg', 29.92);
171
                    me.device.display.updateBARO();
172
                    pop(me.path);
173
                    me.device.display.updateSoftKeys();
174
                },
175
                IN :  func {
176
                    me.device.display._baro_unit = 'inhg';
177
                    me.device.display.updateBARO();
178
                },
179
                HPA : func {
180
                    me.device.display._baro_unit = 'hpa';
181
                    me.device.display.updateBARO();
182
                },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
183
            },
184
            XPDR: {
adds transponder
Sébastien MARQUE authored on 2017-03-17
185
                STBY : func {
186
                    setprop('/instrumentation/transponder/ident', 0);
187
                    setprop('/instrumentation/transponder/knob-mode', 1);
188
                    setprop('/instrumentation/zkv1000/radio/xpdr-mode', 'STBY');
189
                    me.device.display.updateXPDR();
190
                },
191
                ON : func {
192
                    setprop('/instrumentation/transponder/ident', 1);
193
                    setprop('/instrumentation/transponder/knob-mode', 4);
194
                    setprop('/instrumentation/zkv1000/radio/xpdr-mode', 'ON');
195
                    me.device.display.updateXPDR();
196
                },
197
                ALT : func {
198
                    setprop('/instrumentation/transponder/ident', 1);
199
                    setprop('/instrumentation/transponder/knob-mode', 5);
200
                    setprop('/instrumentation/zkv1000/radio/xpdr-mode', 'ALT');
201
                    me.device.display.updateXPDR();
202
                },
203
                VFR : func {
204
                    setprop('/instrumentation/transponder/id-code', '1200');
205
                    me.device.display.updateXPDR();
206
                },
207
                IDENT : func {
208
                    call(me.bindings.PFD.IDENT, [], me);
209
                },
210
                CODE : {
211
                    '0' : func (n = 0) {
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
212
                        if (getprop('/instrumentation/zkv1000/radios/xpdr-tuning-fms-method'))
213
                            return;
214
                        me.device.display.timers2.softkeys_inactivity.stop();
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
215
                        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
216
                        # disable FMS knob entering method
217
                        me.device.knobs.FmsInner = void;
218
                        # When entering the code, the next softkey in sequence
219
                        # must be pressed within 10 seconds, or the entry is cancelled
220
                        # and restored to the previous code
221
                        if (!contains(me.bindings.PFD.XPDR.CODE, 'on_change_inactivity')) {
222
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity = maketimer(10,
223
                                func {
224
                                    setprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit', 3);
225
                                    me.device.knobs.FmsInner = me.device.knobs.XPDRCodeSetDigits;
226
                                    me.device.knobs.FmsOuter = me.device.knobs.XPDRCodeNextDigits;
227
                                    call(me.bindings.PFD.XPDR.CODE.restore, [], me);
228
                                });
229
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.singleShot = 1;
230
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.start();
231
                        }
232
                        else
233
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10);
adds transponder
Sébastien MARQUE authored on 2017-03-17
234
                        var tuning = radios.getNode('xpdr-tuning-digit');
235
                        var d = tuning.getValue();
236
                        setprop('/instrumentation/transponder/inputs/digit[' ~ d ~ ']', n);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
237
                        if (d == 1) {
238
                            if (!contains(me.bindings.PFD.XPDR.CODE, 'on_change_auto_validation'))
239
                                me.bindings.PFD.XPDR.CODE.on_change_auto_validation = maketimer(5,
240
                                    func call(me.bindings.PFD.IDENT, [], me));
241
                            me.bindings.PFD.XPDR.CODE.on_change_auto_validation.singleShot = 1;
242
                            me.bindings.PFD.XPDR.CODE.on_change_auto_validation.start();
243
                        }
244
                        else {
245
                            d -= 1;
246
                            tuning.setValue(d);
247
                        }
adds transponder
Sébastien MARQUE authored on 2017-03-17
248
                        me.device.display.updateXPDR();
249
                    },
250
                    '1' : func {
251
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 1 ], me);
252
                    },
253
                    '2' : func {
254
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 2 ], me);
255
                    },
256
                    '3' : func {
257
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 3 ], me);
258
                    },
259
                    '4' : func {
260
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 4 ], me);
261
                    },
262
                    '5' : func {
263
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 5 ], me);
264
                    },
265
                    '6' : func {
266
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 6 ], me);
267
                    },
268
                    '7' : func {
269
                        call(me.bindings.PFD.XPDR.CODE['0'], [ 7 ], me);
270
                    },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
271
                    IDENT: func {
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
272
                        me.bindings.PFD.XPDR.CODE.inactivity.restart(me.device.display.softkeys_inactivity_delay);
273
                        me.device.display.timers2.softkeys_inactivity.restart(me.device.display.softkeys_inactivity_delay);
adds transponder
Sébastien MARQUE authored on 2017-03-17
274
                        call(me.bindings.PFD.IDENT, [], me);
275
                    },
276
                    BKSP: func {
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
277
                        if (getprop('/instrumentation/zkv1000/radios/xpdr-tuning-fms-method'))
278
                            return;
279
                        if (contains(me.bindings.PFD.XPDR.CODE, 'on_change_inactivity'))
280
                            me.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10);
281
                        if (contains(me.bindings.PFD.XPDR.CODE, 'on_change_auto_validation'))
282
                                me.bindings.PFD.XPDR.CODE.on_change_auto_validation.stop();
adds transponder
Sébastien MARQUE authored on 2017-03-17
283
                        var tuning = radios.getNode('xpdr-tuning-digit');
284
                        var d = tuning.getValue();
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
285
                        if (d < 3) {
286
                            d += 1;
287
                            tuning.setValue(d);
288
                        }
adds transponder
Sébastien MARQUE authored on 2017-03-17
289
                        me.device.display.updateXPDR();
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
290
                    },
adds transponder
Sébastien MARQUE authored on 2017-03-17
291
                    BACK : func (inactive = 0) {
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
292
                        call(me.bindings.PFD.XPDR.CODE.restore, [], me);
adds transponder
Sébastien MARQUE authored on 2017-03-17
293
                        pop(me.path);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
294
                        call(me.bindings.PFD.XPDR.CODE.exit, [me.path], me);
295
                    },
296
                    restore : func {
297
                        setprop('/instrumentation/transponder/id-code',
298
                            sprintf('%s', getprop('/instrumentation/zkv1000/radios/xpdr-backup-code')));
299
                        me.device.display.updateXPDR();
adds transponder
Sébastien MARQUE authored on 2017-03-17
300
                    },
301
                    exit : func (p) {
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
302
                        if (contains(me.bindings.PFD.XPDR.CODE, 'inactivity')) # does not exists if IDENT pressed from top-level
303
                            me.bindings.PFD.XPDR.CODE.inactivity.stop();
adds transponder
Sébastien MARQUE authored on 2017-03-17
304
                        radios.removeChild('xpdr-tuning-digit', 0);
305
                        radios.removeChild('xpdr-backup-code', 0);
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
306
                        radios.removeChild('xpdr-tuning-fms-method', 0);
adds transponder
Sébastien MARQUE authored on 2017-03-17
307
                        me.path = p;
308
                        me.device.display.updateXPDR();
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
309
                        me.device.display.updateSoftKeys();
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
310
                        me.device.knobs.FmsInner = void;
311
                        me.device.knobs.FmsOuter = void;
312
                        me.device.display.timers2.softkeys_inactivity.restart(me.device.display.softkeys_inactivity_delay);
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
313
                    },
adds transponder
Sébastien MARQUE authored on 2017-03-17
314
                    hook : func {
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
315
                        # this level has its own timer as we may need to revert changes, and got different timers
316
                        me.device.display.timers2.softkeys_inactivity.stop();
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
317
                        me.bindings.PFD.XPDR.CODE.inactivity = maketimer(
318
                            me.device.display.softkeys_inactivity_delay,
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
319
                            func call(me.bindings.PFD.XPDR.CODE.BACK, [], me));
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
320
                        me.bindings.PFD.XPDR.CODE.inactivity.singleShot = 1;
321
                        me.bindings.PFD.XPDR.CODE.inactivity.start();
adds transponder
Sébastien MARQUE authored on 2017-03-17
322
                        var tuning = getprop('/instrument/zkv1000/radios/xpdr-tuning-digit');
323
                        if (tuning == nil) {
324
                            radios.getNode('xpdr-tuning-digit', 1).setValue(3);
325
                            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
326
                            radios.getNode('xpdr-tuning-fms-method', 1).setValue(0);
adds transponder
Sébastien MARQUE authored on 2017-03-17
327
                            me.device.display.updateXPDR();
328
                        }
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
329
                        me.device.knobs.FmsInner = me.device.knobs.XPDRCodeSetDigits;
330
                        me.device.knobs.FmsOuter = me.device.knobs.XPDRCodeNextDigits;
adds transponder
Sébastien MARQUE authored on 2017-03-17
331
                    },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
332
                },
adds transponder
Sébastien MARQUE authored on 2017-03-17
333
            },
334
            IDENT : func {
335
                if (getprop('/instrumentation/zkv1000/radio/xpdr-mode') == 'STBY')
336
                    return;
337
                setprop('/instrumentation/transponder/ident', 1);
338
                me.bindings.PFD.XPDR.ident = maketimer(18,
339
                        func {
340
                            setprop('/instrumentation/transponder/ident', 0);
341
                            me.device.display.updateXPDR();
342
                        });
343
                me.bindings.PFD.XPDR.ident.singleShot = 1;
344
                me.bindings.PFD.XPDR.ident.start();
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
345
                call(me.bindings.PFD.XPDR.CODE.exit, [], me);
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
346
            },
adds CDI
Sébastien MARQUE authored on 2017-03-18
347
            CDI : func {
348
                var list = ['OFF'];
349
                if (getprop('/instrumentation/gps/route-distance-nm') != nil)
350
                    append(list, 'GPS');
351
                if (getprop('/instrumentation/nav/in-range') != nil)
352
                    append(list, 'NAV1');
353
                if (getprop('/instrumentation/nav[1]/in-range') != nil)
354
                    append(list, 'NAV2');
355
                var index = std.Vector
356
                               .new(list)
357
                               .index(cdi.getNode('source').getValue());
358
                var next = (index == size(list) -1) ?  0 : index + 1;
359
                cdi.getNode('source').setValue(list[next]);
360
                CDIfromSOURCE(list[next]);
361
                me.device.display.updateCDI();
362
            },
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
363
            'TMR/REF' : func {
364
                if (!contains(me.device.windows.state, 'TMR/REF')) {
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
365
                    var Vspeed_visiblity = func (id, selected, Vspeed)
366
                        me.device.data[Vspeed ~ '-visible'] =
367
                            me.device.windows.state[id].objects[selected].text
368
                            ==
369
                            me.device.windows.state[id].objects[selected].choices[0];
370
                    var GenericTimer = func (id, selected) {
371
                        var action = me.device.windows.state[id].objects[selected].text;
372
                        if (action == 'START?') {
373
                            me.device.data.TMRrevert = 0;
374
                            me.device.data.TMRlast = getprop('/sim/time/elapsed-sec') - 1;
375
                            me.device.data.TMRreset = me.device.windows.state[id].objects[selected - 2].text;
376
                            me.device.data.TMRtimer = maketimer(1, func {
377
                                    var (hh, mm, ss) = split(':',
378
                                            me.device.windows.state[id].objects[selected - 2].text);
379
                                    var direction = -1;
380
                                    if ((me.device.windows.state[id].objects[selected - 1].text
381
                                            ==
382
                                        me.device.windows.state[id].objects[selected - 1].choices[0])
383
                                    or me.device.data.TMRrevert)
384
                                        direction = 1;
385
                                    var now = getprop('/sim/time/elapsed-sec');
386
                                    var dt = int(now - me.device.data.TMRlast) * direction;
387
                                    me.device.data.TMRlast = now;
388
                                    var val = HMS(hh, mm, ss, dt);
389
                                    me.device.windows.state[id].objects[selected - 2].text = val;
390
                                    me.device.windows.window[id ~ '-' ~ (selected -2)]
391
                                        .setText(val);
392
                                    if (val == '00:00:00' and direction == -1)
393
                                        me.device.data.TMRrevert = 1;
394
                                }, me);
395
                            me.device.data.TMRtimer.start();
396
                            action = 'STOP?';
397
                        }
398
                        elsif (action == 'STOP?') {
399
                            me.device.data.TMRtimer.stop();
400
                            action = 'RESET?';
401
                        }
402
                        elsif (action == 'RESET?') {
403
                            action = 'START?';
404
                            if ((me.device.windows.state[id].objects[selected - 1].text
405
                                        ==
406
                                me.device.windows.state[id].objects[selected - 1].choices[1])
407
                            and !me.device.data.TMRrevert)
408
                                var val = me.device.data.TMRreset;
409
                            else
410
                                var val = '00:00:00';
411
                            me.device.windows.state[id].objects[selected - 2].text = val;
412
                            me.device.windows.window[id ~ '-' ~ (selected -2)]
413
                                .setText(val);
414
                        }
415
                        me.device.windows.window[me.device.windows.selected]
416
                            .setText(action);
417
                        me.device.windows.state[id].objects[selected].text = action;
418
                    };
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
419
                    me.device.windows.draw(
420
                        'TMR/REF',
421
                        {x: 720, y: 535, w: 300, l: 5, sep: 3},
TMR/REF window adaptation
Sébastien MARQUE authored on 2017-04-02
422
                        [ # objects infos
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
423
                            {text: 'REFERENCES', type: 'title'},
424
                            {type: 'separator'},
425
                            {text: 'TIMER', type: 'normal'},
426
                            {text: '00:00:00', type: 'selected|time', },
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
427
                            {text: '  UP >', type: 'editable', choices: ['  UP >', '<DOWN ']},
428
                            {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
429
                            {type: 'separator'},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
430
                            {text: sprintf('Vx     %3iKT', alerts.getNode('Vx').getValue()), type: 'normal', scrollgroup:0},
431
                            {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')},
432
                            {text: sprintf('Vy     %3iKT', alerts.getNode('Vy').getValue()), type: 'normal', scrollgroup:1},
433
                            {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')},
434
                            {text: sprintf('Vr     %3iKT', alerts.getNode('Vr').getValue()), type: 'normal', scrollgroup:2},
435
                            {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')},
436
                            {text: sprintf('Vglide %3iKT', alerts.getNode('Vglide').getValue()), type: 'normal', scrollgroup:3},
437
                            {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
438
                            {type: 'separator'},
439
                            {text: 'MINIMUMS', type: 'normal'},
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
440
                            {text: '   OFF   >', type: 'editable', choices: ['   OFF   >', '<  BARO  >','<TEMP COMP'], callback: func},
TMR/REF window adaptation
Sébastien MARQUE authored on 2017-04-02
441
                            {text: ' 1000FT', type: 'editable', format: '% 5iFT', factor: 100, callback: func},
442
                        ],
443
                        { # scrolling info, see menu.nas
444
                            lines : 3,
445
                            columns : 2,
446
                        }
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
447
                    );
448
                    me.device.knobs.FmsInner = me.device.knobs.MenuSettings;
449
                    me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
450
                    me.device.buttons.ENT = me.device.buttons.ValidateTMRREF;
451
                    me.device.buttons.FMS = me.device.buttons.ValidateTMRREF;
452
                    me.device.buttons.CLR = me.device.buttons.ClearTMRREF;
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
453
                }
454
                else {
TMR/REF available
Sébastien MARQUE authored on 2017-04-10
455
                    me.device.buttons.ClearTMRREF();
TMR/REF window
Sébastien MARQUE authored on 2017-03-28
456
                }
457
            },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
458
        },
459
        MFD : {
460
            ENGINE: {
461
                FUEL: {
462
                    UNDO: func {
463
                        pop(me.path);
464
                        me.device.display.updateSoftKeys();
465
                    },
466
                    ENTER: func {
467
                        pop(me.path);
468
                        me.device.display.updateSoftKeys();
469
                    },
470
                },
471
                ENGINE: func {
472
                    me.path = [];
473
                    me.device.display.updateSoftKeys();
474
                },
475
            },
add missing exit to MFD/CHKL...
Sébastien MARQUE authored on 2017-03-20
476
            CHKLIST : {
477
                EXIT: func {
478
                    me.path = [];
479
                    me.device.display.updateSoftKeys();
480
                },
481
            },
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
482
        },
commit initial
Sébastien MARQUE authored on 2017-03-07
483
    },
484
};