zkv1000 / Nasal / display.nas /
Newer Older
1264 lines | 47.177kb
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);
EIS can be aircraft specific
Sébastien MARQUE authored on 2017-04-04
29
            var eis_dir = getprop('/sim/fg-aircraft') ~ '/Instruments-3d/zkv1000/Nasal/EIS/';
30
            var eis_type = getprop('/instrumentation/zkv1000/eis/type');
31
            if (eis_type == nil or
32
                    (io.stat(eis_dir ~ eis_type ~ '.nas') == nil
33
                     and print(eis_type ~ ' not found')))
34
                eis_type = 'none';
35
            io.load_nasal(eis_dir ~ eis_type ~ '.nas', 'zkv1000');
adds Map on MFD
Sébastien MARQUE authored on 2017-03-20
36
        }
37

            
add Vne Vspeed specific to a...
Sébastien MARQUE authored on 2017-04-04
38
        m._ias_vne = getprop('/instrumentation/zkv1000/alerts/Vne');
39

            
commit initial
Sébastien MARQUE authored on 2017-03-07
40
        return m;
41
    },
add new vim folds
Sébastien MARQUE authored on 2017-03-15
42
#}}}
commit initial
Sébastien MARQUE authored on 2017-03-07
43

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

            
47
    timerTrigger : func {
48
        var now = systime();
49
        foreach (var id; keys(me.timers)) {
50
            if (me.timers[id] < now) {
51
                me.screenElements[id].hide();
52
                delete(me.timers, id);
53
            }
54
        }
55
        settimer(func me.timerTrigger(), 1);
56
    },
57

            
58
    addTimer : func (duration, element) {
59
        if (typeof(element) == 'scalar')
60
            element = [ element ];
61
        var end = systime() + duration;
62
        foreach (var e; element)
63
            me.timers[e] = end;
64
    },
add new vim folds
Sébastien MARQUE authored on 2017-03-15
65
#}}}
ajoute un timer pour cacher ...
Sébastien MARQUE authored on 2017-03-13
66

            
commit initial
Sébastien MARQUE authored on 2017-03-07
67
    loadsvg : func () {
68
        me.screen = me.display.createGroup();
69
        me.screen.hide();
70
        canvas.parsesvg(me.screen, "Aircraft/Instruments-3d/zkv1000/Systems/screen.svg");
71
    },
