zkv1000 / Nasal / display.nas /
Newer Older
1289 lines | 48.393kb
comment on the folds
Sébastien MARQUE authored on 2017-03-13
1
# vim: set foldmethod=marker foldmarker={{{,}}} :
commit initial
Sébastien MARQUE authored on 2017-03-07
2
var displayClass = {
pass device pointer to displ...
Sébastien MARQUE authored on 2017-03-14
3
    new: func(device, role) {
add new vim folds
Sébastien MARQUE authored on 2017-03-15
4
# the contructor {{{
commit initial
Sébastien MARQUE authored on 2017-03-07
5
        var m = { parents: [ displayClass ] };
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
6

            
commit initial
Sébastien MARQUE authored on 2017-03-07
7
        m.display = canvas.new({
8
                "name"      : role,
9
                "size"      : [1024, 768],
10
                "view"      : [1024, 768],
11
                "mipmapping": 1
12
        });
13
        m.display.addPlacement({
14
                "node": "Screen",
15
                "parent": role
16
        });
17
        m.display.setColorBackground(0,0,0);
18
        m.role = role;
pass device pointer to displ...
Sébastien MARQUE authored on 2017-03-14
19
        m.device = device;
écriture du wrapper pour le ...
Sébastien MARQUE authored on 2017-03-10
20
        m.screenElements = {};
commit initial
Sébastien MARQUE authored on 2017-03-07
21

            
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
22
        m.timers2 = {}; # tho old timer implementation use already a named timer hash
23
        # Softkeys revert to the previous level after 45 seconds of inactivity.
24
        m.softkeys_inactivity_delay = 45;
25

            
adds Map on MFD
Sébastien MARQUE authored on 2017-03-20
26
        if (role == 'MFD') {
27
            m.MFDMapTiles = MapTiles.new(m.display);
28
            m.MFDMapNavDisplay = MapNavDisplay.new(m.display);
29
        }
30

            
commit initial
Sébastien MARQUE authored on 2017-03-07
31
        return m;
32
    },
add new vim folds
Sébastien MARQUE authored on 2017-03-15
33
#}}}
commit initial
Sébastien MARQUE authored on 2017-03-07
34

            
add new vim folds
Sébastien MARQUE authored on 2017-03-15
35
# timers stuff {{{
ajoute un timer pour cacher ...
Sébastien MARQUE authored on 2017-03-13
36
    timers : {},
37

            
38
    timerTrigger : func {
39
        var now = systime();
40
        foreach (var id; keys(me.timers)) {
41
            if (me.timers[id] < now) {
42
                me.screenElements[id].hide();
43
                delete(me.timers, id);
44
            }
45
        }
46
        settimer(func me.timerTrigger(), 1);
47
    },
48

            
49
    addTimer : func (duration, element) {
50
        if (typeof(element) == 'scalar')
51
            element = [ element ];
52
        var end = systime() + duration;
53
        foreach (var e; element)
54
            me.timers[e] = end;
55
    },
add new vim folds
Sébastien MARQUE authored on 2017-03-15
56
#}}}
ajoute un timer pour cacher ...
Sébastien MARQUE authored on 2017-03-13
57

            
commit initial
Sébastien MARQUE authored on 2017-03-07
58
    loadsvg : func () {
59
        me.screen = me.display.createGroup();
60
        me.screen.hide();
61
        canvas.parsesvg(me.screen, "Aircraft/Instruments-3d/zkv1000/Systems/screen.svg");
62
    },
63

            
64
    _showInitProgress : func (p,t) {
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
65
#{{{
commit initial
Sébastien MARQUE authored on 2017-03-07
66
        p.setText(t);
67
        if (zkv.getNode(me.role ~ 'init').getValue() != 0) {
68
            if (size(t) >= 10) t = '';
69
            settimer(func { me._showInitProgress(p, t ~ '.'); }, 0.1);
70
        }
71
        else {
72
            me.progress.hide();
73
            me.screen.show();
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
74
            var groups = {
animation VSI
Sébastien MARQUE authored on 2017-03-10
75
                show : [
makes header visible on MFD ...
Sébastien MARQUE authored on 2017-03-18
76
                    'Header',
commit initial
Sébastien MARQUE authored on 2017-03-07
77
                    'SoftKeysTexts', 
78
                    'COMM', 
79
                    'NAV', 
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
80
                    'nav-freq-switch',
81
                    'comm-freq-switch',
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
82
                ],
83
                text: [
84
                    'nav1-standby-freq', 'nav1-selected-freq', 'nav1-id',
85
                    'nav2-standby-freq', 'nav2-selected-freq', 'nav2-id',
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
86
                    'comm1-standby-freq', 'comm1-selected-freq',
87
                    'comm2-standby-freq', 'comm2-selected-freq',
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
88
                ],
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
89
                hide : [ ],
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
90
                clip: [ ],
91
            };
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
92

            
add softkeys colors
Sébastien MARQUE authored on 2017-03-21
93
            for (var k = 0; k < 12; k += 1) {
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
94
                append(groups.text, sprintf("SoftKey%02i-text", k));
add softkeys colors
Sébastien MARQUE authored on 2017-03-21
95
                append(groups.show, sprintf("SoftKey%02i-bg", k));
96
            }
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
97

            
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
98
            if (me.role == 'PFD') {
99
                append(groups.show,
commit initial
Sébastien MARQUE authored on 2017-03-07
100
                    'XPDR-TIME', 
AI disponible
Sébastien MARQUE authored on 2017-03-10
101
                    'FlightInstruments',
102
                    'Horizon',
AI disponible, avec bankPoin...
Sébastien MARQUE authored on 2017-03-10
103
                    'bankPointer',
animation VSI
Sébastien MARQUE authored on 2017-03-10
104
                    'VSI',
animation HSI
Sébastien MARQUE authored on 2017-03-11
105
                    'Rose',
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
106
                    'Heading-bug',
107
                    'PFD-Widgets',
trends animation
Sébastien MARQUE authored on 2017-03-13
108
                    'Trends',
109
                    'Airspeed-Trend-Indicator',
110
                    'Altitude-Trend-Indicator',
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
111
                    'OAT',
112
                    'IAS-bg',
113
                    'TAS',
114
                    'GSPD',
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
115
                    'BARO-bg',
adds slipskid animation
Sébastien MARQUE authored on 2017-03-24
116
                    'SlipSkid',
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
117
                );
118
                append(groups.hide,
adds EIS
Sébastien MARQUE authored on 2017-03-18
119
                    'EIS',
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
120
                    'CDI',
adds OMI to PFD
Sébastien MARQUE authored on 2017-03-23
121
                    'OMI', 'MarkerBG', 'MarkerText',
adds CDI
Sébastien MARQUE authored on 2017-03-18
122
                    'NAV1-pointer', 'NAV1-CDI', 'NAV1-FROM', 'NAV1-TO',
123
                    'NAV2-pointer', 'NAV2-CDI', 'NAV2-FROM', 'NAV2-TO',
124
                    'GPS-pointer', 'GPS-CDI', 'GPS-CTI', 'GPS-CTI-diamond', 'GPS-FROM', 'GPS-TO',
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
125
                    'BRG1-pointer',
126
                    'BRG2-pointer',
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
127
                    'SelectedHDG-bg',
128
                    'SelectedHDG-bgtext',
129
                    'SelectedHDG-text',
130
                    'SelectedCRS-bg',
131
                    'SelectedCRS-bgtext',
132
                    'SelectedCRS-text',
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
133
                    'SelectedALT', 'SelectedALT-bug', 'SelectedALT-bg', 'SelectedALT-symbol',
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
134
                    'TAS',
135
                    'GSPD',
136
                    'WindData',
137
                    'Reversionnary',
138
                    'Annunciation',
139
                    'Comparator',
140
                    'BRG1',
141
                    'BRG2',
142
                    'DME1',
143
                    'PFD-Map',
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
144
                    'PFD-Multilines',
improves WindData display
Sébastien MARQUE authored on 2017-03-16
145
                    'WindData', 'WindData-OPTN1', 'WindData-OPTN2', 'WindData-OPTN1-HDG', 'WindData-OPTN2-symbol', 'WindData-OPTN2-headwind', 'WindData-OPTN2-crosswind', 'WindData-NODATA',
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
146
                );
147
                append(groups.clip,
animation IAS
Sébastien MARQUE authored on 2017-03-10
148
                    'SpeedLint1',
animation ALT
Sébastien MARQUE authored on 2017-03-11
149
                    'SpeedTape',
150
                    'LintAlt',
151
                    'AltLint00011'
152
                );
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
153
                append(groups.text,
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
154
                    'SelectedALT-text',
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
155
                    'TAS-text',
156
                    'GSPD-text',
anime time display
Sébastien MARQUE authored on 2017-03-13
157
                    'TIME-text',
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
158
                    'OAT-text',
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
159
                    'VSIText',
160
                    'Speed110',
161
                    'Alt11100',
162
                    'HDG-text',
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
163
                    'BARO-text',
adds CDI
Sébastien MARQUE authored on 2017-03-18
164
                    'CDI-SRC-text', 'CDI-GPS-ANN-text', 'CDI-GPS-XTK-text',
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
165
                    'BRG1-pointer', 'BRG1-SRC-text', 'BRG1-DST-text', 'BRG1-WPID-text',
166
                    'BRG2-pointer', 'BRG2-SRC-text', 'BRG2-DST-text', 'BRG2-WPID-text',
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
167
                    'WindData-OPTN1-HDG-text', 'WindData-OPTN1-SPD-text',
168
                    'WindData-OPTN2-crosswind-text', 'WindData-OPTN2-headwind-text',
adds transponder
Sébastien MARQUE authored on 2017-03-17
169
                    'XPDR-MODE-text', 'XPDR-DIGIT-3-text', 'XPDR-DIGIT-2-text', 'XPDR-DIGIT-1-text', 'XPDR-DIGIT-0-text',
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
170
                    'AltBigC', 'AltSmallC'
171
                );
172
                for (var place = 1; place <= 6; place +=1) {
173
                    append(groups.text,
174
                        'AltBigU' ~ place,
175
                        'AltSmallU' ~ place,
176
                        'AltBigD' ~ place,
177
                        'AltSmallD' ~ place
178
                    );
179
                }
animation ALT
Sébastien MARQUE authored on 2017-03-11
180
            }
adds EIS
Sébastien MARQUE authored on 2017-03-18
181
            else {
animation texts EIS + power ...
Sébastien MARQUE authored on 2017-03-19
182
                append(groups.show, 'EIS', 'POWER-pointer');
183
                append(groups.text,
184
                        'RPM-text', 'EGT-text', 'CHT-text', 'FUEL-USED-text',
185
                        'FUEL-FLOW-text', 'MAN-Hg-text', 'POWER-PERCENT-text',
186
                        'RPM-text', 'BUS-V-text', 'BATT-text', 'PSI-text',
187
                        'OIL-TEMP-text'
188
                    );
adds EIS
Sébastien MARQUE authored on 2017-03-18
189
            }
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
190

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

            
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
193
            if (me.role == 'PFD') {
refresh of vital information...
Sébastien MARQUE authored on 2017-03-18
194
                me.update20Hz();
195
                me.update1Hz();
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
196
                me.updateAI();
197
                me.updateVSI();
198
                me.updateIAS();
199
                me.updateALT();
200
                me.updateHSI();
anime time display
Sébastien MARQUE authored on 2017-03-13
201
                me.updateTIME();
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
202
                me.updateOAT();
203
                me.updateTAS();
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
204
                me.updateBRG();
adds transponder
Sébastien MARQUE authored on 2017-03-17
205
                me.updateXPDR();
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
206
                me.updateBARO();
adds OMI to PFD
Sébastien MARQUE authored on 2017-03-23
207
                me.updateOMI();
ajoute un timer pour cacher ...
Sébastien MARQUE authored on 2017-03-13
208
                me.timerTrigger();
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
209
            }
animation texts EIS + power ...
Sébastien MARQUE authored on 2017-03-19
210
            else {
211
                me.updateEIS();
adds Map on MFD
Sébastien MARQUE authored on 2017-03-20
212
                me.MFDMapNavDisplay.showMap();
213
                me.MFDMapTiles.initialize_grid();
214
                me.MFDMapTiles.update_timer.start();
animation texts EIS + power ...
Sébastien MARQUE authored on 2017-03-19
215
            }
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
216
            me._updateRadio({auto:'nav'});
217
            me._updateRadio({auto:'comm'});
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
218
            me.softkeys_inactivity();
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
219
            me.updateSoftKeys();
commit initial
Sébastien MARQUE authored on 2017-03-07
220
            me.progress.removeAllChildren();
221
            me.progress = nil;
222
            me.showInitProgress = nil;
223
            me._showInitProgress = nil;
224
            zkv.removeChild(me.role ~ 'init');
225
        }
226
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
227
#}}}
commit initial
Sébastien MARQUE authored on 2017-03-07
228

            
229
    showInitProgress : func (role) {
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
230
#{{{
commit initial
Sébastien MARQUE authored on 2017-03-07
231
        me.progress = me.display.createGroup();
232
        me.progress.show();
233
        me.progress.createChild("text", role ~ " title")
234
            .setTranslation(512, 384)
235
            .setAlignment("center-center")
236
            .setFont("LiberationFonts/LiberationSans-Italic.ttf")
237
            .setFontSize(64, 1)
238
            .setColor(1,1,1)
239
            .setText("ZKV1000 " ~ role ~ " init");
240

            
241
        zkv.getNode(role ~ 'init',1).setIntValue(1);
242

            
243
        me._showInitProgress(me.progress.createChild("text", role ~ "progress")
244
            .setTranslation(512, 484)
245
            .setAlignment("center-center")
246
            .setFont("LiberationFonts/LiberationSans-Bold.ttf")
247
            .setFontSize(128, 1)
248
            .setColor(1,0,0), '.');
249
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
250
#}}}
commit initial
Sébastien MARQUE authored on 2017-03-07
251

            
some added comments
Sébastien MARQUE authored on 2017-03-18
252
    colors : {
253
# set of predefined colors {{{
254
        green : [0, 1, 0],
255
        white : [1, 1, 1],
256
        black : [0, 0, 0],
257
        lightblue : [0, 1, 1],
258
        darkblue : [0, 0, 1],
259
        red : [1, 0, 0],
adds CDI
Sébastien MARQUE authored on 2017-03-18
260
        magenta : [1, 0, 1],
some added comments
Sébastien MARQUE authored on 2017-03-18
261
    },
262
#}}}
263

            
écriture du wrapper pour le ...
Sébastien MARQUE authored on 2017-03-10
264
    loadGroup : func (h) {
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
265
#{{{
écriture du wrapper pour le ...
Sébastien MARQUE authored on 2017-03-10
266
        if (typeof(h) != 'hash') {
267
            msg_dbg(sprintf("%s need a hash, but get a %s from %s",
268
                    caller(0)[0],
269
                    typeof(h),
270
                    caller(1)[0]));
271
            return;
commit initial
Sébastien MARQUE authored on 2017-03-07
272
        }
écriture du wrapper pour le ...
Sébastien MARQUE authored on 2017-03-10
273
        var setMethod = func (e, t) {
274
            if (t == 'hide')
275
                me.screenElements[e].hide();
276
            elsif (t == 'show')
277
                me.screenElements[e].show();
AI disponible
Sébastien MARQUE authored on 2017-03-10
278
            elsif (t == 'rot' or t == 'trans') {
279
                if (! contains(me.screenElements[e], t))
280
                    me.screenElements[e][t] = me.screenElements[e].createTransform();
281
            }
282
            elsif (t == 'clip') {
283
                if (contains(me.clips, e))
284
                    me.screenElements[e].set("clip", me.clips[e]);
285
                else
printlog with adapted level ...
Sébastien MARQUE authored on 2017-03-20
286
                    printlog('warn', 'no defined clip for ' ~ e);
AI disponible
Sébastien MARQUE authored on 2017-03-10
287
            }
animation VSI
Sébastien MARQUE authored on 2017-03-10
288
            elsif (t == 'text') {
289
                if (contains(me.texts, e)) {
290
                    if (contains(me.texts[e], 'alignment'))
291
                        me.screenElements[e].setAlignment(me.texts[e].alignment);
292
                    if (contains(me.texts[e], 'default'))
293
                        me.screenElements[e].setText(me.texts[e].default);
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
294
                    if (contains(me.texts[e], 'color'))
295
                        me.screenElements[e].setColor(me.texts[e].color);
adds CDI
Sébastien MARQUE authored on 2017-03-18
296
                    if (contains(me.texts[e], 'visible'))
297
                        me.screenElements[e].setVisible(me.texts[e].visible);
animation VSI
Sébastien MARQUE authored on 2017-03-10
298
                }
printlog with adapted level ...
Sébastien MARQUE authored on 2017-03-20
299
                else
300
                    printlog('debug', 'no text format for ' ~ e);
animation VSI
Sébastien MARQUE authored on 2017-03-10
301
            }
commit initial
Sébastien MARQUE authored on 2017-03-07
302
            else
printlog with adapted level ...
Sébastien MARQUE authored on 2017-03-20
303
                printlog('warn', 'unknown method ' ~ t);
écriture du wrapper pour le ...
Sébastien MARQUE authored on 2017-03-10
304
        };
305
        foreach (var todo; keys(h)) {
306
            if (typeof(h[todo]) != 'vector') h[todo] = [ h[todo] ];
307
            foreach (var id; h[todo]) {
308
                if (! contains(me.screenElements, id)) {
309
                    me.screenElements[id] = me.screen.getElementById(id);
310
                    if (me.screenElements[id] != nil)
311
                        setMethod(id, todo);
312
                    else
printlog with adapted level ...
Sébastien MARQUE authored on 2017-03-20
313
                        printlog('warn', 'SVG ID ' ~ id ~ ' not found');
écriture du wrapper pour le ...
Sébastien MARQUE authored on 2017-03-10
314
                }
315
                else
316
                    setMethod(id, todo);
317
            }
commit initial
Sébastien MARQUE authored on 2017-03-07
318
        }
319
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
320
#}}}
AI disponible
Sébastien MARQUE authored on 2017-03-10
321

            
322
    clips : {
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
323
#{{{
clean pre-merge
Sébastien MARQUE authored on 2017-03-11
324
        PitchScale   : "rect(70,664,370,256)",
325
        SpeedLint1   : "rect(252,226,318,204)",
326
        SpeedTape    : "rect(115,239,455,156)",
327
        LintAlt      : "rect(115,808,455,704)",
animation ALT
Sébastien MARQUE authored on 2017-03-11
328
        AltLint00011 : "rect(252,804,318,771)",
AI disponible
Sébastien MARQUE authored on 2017-03-10
329
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
330
#}}}
AI disponible
Sébastien MARQUE authored on 2017-03-10
331

            
animation VSI
Sébastien MARQUE authored on 2017-03-10
332
    texts : {
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
333
#{{{
animation VSI
Sébastien MARQUE authored on 2017-03-10
334
        VSIText : {
335
            alignment: "right-bottom", default : num('0'),
336
        },
animation IAS
Sébastien MARQUE authored on 2017-03-10
337
        Speed110 : {
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
338
            alignment : 'left-bottom'
animation IAS
Sébastien MARQUE authored on 2017-03-10
339
        },
animation ALT (2)
Sébastien MARQUE authored on 2017-03-11
340
        Alt11100 : {
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
341
            alignment:'left-bottom'
animation ALT (2)
Sébastien MARQUE authored on 2017-03-11
342
        },
clean pre-merge
Sébastien MARQUE authored on 2017-03-11
343
        "HDG-text" : {
344
            default: '---°'
345
        },
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
346
        'nav1-standby-freq' : {
347
            color: [0, 1, 1],
348
        },
349
        'nav1-id' : {
350
            default: ''
351
        },
352
        'nav2-id' : {
353
            default: ''
354
        },
adds CDI
Sébastien MARQUE authored on 2017-03-18
355
        'CDI-GPS-ANN-text' : {
356
            visible : 0
357
        },
358
        'CDI-GPS-XTK-text' : {
359
            visible : 0
360
        },
361
        'CDI-SRC-text' : {
362
            visible : 0
363
        },
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
364
        'BARO-text' : {
365
            alignment : 'left-bottom',
366
        }
some added comments
Sébastien MARQUE authored on 2017-03-18
367
#        'TAS-text' : {
368
#            alignment : 'right-bottom',
369
#        },
370
#        'GSPD-text' : {
371
#            alignment : 'right-bottom',
372
#        },
animation VSI
Sébastien MARQUE authored on 2017-03-10
373
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
374
#}}}
animation VSI
Sébastien MARQUE authored on 2017-03-10
375

            
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
376
    softkeys_inactivity : func {
377
# automagically back to previous level after some delay {{{
378
        me.timers2.softkeys_inactivity = maketimer (
379
            me.softkeys_inactivity_delay,
380
            func {
381
                pop(me.device.softkeys.path);
382
                me.updateSoftKeys();
383
            }, me);
384
        me.timers2.softkeys_inactivity.singleShot = 1;
385
    },
386
#}}}
387

            
add softkeys colors
Sébastien MARQUE authored on 2017-03-21
388
    setSoftKeyColor : func (n, active, alert = 0) {
389
# set colors for active softkeys {{{
390
        var sftk = sprintf('SoftKey%02i-', n);
391
        if (active) {
392
            var bg = alert ? 1 : 0.5;
393
            me.screenElements[sftk ~ 'bg']
394
                .setColorFill(bg,bg,bg);
395
            me.screenElements[sftk ~ 'text']
396
                .setColor(0,0,0);
397
        }
398
        else {
399
            me.screenElements[sftk ~ 'bg']
400
                .setColorFill(0,0,0);
401
            me.screenElements[sftk ~ 'text']
402
                .setColor(1,1,1);
403
        }
404
    },
405
#}}}
406

            
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
407
    updateSoftKeys : func {
408
# update SoftKeys boxes {{{
409
        # on PFD the last boxes are always BACK and ALERTS
410
        if (me.role == 'PFD') {
411
            me.screenElements[sprintf("SoftKey%02i-text", 11)]
412
                .setText('ALERTS');
413
            if (size(me.device.softkeys.path) != 0)
414
                me.screenElements[sprintf("SoftKey%02i-text", 10)]
415
                    .setText('BACK');
416
        }
417

            
418
        var path = keyMap[me.role];
419
        foreach (var p; me.device.softkeys.path)
420
            path = path[p];
421

            
422
        # feeding with empty menus the first boxes
423
        var start = (contains(path, 'first')) ? path.first : 0;
424
        for (var k = 0; k < start; k+=1) {
425
            me.screenElements[sprintf("SoftKey%02i-text", k)]
426
                .setText('');
427
        }
428
        # filling with the content the next boxes
429
        forindex (var k; path.texts) {
430
            var i = k + start;
431
            me.screenElements[sprintf("SoftKey%02i-text", i)]
432
                .setText(path.texts[k]);
433
        }
434
        # feeding the last boxes with empty string
435
        var end = (me.role == 'PFD') ? 10 : 12;
436
        if (size(path.texts) + start < end) {
437
            start = size(path.texts) + start;
438
            for (var k = start; k < end; k += 1)
439
                me.screenElements[sprintf("SoftKey%02i-text", k)]
440
                    .setText('');
441
        }
Softkeys revert to the previ...
Sébastien MARQUE authored on 2017-03-21
442

            
443
        if (size(me.device.softkeys.path))
444
            me.timers2.softkeys_inactivity.restart(me.softkeys_inactivity_delay);
445
        else
446
            me.timers2.softkeys_inactivity.stop();
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
447
    },
448
#}}}
449

            
refresh of vital information...
Sébastien MARQUE authored on 2017-03-18
450
    update20Hz : func {
451
# 20Hz updates roll, pitch, VSI, IAS, altitude and HDG {{{
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
452
        me._updated_roll = getprop('/orientation/roll-deg');
453
        me._updated_pitch = getprop('orientation/pitch-deg');
454
        me._updated_vsi = getprop('/instrumentation/vertical-speed-indicator/indicated-speed-fpm');
455
        me._updated_ias = getprop('/velocities/airspeed-kt');
456
        me._updated_alt = getprop('/instrumentation/altimeter/indicated-altitude-ft');
457
        me._updated_hdg = getprop('/orientation/heading-deg');
refresh of vital information...
Sébastien MARQUE authored on 2017-03-18
458
        settimer(func me.update20Hz(), 0.05);
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
459
     },
460
    _updated_roll : 0,
461
    _updated_pitch : 0,
462
    _updated_vsi : 0,
463
    _updated_ias : 0,
464
    _updated_alt : 0,
465
    _updated_hdg : 0,
466
#}}}
467

            
refresh of vital information...
Sébastien MARQUE authored on 2017-03-18
468
    update1Hz : func {
469
# 1Hz updates {{{
470
        me._updated_wow = getprop('/gear/gear/wow');
471
        settimer(func me.update20Hz(), 1);
472
    },
473
    _updated_wow : 1,
474
#}}}
475

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
476
    updateAI: func(){
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
477
#{{{
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
478
        var pitch = me._updated_pitch;
479
        var roll = me._updated_roll;
AI disponible
Sébastien MARQUE authored on 2017-03-10
480
        if (pitch > 80)
481
            pitch = 80;
clean pre-merge
Sébastien MARQUE authored on 2017-03-11
482
        elsif (pitch < -80)
AI disponible
Sébastien MARQUE authored on 2017-03-10
483
            pitch = -80;
484
        me.screenElements.Horizon
fix AI animation
Sébastien MARQUE authored on 2017-03-19
485
            .setCenter(459, 282.8 - 6.849 * pitch)
AI disponible
Sébastien MARQUE authored on 2017-03-10
486
            .setRotation(-roll * D2R)
fix AI animation
Sébastien MARQUE authored on 2017-03-19
487
            .setTranslation(0, pitch * 6.849);
AI disponible, avec bankPoin...
Sébastien MARQUE authored on 2017-03-10
488
        me.screenElements.bankPointer
489
            .setRotation(-roll * D2R);
adds slipskid animation
Sébastien MARQUE authored on 2017-03-24
490
        me.screenElements['SlipSkid']
491
            .setTranslation(getprop("/instrumentation/slip-skid-ball/indicated-slip-skid") * 10, 0);
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
492
        settimer(func me.updateAI(), 0.1);
AI disponible
Sébastien MARQUE authored on 2017-03-10
493
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
494
#}}}
animation VSI
Sébastien MARQUE authored on 2017-03-10
495

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
496
    updateVSI: func () {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
497
# animate VSI {{{
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
498
        var vsi = me._updated_vsi;
animation VSI
Sébastien MARQUE authored on 2017-03-10
499
        me.screenElements.VSIText
500
            .setText(num(math.round(vsi, 10)));
501
        if (vsi > 4500)
502
            vsi = 4500;
503
        elsif (vsi < -4500)
504
            vsi = -4500;
505
        me.screenElements.VSI
506
            .setTranslation(0, vsi * -0.03465);
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
507
        settimer(func me.updateVSI(), 0.1);
animation VSI
Sébastien MARQUE authored on 2017-03-10
508
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
509
#}}}
animation IAS
Sébastien MARQUE authored on 2017-03-10
510

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
511
    updateIAS: func () {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
512
# animates the IAS lint (PFD) {{{
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
513
        var ias = me._updated_ias;
animation IAS
Sébastien MARQUE authored on 2017-03-10
514
        if (ias >= 10)
515
            me.screenElements.Speed110
516
                .setText(sprintf("% 2u",num(math.floor(ias/10))));
517
        else
518
            me.screenElements.Speed110
519
                .setText('');
520
        me.screenElements.SpeedLint1
521
            .setTranslation(0,(math.mod(ias,10) + (ias >= 10)*10) * 36);
522
        me.screenElements.SpeedTape
523
            .setTranslation(0,ias * 5.711);
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
524
        if (ias > me._ias_vne and ! me._ias_already_exceeded) { # easier than .getColorFill
525
            me._ias_already_exceeded = 1;
526
            me.screenElements['IAS-bg']
527
                .setColorFill(1,0,0);
528
        }
529
        elsif (ias < me._ias_vne and me._ias_already_exceeded) { # easier than .getColorFill
530
            me._ias_already_exceeded = 0;
531
            me.screenElements['IAS-bg']
532
                .setColorFill(0,0,0);
533
        }
trends animation
Sébastien MARQUE authored on 2017-03-13
534
        var now = systime();
535
        # estimated speed in 6s
536
        var Sy = 6 * (ias - me._last_ias_kt) / (now - me._last_ias_s);
537
        if (abs(Sy) > 30)
538
            Sy = 30 * abs(Sy)/Sy; # = -30 or 30
539
        me.screenElements['Airspeed-Trend-Indicator']
540
            .setScale(1,Sy)
541
            .setTranslation(0, -284.5 * (Sy - 1));
542
        me._last_ias_kt = ias;
543
        me._last_ias_s = now;
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
544
        settimer(func me.updateIAS(), 0.1);
animation IAS
Sébastien MARQUE authored on 2017-03-10
545
    },
trends animation
Sébastien MARQUE authored on 2017-03-13
546
    _last_ias_kt : 0,
547
    _last_ias_s : systime(),
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
548
    _ias_vne : 999,
549
    _ias_already_exceeded : 0,
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
550
#}}}
animation ALT
Sébastien MARQUE authored on 2017-03-11
551

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
552
    updateTAS: func {
553
# updates the True Airspeed and GroundSpeed indicators {{{
554
        me.screenElements['TAS-text']
555
            .setText(sprintf('%iKT', getprop('/instrumentation/airspeed-indicator/true-speed-kt')));
556
        me.screenElements['GSPD-text']
557
            .setText(sprintf('%iKT', getprop('/velocities/groundspeed-kt')));
558
        settimer(func me.updateTAS(), 0.5);
559
    },
560
#}}}
561

            
562
    updateALT: func () {
563
# animates the altitude lint (PFD) {{{
564
        var alt = me._updated_alt;
animation ALT
Sébastien MARQUE authored on 2017-03-11
565
        if (alt < 0)
566
            me.screenElements.Alt11100
567
                .setText(sprintf("% 3i",math.ceil(alt/100)));
568
        elsif (alt < 100)
569
            me.screenElements.Alt11100
570
                .setText('');
571
        else
572
            me.screenElements.Alt11100
573
                .setText(sprintf("% 3i",math.floor(alt/100)));
574
        me.screenElements.AltLint00011
575
            .setTranslation(0,math.fmod(alt,100) * 1.24);
576

            
577
        # From Farmin/G1000 http://wiki.flightgear.org/Project_Farmin/FG1000
578
        if (alt> -1000 and alt< 1000000) {
579
            var Offset10 = 0;
580
            var Offset100 = 0;
581
            var Offset1000 = 0;
582
            if (alt< 0) {
583
                var Ne = 1;
584
                var alt= -alt;
585
            }
586
            else
587
                var Ne = 0;
588

            
589
            var Alt10       = math.mod(alt,100);
590
            var Alt100      = int(math.mod(alt/100,10));
591
            var Alt1000     = int(math.mod(alt/1000,10));
592
            var Alt10000    = int(math.mod(alt/10000,10));
593
            var Alt20       = math.mod(Alt10,20)/20;
594
            if (Alt10 >= 80)
595
                var Alt100 += Alt20;
596

            
597
            if (Alt10 >= 80 and Alt100 >= 9)
598
                var Alt1000 += Alt20;
599

            
600
            if (Alt10 >= 80 and Alt100 >= 9 and Alt1000 >= 9)
601
                var Alt10000 += Alt20;
602

            
603
            if (alt> 100)
604
                var Offset10 = 100;
605

            
606
            if (alt> 1000)
607
                var Offset100 = 10;
608

            
609
            if (alt> 10000)
610
                var Offset1000 = 10;
611

            
612
            if (!Ne) {
613
                me.screenElements.LintAlt.setTranslation(0,(math.mod(alt,100))*0.57375);
614
                var altCentral = (int(alt/100)*100);
615
            }
616
            elsif (Ne) {
617
                me.screenElements.LintAlt.setTranslation(0,(math.mod(alt,100))*-0.57375);
618
                var altCentral = -(int(alt/100)*100);
619
            }
620
            me.screenElements["AltBigC"].setText("");
621
            me.screenElements["AltSmallC"].setText("");
622
            for (var place = 1; place <= 6; place += 1) {
623
                var altUP = altCentral + (place*100);
624
                var offset = -30.078;
625
                if (altUP < 0) {
626
                    var altUP = -altUP;
627
                    var prefix = "-";
628
                    var offset += 15.039;
629
                }
630
                else
631
                    var prefix = "";
632

            
633
                if (altUP == 0) {
634
                    var AltBigUP    = "";
635
                    var AltSmallUP  = "0";
636

            
637
                }
638
                elsif (math.mod(altUP,500) == 0 and altUP != 0) {
639
                    var AltBigUP    = sprintf(prefix~"%1d", altUP);
640
                    var AltSmallUP  = "";
641
                }
642
                elsif (altUP < 1000 and (math.mod(altUP,500))) {
643
                    var AltBigUP    = "";
644
                    var AltSmallUP  = sprintf(prefix~"%1d", int(math.mod(altUP,1000)));
645
                    var offset = -30.078;
646
                }
647
                elsif ((altUP < 10000) and (altUP >= 1000) and (math.mod(altUP,500))) {
648
                    var AltBigUP    = sprintf(prefix~"%1d", int(altUP/1000));
649
                    var AltSmallUP  = sprintf("%1d", int(math.mod(altUP,1000)));
650
                    var offset += 15.039;
651
                }
652
                else {
653
                    var AltBigUP    = sprintf(prefix~"%1d", int(altUP/1000));
654
                    var mod = int(math.mod(altUP,1000));
655
                    var AltSmallUP  = sprintf("%1d", mod);
656
                    var offset += 30.078;
657
                }
658

            
659
                me.screenElements["AltBigU"~place].setText(AltBigUP);
660
                me.screenElements["AltSmallU"~place].setText(AltSmallUP);
661
                me.screenElements["AltSmallU"~place].setTranslation(offset,0);
662
                var altDOWN = altCentral - (place*100);
663
                var offset = -30.078;
664
                if (altDOWN < 0) {
665
                    var altDOWN = -altDOWN;
666
                    var prefix = "-";
667
                    var offset += 15.039;
668
                }
669
                else
670
                    var prefix = "";
671

            
672
                if (altDOWN == 0) {
673
                    var AltBigDOWN  = "";
674
                    var AltSmallDOWN    = "0";
675
                }
676
                elsif (math.mod(altDOWN,500) == 0 and altDOWN != 0) {
677
                    var AltBigDOWN  = sprintf(prefix~"%1d", altDOWN);
678
                    var AltSmallDOWN    = "";
679
                }
680
                elsif (altDOWN < 1000 and (math.mod(altDOWN,500))) {
681
                    var AltBigDOWN  = "";
682
                    var AltSmallDOWN    = sprintf(prefix~"%1d", int(math.mod(altDOWN,1000)));
683
                    var offset = -30.078;
684
                }
685
                elsif ((altDOWN < 10000) and (altDOWN >= 1000) and (math.mod(altDOWN,500))) {
686
                    var AltBigDOWN  = sprintf(prefix~"%1d", int(altDOWN/1000));
687
                    var AltSmallDOWN    = sprintf("%1d", int(math.mod(altDOWN,1000)));
688
                    var offset += 15.039;
689
                }
690
                else {
691
                    var AltBigDOWN  = sprintf(prefix~"%1d", int(altDOWN/1000));
692
                    var mod = int(math.mod(altDOWN,1000));
693
                    var AltSmallDOWN    = sprintf("%1d", mod);
694
                    var offset += 30.078;
695
                }
696
                me.screenElements["AltBigD"~place].setText(AltBigDOWN);
697
                me.screenElements["AltSmallD"~place].setText(AltSmallDOWN);
698
                me.screenElements["AltSmallD"~place].setTranslation(offset,0);
699
            }
700
        }
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
701
        me.updateSelectedALT();
trends animation
Sébastien MARQUE authored on 2017-03-13
702
        var now = systime();
703
        # altitude in 6s
704
        var Sy = .3 * (alt - me._last_alt_ft) / (now - me._last_alt_s); # scale = 1/20ft
705
        if (abs(Sy) > 15)
706
            Sy = 15 * abs(Sy)/Sy; # = -15 or 15
707
        me.screenElements['Altitude-Trend-Indicator']
708
            .setScale(1,Sy)
709
            .setTranslation(0, -284.5 * (Sy - 1));
710
        me._last_alt_ft = alt;
711
        me._last_alt_s = now;
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
712
        settimer(func me.updateALT(), 0.2);
animation ALT
Sébastien MARQUE authored on 2017-03-11
713
    },
trends animation
Sébastien MARQUE authored on 2017-03-13
714
    _last_alt_ft : 0,
715
    _last_alt_s  : systime(),
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
716
#}}}
animation HSI
Sébastien MARQUE authored on 2017-03-11
717

            
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
718
    updateBARO : func () {
719
# update BARO widget {{{
720
        var fmt = me._baro_unit == 'inhg' ? '%.2f%s' : '%i%s';
721
        me.screenElements['BARO-text']
722
            .setText(sprintf(fmt,
723
                        getprop('/instrumentation/altimeter/setting-' ~ me._baro_unit),
724
                        me._baro_unit == 'inhg' ? 'in' : 'hPa')
725
                );
726
    },
727
    _baro_unit : 'inhg',
728
#}}}
729

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
730
    updateHSI : func () {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
731
# rotates the compass (PFD) {{{
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
732
        var hdg = me._updated_hdg;
animation HSI
Sébastien MARQUE authored on 2017-03-11
733
        me.screenElements.Rose
734
            .setRotation(-hdg * D2R);
735
        me.screenElements['HDG-text']
736
            .setText(sprintf("%03u°", hdg));
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
737
        settimer(func me.updateHSI(), 0.1);
animation HSI
Sébastien MARQUE authored on 2017-03-11
738
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
739
#}}}
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
740

            
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
741
    updateHDG : func (hdg) {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
742
# moves the heading bug and display heading-deg for 3 seconds (PFD) {{{
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
743
        if (me.role == 'MFD')
744
            return;
745
        me.screenElements['Heading-bug']
746
            .setRotation(hdg * D2R);
747
        me.screenElements['SelectedHDG-bg']
748
            .show();
749
        me.screenElements['SelectedHDG-bgtext']
750
            .show();
751
        me.screenElements['SelectedHDG-text']
752
            .setText(sprintf('%03d°%s', hdg, ''))
753
            .show();
754
        me.addTimer(3, ['SelectedHDG-text', 'SelectedHDG-bgtext', 'SelectedHDG-bg']);
755
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
756
#}}}
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
757

            
adds CDI
Sébastien MARQUE authored on 2017-03-18
758
    updateCRS : func () {
anime CRS
Sébastien MARQUE authored on 2017-03-13
759
# TODO: update display for NAV/GPS/BRG courses {{{
760
        if (me.role == 'MFD')
761
            return;
adds CDI
Sébastien MARQUE authored on 2017-03-18
762
        var source = getprop('/instrumentation/zkv1000/cdi/source');
763
        if (source == 'OFF')
764
            return;
765
        var crs = getprop('/instrumentation/zkv1000/cdi/course');
766
        if (crs == nil)
767
            return;
anime CRS
Sébastien MARQUE authored on 2017-03-13
768
        me.screenElements['SelectedCRS-bg']
769
            .show();
770
        me.screenElements['SelectedCRS-bgtext']
771
            .show();
772
        me.screenElements['SelectedCRS-text']
773
            .setText(sprintf('%03d°%s', crs, ''))
adds CDI
Sébastien MARQUE authored on 2017-03-18
774
            .setColor(source == 'GPS' ? me.colors.magenta : me.colors.green)
anime CRS
Sébastien MARQUE authored on 2017-03-13
775
            .show();
776
        me.addTimer(3, ['SelectedCRS-text', 'SelectedCRS-bgtext', 'SelectedCRS-bg']);
777
    },
778
#}}}
779

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
780
    updateSelectedALT : func {
781
# animation for altitude section, called via updatedALT {{{
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
782
        if (! device[0].display.screenElements['SelectedALT'].getVisible())
783
            return;
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
784
        var selected_alt = getprop('/instrumentation/zkv1000/afcs/selected-alt-ft');
785
        var delta_alt = me._updated_alt - selected_alt;
786
        if (abs(delta_alt) > 300)
787
            delta_alt = 300 * abs(delta_alt)/delta_alt;
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
788
        me.screenElements['SelectedALT-symbol']
789
            .setVisible(abs(delta_alt) > 100);
790
        me.screenElements['SelectedALT-bg']
791
            .setVisible(abs(delta_alt) > 100);
792
        me.screenElements['SelectedALT-text']
793
            .setText(sprintf("%i", selected_alt))
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
794
            .setVisible(abs(delta_alt) > 100);
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
795
        me.screenElements['SelectedALT-bug']
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
796
            .setTranslation(0, delta_alt * 0.567); # 170/300 = 0.567
797
    },
798
#}}}
799

            
adds CDI
Sébastien MARQUE authored on 2017-03-18
800
    updateCDI : func {
801
# animation for CDI {{{
802
        var source = getprop('/instrumentation/zkv1000/cdi/source');
803
        if (source == 'OFF') {
804
            foreach (var s; ['GPS', 'NAV1', 'NAV2'])
805
                foreach (var t; ['pointer', 'CDI'])
806
                    me.screenElements[s ~ '-' ~ t].hide();
807
            me.screenElements['CDI-GPS-ANN-text'].hide();
808
            me.screenElements['CDI-GPS-XTK-text'].hide();
809
            me.screenElements['CDI-SRC-text'].hide();
810
            me.screenElements['CDI'].hide();
811
        }
812
        else {
813
            var course = getprop('/instrumentation/zkv1000/cdi/course');
makes the CDI available
Sébastien MARQUE authored on 2017-03-23
814
            var rot = (course - me._updated_hdg) * D2R;
adds CDI
Sébastien MARQUE authored on 2017-03-18
815
            me.screenElements['CDI']
makes the CDI available
Sébastien MARQUE authored on 2017-03-23
816
                .setRotation(rot)
adds CDI
Sébastien MARQUE authored on 2017-03-18
817
                .show();
818
            me.screenElements['GPS-CTI']
819
                .setVisible(source == 'GPS');
820
            me.screenElements['GPS-CTI-diamond']
821
                .setVisible(source == 'GPS');
822
            foreach (var s; ['GPS', 'NAV1', 'NAV2']) {
823
                me.screenElements[s ~ '-pointer']
824
                    .setRotation(rot)
825
                    .setVisible(source == s);
826
                me.screenElements[s ~ '-CDI']
827
                    .setVisible(source == s);
828
                foreach (var f; ['FROM', 'TO'])
829
                    me.screenElements[s ~ '-' ~ f]
makes the CDI available
Sébastien MARQUE authored on 2017-03-23
830
                        .setVisible(s == source and getprop('/instrumentation/zkv1000/cdi/' ~ f ~ '-flag'));
adds CDI
Sébastien MARQUE authored on 2017-03-18
831
                me.screenElements['CDI-SRC-text']
832
                    .setText(source)
833
                    .setColor(source == 'GPS' ? me.colors.magenta : me.colors.green)
834
                    .show();
835
            }
makes the CDI available
Sébastien MARQUE authored on 2017-03-23
836
            var deflection = getprop('/instrumentation/zkv1000/cdi/course-deflection');
837
            if (left(source, 3) == 'NAV')
838
                var scale = deflection / 4;
839
            else { # GPS
840
                # TODO: deviation depending of the flight phase
841
                # for now fixed 1 dot = 1 nm course error
842
                var abs_deflection = abs(deflection);
843
                me.screenElements['CDI-GPS-XTK-text']
844
                    .setText(sprintf('XTK %iNM', abs_deflection))
845
                    .setVisible(abs_deflection > 2.4);
846
                var scale = deflection / 2;
847
            }
848
            scale = (abs(scale) > 1.2) ? 1.2 : scale;
849
            me.screenElements[source ~ '-CDI']
850
                .setTranslation(65 * scale, 0);
851
            settimer(func me.updateCDI(), 0.3);
adds CDI
Sébastien MARQUE authored on 2017-03-18
852
        }
853
    },
854
#}}}
855

            
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
856
    _updateRadio: func {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
857
# common parts for NAV/LOC/COMM radios{{{
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
858
        # arg[0]._r = <comm|nav>
859
        if (contains(arg[0], "active")) {
860
            if (arg[0]['active'] == 'none') {
861
                me.screenElements[arg[0]._r ~ '1-selected-freq']
862
                    .setColor(1,1,1);
863
                me.screenElements[arg[0]._r ~ '2-selected-freq']
864
                    .setColor(1,1,1);
865
            }
866
            else {
867
                me.screenElements[arg[0]._r ~ arg[0]['active'] ~ '-selected-freq']
868
                    .setColor(0,1,0);
869
                me.screenElements[arg[0]._r ~ arg[0].inactive ~ '-selected-freq']
870
                    .setColor(1,1,1);
871
            }
872
        }
873
        if (contains(arg[0], 'tune')) {
874
            # n = 0 -> NAV1/COMM1
875
            # n = 1 -> NAV1/COMM2
876
            me.screenElements[arg[0]._r ~ '-freq-switch']
877
                .setTranslation(0, arg[0].tune * 25);
878
            me.screenElements[arg[0]._r ~ (arg[0].tune + 1) ~ '-standby-freq']
879
                .setColor(0,1,1);
880
            me.screenElements[arg[0]._r ~ ((arg[0].tune == 0) + 1) ~ '-standby-freq']
881
                .setColor(1,1,1);
882
        }
883
        if (contains(arg[0], 'refresh')) {
small stuff
Sébastien MARQUE authored on 2017-03-22
884
            # refresh only one line: NAV1/COMM1 or NAV2/COMM2
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
885
            var fmt = (arg[0]._r == 'nav') ? '%.2f' : '%.3f';
886
            me.screenElements[arg[0]._r ~ arg[0].refresh ~ '-selected-freq']
887
                .setText(sprintf(fmt, getprop('/instrumentation/'
888
                               ~ arg[0]._r ~ '[' ~ (arg[0].refresh - 1) ~ ']/frequencies/selected-mhz')));
889
            me.screenElements[arg[0]._r ~ arg[0].refresh ~ '-standby-freq']
890
                .setText(sprintf(fmt, getprop('/instrumentation/'
891
                               ~ arg[0]._r ~ '[' ~ (arg[0].refresh - 1) ~ ']/frequencies/standby-mhz')));
892
        }
893
        if (contains(arg[0], 'set')) {
894
            # positionne la valeur modifiée, les listeners "trigguent" en permanence ces propriétés, donc exit
895
            var n = getprop('/instrumentation/zkv1000/radios/' ~ arg[0]._r ~ '-tune');
896
            var fmt = (arg[0]._r == 'nav') ? '%.2f' : '%.3f';
897
            me.screenElements[arg[0]._r ~ (n + 1) ~ '-standby-freq']
fix freq display while setti...
Sébastien MARQUE authored on 2017-03-16
898
                .setText(sprintf(fmt, getprop('/instrumentation/' ~ arg[0]._r ~ '[' ~ n ~ ']/frequencies/standby-mhz')));
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
899
        }
900
        if (contains(arg[0], 'auto')) {
901
            # pour rafraichir automagiquement, toutes les deux secondes un refresh pour un NAV
902
            var radio = arg[0].auto;
903
            me._updateRadio({refresh: 1, _r: radio});
904
            settimer(func me._updateRadio({refresh: 2, _r: radio}), 1);
905
            settimer(func me._updateRadio({auto: radio}), 2);
906
        }
907
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
908
#}}}
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
909

            
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
910
    updateNAV : func {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
911
# update NAV/LOC rodios display upper left (PFD/MFD){{{
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
912
        # made active via menu
913
        if (contains(arg[0], "active")) {
adds CDI
Sébastien MARQUE authored on 2017-03-18
914
            arg[0]._r = 'nav';
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
915
            if (arg[0]['active'] == 'none') {
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
916
                me._updateRadio(arg[0]);
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
917
                me.screenElements['nav1-id']
918
                    .setColor(1,1,1);
919
                me.screenElements['nav2-id']
920
                    .setColor(1,1,1);
921
                me.screenElements['NAV1-pointer']
922
                    .hide();
923
                me.screenElements['NAV2-pointer']
924
                    .hide();
925
            }
926
            else {
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
927
                arg[0].inactive = (arg[0]['active'] == 1) + 1;
928
                me._updateRadio(arg[0]);
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
929
                me.screenElements['nav' ~ arg[0]['active'] ~ '-id']
930
                    .setColor(0,1,0);
931
                me.screenElements['NAV' ~ arg[0]['active'] ~ '-pointer']
932
                    .show();
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
933
                me.screenElements['nav' ~ arg[0].inactive ~ '-id']
934
                    .setColor(1,1,1);
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
935
#                me.screenElements['HDI']
936
#                    .setRotation();
937
#                me.screenElements['NAV' ~ inactive ~ '-pointer']
938
#                    .hide();
939
#                foreach (var e; [ 'FROM', 'TO', 'CDI' ])
940
#                    me.screenElements['NAV' ~ inactive ~ '-' ~ e]
941
#                        .hide();
942
            }
943
        }
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
944
        elsif (contains(arg[0], 'nav-id')) {
Correction swap NAV tuning
Sébastien MARQUE authored on 2017-03-12
945
            # 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
946
            if (arg[0].val == nil)
947
                arg[0].val = '';
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
948
            me.screenElements["nav" ~ arg[0]['nav-id'] ~ "-id"]
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
949
                    .setText(arg[0].val);
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
950
        }
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
951
        else {
952
            arg[0]._r = 'nav';
953
            me._updateRadio(arg[0]);
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
954
        }
955
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
956
#}}}
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
957

            
958
    updateCOMM: func {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
959
# update COMM radios display upper right (PFD/MFD){{{
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
960
        arg[0]._r = 'comm';
961
        me._updateRadio(arg[0]);
962
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
963
#}}}
anime time display
Sébastien MARQUE authored on 2017-03-13
964

            
965
    updateTIME : func {
966
# updates the displayed time botoom left {{{
967
        me.screenElements['TIME-text']
968
            .setText(getprop('/sim/time/gmt-string'));
969
        settimer(func me.updateTIME(), 1);
970
    },
971
#}}}
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
972

            
adds transponder
Sébastien MARQUE authored on 2017-03-17
973
    updateXPDR : func {
974
# updates transponder display {{{
975
        for (var d = 0; d < 4; d+=1)
976
            me.screenElements['XPDR-DIGIT-' ~ d ~ '-text']
977
                .setText(sprintf('%i', getprop('/instrumentation/transponder/inputs/digit[' ~ d ~ ']')));
978
        var tuning = getprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit');
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
979
        var fms = getprop('/instrumentation/zkv1000/radios/xpdr-tuning-fms-method');
980
        for (var d = 0; d < 4; d+=1)
981
            me.screenElements['XPDR-DIGIT-' ~ d ~ '-text']
982
                .setColor(1,1,1);
983
        if (tuning != nil) {
984
            me.screenElements['XPDR-DIGIT-' ~ tuning ~ '-text']
985
                .setColor(0,1,1);
986
            if (fms)
987
                me.screenElements['XPDR-DIGIT-' ~ (tuning - 1) ~ '-text']
988
                    .setColor(0,1,1);
989
        }
adds transponder
Sébastien MARQUE authored on 2017-03-17
990
        else {
991
            if (getprop('/instrumentation/transponder/ident'))
992
                var mode = 'IDENT';
993
            else
994
                var mode = getprop('/instrumentation/zkv1000/radio/xpdr-mode');
995
            var wow = getprop('/gear/gear/wow');
996
            if (! wow and mode != 'STBY')
997
                var color = [0, 1, 0];
998
            else
999
                var color = [1, 1, 1];
1000
            for (var d = 0; d < 4; d+=1)
1001
                me.screenElements['XPDR-DIGIT-' ~ d ~ '-text']
1002
                    .setColor(color);
1003
            me.screenElements['XPDR-MODE-text']
1004
                .setColor(color)
1005
                .setText(mode);
1006
        }
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
1007
    },
adds transponder
Sébastien MARQUE authored on 2017-03-17
1008
#}}}
1009

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
1010
    updateOAT : func {
1011
# update OAT display on normal and reversionnary modes (every 3s) {{{
1012
        var tmp = getprop('/environment/temperature-deg' ~ me._oat_unit);
1013
        me.screenElements['OAT-text']
1014
            .setText(sprintf((abs(tmp) < 10) ? "%.1f %s" : "%i %s", tmp, (me._oat_unit == 'c') ? '°C' : 'F'));
1015
        settimer(func me.updateOAT(), 3);
1016
    },
1017
    _oat_unit : 'c',
1018
#}}}
1019

            
1020
    updateWindData : func {
1021
# update the window text and arrows for OPTN1/2 {{{
1022
        if (me._winddata_optn == 0)
1023
            return;
improves WindData display
Sébastien MARQUE authored on 2017-03-16
1024
        if (me._updated_ias < 30) {
1025
            me.screenElements['WindData-NODATA']
1026
                .hide();
1027
            var wind_hdg = getprop('/environment/wind-from-heading-deg');
1028
            var wind_spd = getprop('/environment/wind-speed-kt');
1029
            var alpha = wind_hdg - me._updated_hdg;
1030
            if (me._winddata_optn == 1) {
1031
                me.screenElements['WindData-OPTN1-HDG']
1032
                    .setRotation((alpha + 180) * D2R)
1033
                    .show();
1034
                me.screenElements['WindData-OPTN1-HDG-text']
1035
                    .setText(sprintf("%03i°", wind_hdg))
1036
                    .show();
1037
                me.screenElements['WindData-OPTN1-SPD-text']
1038
                    .setText(int(wind_spd) ~ 'KT')
1039
                    .show();
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
1040
            }
improves WindData display
Sébastien MARQUE authored on 2017-03-16
1041
            else { # me._winddata_optn == 2
1042
                alpha *= D2R;
1043
                var Vt = wind_spd * math.sin(alpha);
1044
                var Ve = wind_spd * math.cos(alpha);
1045
                if (Vt != 0) {
1046
                    me.screenElements['WindData-OPTN2-crosswind-text']
1047
                        .setText(sprintf('%i', abs(Vt)))
1048
                        .show();
1049
                    me.screenElements['WindData-OPTN2-crosswind']
1050
                        .setScale(-abs(Vt)/Vt, 1)
1051
                        .setTranslation(-35 * (abs(Vt)/Vt + 1), 0)
1052
                        .show();
1053
                }
1054
                if (Ve != 0) {
1055
                    me.screenElements['WindData-OPTN2-headwind-text']
1056
                        .setText(sprintf('%i', abs(Ve)))
1057
                        .show();
1058
                    me.screenElements['WindData-OPTN2-headwind']
1059
                        .setScale(1, abs(Ve)/Ve)
1060
                        .setTranslation(0, 515 * (1 - abs(Ve)/Ve))
1061
                        .show();
1062
                }
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
1063
            }
1064
        }
improves WindData display
Sébastien MARQUE authored on 2017-03-16
1065
        else {
1066
            foreach (var e; [
1067
                    'WindData-OPTN1-HDG',
1068
                    'WindData-OPTN1-HDG-text',
1069
                    'WindData-OPTN1-SPD-text',
1070
                    'WindData-OPTN2-crosswind-text',
1071
                    'WindData-OPTN2-crosswind',
1072
                    'WindData-OPTN2-headwind-text',
1073
                    'WindData-OPTN2-headwind'
1074
            ])
1075
                me.screenElements[e].hide();
1076
            me.screenElements['WindData-NODATA'].show();
1077
        }
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
1078
        settimer(func me.updateWindData(), 0.5);
1079
    },
1080
    _winddata_optn : 0,
1081
#}}}
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
1082

            
1083
    updateBRG : func {
some added comments
Sébastien MARQUE authored on 2017-03-18
1084
# displays and update BRG1/2 {{{
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
1085
        foreach (var brg; [1, 2]) {
1086
            var source = 'brg' ~ brg ~ '-source';
1087

            
1088
            var dev = radios.getNode(source).getValue();
1089
            var el  = 'BRG' ~ brg;
1090
            if (dev != 'OFF') {
colorize BRG1/2 when needed,...
Sébastien MARQUE authored on 2017-03-21
1091
                if (size(me.device.softkeys.path) == 1 and me.device.softkeys.path[0] == 'PFD')
1092
                    me.setSoftKeyColor(brg == 1 ? 4 : 6, 1);
1093
                else
1094
                    me.setSoftKeyColor(brg == 1 ? 4 : 6, 0);
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
1095
                var info = {
1096
                    pointer : nil,
1097
                    id : 'NO DATA',
1098
                    hdg : nil,
1099
                    dst : '--.-NM'
1100
                };
1101
                if (left(dev, 3) == 'NAV') {
1102
                    info.pointer = getprop('/instrumentation/nav[' ~ (brg - 1) ~ ']/in-range');
1103
                    if (info.pointer) {
1104
                        info.id  = getprop('/instrumentation/nav[' ~ (brg - 1) ~ ']/nav-id');
1105
                        info.hdg = getprop('/instrumentation/nav[' ~ (brg - 1) ~ ']/heading-deg');
1106
                        info.dst = sprintf('%.1d', getprop('/instrumentation/nav[' ~ (brg - 1) ~ ']/nav-distance') / 1852); # m -> /1852
1107
                    }
1108
                }
1109
                elsif (dev == 'GPS') {
1110
                    info.pointer = props.getNode('/instrumentation/gps/wp').getChild('wp[1])');
1111
                    if (info.pointer) {
1112
                        info.id  = getprop('/instrumentation/gps/wp/wp[1]/ID');
1113
                        info.hdg = getprop('/instrumentation/gps/wp/wp[1]/bearing-mag-deg');
1114
                        info.dst = sprintf('%.1d', getprop('/instrumentation/gps/wp/wp[1]/distance-nm'));
1115
                    }
1116
                }
1117
                else { # there are 2 available ADF in FG, but instrument manage only 1
1118
                    info.pointer = getprop('/instrumentation/adf/in-range');
1119
                    if (info.pointer) {
1120
                        info.id  = getprop('/instrumentation/adf/ident');
1121
                        info.hdg = getprop('/instrumentation/adf/indicated-bearing-deg');
1122
                    }
1123
                }
1124

            
1125
                if (info.pointer)
1126
                    me.screenElements[el ~ '-pointer']
1127
                        .setRotation(-info.hdg-me._updated_hdg * D2R)
1128
                        .show();
1129
                else
1130
                    me.screenElements[el ~ '-pointer']
1131
                        .hide();
1132
                me.screenElements[el ~ '-SRC-text']
1133
                    .setText(dev);
1134
                me.screenElements[el ~ '-DST-text']
1135
                    .setText(info.dst);
1136
                me.screenElements[el ~ '-WPID-text']
1137
                    .setText(info.id);
1138
                me.screenElements['BRG' ~ brg]
1139
                    .show();
1140
            }
1141
            else {
colorize BRG1/2 when needed,...
Sébastien MARQUE authored on 2017-03-21
1142
                me.setSoftKeyColor(brg == 1 ? 4 : 6, 0);
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
1143
                me.screenElements['BRG' ~ brg]
1144
                    .hide();
1145
            }
1146
        }
colorize BRG1/2 when needed,...
Sébastien MARQUE authored on 2017-03-21
1147
        settimer(func me.updateBRG(), 0.5);
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
1148
    },
some added comments
Sébastien MARQUE authored on 2017-03-18
1149
#}}}
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
1150

            
animation texts EIS + power ...
Sébastien MARQUE authored on 2017-03-19
1151
    updateEIS : func {
1152
# displays Engine Informations System {{{
1153
        var power = getprop('/controls/engines/engine/throttle') * getprop('/engines/engine/running');
1154
        me.screenElements['POWER-pointer']
1155
            .setRotation(D2R * 140 * power);
1156
        me.screenElements['POWER-PERCENT-text']
1157
            .setText(sprintf('%u', power));
1158
        me.screenElements['RPM-text']
1159
            .setText(sprintf(math.round(getprop('/engines/engine/rpm'), 50)));
1160
        me.screenElements['MAN-Hg-text']
1161
            .setText(sprintf('%.1d', getprop('/engines/engine/mp-inhg')));
1162
        me.screenElements['FUEL-FLOW-text']
1163
            .setText(sprintf('%.1f', getprop('/engines/engine/fuel-flow-gph')));
1164
        if (math.mod(me._eis_count, 10) == 0) {
1165
            var psi = getprop('/engines/engine/oil-pressure-psi');
1166
            me.screenElements['PSI-text']
1167
                .setText(psi == nil ? '--' : sprintf('%u', psi));
1168
            me.screenElements['OIL-TEMP-text']
1169
                .setText(sprintf('%i', getprop('/engines/engine/oil-temperature-degf')));
1170
            var used_fuel = getprop('/instrumentation/zkv1000/eis/fuel-qty-at-start')
1171
                          - getprop('/consumables/fuel/tank/level-gal_us')
1172
                          - getprop('/consumables/fuel/tank[1]/level-gal_us');
1173
            me.screenElements['FUEL-USED-text']
1174
                .setText(sprintf('%.1d', used_fuel > 0 ? used_fuel : 0));
1175
            me.screenElements['BUS-V-text']
1176
                .setText(sprintf('%.1i', getprop('/systems/electrical/outputs/bus')));
1177
            me.screenElements['BATT-text']
1178
                .setText(sprintf('%+i', getprop('/systems/electrical/amps')));
1179
            var cht = getprop('/engines/engine/cht-degf');
1180
            me.screenElements['CHT-text']
1181
                .setText(cht == nil ? '--' : sprintf('%i', cht));
1182
            me.screenElements['EGT-text']
1183
                .setText(sprintf('%i', getprop('/engines/engine/egt-degf')));
1184
        }
1185
        settimer(func me.updateEIS(), 1);
1186
        me._eis_count += 1;
1187
    },
1188
    _eis_count : 0,
1189
#}}}
adds OMI to PFD
Sébastien MARQUE authored on 2017-03-23
1190

            
1191
    updateOMI : func {
1192
# display marker baecon Outer, Middle, Inner {{{
1193
        var marker = nil;
1194
        foreach (var m; ['outer', 'middle', 'inner'])
1195
            if (getprop('/instrumentation/marker-beacon/' ~ m)) {
1196
                print(m);
1197
                marker = m;
1198
                me.screenElements['OMI']
1199
                    .show();
1200
                break;
1201
            }
1202
        if (marker != nil) {
1203
            me.screenElements['MarkerText']
1204
                .setText(me._omi_data[marker].t)
1205
                .show();
1206
            me.screenElements['MarkerBG']
1207
                .setColorFill(me._omi_data[marker].bg)
1208
                .show();
1209
        }
1210
        else
1211
            me.screenElements['OMI']
1212
                .hide();
1213
        settimer(func me.updateOMI(), 1);
1214
    },
1215
    _omi_data : {
1216
        'outer':  {t: 'O', bg: [0,1,1]},
1217
        'middle': {t: 'M', bg: [1,1,1]},
1218
        'inner':  {t: 'I', bg: [1,1,0]},
1219
    },
1220
#}}}
animation texts EIS + power ...
Sébastien MARQUE authored on 2017-03-19
1221
};
1222

            
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
1223
var keyMap = {
add new vim folds
Sébastien MARQUE authored on 2017-03-15
1224
# softkeys map for PFD and MFD {{{
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
1225
    PFD : {
1226
        first : 1,
1227
        texts : ['INSET', 'SENSOR', 'PFD', 'OBS', 'CDI', 'DME', 'XPDR', 'IDENT', 'TMR/REF', 'NRST' ],
1228
        INSET : {
1229
            texts : ['OFF', 'DCLTR', 'WXLGND', 'TRAFFIC', 'TOPO', 'TERRAIN', 'STRMSCP', 'NEXRAD-C', 'XM LTNG', 'METAR'],
1230
        },
1231
        SENSOR : {
1232
            first : 2,
1233
            texts : [ 'ADC1', 'ADC2', '', 'AHRS1', 'AHRS2'],
1234
        },
1235
        PFD : {
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
1236
            texts : [ 'SYN VIS', 'DFLTS', 'AOA/WIND', 'DME', 'BRG1', 'HSI FMT', 'BRG2', '', 'ALT UNIT', 'STD BARO' ],
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
1237
            'SYN VIS' : {
1238
                texts : [ 'PATHWAY', 'SYN TERR', 'HR2NHDG', 'APTSIGNS', 'FPM'],
1239
            },
1240
            'AOA/WIND' : {
1241
                first : 4,
1242
                texts : ['AOA', 'WIND'],
1243
                AOA : {
1244
                    first : 5,
1245
                    texts : ['AOA ON', 'AOA AUTO'],
1246
                },
1247
                WIND : {
1248
                    first : 2,
1249
                    texts : ['OPTN1', 'OPTN2', '', 'OFF'],
1250
                },
1251
            },
1252
            'HSI FMT' : {
1253
                first : 6,
1254
                texts : ['360 HSI', 'ARC HSI'],
1255
            },
1256
            'ALT UNIT' : {
1257
                first : 5,
1258
                texts : ['METERS', '', 'IN', 'HPA'],
1259
            },
1260
        },
1261
        XPDR : {
1262
            first : 2,
1263
            texts : ['STBY', 'ON', 'ALT', '', 'VFR', 'CODE', 'IDENT'],
1264
            CODE : {
1265
                texts : ['0', '1', '2', '3', '4', '5', '6', '7', 'IDENT', 'BKSP'],
1266
            },
1267
        },
1268
    },
1269
    MFD : {
1270
        texts : ['ENGINE', '', 'MAP', '', '', '', '', '', '', 'DCLTR', 'SHW CHRT', 'CHKLIST'],
1271
        MAP : {
1272
            texts: ['TRAFFIC', 'PROFILE', 'TOPO', 'TERRAIN', 'AIRWAYS', 'STRMSCP','NEXRAD-C', 'XM LTNG', 'METAR', 'LEGEND', 'BACK'],
1273
        },
1274
        CHKLIST : {
1275
            texts : ['ENGINE', '', '', '', '', 'DONE', '', '', '', '', 'EXIT', 'EMERGCY'],
1276
        },
1277
        ENGINE : {
1278
            texts : ['ENGINE', 'ANTI-ICE', '', 'DCLTR', '', 'ASSIST', '', '', '', '', 'FUEL'],
1279
            'ANTI-ICE' : {
1280
                texts : ['LEFT', 'AUTO', 'RIGHT', '', '', '', '', '', '', '', '', 'BACK'],
1281
            },
1282
            FUEL : {
1283
                first : 1,
1284
                texts : ['FULL', 'TABS', '', '', '', '', '', '', '', 'UNDO', 'ENTER'],
1285
            },
1286
        },
1287
    },
1288
};
add new vim folds
Sébastien MARQUE authored on 2017-03-15
1289
#}}}