zkv1000 / Nasal / display.nas /
Newer Older
534 lines | 20.002kb
commit initial
Sébastien MARQUE authored on 2017-03-07
1
var displayClass = {
2
    new: func(node, role) {
3
        var m = { parents: [ displayClass ] };
4
        
5
        m.display = canvas.new({
6
                "name"      : role,
7
                "size"      : [1024, 768],
8
                "view"      : [1024, 768],
9
                "mipmapping": 1
10
        });
11
        m.display.addPlacement({
12
                "node": "Screen",
13
                "parent": role
14
        });
15
        m.display.setColorBackground(0,0,0);
16
        m.role = role;
écriture du wrapper pour le ...
Sébastien MARQUE authored on 2017-03-10
17
        m.screenElements = {};
commit initial
Sébastien MARQUE authored on 2017-03-07
18

            
19
        return m;
20
    },
21

            
ajoute un timer pour cacher ...
Sébastien MARQUE authored on 2017-03-13
22
    timers : {},
23

            
24
    timerTrigger : func {
25
        var now = systime();
26
        foreach (var id; keys(me.timers)) {
27
            if (me.timers[id] < now) {
28
                me.screenElements[id].hide();
29
                delete(me.timers, id);
30
            }
31
        }
32
        settimer(func me.timerTrigger(), 1);
33
    },
34

            
35
    addTimer : func (duration, element) {
36
        if (typeof(element) == 'scalar')
37
            element = [ element ];
38
        var end = systime() + duration;
39
        foreach (var e; element)
40
            me.timers[e] = end;
41
    },
42

            
commit initial
Sébastien MARQUE authored on 2017-03-07
43
    loadsvg : func () {
44
        me.screen = me.display.createGroup();
45
        me.screen.hide();
46
        canvas.parsesvg(me.screen, "Aircraft/Instruments-3d/zkv1000/Systems/screen.svg");
47
    },
48

            
49
    _showInitProgress : func (p,t) {
50
        p.setText(t);
51
        if (zkv.getNode(me.role ~ 'init').getValue() != 0) {
52
            if (size(t) >= 10) t = '';
53
            settimer(func { me._showInitProgress(p, t ~ '.'); }, 0.1);
54
        }
55
        else {
56
            me.progress.hide();
57
            me.screen.show();
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
58
            var groups = {
animation VSI
Sébastien MARQUE authored on 2017-03-10
59
                show : [
commit initial
Sébastien MARQUE authored on 2017-03-07
60
                    'SoftKeysTexts', 
61
                    'COMM', 
62
                    'NAV', 
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
63
                    'nav-freq-switch',
64
                    'comm-freq-switch',
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
65
                ],
66
                text: [
67
                    'nav1-standby-freq', 'nav1-selected-freq', 'nav1-id',
68
                    'nav2-standby-freq', 'nav2-selected-freq', 'nav2-id',
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
69
                    'comm1-standby-freq', 'comm1-selected-freq',
70
                    'comm2-standby-freq', 'comm2-selected-freq',
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
71
                ],
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
72
                hide : [ ],
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
73
                clip: [ ],
74
            };
75
            if (me.role == 'PFD') {
76
                append(groups.show,
commit initial
Sébastien MARQUE authored on 2017-03-07
77
                    'XPDR-TIME', 
AI disponible
Sébastien MARQUE authored on 2017-03-10
78
                    'FlightInstruments',
79
                    'Horizon',
AI disponible, avec bankPoin...
Sébastien MARQUE authored on 2017-03-10
80
                    'bankPointer',
animation VSI
Sébastien MARQUE authored on 2017-03-10
81
                    'VSI',
animation HSI
Sébastien MARQUE authored on 2017-03-11
82
                    'Rose',
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
83
                );
84
                append(groups.hide,
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
85
                    'CDI',
animation HSI
Sébastien MARQUE authored on 2017-03-11
86
                    'NAV1-pointer',
87
                    'NAV2-pointer',
88
                    'GPS-pointer',
89
                    'Bearing1',
90
                    'Bearing2',
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
91
                );
92
                append(groups.clip,
animation IAS
Sébastien MARQUE authored on 2017-03-10
93
                    'SpeedLint1',
animation ALT
Sébastien MARQUE authored on 2017-03-11
94
                    'SpeedTape',
95
                    'LintAlt',
96
                    'AltLint00011'
97
                );
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
98
                append(groups.text,
99
                    'VSIText',
100
                    'Speed110',
101
                    'Alt11100',
102
                    'HDG-text',
103
                    'AltBigC', 'AltSmallC'
104
                );
105
                for (var place = 1; place <= 6; place +=1) {
106
                    append(groups.text,
107
                        'AltBigU' ~ place,
108
                        'AltSmallU' ~ place,
109
                        'AltBigD' ~ place,
110
                        'AltSmallD' ~ place
111
                    );
112
                }
animation ALT
Sébastien MARQUE authored on 2017-03-11
113
            }
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
114
            else
115
                append(groups.show, 'Header');
116

            
117
            me.loadGroup(groups);
animation ALT
Sébastien MARQUE authored on 2017-03-11
118

            
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
119
            if (me.role == 'PFD') {
120
                me.updateAI(getprop('/orientation/roll-deg'),getprop('orientation/pitch-deg'));
121
                me.updateVSI(getprop('/instrumentation/vertical-speed-indicator/indicated-speed-fpm'));
122
                me.updateIAS(getprop('/velocities/airspeed-kt'));
123
                me.updateALT(getprop('instrumentation/altimeter/indicated-altitude-ft'));
124
                me.updateHSI(getprop('orientation/heading-deg'));
ajoute un timer pour cacher ...
Sébastien MARQUE authored on 2017-03-13
125
                me.timerTrigger();
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
126
            }
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
127
            me._updateRadio({auto:'nav'});
128
            me._updateRadio({auto:'comm'});
commit initial
Sébastien MARQUE authored on 2017-03-07
129
            me.progress.removeAllChildren();
130
            me.progress = nil;
131
            me.showInitProgress = nil;
132
            me._showInitProgress = nil;
133
            zkv.removeChild(me.role ~ 'init');
134
        }
135
    },
136

            
137
    showInitProgress : func (role) {
138
        me.progress = me.display.createGroup();
139
        me.progress.show();
140
        me.progress.createChild("text", role ~ " title")
141
            .setTranslation(512, 384)
142
            .setAlignment("center-center")
143
            .setFont("LiberationFonts/LiberationSans-Italic.ttf")
144
            .setFontSize(64, 1)
145
            .setColor(1,1,1)
146
            .setText("ZKV1000 " ~ role ~ " init");
147

            
148
        zkv.getNode(role ~ 'init',1).setIntValue(1);
149

            
150
        me._showInitProgress(me.progress.createChild("text", role ~ "progress")
151
            .setTranslation(512, 484)
152
            .setAlignment("center-center")
153
            .setFont("LiberationFonts/LiberationSans-Bold.ttf")
154
            .setFontSize(128, 1)
155
            .setColor(1,0,0), '.');
156
    },
157

            
écriture du wrapper pour le ...
Sébastien MARQUE authored on 2017-03-10
158
    loadGroup : func (h) {
159
        if (typeof(h) != 'hash') {
160
            msg_dbg(sprintf("%s need a hash, but get a %s from %s",
161
                    caller(0)[0],
162
                    typeof(h),
163
                    caller(1)[0]));
164
            return;
commit initial
Sébastien MARQUE authored on 2017-03-07
165
        }
écriture du wrapper pour le ...
Sébastien MARQUE authored on 2017-03-10
166
        var setMethod = func (e, t) {
167
            if (t == 'hide')
168
                me.screenElements[e].hide();
169
            elsif (t == 'show')
170
                me.screenElements[e].show();
AI disponible
Sébastien MARQUE authored on 2017-03-10
171
            elsif (t == 'rot' or t == 'trans') {
172
                if (! contains(me.screenElements[e], t))
173
                    me.screenElements[e][t] = me.screenElements[e].createTransform();
174
            }
175
            elsif (t == 'clip') {
176
                if (contains(me.clips, e))
177
                    me.screenElements[e].set("clip", me.clips[e]);
178
                else
179
                    print('no defined clip for ' ~ e);
180
            }
animation VSI
Sébastien MARQUE authored on 2017-03-10
181
            elsif (t == 'text') {
182
                if (contains(me.texts, e)) {
183
                    if (contains(me.texts[e], 'alignment'))
184
                        me.screenElements[e].setAlignment(me.texts[e].alignment);
185
                    if (contains(me.texts[e], 'default'))
186
                        me.screenElements[e].setText(me.texts[e].default);
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
187
                    if (contains(me.texts[e], 'color'))
188
                        me.screenElements[e].setColor(me.texts[e].color);
animation VSI
Sébastien MARQUE authored on 2017-03-10
189
                }
clean pre-merge
Sébastien MARQUE authored on 2017-03-11
190
#                else
191
#                    print('no text format for ' ~ e);
animation VSI
Sébastien MARQUE authored on 2017-03-10
192
            }
commit initial
Sébastien MARQUE authored on 2017-03-07
193
            else
écriture du wrapper pour le ...
Sébastien MARQUE authored on 2017-03-10
194
                print('unknown method ' ~ t);
195
        };
196
        foreach (var todo; keys(h)) {
197
            if (typeof(h[todo]) != 'vector') h[todo] = [ h[todo] ];
198
            foreach (var id; h[todo]) {
199
                if (! contains(me.screenElements, id)) {
200
                    me.screenElements[id] = me.screen.getElementById(id);
201
                    if (me.screenElements[id] != nil)
202
                        setMethod(id, todo);
203
                    else
204
                        print('SVG ID ' ~ id ~ ' not found');
205
                }
206
                else
207
                    setMethod(id, todo);
208
            }
commit initial
Sébastien MARQUE authored on 2017-03-07
209
        }
210
    },
AI disponible
Sébastien MARQUE authored on 2017-03-10
211

            
212
    clips : {
clean pre-merge
Sébastien MARQUE authored on 2017-03-11
213
        PitchScale   : "rect(70,664,370,256)",
214
        SpeedLint1   : "rect(252,226,318,204)",
215
        SpeedTape    : "rect(115,239,455,156)",
216
        LintAlt      : "rect(115,808,455,704)",
animation ALT
Sébastien MARQUE authored on 2017-03-11
217
        AltLint00011 : "rect(252,804,318,771)",
AI disponible
Sébastien MARQUE authored on 2017-03-10
218
    },
219

            
animation VSI
Sébastien MARQUE authored on 2017-03-10
220
    texts : {
221
        VSIText : {
222
            alignment: "right-bottom", default : num('0'),
223
        },
animation IAS
Sébastien MARQUE authored on 2017-03-10
224
        Speed110 : {
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
225
            alignment : 'left-bottom'
animation IAS
Sébastien MARQUE authored on 2017-03-10
226
        },
animation ALT (2)
Sébastien MARQUE authored on 2017-03-11
227
        Alt11100 : {
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
228
            alignment:'left-bottom'
animation ALT (2)
Sébastien MARQUE authored on 2017-03-11
229
        },
clean pre-merge
Sébastien MARQUE authored on 2017-03-11
230
        "HDG-text" : {
231
            default: '---°'
232
        },
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
233
        'nav1-standby-freq' : {
234
            color: [0, 1, 1],
235
        },
236
        'nav1-id' : {
237
            default: ''
238
        },
239
        'nav2-id' : {
240
            default: ''
241
        },
animation VSI
Sébastien MARQUE authored on 2017-03-10
242
    },
243

            
AI disponible, avec bankPoin...
Sébastien MARQUE authored on 2017-03-10
244
    updateAI: func(roll,pitch){
AI disponible
Sébastien MARQUE authored on 2017-03-10
245
        if (pitch > 80)
246
            pitch = 80;
clean pre-merge
Sébastien MARQUE authored on 2017-03-11
247
        elsif (pitch < -80)
AI disponible
Sébastien MARQUE authored on 2017-03-10
248
            pitch = -80;
249
        me.screenElements.Horizon
250
            .setRotation(-roll * D2R)
251
            .setTranslation(0, pitch * 6.8571428);
AI disponible, avec bankPoin...
Sébastien MARQUE authored on 2017-03-10
252
        me.screenElements.bankPointer
253
            .setRotation(-roll * D2R);
254
        settimer(func me.updateAI(getprop('/orientation/roll-deg'),getprop('orientation/pitch-deg')), 0.1);
AI disponible
Sébastien MARQUE authored on 2017-03-10
255
    },
animation VSI
Sébastien MARQUE authored on 2017-03-10
256

            
257
    updateVSI: func (vsi) {
258
        me.screenElements.VSIText
259
            .setText(num(math.round(vsi, 10)));
260
        if (vsi > 4500)
261
            vsi = 4500;
262
        elsif (vsi < -4500)
263
            vsi = -4500;
264
        me.screenElements.VSI
265
            .setTranslation(0, vsi * -0.03465);
266
        settimer(func me.updateVSI(getprop('/instrumentation/vertical-speed-indicator/indicated-speed-fpm')), 0.1);
267
    },
animation IAS
Sébastien MARQUE authored on 2017-03-10
268

            
269
    updateIAS: func (ias) {
270
        if (ias >= 10)
271
            me.screenElements.Speed110
272
                .setText(sprintf("% 2u",num(math.floor(ias/10))));
273
        else
274
            me.screenElements.Speed110
275
                .setText('');
276
        me.screenElements.SpeedLint1
277
            .setTranslation(0,(math.mod(ias,10) + (ias >= 10)*10) * 36);
278
        me.screenElements.SpeedTape
279
            .setTranslation(0,ias * 5.711);
280
        settimer(func me.updateIAS(getprop('/velocities/airspeed-kt')), 0.1);
281
    },
animation ALT
Sébastien MARQUE authored on 2017-03-11
282

            
283
    updateALT: func (alt) {
284
        if (alt < 0)
285
            me.screenElements.Alt11100
286
                .setText(sprintf("% 3i",math.ceil(alt/100)));
287
        elsif (alt < 100)
288
            me.screenElements.Alt11100
289
                .setText('');
290
        else
291
            me.screenElements.Alt11100
292
                .setText(sprintf("% 3i",math.floor(alt/100)));
293
        me.screenElements.AltLint00011
294
            .setTranslation(0,math.fmod(alt,100) * 1.24);
295

            
296
        # From Farmin/G1000 http://wiki.flightgear.org/Project_Farmin/FG1000
297
        if (alt> -1000 and alt< 1000000) {
298
            var Offset10 = 0;
299
            var Offset100 = 0;
300
            var Offset1000 = 0;
301
            if (alt< 0) {
302
                var Ne = 1;
303
                var alt= -alt;
304
            }
305
            else
306
                var Ne = 0;
307

            
308
            var Alt10       = math.mod(alt,100);
309
            var Alt100      = int(math.mod(alt/100,10));
310
            var Alt1000     = int(math.mod(alt/1000,10));
311
            var Alt10000    = int(math.mod(alt/10000,10));
312
            var Alt20       = math.mod(Alt10,20)/20;
313
            if (Alt10 >= 80)
314
                var Alt100 += Alt20;
315

            
316
            if (Alt10 >= 80 and Alt100 >= 9)
317
                var Alt1000 += Alt20;
318

            
319
            if (Alt10 >= 80 and Alt100 >= 9 and Alt1000 >= 9)
320
                var Alt10000 += Alt20;
321

            
322
            if (alt> 100)
323
                var Offset10 = 100;
324

            
325
            if (alt> 1000)
326
                var Offset100 = 10;
327

            
328
            if (alt> 10000)
329
                var Offset1000 = 10;
330

            
331
            if (!Ne) {
332
                me.screenElements.LintAlt.setTranslation(0,(math.mod(alt,100))*0.57375);
333
                var altCentral = (int(alt/100)*100);
334
            }
335
            elsif (Ne) {
336
                me.screenElements.LintAlt.setTranslation(0,(math.mod(alt,100))*-0.57375);
337
                var altCentral = -(int(alt/100)*100);
338
            }
339
            me.screenElements["AltBigC"].setText("");
340
            me.screenElements["AltSmallC"].setText("");
341
            for (var place = 1; place <= 6; place += 1) {
342
                var altUP = altCentral + (place*100);
343
                var offset = -30.078;
344
                if (altUP < 0) {
345
                    var altUP = -altUP;
346
                    var prefix = "-";
347
                    var offset += 15.039;
348
                }
349
                else
350
                    var prefix = "";
351

            
352
                if (altUP == 0) {
353
                    var AltBigUP    = "";
354
                    var AltSmallUP  = "0";
355

            
356
                }
357
                elsif (math.mod(altUP,500) == 0 and altUP != 0) {
358
                    var AltBigUP    = sprintf(prefix~"%1d", altUP);
359
                    var AltSmallUP  = "";
360
                }
361
                elsif (altUP < 1000 and (math.mod(altUP,500))) {
362
                    var AltBigUP    = "";
363
                    var AltSmallUP  = sprintf(prefix~"%1d", int(math.mod(altUP,1000)));
364
                    var offset = -30.078;
365
                }
366
                elsif ((altUP < 10000) and (altUP >= 1000) and (math.mod(altUP,500))) {
367
                    var AltBigUP    = sprintf(prefix~"%1d", int(altUP/1000));
368
                    var AltSmallUP  = sprintf("%1d", int(math.mod(altUP,1000)));
369
                    var offset += 15.039;
370
                }
371
                else {
372
                    var AltBigUP    = sprintf(prefix~"%1d", int(altUP/1000));
373
                    var mod = int(math.mod(altUP,1000));
374
                    var AltSmallUP  = sprintf("%1d", mod);
375
                    var offset += 30.078;
376
                }
377

            
378
                me.screenElements["AltBigU"~place].setText(AltBigUP);
379
                me.screenElements["AltSmallU"~place].setText(AltSmallUP);
380
                me.screenElements["AltSmallU"~place].setTranslation(offset,0);
381
                var altDOWN = altCentral - (place*100);
382
                var offset = -30.078;
383
                if (altDOWN < 0) {
384
                    var altDOWN = -altDOWN;
385
                    var prefix = "-";
386
                    var offset += 15.039;
387
                }
388
                else
389
                    var prefix = "";
390

            
391
                if (altDOWN == 0) {
392
                    var AltBigDOWN  = "";
393
                    var AltSmallDOWN    = "0";
394
                }
395
                elsif (math.mod(altDOWN,500) == 0 and altDOWN != 0) {
396
                    var AltBigDOWN  = sprintf(prefix~"%1d", altDOWN);
397
                    var AltSmallDOWN    = "";
398
                }
399
                elsif (altDOWN < 1000 and (math.mod(altDOWN,500))) {
400
                    var AltBigDOWN  = "";
401
                    var AltSmallDOWN    = sprintf(prefix~"%1d", int(math.mod(altDOWN,1000)));
402
                    var offset = -30.078;
403
                }
404
                elsif ((altDOWN < 10000) and (altDOWN >= 1000) and (math.mod(altDOWN,500))) {
405
                    var AltBigDOWN  = sprintf(prefix~"%1d", int(altDOWN/1000));
406
                    var AltSmallDOWN    = sprintf("%1d", int(math.mod(altDOWN,1000)));
407
                    var offset += 15.039;
408
                }
409
                else {
410
                    var AltBigDOWN  = sprintf(prefix~"%1d", int(altDOWN/1000));
411
                    var mod = int(math.mod(altDOWN,1000));
412
                    var AltSmallDOWN    = sprintf("%1d", mod);
413
                    var offset += 30.078;
414
                }
415
                me.screenElements["AltBigD"~place].setText(AltBigDOWN);
416
                me.screenElements["AltSmallD"~place].setText(AltSmallDOWN);
417
                me.screenElements["AltSmallD"~place].setTranslation(offset,0);
418
            }
419
        }
420
        settimer(func me.updateALT(getprop('instrumentation/altimeter/indicated-altitude-ft')), 0.2);
421
    },
animation HSI
Sébastien MARQUE authored on 2017-03-11
422

            
423
    updateHSI : func (hdg) {
424
        me.screenElements.Rose
425
            .setRotation(-hdg * D2R);
426
        me.screenElements['HDG-text']
427
            .setText(sprintf("%03u°", hdg));
428
        settimer(func me.updateHSI(getprop('orientation/heading-deg')), 0.1);
429
    },
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
430

            
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
431
    _updateRadio: func {
432
        # arg[0]._r = <comm|nav>
433
        if (contains(arg[0], "active")) {
434
            if (arg[0]['active'] == 'none') {
435
                me.screenElements[arg[0]._r ~ '1-selected-freq']
436
                    .setColor(1,1,1);
437
                me.screenElements[arg[0]._r ~ '2-selected-freq']
438
                    .setColor(1,1,1);
439
            }
440
            else {
441
                me.screenElements[arg[0]._r ~ arg[0]['active'] ~ '-selected-freq']
442
                    .setColor(0,1,0);
443
                me.screenElements[arg[0]._r ~ arg[0].inactive ~ '-selected-freq']
444
                    .setColor(1,1,1);
445
            }
446
        }
447
        if (contains(arg[0], 'tune')) {
448
            # n = 0 -> NAV1/COMM1
449
            # n = 1 -> NAV1/COMM2
450
            me.screenElements[arg[0]._r ~ '-freq-switch']
451
                .setTranslation(0, arg[0].tune * 25);
452
            me.screenElements[arg[0]._r ~ (arg[0].tune + 1) ~ '-standby-freq']
453
                .setColor(0,1,1);
454
            me.screenElements[arg[0]._r ~ ((arg[0].tune == 0) + 1) ~ '-standby-freq']
455
                .setColor(1,1,1);
456
        }
457
        if (contains(arg[0], 'refresh')) {
458
            # rafraichi une seule ligne NAV1/COMM1 ou NAV2/COMM2
459
            var fmt = (arg[0]._r == 'nav') ? '%.2f' : '%.3f';
460
            me.screenElements[arg[0]._r ~ arg[0].refresh ~ '-selected-freq']
461
                .setText(sprintf(fmt, getprop('/instrumentation/'
462
                               ~ arg[0]._r ~ '[' ~ (arg[0].refresh - 1) ~ ']/frequencies/selected-mhz')));
463
            me.screenElements[arg[0]._r ~ arg[0].refresh ~ '-standby-freq']
464
                .setText(sprintf(fmt, getprop('/instrumentation/'
465
                               ~ arg[0]._r ~ '[' ~ (arg[0].refresh - 1) ~ ']/frequencies/standby-mhz')));
466
        }
467
        if (contains(arg[0], 'set')) {
468
            # positionne la valeur modifiée, les listeners "trigguent" en permanence ces propriétés, donc exit
469
            var n = getprop('/instrumentation/zkv1000/radios/' ~ arg[0]._r ~ '-tune');
470
            var fmt = (arg[0]._r == 'nav') ? '%.2f' : '%.3f';
471
            me.screenElements[arg[0]._r ~ (n + 1) ~ '-standby-freq']
472
                .setText(getprop('/instrumentation/' ~ arg[0]._r ~ '[' ~ n ~ ']/frequencies/standby-mhz'));
473
        }
474
        if (contains(arg[0], 'auto')) {
475
            # pour rafraichir automagiquement, toutes les deux secondes un refresh pour un NAV
476
            var radio = arg[0].auto;
477
            me._updateRadio({refresh: 1, _r: radio});
478
            settimer(func me._updateRadio({refresh: 2, _r: radio}), 1);
479
            settimer(func me._updateRadio({auto: radio}), 2);
480
        }
481
    },
482

            
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
483
    updateNAV : func {
484
        # made active via menu
485
        if (contains(arg[0], "active")) {
486
            if (arg[0]['active'] == 'none') {
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
487
                arg[0]._r = 'nav';
488
                me._updateRadio(arg[0]);
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
489
                me.screenElements['nav1-id']
490
                    .setColor(1,1,1);
491
                me.screenElements['nav2-id']
492
                    .setColor(1,1,1);
493
                me.screenElements['NAV1-pointer']
494
                    .hide();
495
                me.screenElements['NAV2-pointer']
496
                    .hide();
497
            }
498
            else {
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
499
                arg[0]._r = 'nav';
500
                arg[0].inactive = (arg[0]['active'] == 1) + 1;
501
                me._updateRadio(arg[0]);
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
502
                me.screenElements['nav' ~ arg[0]['active'] ~ '-id']
503
                    .setColor(0,1,0);
504
                me.screenElements['NAV' ~ arg[0]['active'] ~ '-pointer']
505
                    .show();
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
506
                me.screenElements['nav' ~ arg[0].inactive ~ '-id']
507
                    .setColor(1,1,1);
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
508
#                me.screenElements['HDI']
509
#                    .setRotation();
510
#                me.screenElements['NAV' ~ inactive ~ '-pointer']
511
#                    .hide();
512
#                foreach (var e; [ 'FROM', 'TO', 'CDI' ])
513
#                    me.screenElements['NAV' ~ inactive ~ '-' ~ e]
514
#                        .hide();
515
            }
516
        }
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
517
        elsif (contains(arg[0], 'nav-id')) {
Correction swap NAV tuning
Sébastien MARQUE authored on 2017-03-12
518
            # TODO: récupérer la valeur via les paramètres transmis du listener
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
519
            if (arg[0].val == nil)
520
                arg[0].val = '';
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
521
            me.screenElements["nav" ~ arg[0]['nav-id'] ~ "-id"]
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
522
                    .setText(arg[0].val);
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
523
        }
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
524
        else {
525
            arg[0]._r = 'nav';
526
            me._updateRadio(arg[0]);
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
527
        }
528
    },
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
529

            
530
    updateCOMM: func {
531
        arg[0]._r = 'comm';
532
        me._updateRadio(arg[0]);
533
    },
commit initial
Sébastien MARQUE authored on 2017-03-07
534
};