72

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

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

            
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
107
            if (me.role == 'PFD') {
108
                append(groups.show,
commit initial
Sébastien MARQUE authored on 2017-03-07
109
                    'XPDR-TIME', 
AI disponible
Sébastien MARQUE authored on 2017-03-10
110
                    'FlightInstruments',
111
                    'Horizon',
AI disponible, avec bankPoin...
Sébastien MARQUE authored on 2017-03-10
112
                    'bankPointer',
animation VSI
Sébastien MARQUE authored on 2017-03-10
113
                    'VSI',
animation HSI
Sébastien MARQUE authored on 2017-03-11
114
                    'Rose',
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
115
                    'Heading-bug',
116
                    'PFD-Widgets',
trends animation
Sébastien MARQUE authored on 2017-03-13
117
                    'Trends',
118
                    'Airspeed-Trend-Indicator',
119
                    'Altitude-Trend-Indicator',
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
120
                    'OAT',
121
                    'IAS-bg',
122
                    'TAS',
123
                    'GSPD',
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
124
                    'BARO-bg',
adds slipskid animation
Sébastien MARQUE authored on 2017-03-24
125
                    'SlipSkid',
add V-speeds bugs
Sébastien MARQUE authored on 2017-04-04
126
                    'IAS-Vx', 'IAS-Vy', 'IAS-Vr', 'IAS-Vglide',
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
127
                );
128
                append(groups.hide,
adds EIS
Sébastien MARQUE authored on 2017-03-18
129
                    'EIS',
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
130
                    'CDI',
adds OMI to PFD
Sébastien MARQUE authored on 2017-03-23
131
                    'OMI', 'MarkerBG', 'MarkerText',
adds CDI
Sébastien MARQUE authored on 2017-03-18
132
                    'NAV1-pointer', 'NAV1-CDI', 'NAV1-FROM', 'NAV1-TO',
133
                    'NAV2-pointer', 'NAV2-CDI', 'NAV2-FROM', 'NAV2-TO',
134
                    '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
135
                    'BRG1-pointer',
136
                    'BRG2-pointer',
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
137
                    'SelectedHDG-bg',
138
                    'SelectedHDG-bgtext',
139
                    'SelectedHDG-text',
140
                    'SelectedCRS-bg',
141
                    'SelectedCRS-bgtext',
142
                    'SelectedCRS-text',
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
143
                    'SelectedALT', 'SelectedALT-bug', 'SelectedALT-bg', 'SelectedALT-symbol',
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
144
                    'TAS',
145
                    'GSPD',
146
                    'WindData',
147
                    'Reversionnary',
148
                    'Annunciation',
149
                    'Comparator',
150
                    'BRG1',
151
                    'BRG2',
152
                    'DME1',
153
                    'PFD-Map',
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
154
                    'PFD-Multilines',
improves WindData display
Sébastien MARQUE authored on 2017-03-16
155
                    '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
156
                );
157
                append(groups.clip,
animation IAS
Sébastien MARQUE authored on 2017-03-10
158
                    'SpeedLint1',
animation ALT
Sébastien MARQUE authored on 2017-03-11
159
                    'SpeedTape',
160
                    'LintAlt',
161
                    'AltLint00011'
162
                );
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
163
                append(groups.text,
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
164
                    'SelectedALT-text',
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
165
                    'TAS-text',
166
                    'GSPD-text',
anime time display
Sébastien MARQUE authored on 2017-03-13
167
                    'TIME-text',
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
168
                    'OAT-text',
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
169
                    'VSIText',
170
                    'Speed110',
171
                    'Alt11100',
172
                    'HDG-text',
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
173
                    'BARO-text',
adds CDI
Sébastien MARQUE authored on 2017-03-18
174
                    'CDI-SRC-text', 'CDI-GPS-ANN-text', 'CDI-GPS-XTK-text',
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
175
                    'BRG1-pointer', 'BRG1-SRC-text', 'BRG1-DST-text', 'BRG1-WPID-text',
176
                    'BRG2-pointer', 'BRG2-SRC-text', 'BRG2-DST-text', 'BRG2-WPID-text',
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
177
                    'WindData-OPTN1-HDG-text', 'WindData-OPTN1-SPD-text',
178
                    'WindData-OPTN2-crosswind-text', 'WindData-OPTN2-headwind-text',
adds transponder
Sébastien MARQUE authored on 2017-03-17
179
                    '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
180
                    'AltBigC', 'AltSmallC'
181
                );
182
                for (var place = 1; place <= 6; place +=1) {
183
                    append(groups.text,
184
                        'AltBigU' ~ place,
185
                        'AltSmallU' ~ place,
186
                        'AltBigD' ~ place,
187
                        'AltSmallD' ~ place
188
                    );
189
                }
animation ALT
Sébastien MARQUE authored on 2017-03-11
190
            }
adds EIS
Sébastien MARQUE authored on 2017-03-18
191
            else {
EIS can be aircraft specific
Sébastien MARQUE authored on 2017-04-04
192
                if (contains(me.parents[0], 'showEIS'))
193
                    me.showEIS(groups);
adds EIS
Sébastien MARQUE authored on 2017-03-18
194
            }
séparation configuration PFD...
Sébastien MARQUE authored on 2017-03-12
195

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

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

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

            
246
        zkv.getNode(role ~ 'init',1).setIntValue(1);
247

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

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

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

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

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

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

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

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

            
423
        var path = keyMap[me.role];
424
        foreach (var p; me.device.softkeys.path)
425
            path = path[p];
426

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

            
448
        if (size(me.device.softkeys.path))
449
            me.timers2.softkeys_inactivity.restart(me.softkeys_inactivity_delay);
450
        else
451
            me.timers2.softkeys_inactivity.stop();
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
452
    },
