cosmétique: folding pour les...
|
1 |
# vim: set foldmethod=marker foldmarker="{{{,}}}" |
commit initial
|
2 |
var displayClass = { |
3 |
new: func(node, role) { |
|
4 |
var m = { parents: [ displayClass ] }; |
|
cosmétique: folding pour les...
|
5 | |
commit initial
|
6 |
m.display = canvas.new({ |
7 |
"name" : role, |
|
8 |
"size" : [1024, 768], |
|
9 |
"view" : [1024, 768], |
|
10 |
"mipmapping": 1 |
|
11 |
}); |
|
12 |
m.display.addPlacement({ |
|
13 |
"node": "Screen", |
|
14 |
"parent": role |
|
15 |
}); |
|
16 |
m.display.setColorBackground(0,0,0); |
|
17 |
m.role = role; |
|
écriture du wrapper pour le ...
|
18 |
m.screenElements = {}; |
commit initial
|
19 | |
20 |
return m; |
|
21 |
}, |
|
22 | ||
ajoute un timer pour cacher ...
|
23 |
timers : {}, |
24 | ||
25 |
timerTrigger : func { |
|
26 |
var now = systime(); |
|
27 |
foreach (var id; keys(me.timers)) { |
|
28 |
if (me.timers[id] < now) { |
|
29 |
me.screenElements[id].hide(); |
|
30 |
delete(me.timers, id); |
|
31 |
} |
|
32 |
} |
|
33 |
settimer(func me.timerTrigger(), 1); |
|
34 |
}, |
|
35 | ||
36 |
addTimer : func (duration, element) { |
|
37 |
if (typeof(element) == 'scalar') |
|
38 |
element = [ element ]; |
|
39 |
var end = systime() + duration; |
|
40 |
foreach (var e; element) |
|
41 |
me.timers[e] = end; |
|
42 |
}, |
|
43 | ||
commit initial
|
44 |
loadsvg : func () { |
45 |
me.screen = me.display.createGroup(); |
|
46 |
me.screen.hide(); |
|
47 |
canvas.parsesvg(me.screen, "Aircraft/Instruments-3d/zkv1000/Systems/screen.svg"); |
|
48 |
}, |
|
49 | ||
50 |
_showInitProgress : func (p,t) { |
|
cosmétique: folding pour les...
|
51 |
#{{{ |
commit initial
|
52 |
p.setText(t); |
53 |
if (zkv.getNode(me.role ~ 'init').getValue() != 0) { |
|
54 |
if (size(t) >= 10) t = ''; |
|
55 |
settimer(func { me._showInitProgress(p, t ~ '.'); }, 0.1); |
|
56 |
} |
|
57 |
else { |
|
58 |
me.progress.hide(); |
|
59 |
me.screen.show(); |
|
séparation configuration PFD...
|
60 |
var groups = { |
animation VSI
|
61 |
show : [ |
commit initial
|
62 |
'SoftKeysTexts', |
63 |
'COMM', |
|
64 |
'NAV', |
|
ajout COMM, et factorisation...
|
65 |
'nav-freq-switch', |
66 |
'comm-freq-switch', |
|
séparation configuration PFD...
|
67 |
], |
68 |
text: [ |
|
69 |
'nav1-standby-freq', 'nav1-selected-freq', 'nav1-id', |
|
70 |
'nav2-standby-freq', 'nav2-selected-freq', 'nav2-id', |
|
ajout COMM, et factorisation...
|
71 |
'comm1-standby-freq', 'comm1-selected-freq', |
72 |
'comm2-standby-freq', 'comm2-selected-freq', |
|
séparation configuration PFD...
|
73 |
], |
ajout COMM, et factorisation...
|
74 |
hide : [ ], |
séparation configuration PFD...
|
75 |
clip: [ ], |
76 |
}; |
|
77 |
if (me.role == 'PFD') { |
|
78 |
append(groups.show, |
|
commit initial
|
79 |
'XPDR-TIME', |
AI disponible
|
80 |
'FlightInstruments', |
81 |
'Horizon', |
|
AI disponible, avec bankPoin...
|
82 |
'bankPointer', |
animation VSI
|
83 |
'VSI', |
animation HSI
|
84 |
'Rose', |
animation HDG bug
|
85 |
'Heading-bug', |
86 |
'PFD-Widgets', |
|
séparation configuration PFD...
|
87 |
); |
88 |
append(groups.hide, |
|
NAV disponible (hors CDI)
|
89 |
'CDI', |
animation HSI
|
90 |
'NAV1-pointer', |
91 |
'NAV2-pointer', |
|
92 |
'GPS-pointer', |
|
93 |
'Bearing1', |
|
94 |
'Bearing2', |
|
animation HDG bug
|
95 |
'SelectedHDG-bg', |
96 |
'SelectedHDG-bgtext', |
|
97 |
'SelectedHDG-text', |
|
98 |
'SelectedCRS-bg', |
|
99 |
'SelectedCRS-bgtext', |
|
100 |
'SelectedCRS-text', |
|
101 |
'SelectedALT', |
|
102 |
'TAS', |
|
103 |
'GSPD', |
|
104 |
'OAT', |
|
105 |
'BARO', |
|
106 |
'WindData', |
|
107 |
'Reversionnary', |
|
108 |
'Annunciation', |
|
109 |
'Comparator', |
|
110 |
'BRG1', |
|
111 |
'BRG2', |
|
112 |
'DME1', |
|
113 |
'PFD-Map', |
|
114 |
'PFD-Multilines' |
|
séparation configuration PFD...
|
115 |
); |
116 |
append(groups.clip, |
|
animation IAS
|
117 |
'SpeedLint1', |
animation ALT
|
118 |
'SpeedTape', |
119 |
'LintAlt', |
|
120 |
'AltLint00011' |
|
121 |
); |
|
séparation configuration PFD...
|
122 |
append(groups.text, |
123 |
'VSIText', |
|
124 |
'Speed110', |
|
125 |
'Alt11100', |
|
126 |
'HDG-text', |
|
127 |
'AltBigC', 'AltSmallC' |
|
128 |
); |
|
129 |
for (var place = 1; place <= 6; place +=1) { |
|
130 |
append(groups.text, |
|
131 |
'AltBigU' ~ place, |
|
132 |
'AltSmallU' ~ place, |
|
133 |
'AltBigD' ~ place, |
|
134 |
'AltSmallD' ~ place |
|
135 |
); |
|
136 |
} |
|
animation ALT
|
137 |
} |
séparation configuration PFD...
|
138 |
else |
139 |
append(groups.show, 'Header'); |
|
140 | ||
141 |
me.loadGroup(groups); |
|
animation ALT
|
142 | |
séparation configuration PFD...
|
143 |
if (me.role == 'PFD') { |
144 |
me.updateAI(getprop('/orientation/roll-deg'),getprop('orientation/pitch-deg')); |
|
145 |
me.updateVSI(getprop('/instrumentation/vertical-speed-indicator/indicated-speed-fpm')); |
|
146 |
me.updateIAS(getprop('/velocities/airspeed-kt')); |
|
147 |
me.updateALT(getprop('instrumentation/altimeter/indicated-altitude-ft')); |
|
148 |
me.updateHSI(getprop('orientation/heading-deg')); |
|
ajoute un timer pour cacher ...
|
149 |
me.timerTrigger(); |
séparation configuration PFD...
|
150 |
} |
ajout COMM, et factorisation...
|
151 |
me._updateRadio({auto:'nav'}); |
152 |
me._updateRadio({auto:'comm'}); |
|
commit initial
|
153 |
me.progress.removeAllChildren(); |
154 |
me.progress = nil; |
|
155 |
me.showInitProgress = nil; |
|
156 |
me._showInitProgress = nil; |
|
157 |
zkv.removeChild(me.role ~ 'init'); |
|
158 |
} |
|
159 |
}, |
|
cosmétique: folding pour les...
|
160 |
#}}} |
commit initial
|
161 | |
162 |
showInitProgress : func (role) { |
|
cosmétique: folding pour les...
|
163 |
#{{{ |
commit initial
|
164 |
me.progress = me.display.createGroup(); |
165 |
me.progress.show(); |
|
166 |
me.progress.createChild("text", role ~ " title") |
|
167 |
.setTranslation(512, 384) |
|
168 |
.setAlignment("center-center") |
|
169 |
.setFont("LiberationFonts/LiberationSans-Italic.ttf") |
|
170 |
.setFontSize(64, 1) |
|
171 |
.setColor(1,1,1) |
|
172 |
.setText("ZKV1000 " ~ role ~ " init"); |
|
173 | ||
174 |
zkv.getNode(role ~ 'init',1).setIntValue(1); |
|
175 | ||
176 |
me._showInitProgress(me.progress.createChild("text", role ~ "progress") |
|
177 |
.setTranslation(512, 484) |
|
178 |
.setAlignment("center-center") |
|
179 |
.setFont("LiberationFonts/LiberationSans-Bold.ttf") |
|
180 |
.setFontSize(128, 1) |
|
181 |
.setColor(1,0,0), '.'); |
|
182 |
}, |
|
cosmétique: folding pour les...
|
183 |
#}}} |
commit initial
|
184 | |
écriture du wrapper pour le ...
|
185 |
loadGroup : func (h) { |
cosmétique: folding pour les...
|
186 |
#{{{ |
écriture du wrapper pour le ...
|
187 |
if (typeof(h) != 'hash') { |
188 |
msg_dbg(sprintf("%s need a hash, but get a %s from %s", |
|
189 |
caller(0)[0], |
|
190 |
typeof(h), |
|
191 |
caller(1)[0])); |
|
192 |
return; |
|
commit initial
|
193 |
} |
écriture du wrapper pour le ...
|
194 |
var setMethod = func (e, t) { |
195 |
if (t == 'hide') |
|
196 |
me.screenElements[e].hide(); |
|
197 |
elsif (t == 'show') |
|
198 |
me.screenElements[e].show(); |
|
AI disponible
|
199 |
elsif (t == 'rot' or t == 'trans') { |
200 |
if (! contains(me.screenElements[e], t)) |
|
201 |
me.screenElements[e][t] = me.screenElements[e].createTransform(); |
|
202 |
} |
|
203 |
elsif (t == 'clip') { |
|
204 |
if (contains(me.clips, e)) |
|
205 |
me.screenElements[e].set("clip", me.clips[e]); |
|
206 |
else |
|
207 |
print('no defined clip for ' ~ e); |
|
208 |
} |
|
animation VSI
|
209 |
elsif (t == 'text') { |
210 |
if (contains(me.texts, e)) { |
|
211 |
if (contains(me.texts[e], 'alignment')) |
|
212 |
me.screenElements[e].setAlignment(me.texts[e].alignment); |
|
213 |
if (contains(me.texts[e], 'default')) |
|
214 |
me.screenElements[e].setText(me.texts[e].default); |
|
NAV disponible (hors CDI)
|
215 |
if (contains(me.texts[e], 'color')) |
216 |
me.screenElements[e].setColor(me.texts[e].color); |
|
animation VSI
|
217 |
} |
clean pre-merge
|
218 |
# else |
219 |
# print('no text format for ' ~ e); |
|
animation VSI
|
220 |
} |
commit initial
|
221 |
else |
écriture du wrapper pour le ...
|
222 |
print('unknown method ' ~ t); |
223 |
}; |
|
224 |
foreach (var todo; keys(h)) { |
|
225 |
if (typeof(h[todo]) != 'vector') h[todo] = [ h[todo] ]; |
|
226 |
foreach (var id; h[todo]) { |
|
227 |
if (! contains(me.screenElements, id)) { |
|
228 |
me.screenElements[id] = me.screen.getElementById(id); |
|
229 |
if (me.screenElements[id] != nil) |
|
230 |
setMethod(id, todo); |
|
231 |
else |
|
232 |
print('SVG ID ' ~ id ~ ' not found'); |
|
233 |
} |
|
234 |
else |
|
235 |
setMethod(id, todo); |
|
236 |
} |
|
commit initial
|
237 |
} |
238 |
}, |
|
cosmétique: folding pour les...
|
239 |
#}}} |
AI disponible
|
240 | |
241 |
clips : { |
|
cosmétique: folding pour les...
|
242 |
#{{{ |
clean pre-merge
|
243 |
PitchScale : "rect(70,664,370,256)", |
244 |
SpeedLint1 : "rect(252,226,318,204)", |
|
245 |
SpeedTape : "rect(115,239,455,156)", |
|
246 |
LintAlt : "rect(115,808,455,704)", |
|
animation ALT
|
247 |
AltLint00011 : "rect(252,804,318,771)", |
AI disponible
|
248 |
}, |
cosmétique: folding pour les...
|
249 |
#}}} |
AI disponible
|
250 | |
animation VSI
|
251 |
texts : { |
cosmétique: folding pour les...
|
252 |
#{{{ |
animation VSI
|
253 |
VSIText : { |
254 |
alignment: "right-bottom", default : num('0'), |
|
255 |
}, |
|
animation IAS
|
256 |
Speed110 : { |
NAV disponible (hors CDI)
|
257 |
alignment : 'left-bottom' |
animation IAS
|
258 |
}, |
animation ALT (2)
|
259 |
Alt11100 : { |
NAV disponible (hors CDI)
|
260 |
alignment:'left-bottom' |
animation ALT (2)
|
261 |
}, |
clean pre-merge
|
262 |
"HDG-text" : { |
263 |
default: '---°' |
|
264 |
}, |
|
NAV disponible (hors CDI)
|
265 |
'nav1-standby-freq' : { |
266 |
color: [0, 1, 1], |
|
267 |
}, |
|
268 |
'nav1-id' : { |
|
269 |
default: '' |
|
270 |
}, |
|
271 |
'nav2-id' : { |
|
272 |
default: '' |
|
273 |
}, |
|
animation VSI
|
274 |
}, |
cosmétique: folding pour les...
|
275 |
#}}} |
animation VSI
|
276 | |
AI disponible, avec bankPoin...
|
277 |
updateAI: func(roll,pitch){ |
cosmétique: folding pour les...
|
278 |
#{{{ |
AI disponible
|
279 |
if (pitch > 80) |
280 |
pitch = 80; |
|
clean pre-merge
|
281 |
elsif (pitch < -80) |
AI disponible
|
282 |
pitch = -80; |
283 |
me.screenElements.Horizon |
|
284 |
.setRotation(-roll * D2R) |
|
285 |
.setTranslation(0, pitch * 6.8571428); |
|
AI disponible, avec bankPoin...
|
286 |
me.screenElements.bankPointer |
287 |
.setRotation(-roll * D2R); |
|
288 |
settimer(func me.updateAI(getprop('/orientation/roll-deg'),getprop('orientation/pitch-deg')), 0.1); |
|
AI disponible
|
289 |
}, |
cosmétique: folding pour les...
|
290 |
#}}} |
animation VSI
|
291 | |
292 |
updateVSI: func (vsi) { |
|
cosmétique: folding pour les...
|
293 |
#{{{ |
animation VSI
|
294 |
me.screenElements.VSIText |
295 |
.setText(num(math.round(vsi, 10))); |
|
296 |
if (vsi > 4500) |
|
297 |
vsi = 4500; |
|
298 |
elsif (vsi < -4500) |
|
299 |
vsi = -4500; |
|
300 |
me.screenElements.VSI |
|
301 |
.setTranslation(0, vsi * -0.03465); |
|
302 |
settimer(func me.updateVSI(getprop('/instrumentation/vertical-speed-indicator/indicated-speed-fpm')), 0.1); |
|
303 |
}, |
|
cosmétique: folding pour les...
|
304 |
#}}} |
animation IAS
|
305 | |
306 |
updateIAS: func (ias) { |
|
cosmétique: folding pour les...
|
307 |
#{{{ |
animation IAS
|
308 |
if (ias >= 10) |
309 |
me.screenElements.Speed110 |
|
310 |
.setText(sprintf("% 2u",num(math.floor(ias/10)))); |
|
311 |
else |
|
312 |
me.screenElements.Speed110 |
|
313 |
.setText(''); |
|
314 |
me.screenElements.SpeedLint1 |
|
315 |
.setTranslation(0,(math.mod(ias,10) + (ias >= 10)*10) * 36); |
|
316 |
me.screenElements.SpeedTape |
|
317 |
.setTranslation(0,ias * 5.711); |
|
318 |
settimer(func me.updateIAS(getprop('/velocities/airspeed-kt')), 0.1); |
|
319 |
}, |
|
cosmétique: folding pour les...
|
320 |
#}}} |
animation ALT
|
321 | |
322 |
updateALT: func (alt) { |
|
cosmétique: folding pour les...
|
323 |
#{{{ |
animation ALT
|
324 |
if (alt < 0) |
325 |
me.screenElements.Alt11100 |
|
326 |
.setText(sprintf("% 3i",math.ceil(alt/100))); |
|
327 |
elsif (alt < 100) |
|
328 |
me.screenElements.Alt11100 |
|
329 |
.setText(''); |
|
330 |
else |
|
331 |
me.screenElements.Alt11100 |
|
332 |
.setText(sprintf("% 3i",math.floor(alt/100))); |
|
333 |
me.screenElements.AltLint00011 |
|
334 |
.setTranslation(0,math.fmod(alt,100) * 1.24); |
|
335 | ||
336 |
# From Farmin/G1000 http://wiki.flightgear.org/Project_Farmin/FG1000 |
|
337 |
if (alt> -1000 and alt< 1000000) { |
|
338 |
var Offset10 = 0; |
|
339 |
var Offset100 = 0; |
|
340 |
var Offset1000 = 0; |
|
341 |
if (alt< 0) { |
|
342 |
var Ne = 1; |
|
343 |
var alt= -alt; |
|
344 |
} |
|
345 |
else |
|
346 |
var Ne = 0; |
|
347 | ||
348 |
var Alt10 = math.mod(alt,100); |
|
349 |
var Alt100 = int(math.mod(alt/100,10)); |
|
350 |
var Alt1000 = int(math.mod(alt/1000,10)); |
|
351 |
var Alt10000 = int(math.mod(alt/10000,10)); |
|
352 |
var Alt20 = math.mod(Alt10,20)/20; |
|
353 |
if (Alt10 >= 80) |
|
354 |
var Alt100 += Alt20; |
|
355 | ||
356 |
if (Alt10 >= 80 and Alt100 >= 9) |
|
357 |
var Alt1000 += Alt20; |
|
358 | ||
359 |
if (Alt10 >= 80 and Alt100 >= 9 and Alt1000 >= 9) |
|
360 |
var Alt10000 += Alt20; |
|
361 | ||
362 |
if (alt> 100) |
|
363 |
var Offset10 = 100; |
|
364 | ||
365 |
if (alt> 1000) |
|
366 |
var Offset100 = 10; |
|
367 | ||
368 |
if (alt> 10000) |
|
369 |
var Offset1000 = 10; |
|
370 | ||
371 |
if (!Ne) { |
|
372 |
me.screenElements.LintAlt.setTranslation(0,(math.mod(alt,100))*0.57375); |
|
373 |
var altCentral = (int(alt/100)*100); |
|
374 |
} |
|
375 |
elsif (Ne) { |
|
376 |
me.screenElements.LintAlt.setTranslation(0,(math.mod(alt,100))*-0.57375); |
|
377 |
var altCentral = -(int(alt/100)*100); |
|
378 |
} |
|
379 |
me.screenElements["AltBigC"].setText(""); |
|
380 |
me.screenElements["AltSmallC"].setText(""); |
|
381 |
for (var place = 1; place <= 6; place += 1) { |
|
382 |
var altUP = altCentral + (place*100); |
|
383 |
var offset = -30.078; |
|
384 |
if (altUP < 0) { |
|
385 |
var altUP = -altUP; |
|
386 |
var prefix = "-"; |
|
387 |
var offset += 15.039; |
|
388 |
} |
|
389 |
else |
|
390 |
var prefix = ""; |
|
391 | ||
392 |
if (altUP == 0) { |
|
393 |
var AltBigUP = ""; |
|
394 |
var AltSmallUP = "0"; |
|
395 | ||
396 |
} |
|
397 |
elsif (math.mod(altUP,500) == 0 and altUP != 0) { |
|
398 |
var AltBigUP = sprintf(prefix~"%1d", altUP); |
|
399 |
var AltSmallUP = ""; |
|
400 |
} |
|
401 |
elsif (altUP < 1000 and (math.mod(altUP,500))) { |
|
402 |
var AltBigUP = ""; |
|
403 |
var AltSmallUP = sprintf(prefix~"%1d", int(math.mod(altUP,1000))); |
|
404 |
var offset = -30.078; |
|
405 |
} |
|
406 |
elsif ((altUP < 10000) and (altUP >= 1000) and (math.mod(altUP,500))) { |
|
407 |
var AltBigUP = sprintf(prefix~"%1d", int(altUP/1000)); |
|
408 |
var AltSmallUP = sprintf("%1d", int(math.mod(altUP,1000))); |
|
409 |
var offset += 15.039; |
|
410 |
} |
|
411 |
else { |
|
412 |
var AltBigUP = sprintf(prefix~"%1d", int(altUP/1000)); |
|
413 |
var mod = int(math.mod(altUP,1000)); |
|
414 |
var AltSmallUP = sprintf("%1d", mod); |
|
415 |
var offset += 30.078; |
|
416 |
} |
|
417 | ||
418 |
me.screenElements["AltBigU"~place].setText(AltBigUP); |
|
419 |
me.screenElements["AltSmallU"~place].setText(AltSmallUP); |
|
420 |
me.screenElements["AltSmallU"~place].setTranslation(offset,0); |
|
421 |
var altDOWN = altCentral - (place*100); |
|
422 |
var offset = -30.078; |
|
423 |
if (altDOWN < 0) { |
|
424 |
var altDOWN = -altDOWN; |
|
425 |
var prefix = "-"; |
|
426 |
var offset += 15.039; |
|
427 |
} |
|
428 |
else |
|
429 |
var prefix = ""; |
|
430 | ||
431 |
if (altDOWN == 0) { |
|
432 |
var AltBigDOWN = ""; |
|
433 |
var AltSmallDOWN = "0"; |
|
434 |
} |
|
435 |
elsif (math.mod(altDOWN,500) == 0 and altDOWN != 0) { |
|
436 |
var AltBigDOWN = sprintf(prefix~"%1d", altDOWN); |
|
437 |
var AltSmallDOWN = ""; |
|
438 |
} |
|
439 |
elsif (altDOWN < 1000 and (math.mod(altDOWN,500))) { |
|
440 |
var AltBigDOWN = ""; |
|
441 |
var AltSmallDOWN = sprintf(prefix~"%1d", int(math.mod(altDOWN,1000))); |
|
442 |
var offset = -30.078; |
|
443 |
} |
|
444 |
elsif ((altDOWN < 10000) and (altDOWN >= 1000) and (math.mod(altDOWN,500))) { |
|
445 |
var AltBigDOWN = sprintf(prefix~"%1d", int(altDOWN/1000)); |
|
446 |
var AltSmallDOWN = sprintf("%1d", int(math.mod(altDOWN,1000))); |
|
447 |
var offset += 15.039; |
|
448 |
} |
|
449 |
else { |
|
450 |
var AltBigDOWN = sprintf(prefix~"%1d", int(altDOWN/1000)); |
|
451 |
var mod = int(math.mod(altDOWN,1000)); |
|
452 |
var AltSmallDOWN = sprintf("%1d", mod); |
|
453 |
var offset += 30.078; |
|
454 |
} |
|
455 |
me.screenElements["AltBigD"~place].setText(AltBigDOWN); |
|
456 |
me.screenElements["AltSmallD"~place].setText(AltSmallDOWN); |
|
457 |
me.screenElements["AltSmallD"~place].setTranslation(offset,0); |
|
458 |
} |
|
459 |
} |
|
460 |
settimer(func me.updateALT(getprop('instrumentation/altimeter/indicated-altitude-ft')), 0.2); |
|
461 |
}, |
|
cosmétique: folding pour les...
|
462 |
#}}} |
animation HSI
|
463 | |
464 |
updateHSI : func (hdg) { |
|
cosmétique: folding pour les...
|
465 |
#{{{ |
animation HSI
|
466 |
me.screenElements.Rose |
467 |
.setRotation(-hdg * D2R); |
|
468 |
me.screenElements['HDG-text'] |
|
469 |
.setText(sprintf("%03u°", hdg)); |
|
470 |
settimer(func me.updateHSI(getprop('orientation/heading-deg')), 0.1); |
|
471 |
}, |
|
cosmétique: folding pour les...
|
472 |
#}}} |
NAV disponible (hors CDI)
|
473 | |
animation HDG bug
|
474 |
updateHDG : func (hdg) { |
cosmétique: folding pour les...
|
475 |
#{{{ |
animation HDG bug
|
476 |
if (me.role == 'MFD') |
477 |
return; |
|
478 |
me.screenElements['Heading-bug'] |
|
479 |
.setRotation(hdg * D2R); |
|
480 |
me.screenElements['SelectedHDG-bg'] |
|
481 |
.show(); |
|
482 |
me.screenElements['SelectedHDG-bgtext'] |
|
483 |
.show(); |
|
484 |
me.screenElements['SelectedHDG-text'] |
|
485 |
.setText(sprintf('%03d°%s', hdg, '')) |
|
486 |
.show(); |
|
487 |
me.addTimer(3, ['SelectedHDG-text', 'SelectedHDG-bgtext', 'SelectedHDG-bg']); |
|
488 |
}, |
|
cosmétique: folding pour les...
|
489 |
#}}} |
animation HDG bug
|
490 | |
ajout COMM, et factorisation...
|
491 |
_updateRadio: func { |
cosmétique: folding pour les...
|
492 |
#{{{ |
ajout COMM, et factorisation...
|
493 |
# arg[0]._r = <comm|nav> |
494 |
if (contains(arg[0], "active")) { |
|
495 |
if (arg[0]['active'] == 'none') { |
|
496 |
me.screenElements[arg[0]._r ~ '1-selected-freq'] |
|
497 |
.setColor(1,1,1); |
|
498 |
me.screenElements[arg[0]._r ~ '2-selected-freq'] |
|
499 |
.setColor(1,1,1); |
|
500 |
} |
|
501 |
else { |
|
502 |
me.screenElements[arg[0]._r ~ arg[0]['active'] ~ '-selected-freq'] |
|
503 |
.setColor(0,1,0); |
|
504 |
me.screenElements[arg[0]._r ~ arg[0].inactive ~ '-selected-freq'] |
|
505 |
.setColor(1,1,1); |
|
506 |
} |
|
507 |
} |
|
508 |
if (contains(arg[0], 'tune')) { |
|
509 |
# n = 0 -> NAV1/COMM1 |
|
510 |
# n = 1 -> NAV1/COMM2 |
|
511 |
me.screenElements[arg[0]._r ~ '-freq-switch'] |
|
512 |
.setTranslation(0, arg[0].tune * 25); |
|
513 |
me.screenElements[arg[0]._r ~ (arg[0].tune + 1) ~ '-standby-freq'] |
|
514 |
.setColor(0,1,1); |
|
515 |
me.screenElements[arg[0]._r ~ ((arg[0].tune == 0) + 1) ~ '-standby-freq'] |
|
516 |
.setColor(1,1,1); |
|
517 |
} |
|
518 |
if (contains(arg[0], 'refresh')) { |
|
519 |
# rafraichi une seule ligne NAV1/COMM1 ou NAV2/COMM2 |
|
520 |
var fmt = (arg[0]._r == 'nav') ? '%.2f' : '%.3f'; |
|
521 |
me.screenElements[arg[0]._r ~ arg[0].refresh ~ '-selected-freq'] |
|
522 |
.setText(sprintf(fmt, getprop('/instrumentation/' |
|
523 |
~ arg[0]._r ~ '[' ~ (arg[0].refresh - 1) ~ ']/frequencies/selected-mhz'))); |
|
524 |
me.screenElements[arg[0]._r ~ arg[0].refresh ~ '-standby-freq'] |
|
525 |
.setText(sprintf(fmt, getprop('/instrumentation/' |
|
526 |
~ arg[0]._r ~ '[' ~ (arg[0].refresh - 1) ~ ']/frequencies/standby-mhz'))); |
|
527 |
} |
|
528 |
if (contains(arg[0], 'set')) { |
|
529 |
# positionne la valeur modifiée, les listeners "trigguent" en permanence ces propriétés, donc exit |
|
530 |
var n = getprop('/instrumentation/zkv1000/radios/' ~ arg[0]._r ~ '-tune'); |
|
531 |
var fmt = (arg[0]._r == 'nav') ? '%.2f' : '%.3f'; |
|
532 |
me.screenElements[arg[0]._r ~ (n + 1) ~ '-standby-freq'] |
|
533 |
.setText(getprop('/instrumentation/' ~ arg[0]._r ~ '[' ~ n ~ ']/frequencies/standby-mhz')); |
|
534 |
} |
|
535 |
if (contains(arg[0], 'auto')) { |
|
536 |
# pour rafraichir automagiquement, toutes les deux secondes un refresh pour un NAV |
|
537 |
var radio = arg[0].auto; |
|
538 |
me._updateRadio({refresh: 1, _r: radio}); |
|
539 |
settimer(func me._updateRadio({refresh: 2, _r: radio}), 1); |
|
540 |
settimer(func me._updateRadio({auto: radio}), 2); |
|
541 |
} |
|
542 |
}, |
|
cosmétique: folding pour les...
|
543 |
#}}} |
ajout COMM, et factorisation...
|
544 | |
NAV disponible (hors CDI)
|
545 |
updateNAV : func { |
cosmétique: folding pour les...
|
546 |
#{{{ |
NAV disponible (hors CDI)
|
547 |
# made active via menu |
548 |
if (contains(arg[0], "active")) { |
|
549 |
if (arg[0]['active'] == 'none') { |
|
ajout COMM, et factorisation...
|
550 |
arg[0]._r = 'nav'; |
551 |
me._updateRadio(arg[0]); |
|
NAV disponible (hors CDI)
|
552 |
me.screenElements['nav1-id'] |
553 |
.setColor(1,1,1); |
|
554 |
me.screenElements['nav2-id'] |
|
555 |
.setColor(1,1,1); |
|
556 |
me.screenElements['NAV1-pointer'] |
|
557 |
.hide(); |
|
558 |
me.screenElements['NAV2-pointer'] |
|
559 |
.hide(); |
|
560 |
} |
|
561 |
else { |
|
ajout COMM, et factorisation...
|
562 |
arg[0]._r = 'nav'; |
563 |
arg[0].inactive = (arg[0]['active'] == 1) + 1; |
|
564 |
me._updateRadio(arg[0]); |
|
NAV disponible (hors CDI)
|
565 |
me.screenElements['nav' ~ arg[0]['active'] ~ '-id'] |
566 |
.setColor(0,1,0); |
|
567 |
me.screenElements['NAV' ~ arg[0]['active'] ~ '-pointer'] |
|
568 |
.show(); |
|
ajout COMM, et factorisation...
|
569 |
me.screenElements['nav' ~ arg[0].inactive ~ '-id'] |
570 |
.setColor(1,1,1); |
|
NAV disponible (hors CDI)
|
571 |
# me.screenElements['HDI'] |
572 |
# .setRotation(); |
|
573 |
# me.screenElements['NAV' ~ inactive ~ '-pointer'] |
|
574 |
# .hide(); |
|
575 |
# foreach (var e; [ 'FROM', 'TO', 'CDI' ]) |
|
576 |
# me.screenElements['NAV' ~ inactive ~ '-' ~ e] |
|
577 |
# .hide(); |
|
578 |
} |
|
579 |
} |
|
ajout COMM, et factorisation...
|
580 |
elsif (contains(arg[0], 'nav-id')) { |
Correction swap NAV tuning
|
581 |
# TODO: récupérer la valeur via les paramètres transmis du listener |
ajout COMM, et factorisation...
|
582 |
if (arg[0].val == nil) |
583 |
arg[0].val = ''; |
|
NAV disponible (hors CDI)
|
584 |
me.screenElements["nav" ~ arg[0]['nav-id'] ~ "-id"] |
ajout COMM, et factorisation...
|
585 |
.setText(arg[0].val); |
NAV disponible (hors CDI)
|
586 |
} |
ajout COMM, et factorisation...
|
587 |
else { |
588 |
arg[0]._r = 'nav'; |
|
589 |
me._updateRadio(arg[0]); |
|
NAV disponible (hors CDI)
|
590 |
} |
591 |
}, |
|
cosmétique: folding pour les...
|
592 |
#}}} |
ajout COMM, et factorisation...
|
593 | |
594 |
updateCOMM: func { |
|
cosmétique: folding pour les...
|
595 |
#{{{ |
ajout COMM, et factorisation...
|
596 |
arg[0]._r = 'comm'; |
597 |
me._updateRadio(arg[0]); |
|
598 |
}, |
|
cosmétique: folding pour les...
|
599 |
#}}} |
commit initial
|
600 |
}; |