comment on the folds
|
1 |
# vim: set foldmethod=marker foldmarker={{{,}}} : |
commit initial
|
2 |
var displayClass = { |
pass device pointer to displ...
|
3 |
new: func(device, role) { |
add new vim folds
|
4 |
# the contructor {{{ |
commit initial
|
5 |
var m = { parents: [ displayClass ] }; |
cosmétique: folding pour les...
|
6 | |
commit initial
|
7 |
m.display = canvas.new({ |
8 |
"name" : role, |
|
9 |
"size" : [1024, 768], |
|
10 |
"view" : [1024, 768], |
|
11 |
"mipmapping": 1 |
|
12 |
}); |
|
13 |
m.display.addPlacement({ |
|
14 |
"node": "Screen", |
|
15 |
"parent": role |
|
16 |
}); |
|
17 |
m.display.setColorBackground(0,0,0); |
|
18 |
m.role = role; |
|
pass device pointer to displ...
|
19 |
m.device = device; |
écriture du wrapper pour le ...
|
20 |
m.screenElements = {}; |
commit initial
|
21 | |
22 |
return m; |
|
23 |
}, |
|
add new vim folds
|
24 |
#}}} |
commit initial
|
25 | |
add new vim folds
|
26 |
# timers stuff {{{ |
ajoute un timer pour cacher ...
|
27 |
timers : {}, |
28 | ||
29 |
timerTrigger : func { |
|
30 |
var now = systime(); |
|
31 |
foreach (var id; keys(me.timers)) { |
|
32 |
if (me.timers[id] < now) { |
|
33 |
me.screenElements[id].hide(); |
|
34 |
delete(me.timers, id); |
|
35 |
} |
|
36 |
} |
|
37 |
settimer(func me.timerTrigger(), 1); |
|
38 |
}, |
|
39 | ||
40 |
addTimer : func (duration, element) { |
|
41 |
if (typeof(element) == 'scalar') |
|
42 |
element = [ element ]; |
|
43 |
var end = systime() + duration; |
|
44 |
foreach (var e; element) |
|
45 |
me.timers[e] = end; |
|
46 |
}, |
|
add new vim folds
|
47 |
#}}} |
ajoute un timer pour cacher ...
|
48 | |
commit initial
|
49 |
loadsvg : func () { |
50 |
me.screen = me.display.createGroup(); |
|
51 |
me.screen.hide(); |
|
52 |
canvas.parsesvg(me.screen, "Aircraft/Instruments-3d/zkv1000/Systems/screen.svg"); |
|
53 |
}, |
|
54 | ||
55 |
_showInitProgress : func (p,t) { |
|
cosmétique: folding pour les...
|
56 |
#{{{ |
commit initial
|
57 |
p.setText(t); |
58 |
if (zkv.getNode(me.role ~ 'init').getValue() != 0) { |
|
59 |
if (size(t) >= 10) t = ''; |
|
60 |
settimer(func { me._showInitProgress(p, t ~ '.'); }, 0.1); |
|
61 |
} |
|
62 |
else { |
|
63 |
me.progress.hide(); |
|
64 |
me.screen.show(); |
|
séparation configuration PFD...
|
65 |
var groups = { |
animation VSI
|
66 |
show : [ |
commit initial
|
67 |
'SoftKeysTexts', |
68 |
'COMM', |
|
69 |
'NAV', |
|
ajout COMM, et factorisation...
|
70 |
'nav-freq-switch', |
71 |
'comm-freq-switch', |
|
séparation configuration PFD...
|
72 |
], |
73 |
text: [ |
|
74 |
'nav1-standby-freq', 'nav1-selected-freq', 'nav1-id', |
|
75 |
'nav2-standby-freq', 'nav2-selected-freq', 'nav2-id', |
|
ajout COMM, et factorisation...
|
76 |
'comm1-standby-freq', 'comm1-selected-freq', |
77 |
'comm2-standby-freq', 'comm2-selected-freq', |
|
séparation configuration PFD...
|
78 |
], |
ajout COMM, et factorisation...
|
79 |
hide : [ ], |
séparation configuration PFD...
|
80 |
clip: [ ], |
81 |
}; |
|
softkeys are available now
|
82 | |
83 |
for (var k = 0; k < 12; k += 1) |
|
84 |
append(groups.text, sprintf("SoftKey%02i-text", k)); |
|
85 | ||
séparation configuration PFD...
|
86 |
if (me.role == 'PFD') { |
87 |
append(groups.show, |
|
commit initial
|
88 |
'XPDR-TIME', |
AI disponible
|
89 |
'FlightInstruments', |
90 |
'Horizon', |
|
AI disponible, avec bankPoin...
|
91 |
'bankPointer', |
animation VSI
|
92 |
'VSI', |
animation HSI
|
93 |
'Rose', |
animation HDG bug
|
94 |
'Heading-bug', |
95 |
'PFD-Widgets', |
|
trends animation
|
96 |
'Trends', |
97 |
'Airspeed-Trend-Indicator', |
|
98 |
'Altitude-Trend-Indicator', |
|
adds OAT, TAS, GSPD, WindDat...
|
99 |
'OAT', |
100 |
'IAS-bg', |
|
101 |
'TAS', |
|
102 |
'GSPD', |
|
séparation configuration PFD...
|
103 |
); |
104 |
append(groups.hide, |
|
NAV disponible (hors CDI)
|
105 |
'CDI', |
animation HSI
|
106 |
'NAV1-pointer', |
107 |
'NAV2-pointer', |
|
108 |
'GPS-pointer', |
|
adds BRG1/2 animation
|
109 |
'BRG1-pointer', |
110 |
'BRG2-pointer', |
|
animation HDG bug
|
111 |
'SelectedHDG-bg', |
112 |
'SelectedHDG-bgtext', |
|
113 |
'SelectedHDG-text', |
|
114 |
'SelectedCRS-bg', |
|
115 |
'SelectedCRS-bgtext', |
|
116 |
'SelectedCRS-text', |
|
adds OAT, TAS, GSPD, WindDat...
|
117 |
'SelectedAlt-bug', |
118 |
'SelectedAlt-top', |
|
animation HDG bug
|
119 |
'TAS', |
120 |
'GSPD', |
|
121 |
'BARO', |
|
122 |
'WindData', |
|
123 |
'Reversionnary', |
|
124 |
'Annunciation', |
|
125 |
'Comparator', |
|
126 |
'BRG1', |
|
127 |
'BRG2', |
|
128 |
'DME1', |
|
129 |
'PFD-Map', |
|
adds OAT, TAS, GSPD, WindDat...
|
130 |
'PFD-Multilines', |
131 |
'WindData', 'WindData-OPTN1', 'WindData-OPTN2', 'WindData-OPTN1-HDG', 'WindData-OPTN2-symbol', 'WindData-OPTN2-headwind', 'WindData-OPTN2-crosswind' |
|
séparation configuration PFD...
|
132 |
); |
133 |
append(groups.clip, |
|
animation IAS
|
134 |
'SpeedLint1', |
animation ALT
|
135 |
'SpeedTape', |
136 |
'LintAlt', |
|
137 |
'AltLint00011' |
|
138 |
); |
|
séparation configuration PFD...
|
139 |
append(groups.text, |
adds OAT, TAS, GSPD, WindDat...
|
140 |
'SelectedAlt-text', |
141 |
'TAS-text', |
|
142 |
'GSPD-text', |
|
anime time display
|
143 |
'TIME-text', |
adds OAT, TAS, GSPD, WindDat...
|
144 |
'OAT-text', |
séparation configuration PFD...
|
145 |
'VSIText', |
146 |
'Speed110', |
|
147 |
'Alt11100', |
|
148 |
'HDG-text', |
|
adds BRG1/2 animation
|
149 |
'BRG1-pointer', 'BRG1-SRC-text', 'BRG1-DST-text', 'BRG1-WPID-text', |
150 |
'BRG2-pointer', 'BRG2-SRC-text', 'BRG2-DST-text', 'BRG2-WPID-text', |
|
adds OAT, TAS, GSPD, WindDat...
|
151 |
'WindData-OPTN1-HDG-text', 'WindData-OPTN1-SPD-text', |
152 |
'WindData-OPTN2-crosswind-text', 'WindData-OPTN2-headwind-text', |
|
séparation configuration PFD...
|
153 |
'AltBigC', 'AltSmallC' |
154 |
); |
|
155 |
for (var place = 1; place <= 6; place +=1) { |
|
156 |
append(groups.text, |
|
157 |
'AltBigU' ~ place, |
|
158 |
'AltSmallU' ~ place, |
|
159 |
'AltBigD' ~ place, |
|
160 |
'AltSmallD' ~ place |
|
161 |
); |
|
162 |
} |
|
animation ALT
|
163 |
} |
séparation configuration PFD...
|
164 |
else |
165 |
append(groups.show, 'Header'); |
|
166 | ||
167 |
me.loadGroup(groups); |
|
animation ALT
|
168 | |
séparation configuration PFD...
|
169 |
if (me.role == 'PFD') { |
adds OAT, TAS, GSPD, WindDat...
|
170 |
me.update(); |
171 |
me.updateAI(); |
|
172 |
me.updateVSI(); |
|
173 |
me.updateIAS(); |
|
174 |
me.updateALT(); |
|
175 |
me.updateHSI(); |
|
anime time display
|
176 |
me.updateTIME(); |
adds OAT, TAS, GSPD, WindDat...
|
177 |
me.updateOAT(); |
178 |
me.updateTAS(); |
|
adds BRG1/2 animation
|
179 |
me.updateBRG(); |
ajoute un timer pour cacher ...
|
180 |
me.timerTrigger(); |
séparation configuration PFD...
|
181 |
} |
ajout COMM, et factorisation...
|
182 |
me._updateRadio({auto:'nav'}); |
183 |
me._updateRadio({auto:'comm'}); |
|
softkeys are available now
|
184 |
me.updateSoftKeys(); |
commit initial
|
185 |
me.progress.removeAllChildren(); |
186 |
me.progress = nil; |
|
187 |
me.showInitProgress = nil; |
|
188 |
me._showInitProgress = nil; |
|
189 |
zkv.removeChild(me.role ~ 'init'); |
|
190 |
} |
|
191 |
}, |
|
cosmétique: folding pour les...
|
192 |
#}}} |
commit initial
|
193 | |
194 |
showInitProgress : func (role) { |
|
cosmétique: folding pour les...
|
195 |
#{{{ |
commit initial
|
196 |
me.progress = me.display.createGroup(); |
197 |
me.progress.show(); |
|
198 |
me.progress.createChild("text", role ~ " title") |
|
199 |
.setTranslation(512, 384) |
|
200 |
.setAlignment("center-center") |
|
201 |
.setFont("LiberationFonts/LiberationSans-Italic.ttf") |
|
202 |
.setFontSize(64, 1) |
|
203 |
.setColor(1,1,1) |
|
204 |
.setText("ZKV1000 " ~ role ~ " init"); |
|
205 | ||
206 |
zkv.getNode(role ~ 'init',1).setIntValue(1); |
|
207 | ||
208 |
me._showInitProgress(me.progress.createChild("text", role ~ "progress") |
|
209 |
.setTranslation(512, 484) |
|
210 |
.setAlignment("center-center") |
|
211 |
.setFont("LiberationFonts/LiberationSans-Bold.ttf") |
|
212 |
.setFontSize(128, 1) |
|
213 |
.setColor(1,0,0), '.'); |
|
214 |
}, |
|
cosmétique: folding pour les...
|
215 |
#}}} |
commit initial
|
216 | |
écriture du wrapper pour le ...
|
217 |
loadGroup : func (h) { |
cosmétique: folding pour les...
|
218 |
#{{{ |
écriture du wrapper pour le ...
|
219 |
if (typeof(h) != 'hash') { |
220 |
msg_dbg(sprintf("%s need a hash, but get a %s from %s", |
|
221 |
caller(0)[0], |
|
222 |
typeof(h), |
|
223 |
caller(1)[0])); |
|
224 |
return; |
|
commit initial
|
225 |
} |
écriture du wrapper pour le ...
|
226 |
var setMethod = func (e, t) { |
227 |
if (t == 'hide') |
|
228 |
me.screenElements[e].hide(); |
|
229 |
elsif (t == 'show') |
|
230 |
me.screenElements[e].show(); |
|
AI disponible
|
231 |
elsif (t == 'rot' or t == 'trans') { |
232 |
if (! contains(me.screenElements[e], t)) |
|
233 |
me.screenElements[e][t] = me.screenElements[e].createTransform(); |
|
234 |
} |
|
235 |
elsif (t == 'clip') { |
|
236 |
if (contains(me.clips, e)) |
|
237 |
me.screenElements[e].set("clip", me.clips[e]); |
|
238 |
else |
|
239 |
print('no defined clip for ' ~ e); |
|
240 |
} |
|
animation VSI
|
241 |
elsif (t == 'text') { |
242 |
if (contains(me.texts, e)) { |
|
243 |
if (contains(me.texts[e], 'alignment')) |
|
244 |
me.screenElements[e].setAlignment(me.texts[e].alignment); |
|
245 |
if (contains(me.texts[e], 'default')) |
|
246 |
me.screenElements[e].setText(me.texts[e].default); |
|
NAV disponible (hors CDI)
|
247 |
if (contains(me.texts[e], 'color')) |
248 |
me.screenElements[e].setColor(me.texts[e].color); |
|
animation VSI
|
249 |
} |
clean pre-merge
|
250 |
# else |
251 |
# print('no text format for ' ~ e); |
|
animation VSI
|
252 |
} |
commit initial
|
253 |
else |
écriture du wrapper pour le ...
|
254 |
print('unknown method ' ~ t); |
255 |
}; |
|
256 |
foreach (var todo; keys(h)) { |
|
257 |
if (typeof(h[todo]) != 'vector') h[todo] = [ h[todo] ]; |
|
258 |
foreach (var id; h[todo]) { |
|
259 |
if (! contains(me.screenElements, id)) { |
|
260 |
me.screenElements[id] = me.screen.getElementById(id); |
|
261 |
if (me.screenElements[id] != nil) |
|
262 |
setMethod(id, todo); |
|
263 |
else |
|
264 |
print('SVG ID ' ~ id ~ ' not found'); |
|
265 |
} |
|
266 |
else |
|
267 |
setMethod(id, todo); |
|
268 |
} |
|
commit initial
|
269 |
} |
270 |
}, |
|
cosmétique: folding pour les...
|
271 |
#}}} |
AI disponible
|
272 | |
273 |
clips : { |
|
cosmétique: folding pour les...
|
274 |
#{{{ |
clean pre-merge
|
275 |
PitchScale : "rect(70,664,370,256)", |
276 |
SpeedLint1 : "rect(252,226,318,204)", |
|
277 |
SpeedTape : "rect(115,239,455,156)", |
|
278 |
LintAlt : "rect(115,808,455,704)", |
|
animation ALT
|
279 |
AltLint00011 : "rect(252,804,318,771)", |
AI disponible
|
280 |
}, |
cosmétique: folding pour les...
|
281 |
#}}} |
AI disponible
|
282 | |
animation VSI
|
283 |
texts : { |
cosmétique: folding pour les...
|
284 |
#{{{ |
animation VSI
|
285 |
VSIText : { |
286 |
alignment: "right-bottom", default : num('0'), |
|
287 |
}, |
|
animation IAS
|
288 |
Speed110 : { |
NAV disponible (hors CDI)
|
289 |
alignment : 'left-bottom' |
animation IAS
|
290 |
}, |
animation ALT (2)
|
291 |
Alt11100 : { |
NAV disponible (hors CDI)
|
292 |
alignment:'left-bottom' |
animation ALT (2)
|
293 |
}, |
clean pre-merge
|
294 |
"HDG-text" : { |
295 |
default: '---°' |
|
296 |
}, |
|
NAV disponible (hors CDI)
|
297 |
'nav1-standby-freq' : { |
298 |
color: [0, 1, 1], |
|
299 |
}, |
|
300 |
'nav1-id' : { |
|
301 |
default: '' |
|
302 |
}, |
|
303 |
'nav2-id' : { |
|
304 |
default: '' |
|
305 |
}, |
|
adds OAT, TAS, GSPD, WindDat...
|
306 |
'TAS-text' : { |
307 |
alignment : 'right-bottom', |
|
308 |
}, |
|
309 |
'GSPD-text' : { |
|
310 |
alignment : 'right-bottom', |
|
311 |
}, |
|
animation VSI
|
312 |
}, |
cosmétique: folding pour les...
|
313 |
#}}} |
animation VSI
|
314 | |
softkeys are available now
|
315 |
updateSoftKeys : func { |
316 |
# update SoftKeys boxes {{{ |
|
317 |
# grey background code = #353939 |
|
318 |
# on PFD the last boxes are always BACK and ALERTS |
|
319 |
if (me.role == 'PFD') { |
|
320 |
me.screenElements[sprintf("SoftKey%02i-text", 11)] |
|
321 |
.setText('ALERTS'); |
|
322 |
if (size(me.device.softkeys.path) != 0) |
|
323 |
me.screenElements[sprintf("SoftKey%02i-text", 10)] |
|
324 |
.setText('BACK'); |
|
325 |
} |
|
326 | ||
327 |
var path = keyMap[me.role]; |
|
328 |
foreach (var p; me.device.softkeys.path) |
|
329 |
path = path[p]; |
|
330 | ||
331 |
# feeding with empty menus the first boxes |
|
332 |
var start = (contains(path, 'first')) ? path.first : 0; |
|
333 |
for (var k = 0; k < start; k+=1) { |
|
334 |
me.screenElements[sprintf("SoftKey%02i-text", k)] |
|
335 |
.setText(''); |
|
336 |
} |
|
337 |
# filling with the content the next boxes |
|
338 |
forindex (var k; path.texts) { |
|
339 |
var i = k + start; |
|
340 |
me.screenElements[sprintf("SoftKey%02i-text", i)] |
|
341 |
.setText(path.texts[k]); |
|
342 |
} |
|
343 |
# feeding the last boxes with empty string |
|
344 |
var end = (me.role == 'PFD') ? 10 : 12; |
|
345 |
if (size(path.texts) + start < end) { |
|
346 |
start = size(path.texts) + start; |
|
347 |
for (var k = start; k < end; k += 1) |
|
348 |
me.screenElements[sprintf("SoftKey%02i-text", k)] |
|
349 |
.setText(''); |
|
350 |
} |
|
351 |
}, |
|
352 |
#}}} |
|
353 | ||
adds OAT, TAS, GSPD, WindDat...
|
354 |
update : func { |
355 |
# updates roll, pitch, VSI, IAS, altitude and HDG {{{ |
|
356 |
me._updated_roll = getprop('/orientation/roll-deg'); |
|
357 |
me._updated_pitch = getprop('orientation/pitch-deg'); |
|
358 |
me._updated_vsi = getprop('/instrumentation/vertical-speed-indicator/indicated-speed-fpm'); |
|
359 |
me._updated_ias = getprop('/velocities/airspeed-kt'); |
|
360 |
me._updated_alt = getprop('/instrumentation/altimeter/indicated-altitude-ft'); |
|
361 |
me._updated_hdg = getprop('/orientation/heading-deg'); |
|
362 |
settimer(func me.update(), 0.05); |
|
363 |
}, |
|
364 |
_updated_roll : 0, |
|
365 |
_updated_pitch : 0, |
|
366 |
_updated_vsi : 0, |
|
367 |
_updated_ias : 0, |
|
368 |
_updated_alt : 0, |
|
369 |
_updated_hdg : 0, |
|
370 |
#}}} |
|
371 | ||
372 |
updateAI: func(){ |
|
cosmétique: folding pour les...
|
373 |
#{{{ |
adds OAT, TAS, GSPD, WindDat...
|
374 |
var pitch = me._updated_pitch; |
375 |
var roll = me._updated_roll; |
|
AI disponible
|
376 |
if (pitch > 80) |
377 |
pitch = 80; |
|
clean pre-merge
|
378 |
elsif (pitch < -80) |
AI disponible
|
379 |
pitch = -80; |
380 |
me.screenElements.Horizon |
|
381 |
.setRotation(-roll * D2R) |
|
382 |
.setTranslation(0, pitch * 6.8571428); |
|
AI disponible, avec bankPoin...
|
383 |
me.screenElements.bankPointer |
384 |
.setRotation(-roll * D2R); |
|
adds OAT, TAS, GSPD, WindDat...
|
385 |
settimer(func me.updateAI(), 0.1); |
AI disponible
|
386 |
}, |
cosmétique: folding pour les...
|
387 |
#}}} |
animation VSI
|
388 | |
adds OAT, TAS, GSPD, WindDat...
|
389 |
updateVSI: func () { |
comment on the folds
|
390 |
# animate VSI {{{ |
adds OAT, TAS, GSPD, WindDat...
|
391 |
var vsi = me._updated_vsi; |
animation VSI
|
392 |
me.screenElements.VSIText |
393 |
.setText(num(math.round(vsi, 10))); |
|
394 |
if (vsi > 4500) |
|
395 |
vsi = 4500; |
|
396 |
elsif (vsi < -4500) |
|
397 |
vsi = -4500; |
|
398 |
me.screenElements.VSI |
|
399 |
.setTranslation(0, vsi * -0.03465); |
|
adds OAT, TAS, GSPD, WindDat...
|
400 |
settimer(func me.updateVSI(), 0.1); |
animation VSI
|
401 |
}, |
cosmétique: folding pour les...
|
402 |
#}}} |
animation IAS
|
403 | |
adds OAT, TAS, GSPD, WindDat...
|
404 |
updateIAS: func () { |
comment on the folds
|
405 |
# animates the IAS lint (PFD) {{{ |
adds OAT, TAS, GSPD, WindDat...
|
406 |
var ias = me._updated_ias; |
animation IAS
|
407 |
if (ias >= 10) |
408 |
me.screenElements.Speed110 |
|
409 |
.setText(sprintf("% 2u",num(math.floor(ias/10)))); |
|
410 |
else |
|
411 |
me.screenElements.Speed110 |
|
412 |
.setText(''); |
|
413 |
me.screenElements.SpeedLint1 |
|
414 |
.setTranslation(0,(math.mod(ias,10) + (ias >= 10)*10) * 36); |
|
415 |
me.screenElements.SpeedTape |
|
416 |
.setTranslation(0,ias * 5.711); |
|
adds OAT, TAS, GSPD, WindDat...
|
417 |
if (ias > me._ias_vne and ! me._ias_already_exceeded) { # easier than .getColorFill |
418 |
me._ias_already_exceeded = 1; |
|
419 |
me.screenElements['IAS-bg'] |
|
420 |
.setColorFill(1,0,0); |
|
421 |
} |
|
422 |
elsif (ias < me._ias_vne and me._ias_already_exceeded) { # easier than .getColorFill |
|
423 |
me._ias_already_exceeded = 0; |
|
424 |
me.screenElements['IAS-bg'] |
|
425 |
.setColorFill(0,0,0); |
|
426 |
} |
|
trends animation
|
427 |
var now = systime(); |
428 |
# estimated speed in 6s |
|
429 |
var Sy = 6 * (ias - me._last_ias_kt) / (now - me._last_ias_s); |
|
430 |
if (abs(Sy) > 30) |
|
431 |
Sy = 30 * abs(Sy)/Sy; # = -30 or 30 |
|
432 |
me.screenElements['Airspeed-Trend-Indicator'] |
|
433 |
.setScale(1,Sy) |
|
434 |
.setTranslation(0, -284.5 * (Sy - 1)); |
|
435 |
me._last_ias_kt = ias; |
|
436 |
me._last_ias_s = now; |
|
adds OAT, TAS, GSPD, WindDat...
|
437 |
settimer(func me.updateIAS(), 0.1); |
animation IAS
|
438 |
}, |
trends animation
|
439 |
_last_ias_kt : 0, |
440 |
_last_ias_s : systime(), |
|
adds OAT, TAS, GSPD, WindDat...
|
441 |
_ias_vne : 999, |
442 |
_ias_already_exceeded : 0, |
|
cosmétique: folding pour les...
|
443 |
#}}} |
animation ALT
|
444 | |
adds OAT, TAS, GSPD, WindDat...
|
445 |
updateTAS: func { |
446 |
# updates the True Airspeed and GroundSpeed indicators {{{ |
|
447 |
me.screenElements['TAS-text'] |
|
448 |
.setText(sprintf('%iKT', getprop('/instrumentation/airspeed-indicator/true-speed-kt'))); |
|
449 |
me.screenElements['GSPD-text'] |
|
450 |
.setText(sprintf('%iKT', getprop('/velocities/groundspeed-kt'))); |
|
451 |
settimer(func me.updateTAS(), 0.5); |
|
452 |
}, |
|
453 |
#}}} |
|
454 | ||
455 |
updateALT: func () { |
|
456 |
# animates the altitude lint (PFD) {{{ |
|
457 |
var alt = me._updated_alt; |
|
animation ALT
|
458 |
if (alt < 0) |
459 |
me.screenElements.Alt11100 |
|
460 |
.setText(sprintf("% 3i",math.ceil(alt/100))); |
|
461 |
elsif (alt < 100) |
|
462 |
me.screenElements.Alt11100 |
|
463 |
.setText(''); |
|
464 |
else |
|
465 |
me.screenElements.Alt11100 |
|
466 |
.setText(sprintf("% 3i",math.floor(alt/100))); |
|
467 |
me.screenElements.AltLint00011 |
|
468 |
.setTranslation(0,math.fmod(alt,100) * 1.24); |
|
469 | ||
470 |
# From Farmin/G1000 http://wiki.flightgear.org/Project_Farmin/FG1000 |
|
471 |
if (alt> -1000 and alt< 1000000) { |
|
472 |
var Offset10 = 0; |
|
473 |
var Offset100 = 0; |
|
474 |
var Offset1000 = 0; |
|
475 |
if (alt< 0) { |
|
476 |
var Ne = 1; |
|
477 |
var alt= -alt; |
|
478 |
} |
|
479 |
else |
|
480 |
var Ne = 0; |
|
481 | ||
482 |
var Alt10 = math.mod(alt,100); |
|
483 |
var Alt100 = int(math.mod(alt/100,10)); |
|
484 |
var Alt1000 = int(math.mod(alt/1000,10)); |
|
485 |
var Alt10000 = int(math.mod(alt/10000,10)); |
|
486 |
var Alt20 = math.mod(Alt10,20)/20; |
|
487 |
if (Alt10 >= 80) |
|
488 |
var Alt100 += Alt20; |
|
489 | ||
490 |
if (Alt10 >= 80 and Alt100 >= 9) |
|
491 |
var Alt1000 += Alt20; |
|
492 | ||
493 |
if (Alt10 >= 80 and Alt100 >= 9 and Alt1000 >= 9) |
|
494 |
var Alt10000 += Alt20; |
|
495 | ||
496 |
if (alt> 100) |
|
497 |
var Offset10 = 100; |
|
498 | ||
499 |
if (alt> 1000) |
|
500 |
var Offset100 = 10; |
|
501 | ||
502 |
if (alt> 10000) |
|
503 |
var Offset1000 = 10; |
|
504 | ||
505 |
if (!Ne) { |
|
506 |
me.screenElements.LintAlt.setTranslation(0,(math.mod(alt,100))*0.57375); |
|
507 |
var altCentral = (int(alt/100)*100); |
|
508 |
} |
|
509 |
elsif (Ne) { |
|
510 |
me.screenElements.LintAlt.setTranslation(0,(math.mod(alt,100))*-0.57375); |
|
511 |
var altCentral = -(int(alt/100)*100); |
|
512 |
} |
|
513 |
me.screenElements["AltBigC"].setText(""); |
|
514 |
me.screenElements["AltSmallC"].setText(""); |
|
515 |
for (var place = 1; place <= 6; place += 1) { |
|
516 |
var altUP = altCentral + (place*100); |
|
517 |
var offset = -30.078; |
|
518 |
if (altUP < 0) { |
|
519 |
var altUP = -altUP; |
|
520 |
var prefix = "-"; |
|
521 |
var offset += 15.039; |
|
522 |
} |
|
523 |
else |
|
524 |
var prefix = ""; |
|
525 | ||
526 |
if (altUP == 0) { |
|
527 |
var AltBigUP = ""; |
|
528 |
var AltSmallUP = "0"; |
|
529 | ||
530 |
} |
|
531 |
elsif (math.mod(altUP,500) == 0 and altUP != 0) { |
|
532 |
var AltBigUP = sprintf(prefix~"%1d", altUP); |
|
533 |
var AltSmallUP = ""; |
|
534 |
} |
|
535 |
elsif (altUP < 1000 and (math.mod(altUP,500))) { |
|
536 |
var AltBigUP = ""; |
|
537 |
var AltSmallUP = sprintf(prefix~"%1d", int(math.mod(altUP,1000))); |
|
538 |
var offset = -30.078; |
|
539 |
} |
|
540 |
elsif ((altUP < 10000) and (altUP >= 1000) and (math.mod(altUP,500))) { |
|
541 |
var AltBigUP = sprintf(prefix~"%1d", int(altUP/1000)); |
|
542 |
var AltSmallUP = sprintf("%1d", int(math.mod(altUP,1000))); |
|
543 |
var offset += 15.039; |
|
544 |
} |
|
545 |
else { |
|
546 |
var AltBigUP = sprintf(prefix~"%1d", int(altUP/1000)); |
|
547 |
var mod = int(math.mod(altUP,1000)); |
|
548 |
var AltSmallUP = sprintf("%1d", mod); |
|
549 |
var offset += 30.078; |
|
550 |
} |
|
551 | ||
552 |
me.screenElements["AltBigU"~place].setText(AltBigUP); |
|
553 |
me.screenElements["AltSmallU"~place].setText(AltSmallUP); |
|
554 |
me.screenElements["AltSmallU"~place].setTranslation(offset,0); |
|
555 |
var altDOWN = altCentral - (place*100); |
|
556 |
var offset = -30.078; |
|
557 |
if (altDOWN < 0) { |
|
558 |
var altDOWN = -altDOWN; |
|
559 |
var prefix = "-"; |
|
560 |
var offset += 15.039; |
|
561 |
} |
|
562 |
else |
|
563 |
var prefix = ""; |
|
564 | ||
565 |
if (altDOWN == 0) { |
|
566 |
var AltBigDOWN = ""; |
|
567 |
var AltSmallDOWN = "0"; |
|
568 |
} |
|
569 |
elsif (math.mod(altDOWN,500) == 0 and altDOWN != 0) { |
|
570 |
var AltBigDOWN = sprintf(prefix~"%1d", altDOWN); |
|
571 |
var AltSmallDOWN = ""; |
|
572 |
} |
|
573 |
elsif (altDOWN < 1000 and (math.mod(altDOWN,500))) { |
|
574 |
var AltBigDOWN = ""; |
|
575 |
var AltSmallDOWN = sprintf(prefix~"%1d", int(math.mod(altDOWN,1000))); |
|
576 |
var offset = -30.078; |
|
577 |
} |
|
578 |
elsif ((altDOWN < 10000) and (altDOWN >= 1000) and (math.mod(altDOWN,500))) { |
|
579 |
var AltBigDOWN = sprintf(prefix~"%1d", int(altDOWN/1000)); |
|
580 |
var AltSmallDOWN = sprintf("%1d", int(math.mod(altDOWN,1000))); |
|
581 |
var offset += 15.039; |
|
582 |
} |
|
583 |
else { |
|
584 |
var AltBigDOWN = sprintf(prefix~"%1d", int(altDOWN/1000)); |
|
585 |
var mod = int(math.mod(altDOWN,1000)); |
|
586 |
var AltSmallDOWN = sprintf("%1d", mod); |
|
587 |
var offset += 30.078; |
|
588 |
} |
|
589 |
me.screenElements["AltBigD"~place].setText(AltBigDOWN); |
|
590 |
me.screenElements["AltSmallD"~place].setText(AltSmallDOWN); |
|
591 |
me.screenElements["AltSmallD"~place].setTranslation(offset,0); |
|
592 |
} |
|
593 |
} |
|
adds OAT, TAS, GSPD, WindDat...
|
594 |
me.updateSelectedALT(); |
trends animation
|
595 |
var now = systime(); |
596 |
# altitude in 6s |
|
597 |
var Sy = .3 * (alt - me._last_alt_ft) / (now - me._last_alt_s); # scale = 1/20ft |
|
598 |
if (abs(Sy) > 15) |
|
599 |
Sy = 15 * abs(Sy)/Sy; # = -15 or 15 |
|
600 |
me.screenElements['Altitude-Trend-Indicator'] |
|
601 |
.setScale(1,Sy) |
|
602 |
.setTranslation(0, -284.5 * (Sy - 1)); |
|
603 |
me._last_alt_ft = alt; |
|
604 |
me._last_alt_s = now; |
|
adds OAT, TAS, GSPD, WindDat...
|
605 |
settimer(func me.updateALT(), 0.2); |
animation ALT
|
606 |
}, |
trends animation
|
607 |
_last_alt_ft : 0, |
608 |
_last_alt_s : systime(), |
|
cosmétique: folding pour les...
|
609 |
#}}} |
animation HSI
|
610 | |
adds OAT, TAS, GSPD, WindDat...
|
611 |
updateHSI : func () { |
comment on the folds
|
612 |
# rotates the compass (PFD) {{{ |
adds OAT, TAS, GSPD, WindDat...
|
613 |
var hdg = me._updated_hdg; |
animation HSI
|
614 |
me.screenElements.Rose |
615 |
.setRotation(-hdg * D2R); |
|
616 |
me.screenElements['HDG-text'] |
|
617 |
.setText(sprintf("%03u°", hdg)); |
|
adds OAT, TAS, GSPD, WindDat...
|
618 |
settimer(func me.updateHSI(), 0.1); |
animation HSI
|
619 |
}, |
cosmétique: folding pour les...
|
620 |
#}}} |
NAV disponible (hors CDI)
|
621 | |
animation HDG bug
|
622 |
updateHDG : func (hdg) { |
comment on the folds
|
623 |
# moves the heading bug and display heading-deg for 3 seconds (PFD) {{{ |
animation HDG bug
|
624 |
if (me.role == 'MFD') |
625 |
return; |
|
626 |
me.screenElements['Heading-bug'] |
|
627 |
.setRotation(hdg * D2R); |
|
628 |
me.screenElements['SelectedHDG-bg'] |
|
629 |
.show(); |
|
630 |
me.screenElements['SelectedHDG-bgtext'] |
|
631 |
.show(); |
|
632 |
me.screenElements['SelectedHDG-text'] |
|
633 |
.setText(sprintf('%03d°%s', hdg, '')) |
|
634 |
.show(); |
|
635 |
me.addTimer(3, ['SelectedHDG-text', 'SelectedHDG-bgtext', 'SelectedHDG-bg']); |
|
636 |
}, |
|
cosmétique: folding pour les...
|
637 |
#}}} |
animation HDG bug
|
638 | |
anime CRS
|
639 |
updateCRS : func (crs) { |
640 |
# TODO: update display for NAV/GPS/BRG courses {{{ |
|
641 |
if (me.role == 'MFD') |
|
642 |
return; |
|
643 |
me.screenElements['SelectedCRS-bg'] |
|
644 |
.show(); |
|
645 |
me.screenElements['SelectedCRS-bgtext'] |
|
646 |
.show(); |
|
647 |
me.screenElements['SelectedCRS-text'] |
|
648 |
.setText(sprintf('%03d°%s', crs, '')) |
|
649 |
.show(); |
|
650 |
me.addTimer(3, ['SelectedCRS-text', 'SelectedCRS-bgtext', 'SelectedCRS-bg']); |
|
651 |
}, |
|
652 |
#}}} |
|
653 | ||
adds OAT, TAS, GSPD, WindDat...
|
654 |
updateSelectedALT : func { |
655 |
# animation for altitude section, called via updatedALT {{{ |
|
656 |
var selected_alt = getprop('/instrumentation/zkv1000/afcs/selected-alt-ft'); |
|
657 |
var delta_alt = me._updated_alt - selected_alt; |
|
658 |
if (abs(delta_alt) > 300) |
|
659 |
delta_alt = 300 * abs(delta_alt)/delta_alt; |
|
660 |
me.screenElements['SelectedAlt-top'] |
|
661 |
.setVisible(abs(delta_alt) > 100); |
|
662 |
me.screenElements['SelectedAlt-bug'] |
|
663 |
.setTranslation(0, delta_alt * 0.567); # 170/300 = 0.567 |
|
664 |
me.screenElements['SelectedAlt-text'] |
|
665 |
.setText(sprintf("%i", selected_alt)); |
|
666 |
}, |
|
667 |
#}}} |
|
668 | ||
ajout COMM, et factorisation...
|
669 |
_updateRadio: func { |
comment on the folds
|
670 |
# common parts for NAV/LOC/COMM radios{{{ |
ajout COMM, et factorisation...
|
671 |
# arg[0]._r = <comm|nav> |
672 |
if (contains(arg[0], "active")) { |
|
673 |
if (arg[0]['active'] == 'none') { |
|
674 |
me.screenElements[arg[0]._r ~ '1-selected-freq'] |
|
675 |
.setColor(1,1,1); |
|
676 |
me.screenElements[arg[0]._r ~ '2-selected-freq'] |
|
677 |
.setColor(1,1,1); |
|
678 |
} |
|
679 |
else { |
|
680 |
me.screenElements[arg[0]._r ~ arg[0]['active'] ~ '-selected-freq'] |
|
681 |
.setColor(0,1,0); |
|
682 |
me.screenElements[arg[0]._r ~ arg[0].inactive ~ '-selected-freq'] |
|
683 |
.setColor(1,1,1); |
|
684 |
} |
|
685 |
} |
|
686 |
if (contains(arg[0], 'tune')) { |
|
687 |
# n = 0 -> NAV1/COMM1 |
|
688 |
# n = 1 -> NAV1/COMM2 |
|
689 |
me.screenElements[arg[0]._r ~ '-freq-switch'] |
|
690 |
.setTranslation(0, arg[0].tune * 25); |
|
691 |
me.screenElements[arg[0]._r ~ (arg[0].tune + 1) ~ '-standby-freq'] |
|
692 |
.setColor(0,1,1); |
|
693 |
me.screenElements[arg[0]._r ~ ((arg[0].tune == 0) + 1) ~ '-standby-freq'] |
|
694 |
.setColor(1,1,1); |
|
695 |
} |
|
696 |
if (contains(arg[0], 'refresh')) { |
|
697 |
# rafraichi une seule ligne NAV1/COMM1 ou NAV2/COMM2 |
|
698 |
var fmt = (arg[0]._r == 'nav') ? '%.2f' : '%.3f'; |
|
699 |
me.screenElements[arg[0]._r ~ arg[0].refresh ~ '-selected-freq'] |
|
700 |
.setText(sprintf(fmt, getprop('/instrumentation/' |
|
701 |
~ arg[0]._r ~ '[' ~ (arg[0].refresh - 1) ~ ']/frequencies/selected-mhz'))); |
|
702 |
me.screenElements[arg[0]._r ~ arg[0].refresh ~ '-standby-freq'] |
|
703 |
.setText(sprintf(fmt, getprop('/instrumentation/' |
|
704 |
~ arg[0]._r ~ '[' ~ (arg[0].refresh - 1) ~ ']/frequencies/standby-mhz'))); |
|
705 |
} |
|
706 |
if (contains(arg[0], 'set')) { |
|
707 |
# positionne la valeur modifiée, les listeners "trigguent" en permanence ces propriétés, donc exit |
|
708 |
var n = getprop('/instrumentation/zkv1000/radios/' ~ arg[0]._r ~ '-tune'); |
|
709 |
var fmt = (arg[0]._r == 'nav') ? '%.2f' : '%.3f'; |
|
710 |
me.screenElements[arg[0]._r ~ (n + 1) ~ '-standby-freq'] |
|
711 |
.setText(getprop('/instrumentation/' ~ arg[0]._r ~ '[' ~ n ~ ']/frequencies/standby-mhz')); |
|
712 |
} |
|
713 |
if (contains(arg[0], 'auto')) { |
|
714 |
# pour rafraichir automagiquement, toutes les deux secondes un refresh pour un NAV |
|
715 |
var radio = arg[0].auto; |
|
716 |
me._updateRadio({refresh: 1, _r: radio}); |
|
717 |
settimer(func me._updateRadio({refresh: 2, _r: radio}), 1); |
|
718 |
settimer(func me._updateRadio({auto: radio}), 2); |
|
719 |
} |
|
720 |
}, |
|
cosmétique: folding pour les...
|
721 |
#}}} |
ajout COMM, et factorisation...
|
722 | |
NAV disponible (hors CDI)
|
723 |
updateNAV : func { |
comment on the folds
|
724 |
# update NAV/LOC rodios display upper left (PFD/MFD){{{ |
NAV disponible (hors CDI)
|
725 |
# made active via menu |
726 |
if (contains(arg[0], "active")) { |
|
727 |
if (arg[0]['active'] == 'none') { |
|
ajout COMM, et factorisation...
|
728 |
arg[0]._r = 'nav'; |
729 |
me._updateRadio(arg[0]); |
|
NAV disponible (hors CDI)
|
730 |
me.screenElements['nav1-id'] |
731 |
.setColor(1,1,1); |
|
732 |
me.screenElements['nav2-id'] |
|
733 |
.setColor(1,1,1); |
|
734 |
me.screenElements['NAV1-pointer'] |
|
735 |
.hide(); |
|
736 |
me.screenElements['NAV2-pointer'] |
|
737 |
.hide(); |
|
738 |
} |
|
739 |
else { |
|
ajout COMM, et factorisation...
|
740 |
arg[0]._r = 'nav'; |
741 |
arg[0].inactive = (arg[0]['active'] == 1) + 1; |
|
742 |
me._updateRadio(arg[0]); |
|
NAV disponible (hors CDI)
|
743 |
me.screenElements['nav' ~ arg[0]['active'] ~ '-id'] |
744 |
.setColor(0,1,0); |
|
745 |
me.screenElements['NAV' ~ arg[0]['active'] ~ '-pointer'] |
|
746 |
.show(); |
|
ajout COMM, et factorisation...
|
747 |
me.screenElements['nav' ~ arg[0].inactive ~ '-id'] |
748 |
.setColor(1,1,1); |
|
NAV disponible (hors CDI)
|
749 |
# me.screenElements['HDI'] |
750 |
# .setRotation(); |
|
751 |
# me.screenElements['NAV' ~ inactive ~ '-pointer'] |
|
752 |
# .hide(); |
|
753 |
# foreach (var e; [ 'FROM', 'TO', 'CDI' ]) |
|
754 |
# me.screenElements['NAV' ~ inactive ~ '-' ~ e] |
|
755 |
# .hide(); |
|
756 |
} |
|
757 |
} |
|
ajout COMM, et factorisation...
|
758 |
elsif (contains(arg[0], 'nav-id')) { |
Correction swap NAV tuning
|
759 |
# TODO: récupérer la valeur via les paramètres transmis du listener |
ajout COMM, et factorisation...
|
760 |
if (arg[0].val == nil) |
761 |
arg[0].val = ''; |
|
NAV disponible (hors CDI)
|
762 |
me.screenElements["nav" ~ arg[0]['nav-id'] ~ "-id"] |
ajout COMM, et factorisation...
|
763 |
.setText(arg[0].val); |
NAV disponible (hors CDI)
|
764 |
} |
ajout COMM, et factorisation...
|
765 |
else { |
766 |
arg[0]._r = 'nav'; |
|
767 |
me._updateRadio(arg[0]); |
|
NAV disponible (hors CDI)
|
768 |
} |
769 |
}, |
|
cosmétique: folding pour les...
|
770 |
#}}} |
ajout COMM, et factorisation...
|
771 | |
772 |
updateCOMM: func { |
|
comment on the folds
|
773 |
# update COMM radios display upper right (PFD/MFD){{{ |
ajout COMM, et factorisation...
|
774 |
arg[0]._r = 'comm'; |
775 |
me._updateRadio(arg[0]); |
|
776 |
}, |
|
cosmétique: folding pour les...
|
777 |
#}}} |
anime time display
|
778 | |
779 |
updateTIME : func { |
|
780 |
# updates the displayed time botoom left {{{ |
|
781 |
me.screenElements['TIME-text'] |
|
782 |
.setText(getprop('/sim/time/gmt-string')); |
|
783 |
settimer(func me.updateTIME(), 1); |
|
784 |
}, |
|
785 |
#}}} |
|
adds OAT, TAS, GSPD, WindDat...
|
786 | |
787 |
updateOAT : func { |
|
788 |
# update OAT display on normal and reversionnary modes (every 3s) {{{ |
|
789 |
var tmp = getprop('/environment/temperature-deg' ~ me._oat_unit); |
|
790 |
me.screenElements['OAT-text'] |
|
791 |
.setText(sprintf((abs(tmp) < 10) ? "%.1f %s" : "%i %s", tmp, (me._oat_unit == 'c') ? '°C' : 'F')); |
|
792 |
settimer(func me.updateOAT(), 3); |
|
793 |
}, |
|
794 |
_oat_unit : 'c', |
|
795 |
#}}} |
|
796 | ||
797 |
updateWindData : func { |
|
798 |
# update the window text and arrows for OPTN1/2 {{{ |
|
799 |
if (me._winddata_optn == 0) |
|
800 |
return; |
|
801 |
var wind_hdg = getprop('/environment/wind-from-heading-deg'); |
|
802 |
var wind_spd = getprop('/environment/wind-speed-kt'); |
|
803 |
var alpha = wind_hdg - me._updated_hdg; |
|
804 |
if (me._winddata_optn == 1) { |
|
805 |
me.screenElements['WindData-OPTN1-HDG'] |
|
806 |
.setRotation((alpha + 180) * D2R); |
|
807 |
me.screenElements['WindData-OPTN1-HDG-text'] |
|
808 |
.setText(sprintf("%03i°", wind_hdg)); |
|
809 |
me.screenElements['WindData-OPTN1-SPD-text'] |
|
810 |
.setText(int(wind_spd) ~ 'KT'); |
|
811 |
} |
|
812 |
else { # me._winddata_optn == 2 |
|
813 |
alpha *= D2R; |
|
814 |
var Vt = wind_spd * math.sin(alpha); |
|
815 |
var Ve = wind_spd * math.cos(alpha); |
|
816 |
if (Vt != 0) { |
|
817 |
me.screenElements['WindData-OPTN2-crosswind-text'] |
|
818 |
.setText(sprintf('%i', abs(Vt))); |
|
819 |
me.screenElements['WindData-OPTN2-crosswind'] |
|
820 |
.setScale(-abs(Vt)/Vt, 1) |
|
821 |
.setTranslation(-35 * (abs(Vt)/Vt + 1), 0); |
|
822 |
} |
|
823 |
if (Ve != 0) { |
|
824 |
me.screenElements['WindData-OPTN2-headwind-text'] |
|
825 |
.setText(sprintf('%i', abs(Ve))); |
|
826 |
me.screenElements['WindData-OPTN2-headwind'] |
|
827 |
.setScale(1, abs(Ve)/Ve) |
|
828 |
.setTranslation(0, 515 * (1 - abs(Ve)/Ve)); |
|
829 |
} |
|
830 |
} |
|
831 |
settimer(func me.updateWindData(), 0.5); |
|
832 |
}, |
|
833 |
_winddata_optn : 0, |
|
834 |
#}}} |
|
adds BRG1/2 animation
|
835 | |
836 |
updateBRG : func { |
|
837 |
# displays and update |
|
838 |
foreach (var brg; [1, 2]) { |
|
839 |
var source = 'brg' ~ brg ~ '-source'; |
|
840 | ||
841 |
var dev = radios.getNode(source).getValue(); |
|
842 |
var el = 'BRG' ~ brg; |
|
843 |
if (dev != 'OFF') { |
|
844 |
var info = { |
|
845 |
pointer : nil, |
|
846 |
id : 'NO DATA', |
|
847 |
hdg : nil, |
|
848 |
dst : '--.-NM' |
|
849 |
}; |
|
850 |
if (left(dev, 3) == 'NAV') { |
|
851 |
info.pointer = getprop('/instrumentation/nav[' ~ (brg - 1) ~ ']/in-range'); |
|
852 |
if (info.pointer) { |
|
853 |
info.id = getprop('/instrumentation/nav[' ~ (brg - 1) ~ ']/nav-id'); |
|
854 |
info.hdg = getprop('/instrumentation/nav[' ~ (brg - 1) ~ ']/heading-deg'); |
|
855 |
info.dst = sprintf('%.1d', getprop('/instrumentation/nav[' ~ (brg - 1) ~ ']/nav-distance') / 1852); # m -> /1852 |
|
856 |
} |
|
857 |
} |
|
858 |
elsif (dev == 'GPS') { |
|
859 |
info.pointer = props.getNode('/instrumentation/gps/wp').getChild('wp[1])'); |
|
860 |
if (info.pointer) { |
|
861 |
info.id = getprop('/instrumentation/gps/wp/wp[1]/ID'); |
|
862 |
info.hdg = getprop('/instrumentation/gps/wp/wp[1]/bearing-mag-deg'); |
|
863 |
info.dst = sprintf('%.1d', getprop('/instrumentation/gps/wp/wp[1]/distance-nm')); |
|
864 |
} |
|
865 |
} |
|
866 |
else { # there are 2 available ADF in FG, but instrument manage only 1 |
|
867 |
info.pointer = getprop('/instrumentation/adf/in-range'); |
|
868 |
if (info.pointer) { |
|
869 |
info.id = getprop('/instrumentation/adf/ident'); |
|
870 |
info.hdg = getprop('/instrumentation/adf/indicated-bearing-deg'); |
|
871 |
} |
|
872 |
} |
|
873 | ||
874 |
if (info.pointer) |
|
875 |
me.screenElements[el ~ '-pointer'] |
|
876 |
.setRotation(-info.hdg-me._updated_hdg * D2R) |
|
877 |
.show(); |
|
878 |
else |
|
879 |
me.screenElements[el ~ '-pointer'] |
|
880 |
.hide(); |
|
881 |
me.screenElements[el ~ '-SRC-text'] |
|
882 |
.setText(dev); |
|
883 |
me.screenElements[el ~ '-DST-text'] |
|
884 |
.setText(info.dst); |
|
885 |
me.screenElements[el ~ '-WPID-text'] |
|
886 |
.setText(info.id); |
|
887 |
me.screenElements['BRG' ~ brg] |
|
888 |
.show(); |
|
889 |
} |
|
890 |
else { |
|
891 |
me.screenElements['BRG' ~ brg] |
|
892 |
.hide(); |
|
893 |
} |
|
894 |
} |
|
895 |
settimer(func me.updateBRG(), 1); |
|
896 |
}, |
|
commit initial
|
897 |
}; |
softkeys are available now
|
898 | |
899 |
var keyMap = { |
|
add new vim folds
|
900 |
# softkeys map for PFD and MFD {{{ |
softkeys are available now
|
901 |
PFD : { |
902 |
first : 1, |
|
903 |
texts : ['INSET', 'SENSOR', 'PFD', 'OBS', 'CDI', 'DME', 'XPDR', 'IDENT', 'TMR/REF', 'NRST' ], |
|
904 |
INSET : { |
|
905 |
texts : ['OFF', 'DCLTR', 'WXLGND', 'TRAFFIC', 'TOPO', 'TERRAIN', 'STRMSCP', 'NEXRAD-C', 'XM LTNG', 'METAR'], |
|
906 |
}, |
|
907 |
SENSOR : { |
|
908 |
first : 2, |
|
909 |
texts : [ 'ADC1', 'ADC2', '', 'AHRS1', 'AHRS2'], |
|
910 |
}, |
|
911 |
PFD : { |
|
adds BRG1/2 animation
|
912 |
texts : [ 'SYN VIS', 'DFLTS', 'AOA/WIND', 'DME', 'BRG1', 'HSI FMT', 'BRG2', '', 'ALT UNIT', 'STD BARO' ], |
softkeys are available now
|
913 |
'SYN VIS' : { |
914 |
texts : [ 'PATHWAY', 'SYN TERR', 'HR2NHDG', 'APTSIGNS', 'FPM'], |
|
915 |
}, |
|
916 |
'AOA/WIND' : { |
|
917 |
first : 4, |
|
918 |
texts : ['AOA', 'WIND'], |
|
919 |
AOA : { |
|
920 |
first : 5, |
|
921 |
texts : ['AOA ON', 'AOA AUTO'], |
|
922 |
}, |
|
923 |
WIND : { |
|
924 |
first : 2, |
|
925 |
texts : ['OPTN1', 'OPTN2', '', 'OFF'], |
|
926 |
}, |
|
927 |
}, |
|
928 |
'HSI FMT' : { |
|
929 |
first : 6, |
|
930 |
texts : ['360 HSI', 'ARC HSI'], |
|
931 |
}, |
|
932 |
'ALT UNIT' : { |
|
933 |
first : 5, |
|
934 |
texts : ['METERS', '', 'IN', 'HPA'], |
|
935 |
}, |
|
936 |
}, |
|
937 |
XPDR : { |
|
938 |
first : 2, |
|
939 |
texts : ['STBY', 'ON', 'ALT', '', 'VFR', 'CODE', 'IDENT'], |
|
940 |
CODE : { |
|
941 |
texts : ['0', '1', '2', '3', '4', '5', '6', '7', 'IDENT', 'BKSP'], |
|
942 |
}, |
|
943 |
}, |
|
944 |
}, |
|
945 |
MFD : { |
|
946 |
texts : ['ENGINE', '', 'MAP', '', '', '', '', '', '', 'DCLTR', 'SHW CHRT', 'CHKLIST'], |
|
947 |
MAP : { |
|
948 |
texts: ['TRAFFIC', 'PROFILE', 'TOPO', 'TERRAIN', 'AIRWAYS', 'STRMSCP','NEXRAD-C', 'XM LTNG', 'METAR', 'LEGEND', 'BACK'], |
|
949 |
}, |
|
950 |
CHKLIST : { |
|
951 |
texts : ['ENGINE', '', '', '', '', 'DONE', '', '', '', '', 'EXIT', 'EMERGCY'], |
|
952 |
}, |
|
953 |
ENGINE : { |
|
954 |
texts : ['ENGINE', 'ANTI-ICE', '', 'DCLTR', '', 'ASSIST', '', '', '', '', 'FUEL'], |
|
955 |
'ANTI-ICE' : { |
|
956 |
texts : ['LEFT', 'AUTO', 'RIGHT', '', '', '', '', '', '', '', '', 'BACK'], |
|
957 |
}, |
|
958 |
FUEL : { |
|
959 |
first : 1, |
|
960 |
texts : ['FULL', 'TABS', '', '', '', '', '', '', '', 'UNDO', 'ENTER'], |
|
961 |
}, |
|
962 |
}, |
|
963 |
}, |
|
964 |
}; |
|
add new vim folds
|
965 |
#}}} |