453
#}}}
454

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

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

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

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

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
516
    updateIAS: func () {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
517
# animates the IAS lint (PFD) {{{
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
518
        var ias = me._updated_ias;
animation IAS
Sébastien MARQUE authored on 2017-03-10
519
        if (ias >= 10)
520
            me.screenElements.Speed110
521
                .setText(sprintf("% 2u",num(math.floor(ias/10))));
522
        else
523
            me.screenElements.Speed110
524
                .setText('');
525
        me.screenElements.SpeedLint1
526
            .setTranslation(0,(math.mod(ias,10) + (ias >= 10)*10) * 36);
527
        me.screenElements.SpeedTape
528
            .setTranslation(0,ias * 5.711);
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
529
        if (ias > me._ias_vne and ! me._ias_already_exceeded) { # easier than .getColorFill
530
            me._ias_already_exceeded = 1;
531
            me.screenElements['IAS-bg']
532
                .setColorFill(1,0,0);
533
        }
534
        elsif (ias < me._ias_vne and me._ias_already_exceeded) { # easier than .getColorFill
535
            me._ias_already_exceeded = 0;
536
            me.screenElements['IAS-bg']
537
                .setColorFill(0,0,0);
538
        }
add V-speeds bugs
Sébastien MARQUE authored on 2017-04-04
539
        foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide']) {
540
            if (me.device.data[v ~ '-visible'] and abs(me.device.data[v] - ias) < 30)
541
                me.screenElements['IAS-' ~ v]
542
                    .setTranslation(0, (ias - me.device.data[v]) * 5.711)
543
                    .show();
544
            else
545
                me.screenElements['IAS-' ~ v]
546
                    .hide();
547
        }
548

            
trends animation
Sébastien MARQUE authored on 2017-03-13
549
        var now = systime();
550
        # estimated speed in 6s
551
        var Sy = 6 * (ias - me._last_ias_kt) / (now - me._last_ias_s);
552
        if (abs(Sy) > 30)
553
            Sy = 30 * abs(Sy)/Sy; # = -30 or 30
554
        me.screenElements['Airspeed-Trend-Indicator']
555
            .setScale(1,Sy)
556
            .setTranslation(0, -284.5 * (Sy - 1));
557
        me._last_ias_kt = ias;
558
        me._last_ias_s = now;
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
559
        settimer(func me.updateIAS(), 0.1);
animation IAS
Sébastien MARQUE authored on 2017-03-10
560
    },
trends animation
Sébastien MARQUE authored on 2017-03-13
561
    _last_ias_kt : 0,
562
    _last_ias_s : systime(),
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
563
    _ias_already_exceeded : 0,
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
564
#}}}
animation ALT
Sébastien MARQUE authored on 2017-03-11
565

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
566
    updateTAS: func {
567
# updates the True Airspeed and GroundSpeed indicators {{{
568
        me.screenElements['TAS-text']
569
            .setText(sprintf('%iKT', getprop('/instrumentation/airspeed-indicator/true-speed-kt')));
570
        me.screenElements['GSPD-text']
571
            .setText(sprintf('%iKT', getprop('/velocities/groundspeed-kt')));
572
        settimer(func me.updateTAS(), 0.5);
573
    },
