zkv1000 / Nasal / display.nas /
Newer Older
1290 lines | 48.619kb
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 {{{
new var organistaion (and fi...
Sébastien MARQUE authored on 2017-03-26
782
        if (! PFD.display.screenElements['SelectedALT'].getVisible())
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
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']
animates GPS-CTI
Sébastien MARQUE authored on 2017-03-24
819
                .setVisible(getprop('/instrumentation/gps/wp/wp[1]/valid'))
820
                .setRotation(getprop('/instrumentation/gps/wp/wp[1]/course-deviation-deg') * D2R);
adds CDI
Sébastien MARQUE authored on 2017-03-18
821
            me.screenElements['GPS-CTI-diamond']
animates GPS-CTI
Sébastien MARQUE authored on 2017-03-24
822
                .setVisible(getprop('/instrumentation/gps/wp/wp[1]/valid'))
823
                .setRotation(getprop('/instrumentation/gps/wp/wp[1]/course-deviation-deg') * D2R);
adds CDI
Sébastien MARQUE authored on 2017-03-18
824
            foreach (var s; ['GPS', 'NAV1', 'NAV2']) {
825
                me.screenElements[s ~ '-pointer']
826
                    .setRotation(rot)
827
                    .setVisible(source == s);
828
                me.screenElements[s ~ '-CDI']
829
                    .setVisible(source == s);
830
                foreach (var f; ['FROM', 'TO'])
831
                    me.screenElements[s ~ '-' ~ f]
makes the CDI available
Sébastien MARQUE authored on 2017-03-23
832
                        .setVisible(s == source and getprop('/instrumentation/zkv1000/cdi/' ~ f ~ '-flag'));
adds CDI
Sébastien MARQUE authored on 2017-03-18
833
                me.screenElements['CDI-SRC-text']
834
                    .setText(source)
835
                    .setColor(source == 'GPS' ? me.colors.magenta : me.colors.green)
836
                    .show();
837
            }
makes the CDI available
Sébastien MARQUE authored on 2017-03-23
838
            var deflection = getprop('/instrumentation/zkv1000/cdi/course-deflection');
839
            if (left(source, 3) == 'NAV')
840
                var scale = deflection / 4;
841
            else { # GPS
842
                # TODO: deviation depending of the flight phase
843
                # for now fixed 1 dot = 1 nm course error
844
                var abs_deflection = abs(deflection);
845
                me.screenElements['CDI-GPS-XTK-text']
846
                    .setText(sprintf('XTK %iNM', abs_deflection))
847
                    .setVisible(abs_deflection > 2.4);
848
                var scale = deflection / 2;
849
            }
850
            scale = (abs(scale) > 1.2) ? 1.2 : scale;
851
            me.screenElements[source ~ '-CDI']
852
                .setTranslation(65 * scale, 0);
853
            settimer(func me.updateCDI(), 0.3);
adds CDI
Sébastien MARQUE authored on 2017-03-18
854
        }
855
    },
856
#}}}
857

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

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

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

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

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

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

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

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

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

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

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

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

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