zkv1000 / Nasal / display.nas /
Newer Older
1253 lines | 47.201kb
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',
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
116
                );
117
                append(groups.hide,
adds EIS
Sébastien MARQUE authored on 2017-03-18
118
                    'EIS',
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
119
                    'CDI',
adds CDI
Sébastien MARQUE authored on 2017-03-18
120
                    'NAV1-pointer', 'NAV1-CDI', 'NAV1-FROM', 'NAV1-TO',
121
                    'NAV2-pointer', 'NAV2-CDI', 'NAV2-FROM', 'NAV2-TO',
122
                    '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
123
                    'BRG1-pointer',
124
                    'BRG2-pointer',
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
125
                    'SelectedHDG-bg',
126
                    'SelectedHDG-bgtext',
127
                    'SelectedHDG-text',
128
                    'SelectedCRS-bg',
129
                    'SelectedCRS-bgtext',
130
                    'SelectedCRS-text',
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
131
                    'SelectedALT', 'SelectedALT-bug', 'SelectedALT-bg', 'SelectedALT-symbol',
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
132
                    'TAS',
133
                    'GSPD',
134
                    'WindData',
135
                    'Reversionnary',
136
                    'Annunciation',
137
                    'Comparator',
138
                    'BRG1',
139
                    'BRG2',
140
                    'DME1',
141
                    'PFD-Map',
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
142
                    'PFD-Multilines',
improves WindData display
Sébastien MARQUE authored on 2017-03-16
143
                    '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
144
                );
145
                append(groups.clip,
animation IAS
Sébastien MARQUE authored on 2017-03-10
146
                    'SpeedLint1',
animation ALT
Sébastien MARQUE authored on 2017-03-11
147
                    'SpeedTape',
148
                    'LintAlt',
149
                    'AltLint00011'
150
                );
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
151
                append(groups.text,
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
152
                    'SelectedALT-text',
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
153
                    'TAS-text',
154
                    'GSPD-text',
anime time display
Sébastien MARQUE authored on 2017-03-13
155
                    'TIME-text',
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
156
                    'OAT-text',
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
157
                    'VSIText',
158
                    'Speed110',
159
                    'Alt11100',
160
                    'HDG-text',
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
161
                    'BARO-text',
adds CDI
Sébastien MARQUE authored on 2017-03-18
162
                    'CDI-SRC-text', 'CDI-GPS-ANN-text', 'CDI-GPS-XTK-text',
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
163
                    'BRG1-pointer', 'BRG1-SRC-text', 'BRG1-DST-text', 'BRG1-WPID-text',
164
                    'BRG2-pointer', 'BRG2-SRC-text', 'BRG2-DST-text', 'BRG2-WPID-text',
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
165
                    'WindData-OPTN1-HDG-text', 'WindData-OPTN1-SPD-text',
166
                    'WindData-OPTN2-crosswind-text', 'WindData-OPTN2-headwind-text',
adds transponder
Sébastien MARQUE authored on 2017-03-17
167
                    '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
168
                    'AltBigC', 'AltSmallC'
169
                );
170
                for (var place = 1; place <= 6; place +=1) {
171
                    append(groups.text,
172
                        'AltBigU' ~ place,
173
                        'AltSmallU' ~ place,
174
                        'AltBigD' ~ place,
175
                        'AltSmallD' ~ place
176
                    );
177
                }
animation ALT
Sébastien MARQUE authored on 2017-03-11
178
            }
