zkv1000 / Nasal / display.nas /
Newer Older
1235 lines | 46.296kb
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 = {
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
3
    new: func(device) {
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({
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
8
                "name"      : device.name,
commit initial
Sébastien MARQUE authored on 2017-03-07
9
                "size"      : [1024, 768],
10
                "view"      : [1024, 768],
11
                "mipmapping": 1
12
        });
13
        m.display.addPlacement({
14
                "node": "Screen",
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
15
                "parent": device.name
commit initial
Sébastien MARQUE authored on 2017-03-07
16
        });
17
        m.display.setColorBackground(0,0,0);
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
18
        m.role = device.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

            
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
26
        if (device.role == 'MFD') {
adds Map on MFD
Sébastien MARQUE authored on 2017-03-20
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

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

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

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

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

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

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

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

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

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

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

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

            
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
242
        zkv.getNode(name ~ '-init',1).setIntValue(1);
commit initial
Sébastien MARQUE authored on 2017-03-07
243

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

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

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

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

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

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

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

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

            
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
419
        var path = keyMap[me.device.role];
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
420
        foreach (var p; me.device.softkeys.path)
421
            path = path[p];
422

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

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

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
451
    updateAI: func(){
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
452
#{{{
make some data common to all...
Sébastien MARQUE authored on 2017-04-07
453
        var pitch = data.pitch;
454
        var roll = data.roll;
AI disponible
Sébastien MARQUE authored on 2017-03-10
455
        if (pitch > 80)
456
            pitch = 80;
clean pre-merge
Sébastien MARQUE authored on 2017-03-11
457
        elsif (pitch < -80)
AI disponible
Sébastien MARQUE authored on 2017-03-10
458
            pitch = -80;
459
        me.screenElements.Horizon
fix AI animation
Sébastien MARQUE authored on 2017-03-19
460
            .setCenter(459, 282.8 - 6.849 * pitch)
AI disponible
Sébastien MARQUE authored on 2017-03-10
461
            .setRotation(-roll * D2R)
fix AI animation
Sébastien MARQUE authored on 2017-03-19
462
            .setTranslation(0, pitch * 6.849);
AI disponible, avec bankPoin...
Sébastien MARQUE authored on 2017-03-10
463
        me.screenElements.bankPointer
464
            .setRotation(-roll * D2R);
adds slipskid animation
Sébastien MARQUE authored on 2017-03-24
465
        me.screenElements['SlipSkid']
466
            .setTranslation(getprop("/instrumentation/slip-skid-ball/indicated-slip-skid") * 10, 0);
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
467
        settimer(func me.updateAI(), 0.1);
AI disponible
Sébastien MARQUE authored on 2017-03-10
468
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
469
#}}}
animation VSI
Sébastien MARQUE authored on 2017-03-10
470

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
471
    updateVSI: func () {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
472
# animate VSI {{{
make some data common to all...
Sébastien MARQUE authored on 2017-04-07
473
        var vsi = data.vsi;
animation VSI
Sébastien MARQUE authored on 2017-03-10
474
        me.screenElements.VSIText
475
            .setText(num(math.round(vsi, 10)));
476
        if (vsi > 4500)
477
            vsi = 4500;
478
        elsif (vsi < -4500)
479
            vsi = -4500;
480
        me.screenElements.VSI
481
            .setTranslation(0, vsi * -0.03465);
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
482
        settimer(func me.updateVSI(), 0.1);
animation VSI
Sébastien MARQUE authored on 2017-03-10
483
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
484
#}}}
animation IAS
Sébastien MARQUE authored on 2017-03-10
485

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
486
    updateIAS: func () {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
487
# animates the IAS lint (PFD) {{{
make some data common to all...
Sébastien MARQUE authored on 2017-04-07
488
        var ias = data.ias;
animation IAS
Sébastien MARQUE authored on 2017-03-10
489
        if (ias >= 10)
490
            me.screenElements.Speed110
491
                .setText(sprintf("% 2u",num(math.floor(ias/10))));
492
        else
493
            me.screenElements.Speed110
494
                .setText('');
495
        me.screenElements.SpeedLint1
496
            .setTranslation(0,(math.mod(ias,10) + (ias >= 10)*10) * 36);
497
        me.screenElements.SpeedTape
498
            .setTranslation(0,ias * 5.711);
put Vspeeds in common data s...
Sébastien MARQUE authored on 2017-04-11
499
        if (ias > data.Vne and ! me._ias_already_exceeded) { # easier than .getColorFill
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
500
            me._ias_already_exceeded = 1;
501
            me.screenElements['IAS-bg']
502
                .setColorFill(1,0,0);
503
        }
put Vspeeds in common data s...
Sébastien MARQUE authored on 2017-04-11
504
        elsif (ias < data.Vne and me._ias_already_exceeded) { # easier than .getColorFill
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
505
            me._ias_already_exceeded = 0;
506
            me.screenElements['IAS-bg']
507
                .setColorFill(0,0,0);
508
        }
add V-speeds bugs
Sébastien MARQUE authored on 2017-04-04
509
        foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide']) {
put Vspeeds in common data s...
Sébastien MARQUE authored on 2017-04-11
510
            if (me.device.data[v ~ '-visible'] and abs(data[v] - ias) < 30)
add V-speeds bugs
Sébastien MARQUE authored on 2017-04-04
511
                me.screenElements['IAS-' ~ v]
put Vspeeds in common data s...
Sébastien MARQUE authored on 2017-04-11
512
                    .setTranslation(0, (ias - data[v]) * 5.711)
add V-speeds bugs
Sébastien MARQUE authored on 2017-04-04
513
                    .show();
514
            else
515
                me.screenElements['IAS-' ~ v]
516
                    .hide();
517
        }
518

            
trends animation
Sébastien MARQUE authored on 2017-03-13
519
        var now = systime();
520
        # estimated speed in 6s
521
        var Sy = 6 * (ias - me._last_ias_kt) / (now - me._last_ias_s);
522
        if (abs(Sy) > 30)
523
            Sy = 30 * abs(Sy)/Sy; # = -30 or 30
524
        me.screenElements['Airspeed-Trend-Indicator']
525
            .setScale(1,Sy)
526
            .setTranslation(0, -284.5 * (Sy - 1));
527
        me._last_ias_kt = ias;
528
        me._last_ias_s = now;
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
529
        settimer(func me.updateIAS(), 0.1);
animation IAS
Sébastien MARQUE authored on 2017-03-10
530
    },
trends animation
Sébastien MARQUE authored on 2017-03-13
531
    _last_ias_kt : 0,
532
    _last_ias_s : systime(),
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
533
    _ias_already_exceeded : 0,
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
534
#}}}
animation ALT
Sébastien MARQUE authored on 2017-03-11
535

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
536
    updateTAS: func {
537
# updates the True Airspeed and GroundSpeed indicators {{{
538
        me.screenElements['TAS-text']
539
            .setText(sprintf('%iKT', getprop('/instrumentation/airspeed-indicator/true-speed-kt')));
540
        me.screenElements['GSPD-text']
541
            .setText(sprintf('%iKT', getprop('/velocities/groundspeed-kt')));
542
        settimer(func me.updateTAS(), 0.5);
543
    },
544
#}}}
545

            
546
    updateALT: func () {
547
# animates the altitude lint (PFD) {{{
make some data common to all...
Sébastien MARQUE authored on 2017-04-07
548
        var alt = data.alt;
animation ALT
Sébastien MARQUE authored on 2017-03-11
549
        if (alt < 0)
550
            me.screenElements.Alt11100
551
                .setText(sprintf("% 3i",math.ceil(alt/100)));
552
        elsif (alt < 100)
553
            me.screenElements.Alt11100
554
                .setText('');
555
        else
556
            me.screenElements.Alt11100
557
                .setText(sprintf("% 3i",math.floor(alt/100)));
558
        me.screenElements.AltLint00011
559
            .setTranslation(0,math.fmod(alt,100) * 1.24);
560

            
561
        # From Farmin/G1000 http://wiki.flightgear.org/Project_Farmin/FG1000
562
        if (alt> -1000 and alt< 1000000) {
563
            var Offset10 = 0;
564
            var Offset100 = 0;
565
            var Offset1000 = 0;
566
            if (alt< 0) {
567
                var Ne = 1;
568
                var alt= -alt;
569
            }
570
            else
571
                var Ne = 0;
572

            
573
            var Alt10       = math.mod(alt,100);
574
            var Alt100      = int(math.mod(alt/100,10));
575
            var Alt1000     = int(math.mod(alt/1000,10));
576
            var Alt10000    = int(math.mod(alt/10000,10));
577
            var Alt20       = math.mod(Alt10,20)/20;
578
            if (Alt10 >= 80)
579
                var Alt100 += Alt20;
580

            
581
            if (Alt10 >= 80 and Alt100 >= 9)
582
                var Alt1000 += Alt20;
583

            
584
            if (Alt10 >= 80 and Alt100 >= 9 and Alt1000 >= 9)
585
                var Alt10000 += Alt20;
586

            
587
            if (alt> 100)
588
                var Offset10 = 100;
589

            
590
            if (alt> 1000)
591
                var Offset100 = 10;
592

            
593
            if (alt> 10000)
594
                var Offset1000 = 10;
595

            
596
            if (!Ne) {
597
                me.screenElements.LintAlt.setTranslation(0,(math.mod(alt,100))*0.57375);
598
                var altCentral = (int(alt/100)*100);
599
            }
600
            elsif (Ne) {
601
                me.screenElements.LintAlt.setTranslation(0,(math.mod(alt,100))*-0.57375);
602
                var altCentral = -(int(alt/100)*100);
603
            }
604
            me.screenElements["AltBigC"].setText("");
605
            me.screenElements["AltSmallC"].setText("");
606
            for (var place = 1; place <= 6; place += 1) {
607
                var altUP = altCentral + (place*100);
608
                var offset = -30.078;
609
                if (altUP < 0) {
610
                    var altUP = -altUP;
611
                    var prefix = "-";
612
                    var offset += 15.039;
613
                }
614
                else
615
                    var prefix = "";
616

            
617
                if (altUP == 0) {
618
                    var AltBigUP    = "";
619
                    var AltSmallUP  = "0";
620

            
621
                }
622
                elsif (math.mod(altUP,500) == 0 and altUP != 0) {
623
                    var AltBigUP    = sprintf(prefix~"%1d", altUP);
624
                    var AltSmallUP  = "";
625
                }
626
                elsif (altUP < 1000 and (math.mod(altUP,500))) {
627
                    var AltBigUP    = "";
628
                    var AltSmallUP  = sprintf(prefix~"%1d", int(math.mod(altUP,1000)));
629
                    var offset = -30.078;
630
                }
631
                elsif ((altUP < 10000) and (altUP >= 1000) and (math.mod(altUP,500))) {
632
                    var AltBigUP    = sprintf(prefix~"%1d", int(altUP/1000));
633
                    var AltSmallUP  = sprintf("%1d", int(math.mod(altUP,1000)));
634
                    var offset += 15.039;
635
                }
636
                else {
637
                    var AltBigUP    = sprintf(prefix~"%1d", int(altUP/1000));
638
                    var mod = int(math.mod(altUP,1000));
639
                    var AltSmallUP  = sprintf("%1d", mod);
640
                    var offset += 30.078;
641
                }
642

            
643
                me.screenElements["AltBigU"~place].setText(AltBigUP);
644
                me.screenElements["AltSmallU"~place].setText(AltSmallUP);
645
                me.screenElements["AltSmallU"~place].setTranslation(offset,0);
646
                var altDOWN = altCentral - (place*100);
647
                var offset = -30.078;
648
                if (altDOWN < 0) {
649
                    var altDOWN = -altDOWN;
650
                    var prefix = "-";
651
                    var offset += 15.039;
652
                }
653
                else
654
                    var prefix = "";
655

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

            
adds BARO settings
Sébastien MARQUE authored on 2017-03-20
702
    updateBARO : func () {
703
# update BARO widget {{{
704
        var fmt = me._baro_unit == 'inhg' ? '%.2f%s' : '%i%s';
705
        me.screenElements['BARO-text']
706
            .setText(sprintf(fmt,
707
                        getprop('/instrumentation/altimeter/setting-' ~ me._baro_unit),
708
                        me._baro_unit == 'inhg' ? 'in' : 'hPa')
709
                );
710
    },
711
    _baro_unit : 'inhg',
712
#}}}
713

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
714
    updateHSI : func () {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
715
# rotates the compass (PFD) {{{
make some data common to all...
Sébastien MARQUE authored on 2017-04-07
716
        var hdg = data.hdg;
animation HSI
Sébastien MARQUE authored on 2017-03-11
717
        me.screenElements.Rose
718
            .setRotation(-hdg * D2R);
719
        me.screenElements['HDG-text']
720
            .setText(sprintf("%03u°", hdg));
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
721
        settimer(func me.updateHSI(), 0.1);
animation HSI
Sébastien MARQUE authored on 2017-03-11
722
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
723
#}}}
NAV disponible (hors CDI)
Sébastien MARQUE authored on 2017-03-11
724

            
removes unecessary listeners
Sébastien MARQUE authored on 2017-04-08
725
    updateHDG : func () {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
726
# moves the heading bug and display heading-deg for 3 seconds (PFD) {{{
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
727
        if (me.device.role == 'MFD')
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
728
            return;
removes unecessary listeners
Sébastien MARQUE authored on 2017-04-08
729
        var hdg = getprop('/instrumentation/zkv1000/afcs/heading-bug-deg');
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
730
        me.screenElements['Heading-bug']
731
            .setRotation(hdg * D2R);
732
        me.screenElements['SelectedHDG-bg']
733
            .show();
734
        me.screenElements['SelectedHDG-bgtext']
735
            .show();
736
        me.screenElements['SelectedHDG-text']
737
            .setText(sprintf('%03d°%s', hdg, ''))
738
            .show();
739
        me.addTimer(3, ['SelectedHDG-text', 'SelectedHDG-bgtext', 'SelectedHDG-bg']);
740
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
741
#}}}
animation HDG bug
Sébastien MARQUE authored on 2017-03-13
742

            
adds CDI
Sébastien MARQUE authored on 2017-03-18
743
    updateCRS : func () {
anime CRS
Sébastien MARQUE authored on 2017-03-13
744
# TODO: update display for NAV/GPS/BRG courses {{{
improves role/name variables...
Sébastien MARQUE authored on 2017-04-08
745
        if (me.device.role == 'MFD')
anime CRS
Sébastien MARQUE authored on 2017-03-13
746
            return;
adds CDI
Sébastien MARQUE authored on 2017-03-18
747
        var source = getprop('/instrumentation/zkv1000/cdi/source');
748
        if (source == 'OFF')
749
            return;
750
        var crs = getprop('/instrumentation/zkv1000/cdi/course');
751
        if (crs == nil)
752
            return;
anime CRS
Sébastien MARQUE authored on 2017-03-13
753
        me.screenElements['SelectedCRS-bg']
754
            .show();
755
        me.screenElements['SelectedCRS-bgtext']
756
            .show();
757
        me.screenElements['SelectedCRS-text']
758
            .setText(sprintf('%03d°%s', crs, ''))
adds CDI
Sébastien MARQUE authored on 2017-03-18
759
            .setColor(source == 'GPS' ? me.colors.magenta : me.colors.green)
anime CRS
Sébastien MARQUE authored on 2017-03-13
760
            .show();
761
        me.addTimer(3, ['SelectedCRS-text', 'SelectedCRS-bgtext', 'SelectedCRS-bg']);
762
    },
763
#}}}
764

            
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
765
    updateSelectedALT : func {
766
# animation for altitude section, called via updatedALT {{{
creates flightdeck hash to p...
Sébastien MARQUE authored on 2017-04-07
767
        if (! me.screenElements['SelectedALT'].getVisible())
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
768
            return;
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
769
        var selected_alt = getprop('/instrumentation/zkv1000/afcs/selected-alt-ft');
make some data common to all...
Sébastien MARQUE authored on 2017-04-07
770
        var delta_alt = data.alt - selected_alt;
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
771
        if (abs(delta_alt) > 300)
772
            delta_alt = 300 * abs(delta_alt)/delta_alt;
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
773
        me.screenElements['SelectedALT-symbol']
774
            .setVisible(abs(delta_alt) > 100);
775
        me.screenElements['SelectedALT-bg']
776
            .setVisible(abs(delta_alt) > 100);
777
        me.screenElements['SelectedALT-text']
778
            .setText(sprintf("%i", selected_alt))
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
779
            .setVisible(abs(delta_alt) > 100);
fix Selected Altitude displa...
Sébastien MARQUE authored on 2017-03-18
780
        me.screenElements['SelectedALT-bug']
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
781
            .setTranslation(0, delta_alt * 0.567); # 170/300 = 0.567
782
    },
783
#}}}
784

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

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

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

            
945
    updateCOMM: func {
comment on the folds
Sébastien MARQUE authored on 2017-03-13
946
# update COMM radios display upper right (PFD/MFD){{{
ajout COMM, et factorisation...
Sébastien MARQUE authored on 2017-03-12
947
        arg[0]._r = 'comm';
948
        me._updateRadio(arg[0]);
949
    },
cosmétique: folding pour les...
Sébastien MARQUE authored on 2017-03-13
950
#}}}
anime time display
Sébastien MARQUE authored on 2017-03-13
951

            
952
    updateTIME : func {
953
# updates the displayed time botoom left {{{
954
        me.screenElements['TIME-text']
955
            .setText(getprop('/sim/time/gmt-string'));
956
        settimer(func me.updateTIME(), 1);
957
    },
958
#}}}
adds OAT, TAS, GSPD, WindDat...
Sébastien MARQUE authored on 2017-03-15
959

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

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

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

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

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

            
1112
                if (info.pointer)
1113
                    me.screenElements[el ~ '-pointer']
make some data common to all...
Sébastien MARQUE authored on 2017-04-07
1114
                        .setRotation(-info.hdg - data.hdg * D2R)
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
1115
                        .show();
1116
                else
1117
                    me.screenElements[el ~ '-pointer']
1118
                        .hide();
1119
                me.screenElements[el ~ '-SRC-text']
1120
                    .setText(dev);
1121
                me.screenElements[el ~ '-DST-text']
1122
                    .setText(info.dst);
1123
                me.screenElements[el ~ '-WPID-text']
1124
                    .setText(info.id);
1125
                me.screenElements['BRG' ~ brg]
1126
                    .show();
1127
            }
1128
            else {
colorize BRG1/2 when needed,...
Sébastien MARQUE authored on 2017-03-21
1129
                me.setSoftKeyColor(brg == 1 ? 4 : 6, 0);
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
1130
                me.screenElements['BRG' ~ brg]
1131
                    .hide();
1132
            }
1133
        }
colorize BRG1/2 when needed,...
Sébastien MARQUE authored on 2017-03-21
1134
        settimer(func me.updateBRG(), 0.5);
adds BRG1/2 animation
Sébastien MARQUE authored on 2017-03-16
1135
    },
some added comments
Sébastien MARQUE authored on 2017-03-18
1136
#}}}
softkeys are available now
Sébastien MARQUE authored on 2017-03-14
1137

            
adds OMI to PFD
Sébastien MARQUE authored on 2017-03-23
1138
    updateOMI : func {
1139
# display marker baecon Outer, Middle, Inner {{{
1140
        var marker = nil;
1141
        foreach (var m; ['outer', 'middle', 'inner'])
1142
            if (getprop('/instrumentation/marker-beacon/' ~ m)) {
1143
                marker = m;
1144
                me.screenElements['OMI']
1145
                    .show();
1146
                break;
1147
            }
1148
        if (marker != nil) {
1149
            me.screenElements['MarkerText']
1150
                .setText(me._omi_data[marker].t)
1151
                .show();
1152
            me.screenElements['MarkerBG']
1153
                .setColorFill(me._omi_data[marker].bg)
1154
                .show();
1155
        }
1156
        else
1157
            me.screenElements['OMI']
1158
                .hide();
1159
        settimer(func me.updateOMI(), 1);
1160
    },
1161
    _omi_data : {
1162
        'outer':  {t: 'O', bg: [0,1,1]},
1163
        'middle': {t: 'M', bg: [1,1,1]},
1164
        'inner':  {t: 'I', bg: [1,1,0]},
1165
    },
1166
#}}}
animation texts EIS + power ...
Sébastien MARQUE authored on 2017-03-19
1167
};
1168

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