574
#}}}
575

            
576
    updateALT: func () {
577
# animates the altitude lint (PFD) {{{
578
        var alt = me._updated_alt;
animation ALT
Sébastien MARQUE authored on 2017-03-11
579
        if (alt < 0)
580
            me.screenElements.Alt11100
581
                .setText(sprintf("% 3i",math.ceil(alt/100)));
582
        elsif (alt < 100)
583
            me.screenElements.Alt11100
584
                .setText('');
585
        else
586
            me.screenElements.Alt11100
587
                .setText(sprintf("% 3i",math.floor(alt/100)));
588
        me.screenElements.AltLint00011
589
            .setTranslation(0,math.fmod(alt,100) * 1.24);
590

            
591
        # From Farmin/G1000 http://wiki.flightgear.org/Project_Farmin/FG1000
592
        if (alt> -1000 and alt< 1000000) {
593
            var Offset10 = 0;
594
            var Offset100 = 0;
595
            var Offset1000 = 0;
596
            if (alt< 0) {
597
                var Ne = 1;
598
                var alt= -alt;
599
            }
600
            else
601
                var Ne = 0;
602

            
603
            var Alt10       = math.mod(alt,100);
604
            var Alt100      = int(math.mod(alt/100,10));
605
            var Alt1000     = int(math.mod(alt/1000,10));
606
            var Alt10000    = int(math.mod(alt/10000,10));
607
            var Alt20       = math.mod(Alt10,20)/20;
608
            if (Alt10 >= 80)
609
                var Alt100 += Alt20;
610

            
611
            if (Alt10 >= 80 and Alt100 >= 9)
612
                var Alt1000 += Alt20;
613

            
614
            if (Alt10 >= 80 and Alt100 >= 9 and Alt1000 >= 9)
615
                var Alt10000 += Alt20;
616

            
617
            if (alt> 100)
618
                var Offset10 = 100;
619

            
620
            if (alt> 1000)
621
                var Offset100 = 10;
622

            
623
            if (alt> 10000)
624
                var Offset1000 = 10;
625

            
626
            if (!Ne) {
627
                me.screenElements.LintAlt.setTranslation(0,(math.mod(alt,100))*0.57375);
628
                var altCentral = (int(alt/100)*100);
629
            }
630
            elsif (Ne) {
631
                me.screenElements.LintAlt.setTranslation(0,(math.mod(alt,100))*-0.57375);
632
                var altCentral = -(int(alt/100)*100);
633
            }
634
            me.screenElements["AltBigC"].setText("");
635
            me.screenElements["AltSmallC"].setText("");
636
            for (var place = 1; place <= 6; place += 1) {
637
                var altUP = altCentral + (place*100);
638
                var offset = -30.078;
639
                if (altUP < 0) {
640
                    var altUP = -altUP;
641
                    var prefix = "-";
642
                    var offset += 15.039;
643
                }
644
                else
645
                    var prefix = "";
646

            
647
                if (altUP == 0) {
648
                    var AltBigUP    = "";
649
                    var AltSmallUP  = "0";
650

            
651
                }
652
                elsif (math.mod(altUP,500) == 0 and altUP != 0) {
653
                    var AltBigUP    = sprintf(prefix~"%1d", altUP);
654
                    var AltSmallUP  = "";
655
                }
656
                elsif (altUP < 1000 and (math.mod(altUP,500))) {
657
                    var AltBigUP    = "";
658
                    var AltSmallUP  = sprintf(prefix~"%1d", int(math.mod(altUP,1000)));
659
                    var offset = -30.078;
660
                }
661
                elsif ((altUP < 10000) and (altUP >= 1000) and (math.mod(altUP,500))) {
662
                    var AltBigUP    = sprintf(prefix~"%1d", int(altUP/1000));
663
                    var AltSmallUP  = sprintf("%1d", int(math.mod(altUP,1000)));
664
                    var offset += 15.039;
665
                }
666
                else {
667
                    var AltBigUP    = sprintf(prefix~"%1d", int(altUP/1000));
668
                    var mod = int(math.mod(altUP,1000));
669
                    var AltSmallUP  = sprintf("%1d", mod);
670
                    var offset += 30.078;
671
                }
672

            
673
                me.screenElements["AltBigU"~place].setText(AltBigUP);
674
                me.screenElements["AltSmallU"~place].setText(AltSmallUP);
675
                me.screenElements["AltSmallU"~place].setTranslation(offset,0);
676
                var altDOWN = altCentral - (place*100);
677
                var offset = -30.078;
678
                if (altDOWN < 0) {
679
                    var altDOWN = -altDOWN;
680
                    var prefix = "-";
681
                    var offset += 15.039;
682
                }
683
                else
684
                    var prefix = "";
685

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

            
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
732
    updateBARO : func () {
733
# update BARO widget {{{
734
        var fmt = me._baro_unit == 'inhg' ? '%.2f%s' : '%i%s';
735
        me.screenElements['BARO-text']
736
            .setText(sprintf(fmt,
737
                        getprop('/instrumentation/altimeter/setting-' ~ me._baro_unit),
738
                        me._baro_unit == 'inhg' ? 'in' : 'hPa')
739
                );
740
    },
741
    _baro_unit : 'inhg',
742
#}}}
743

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
744
    updateHSI : func () {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
745
# rotates the compass (PFD) {{{
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
746
        var hdg = me._updated_hdg;
animation HSI
Sébastien MARQUE authored on 2017-03-11
747
        me.screenElements.Rose
748
            .setRotation(-hdg * D2R);
749
        me.screenElements['HDG-text']
750
            .setText(sprintf("%03u°", hdg));
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
751
        settimer(func me.updateHSI(), 0.1);
animation HSI
Sébastien MARQUE authored on 2017-03-11
752
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
753
#}}}
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
754

            
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
755
    updateHDG : func (hdg) {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
756
# moves the heading bug and display heading-deg for 3 seconds (PFD) {{{
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
757
        if (me.role == 'MFD')
758
            return;
759
        me.screenElements['Heading-bug']
760
            .setRotation(hdg * D2R);
761
        me.screenElements['SelectedHDG-bg']
762
            .show();
763
        me.screenElements['SelectedHDG-bgtext']
764
            .show();
765
        me.screenElements['SelectedHDG-text']
766
            .setText(sprintf('%03d°%s', hdg, ''))
767
            .show();
768
        me.addTimer(3, ['SelectedHDG-text', 'SelectedHDG-bgtext', 'SelectedHDG-bg']);
769
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
770
#}}}
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
771

            
adds CDI
Sébastien MARQUE authored on 2017-03-18
772
    updateCRS : func () {
anime CRS
Sébastien MARQUE authored on 2017-03-13
773
# TODO: update display for NAV/GPS/BRG courses {{{
774
        if (me.role == 'MFD')
775
            return;
adds CDI
Sébastien MARQUE authored on 2017-03-18
776
        var source = getprop('/instrumentation/zkv1000/cdi/source');
777
        if (source == 'OFF')
778
            return;
779
        var crs = getprop('/instrumentation/zkv1000/cdi/course');
780
        if (crs == nil)
781
            return;
anime CRS
Sébastien MARQUE authored on 2017-03-13
782
        me.screenElements['SelectedCRS-bg']
783
            .show();
784
        me.screenElements['SelectedCRS-bgtext']
785
            .show();
786
        me.screenElements['SelectedCRS-text']
787
            .setText(sprintf('%03d°%s', crs, ''))
adds CDI
Sébastien MARQUE authored on 2017-03-18
788
            .setColor(source == 'GPS' ? me.colors.magenta : me.colors.green)
anime CRS
Sébastien MARQUE authored on 2017-03-13
789
            .show();
790
        me.addTimer(3, ['SelectedCRS-text', 'SelectedCRS-bgtext', 'SelectedCRS-bg']);
791
    },
792
#}}}
793

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
794
    updateSelectedALT : func {
795
# animation for altitude section, called via updatedALT {{{
new var organistaion (and fi...
Sébastien MARQUE authored on 2017-03-26
796
        if (! PFD.display.screenElements['SelectedALT'].getVisible())
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
797
            return;
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
798
        var selected_alt = getprop('/instrumentation/zkv1000/afcs/selected-alt-ft');
799
        var delta_alt = me._updated_alt - selected_alt;
800
        if (abs(delta_alt) > 300)
801
            delta_alt = 300 * abs(delta_alt)/delta_alt;
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
802
        me.screenElements['SelectedALT-symbol']
803
            .setVisible(abs(delta_alt) > 100);
804
        me.screenElements['SelectedALT-bg']
805
            .setVisible(abs(delta_alt) > 100);
806
        me.screenElements['SelectedALT-text']
807
            .setText(sprintf("%i", selected_alt))
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
808
            .setVisible(abs(delta_alt) > 100);
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
809
        me.screenElements['SelectedALT-bug']
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
810
            .setTranslation(0, delta_alt * 0.567); # 170/300 = 0.567
811
    },
812
#}}}
813

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

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

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

            
974
    updateCOMM: func {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
975
# update COMM radios display upper right (PFD/MFD){{{
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
976
        arg[0]._r = 'comm';
977
        me._updateRadio(arg[0]);
978
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
979
#}}}
anime time display
Sébastien MARQUE authored on 2017-03-13
980

            
981
    updateTIME : func {
982
# updates the displayed time botoom left {{{
983
        me.screenElements['TIME-text']
984
            .setText(getprop('/sim/time/gmt-string'));
985
        settimer(func me.updateTIME(), 1);
986
    },
987
#}}}
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
988

            
adds transponder
Sébastien MARQUE authored on 2017-03-17
989
    updateXPDR : func {
990
# updates transponder display {{{
991
        for (var d = 0; d < 4; d+=1)
992
            me.screenElements['XPDR-DIGIT-' ~ d ~ '-text']
993
                .setText(sprintf('%i', getprop('/instrumentation/transponder/inputs/digit[' ~ d ~ ']')));
994
        var tuning = getprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit');
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
995
        var fms = getprop('/instrumentation/zkv1000/radios/xpdr-tuning-fms-method');
996
        for (var d = 0; d < 4; d+=1)
997
            me.screenElements['XPDR-DIGIT-' ~ d ~ '-text']
998
                .setColor(1,1,1);
999
        if (tuning != nil) {
1000
            me.screenElements['XPDR-DIGIT-' ~ tuning ~ '-text']
1001
                .setColor(0,1,1);
1002
            if (fms)
1003
                me.screenElements['XPDR-DIGIT-' ~ (tuning - 1) ~ '-text']
1004
                    .setColor(0,1,1);
1005
        }
adds transponder
Sébastien MARQUE authored on 2017-03-17
1006
        else {
1007
            if (getprop('/instrumentation/transponder/ident'))
1008
                var mode = 'IDENT';
1009
            else
1010
                var mode = getprop('/instrumentation/zkv1000/radio/xpdr-mode');
1011
            var wow = getprop('/gear/gear/wow');
1012
            if (! wow and mode != 'STBY')
1013
                var color = [0, 1, 0];
1014
            else
1015
                var color = [1, 1, 1];
1016
            for (var d = 0; d < 4; d+=1)
1017
                me.screenElements['XPDR-DIGIT-' ~ d ~ '-text']
1018
                    .setColor(color);
1019
            me.screenElements['XPDR-MODE-text']
1020
                .setColor(color)
1021
                .setText(mode);
1022
        }
XPDR settings via knob or so...
Sébastien MARQUE authored on 2017-03-22
1023
    },
adds transponder
Sébastien MARQUE authored on 2017-03-17
1024
#}}}
1025

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
1026
    updateOAT : func {
1027
# update OAT display on normal and reversionnary modes (every 3s) {{{
1028
        var tmp = getprop('/environment/temperature-deg' ~ me._oat_unit);
1029
        me.screenElements['OAT-text']
1030
            .setText(sprintf((abs(tmp) < 10) ? "%.1f %s" : "%i %s", tmp, (me._oat_unit == 'c') ? '°C' : 'F'));
1031
        settimer(func me.updateOAT(), 3);
1032
    },
1033
    _oat_unit : 'c',
1034
#}}}
1035

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

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

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

            
1141
                if (info.pointer)
1142
                    me.screenElements[el ~ '-pointer']
1143
                        .setRotation(-info.hdg-me._updated_hdg * D2R)
1144
                        .show();
1145
                else
1146
                    me.screenElements[el ~ '-pointer']
1147
                        .hide();
1148
                me.screenElements[el ~ '-SRC-text']
1149
                    .setText(dev);
1150
                me.screenElements[el ~ '-DST-text']
1151
                    .setText(info.dst);
1152
                me.screenElements[el ~ '-WPID-text']
1153
                    .setText(info.id);
1154
                me.screenElements['BRG' ~ brg]
1155
                    .show();
1156
            }
1157
            else {
colorize BRG1/2 when needed,...
Sébastien MARQUE authored on 2017-03-21
1158
                me.setSoftKeyColor(brg == 1 ? 4 : 6, 0);
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
1159
                me.screenElements['BRG' ~ brg]
1160
                    .hide();
1161
            }
1162
        }
colorize BRG1/2 when needed,...
Sébastien MARQUE authored on 2017-03-21
1163
        settimer(func me.updateBRG(), 0.5);
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
1164
    },
some added comments
Sébastien MARQUE authored on 2017-03-18
1165
#}}}
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
1166

            
adds OMI to PFD
Sébastien MARQUE authored on 2017-03-23
1167
    updateOMI : func {
1168
# display marker baecon Outer, Middle, Inner {{{
1169
        var marker = nil;
1170
        foreach (var m; ['outer', 'middle', 'inner'])
1171
            if (getprop('/instrumentation/marker-beacon/' ~ m)) {
1172
                marker = m;
1173
                me.screenElements['OMI']
1174
                    .show();
1175
                break;
1176
            }
1177
        if (marker != nil) {
1178
            me.screenElements['MarkerText']
1179
                .setText(me._omi_data[marker].t)
1180
                .show();
1181
            me.screenElements['MarkerBG']
1182
                .setColorFill(me._omi_data[marker].bg)
1183
                .show();
1184
        }
1185
        else
1186
            me.screenElements['OMI']
1187
                .hide();
1188
        settimer(func me.updateOMI(), 1);
1189
    },
1190
    _omi_data : {
1191
        'outer':  {t: 'O', bg: [0,1,1]},
1192
        'middle': {t: 'M', bg: [1,1,1]},
1193
        'inner':  {t: 'I', bg: [1,1,0]},
1194
    },
1195
#}}}
animation texts EIS + power ...
Sébastien MARQUE authored on 2017-03-19
1196
};
1197

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