adds EIS
Sébastien MARQUE authored on 2017-03-18
179
            else {
animation texts EIS + power ...
Sébastien MARQUE authored on 2017-03-19
180
                append(groups.show, 'EIS', 'POWER-pointer');
181
                append(groups.text,
182
                        'RPM-text', 'EGT-text', 'CHT-text', 'FUEL-USED-text',
183
                        'FUEL-FLOW-text', 'MAN-Hg-text', 'POWER-PERCENT-text',
184
                        'RPM-text', 'BUS-V-text', 'BATT-text', 'PSI-text',
185
                        'OIL-TEMP-text'
186
                    );
adds EIS
Sébastien MARQUE authored on 2017-03-18
187
            }
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
188

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

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

            
226
    showInitProgress : func (role) {
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
        me.progress = me.display.createGroup();
229
        me.progress.show();
230
        me.progress.createChild("text", role ~ " title")
231
            .setTranslation(512, 384)
232
            .setAlignment("center-center")
233
            .setFont("LiberationFonts/LiberationSans-Italic.ttf")
234
            .setFontSize(64, 1)
235
            .setColor(1,1,1)
236
            .setText("ZKV1000 " ~ role ~ " init");
237

            
238
        zkv.getNode(role ~ 'init',1).setIntValue(1);
239

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

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

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

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

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

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

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

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

            
415
        var path = keyMap[me.role];
416
        foreach (var p; me.device.softkeys.path)
417
            path = path[p];
418

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

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

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

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

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
473
    updateAI: func(){
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
474
#{{{
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
475
        var pitch = me._updated_pitch;
476
        var roll = me._updated_roll;
AI disponible
Sébastien MARQUE authored on 2017-03-10
477
        if (pitch > 80)
478
            pitch = 80;
clean pre-merge
Sébastien MARQUE authored on 2017-03-11
479
        elsif (pitch < -80)
AI disponible
Sébastien MARQUE authored on 2017-03-10
480
            pitch = -80;
481
        me.screenElements.Horizon
fix AI animation
Sébastien MARQUE authored on 2017-03-19
482
            .setCenter(459, 282.8 - 6.849 * pitch)
AI disponible
Sébastien MARQUE authored on 2017-03-10
483
            .setRotation(-roll * D2R)
fix AI animation
Sébastien MARQUE authored on 2017-03-19
484
            .setTranslation(0, pitch * 6.849);
AI disponible, avec bankPoin...
Sébastien MARQUE authored on 2017-03-10
485
        me.screenElements.bankPointer
486
            .setRotation(-roll * D2R);
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
487
        settimer(func me.updateAI(), 0.1);
AI disponible
Sébastien MARQUE authored on 2017-03-10
488
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
489
#}}}
animation VSI
Sébastien MARQUE authored on 2017-03-10
490

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

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

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

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

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

            
584
            var Alt10       = math.mod(alt,100);
585
            var Alt100      = int(math.mod(alt/100,10));
586
            var Alt1000     = int(math.mod(alt/1000,10));
587
            var Alt10000    = int(math.mod(alt/10000,10));
588
            var Alt20       = math.mod(Alt10,20)/20;
589
            if (Alt10 >= 80)
590
                var Alt100 += Alt20;
591

            
592
            if (Alt10 >= 80 and Alt100 >= 9)
593
                var Alt1000 += Alt20;
594

            
595
            if (Alt10 >= 80 and Alt100 >= 9 and Alt1000 >= 9)
596
                var Alt10000 += Alt20;
597

            
598
            if (alt> 100)
599
                var Offset10 = 100;
600

            
601
            if (alt> 1000)
602
                var Offset100 = 10;
603

            
604
            if (alt> 10000)
605
                var Offset1000 = 10;
606

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

            
628
                if (altUP == 0) {
629
                    var AltBigUP    = "";
630
                    var AltSmallUP  = "0";
631

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
1187
var keyMap = {
add new vim folds
Sébastien MARQUE authored on 2017-03-15
1188
# softkeys map for PFD and MFD {{{
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
1189
    PFD : {
1190
        first : 1,
1191
        texts : ['INSET', 'SENSOR', 'PFD', 'OBS', 'CDI', 'DME', 'XPDR', 'IDENT', 'TMR/REF', 'NRST' ],
1192
        INSET : {
1193
            texts : ['OFF', 'DCLTR', 'WXLGND', 'TRAFFIC', 'TOPO', 'TERRAIN', 'STRMSCP', 'NEXRAD-C', 'XM LTNG', 'METAR'],
1194
        },
1195
        SENSOR : {
1196
            first : 2,
1197
            texts : [ 'ADC1', 'ADC2', '', 'AHRS1', 'AHRS2'],
1198
        },
1199
        PFD : {
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
1200
            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
1201
            'SYN VIS' : {
1202
                texts : [ 'PATHWAY', 'SYN TERR', 'HR2NHDG', 'APTSIGNS', 'FPM'],
1203
            },
1204
            'AOA/WIND' : {
1205
                first : 4,
1206
                texts : ['AOA', 'WIND'],
1207
                AOA : {
1208
                    first : 5,
1209
                    texts : ['AOA ON', 'AOA AUTO'],
1210
                },
1211
                WIND : {
1212
                    first : 2,
1213
                    texts : ['OPTN1', 'OPTN2', '', 'OFF'],
1214
                },
1215
            },
1216
            'HSI FMT' : {
1217
                first : 6,
1218
                texts : ['360 HSI', 'ARC HSI'],
1219
            },
1220
            'ALT UNIT' : {
1221
                first : 5,
1222
                texts : ['METERS', '', 'IN', 'HPA'],
1223
            },
1224
        },
1225
        XPDR : {
1226
            first : 2,
1227
            texts : ['STBY', 'ON', 'ALT', '', 'VFR', 'CODE', 'IDENT'],
1228
            CODE : {
1229
                texts : ['0', '1', '2', '3', '4', '5', '6', '7', 'IDENT', 'BKSP'],
1230
            },
1231
        },
1232
    },
1233
    MFD : {
1234
        texts : ['ENGINE', '', 'MAP', '', '', '', '', '', '', 'DCLTR', 'SHW CHRT', 'CHKLIST'],
1235
        MAP : {
1236
            texts: ['TRAFFIC', 'PROFILE', 'TOPO', 'TERRAIN', 'AIRWAYS', 'STRMSCP','NEXRAD-C', 'XM LTNG', 'METAR', 'LEGEND', 'BACK'],
1237
        },
1238
        CHKLIST : {
1239
            texts : ['ENGINE', '', '', '', '', 'DONE', '', '', '', '', 'EXIT', 'EMERGCY'],
1240
        },
1241
        ENGINE : {
1242
            texts : ['ENGINE', 'ANTI-ICE', '', 'DCLTR', '', 'ASSIST', '', '', '', '', 'FUEL'],
1243
            'ANTI-ICE' : {
1244
                texts : ['LEFT', 'AUTO', 'RIGHT', '', '', '', '', '', '', '', '', 'BACK'],
1245
            },
1246
            FUEL : {
1247
                first : 1,
1248
                texts : ['FULL', 'TABS', '', '', '', '', '', '', '', 'UNDO', 'ENTER'],
1249
            },
1250
        },
1251
    },
1252
};
add new vim folds
Sébastien MARQUE authored on 2017-03-15
1253
#}}}