comment on the folds
|
1 |
# vim: set foldmethod=marker foldmarker={{{,}}} : |
commit initial
|
2 |
var displayClass = { |
improves role/name variables...
|
3 |
new: func(device) { |
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({ |
improves role/name variables...
|
8 |
"name" : device.name, |
massive code reorganisation ...
|
9 |
"size" : [1280, 1280], |
10 |
"view" : [1024, 768], |
|
commit initial
|
11 |
"mipmapping": 1 |
12 |
}); |
|
13 |
m.display.addPlacement({ |
|
configurable display size, v...
|
14 |
"node": device.data['screen-object'] != nil ? device.data['screen-object'] : "Screen", |
improves role/name variables...
|
15 |
"parent": device.name |
massive code reorganisation ...
|
16 |
}); |
commit initial
|
17 |
m.display.setColorBackground(0,0,0); |
improves role/name variables...
|
18 |
m.role = device.role; |
pass device pointer to displ...
|
19 |
m.device = device; |
écriture du wrapper pour le ...
|
20 |
m.screenElements = {}; |
massive code reorganisation ...
|
21 |
m.screen = m.display |
22 |
.createGroup() |
|
23 |
.show(); |
|
commit initial
|
24 | |
Softkeys revert to the previ...
|
25 |
m.timers2 = {}; # tho old timer implementation use already a named timer hash |
26 |
# Softkeys revert to the previous level after 45 seconds of inactivity. |
|
27 |
m.softkeys_inactivity_delay = 45; |
|
28 | ||
séparation configuration PFD...
|
29 |
var groups = { |
animation VSI
|
30 |
show : [ |
makes header visible on MFD ...
|
31 |
'Header', |
commit initial
|
32 |
'SoftKeysTexts', |
33 |
'COMM', |
|
34 |
'NAV', |
|
ajout COMM, et factorisation...
|
35 |
'nav-freq-switch', |
36 |
'comm-freq-switch', |
|
séparation configuration PFD...
|
37 |
], |
38 |
text: [ |
|
39 |
'nav1-standby-freq', 'nav1-selected-freq', 'nav1-id', |
|
40 |
'nav2-standby-freq', 'nav2-selected-freq', 'nav2-id', |
|
ajout COMM, et factorisation...
|
41 |
'comm1-standby-freq', 'comm1-selected-freq', |
42 |
'comm2-standby-freq', 'comm2-selected-freq', |
|
séparation configuration PFD...
|
43 |
], |
massive code reorganisation ...
|
44 |
hide : [ 'Failures', 'NAV-COMM-Failures' ], |
séparation configuration PFD...
|
45 |
clip: [ ], |
46 |
}; |
|
softkeys are available now
|
47 | |
add softkeys colors
|
48 |
for (var k = 0; k < 12; k += 1) { |
softkeys are available now
|
49 |
append(groups.text, sprintf("SoftKey%02i-text", k)); |
add softkeys colors
|
50 |
append(groups.show, sprintf("SoftKey%02i-bg", k)); |
51 |
} |
|
softkeys are available now
|
52 | |
massive code reorganisation ...
|
53 |
if (m.device.role == 'PFD') { |
séparation configuration PFD...
|
54 |
append(groups.show, |
adds some vim z-folds
|
55 |
# {{{ |
commit initial
|
56 |
'XPDR-TIME', |
AI disponible
|
57 |
'FlightInstruments', |
58 |
'Horizon', |
|
AI disponible, avec bankPoin...
|
59 |
'bankPointer', |
animation VSI
|
60 |
'VSI', |
animation HSI
|
61 |
'Rose', |
animation HDG bug
|
62 |
'Heading-bug', |
63 |
'PFD-Widgets', |
|
trends animation
|
64 |
'Trends', |
65 |
'Airspeed-Trend-Indicator', |
|
66 |
'Altitude-Trend-Indicator', |
|
adds OAT, TAS, GSPD, WindDat...
|
67 |
'OAT', |
68 |
'IAS-bg', |
|
69 |
'TAS', |
|
70 |
'GSPD', |
|
adds BARO settings
|
71 |
'BARO-bg', |
adds slipskid animation
|
72 |
'SlipSkid', |
add V-speeds bugs
|
73 |
'IAS-Vx', 'IAS-Vy', 'IAS-Vr', 'IAS-Vglide', |
adds some vim z-folds
|
74 |
# }}} |
séparation configuration PFD...
|
75 |
); |
76 |
append(groups.hide, |
|
adds some vim z-folds
|
77 |
# {{{ |
adds EIS
|
78 |
'EIS', |
NAV disponible (hors CDI)
|
79 |
'CDI', |
adds OMI to PFD
|
80 |
'OMI', 'MarkerBG', 'MarkerText', |
massive code reorganisation ...
|
81 |
'VDI', |
adds CDI
|
82 |
'NAV1-pointer', 'NAV1-CDI', 'NAV1-FROM', 'NAV1-TO', |
83 |
'NAV2-pointer', 'NAV2-CDI', 'NAV2-FROM', 'NAV2-TO', |
|
84 |
'GPS-pointer', 'GPS-CDI', 'GPS-CTI', 'GPS-CTI-diamond', 'GPS-FROM', 'GPS-TO', |
|
adds BRG1/2 animation
|
85 |
'BRG1-pointer', |
86 |
'BRG2-pointer', |
|
animation HDG bug
|
87 |
'SelectedHDG-bg', |
88 |
'SelectedHDG-bgtext', |
|
89 |
'SelectedHDG-text', |
|
90 |
'SelectedCRS-bg', |
|
91 |
'SelectedCRS-bgtext', |
|
92 |
'SelectedCRS-text', |
|
fix Selected Altitude displa...
|
93 |
'SelectedALT', 'SelectedALT-bug', 'SelectedALT-bg', 'SelectedALT-symbol', |
animation HDG bug
|
94 |
'TAS', |
95 |
'GSPD', |
|
96 |
'WindData', |
|
97 |
'Reversionnary', |
|
98 |
'Annunciation', |
|
99 |
'Comparator', |
|
100 |
'BRG1', |
|
101 |
'BRG2', |
|
102 |
'DME1', |
|
makes map available for PFD ...
|
103 |
'PFD-Map-bg', |
adds OAT, TAS, GSPD, WindDat...
|
104 |
'PFD-Multilines', |
hide orientation on Inset ma...
|
105 |
'MapOrientation', |
improves WindData display
|
106 |
'WindData', 'WindData-OPTN1', 'WindData-OPTN2', 'WindData-OPTN1-HDG', 'WindData-OPTN2-symbol', 'WindData-OPTN2-headwind', 'WindData-OPTN2-crosswind', 'WindData-NODATA', |
nicer AOA display
|
107 |
'AOA', 'AOA-needle', 'AOA-text', 'AOA-approach', |
add navigation infos on head...
|
108 |
'MFD-navbox', |
add TCAS
|
109 |
'Traffic', |
adds some vim z-folds
|
110 |
# }}} |
séparation configuration PFD...
|
111 |
); |
112 |
append(groups.clip, |
|
adds some vim z-folds
|
113 |
# {{{ |
animation IAS
|
114 |
'SpeedLint1', |
animation ALT
|
115 |
'SpeedTape', |
116 |
'LintAlt', |
|
massive code reorganisation ...
|
117 |
'AltLint00011', |
118 |
'PitchScale', |
|
adds some vim z-folds
|
119 |
# }}} |
animation ALT
|
120 |
); |
séparation configuration PFD...
|
121 |
append(groups.text, |
adds some vim z-folds
|
122 |
# {{{ |
fix Selected Altitude displa...
|
123 |
'SelectedALT-text', |
adds OAT, TAS, GSPD, WindDat...
|
124 |
'TAS-text', |
125 |
'GSPD-text', |
|
anime time display
|
126 |
'TIME-text', |
adds OAT, TAS, GSPD, WindDat...
|
127 |
'OAT-text', |
séparation configuration PFD...
|
128 |
'VSIText', |
129 |
'Speed110', |
|
130 |
'Alt11100', |
|
131 |
'HDG-text', |
|
adds BARO settings
|
132 |
'BARO-text', |
adds CDI
|
133 |
'CDI-SRC-text', 'CDI-GPS-ANN-text', 'CDI-GPS-XTK-text', |
adds BRG1/2 animation
|
134 |
'BRG1-pointer', 'BRG1-SRC-text', 'BRG1-DST-text', 'BRG1-WPID-text', |
135 |
'BRG2-pointer', 'BRG2-SRC-text', 'BRG2-DST-text', 'BRG2-WPID-text', |
|
adds OAT, TAS, GSPD, WindDat...
|
136 |
'WindData-OPTN1-HDG-text', 'WindData-OPTN1-SPD-text', |
137 |
'WindData-OPTN2-crosswind-text', 'WindData-OPTN2-headwind-text', |
|
adds transponder
|
138 |
'XPDR-MODE-text', 'XPDR-DIGIT-3-text', 'XPDR-DIGIT-2-text', 'XPDR-DIGIT-1-text', 'XPDR-DIGIT-0-text', |
add navigation infos on head...
|
139 |
'ETE', 'ETE-text', 'DIS', 'DIS-text', 'LEG-text', |
séparation configuration PFD...
|
140 |
'AltBigC', 'AltSmallC' |
adds some vim z-folds
|
141 |
# }}} |
séparation configuration PFD...
|
142 |
); |
143 |
for (var place = 1; place <= 6; place +=1) { |
|
144 |
append(groups.text, |
|
145 |
'AltBigU' ~ place, |
|
146 |
'AltSmallU' ~ place, |
|
147 |
'AltBigD' ~ place, |
|
148 |
'AltSmallD' ~ place |
|
149 |
); |
|
150 |
} |
|
relocate SVG files in Models...
|
151 |
canvas.parsesvg(m.screen, data.zkv1000_reldir ~ 'Models/PFD.svg'); |
animation ALT
|
152 |
} |
adds EIS
|
153 |
else { |
remove hardcoded properties ...
|
154 |
var eis_file = eis.getValue('type'); |
EIS now really specific to a...
|
155 |
if (eis_file == nil) |
remove hardcoded properties ...
|
156 |
eis_file = eis.getValue('file'); |
EIS now really specific to a...
|
157 | |
158 |
if (eis_file != nil) { |
|
159 |
if (find('/', eis_file) == -1) |
|
160 |
eis_file = data.zkv1000_dir ~ 'Nasal/EIS/' ~ eis_file ~ '.nas'; |
|
161 |
elsif (split('/', eis_file)[0] == 'Aircraft') { |
|
162 |
var path = split('/', eis_file); |
|
163 |
if (getprop('/sim/fg-aircraft') != nil) { |
|
164 |
eis_file = getprop('/sim/fg-aircraft'); |
|
165 |
for (var i = 1; i < size(path); i += 1) |
|
166 |
eis_file ~= '/' ~ path[i]; |
|
167 |
} |
|
168 |
else |
|
169 |
eis_file = getprop('/sim/fg-root') ~ '/' ~ eis_file; |
|
170 |
} |
|
171 |
} |
|
172 |
else |
|
173 |
eis_file = data.zkv1000_dir ~ 'Nasal/EIS/none.nas'; |
|
174 | ||
175 |
if (io.stat(eis_file) == nil |
|
176 |
and print(eis_file ~ ' not found')) |
|
177 |
eis_file = data.zkv1000_dir ~ 'Nasal/EIS/none.nas'; |
|
178 |
io.load_nasal(eis_file, 'zkv1000'); |
|
179 | ||
massive code reorganisation ...
|
180 |
if (contains(m.parents[0], 'showEIS')) |
181 |
m.showEIS(groups); |
|
add navigation infos on head...
|
182 | |
183 |
append(groups.hide, 'PFD-navbox'); |
|
184 |
for (var i=1; i <= 4; i+=1) |
|
185 |
foreach (var t; ['ID', 'VAL']) |
|
186 |
append(groups.text, 'DATA-FIELD' ~ i ~ '-' ~ t ~ '-text'); |
|
adds EIS
|
187 |
} |
séparation configuration PFD...
|
188 | |
relocate SVG files in Models...
|
189 |
canvas.parsesvg(m.screen, data.zkv1000_reldir ~ 'Models/softkeys.svg'); |
190 |
canvas.parsesvg(m.screen, data.zkv1000_reldir ~ 'Models/header-nav-comm.svg'); |
|
animation ALT
|
191 | |
massive code reorganisation ...
|
192 |
m.loadGroup(groups); |
193 | ||
194 |
if (m.device.role == 'PFD') { |
|
195 |
m.device.data.aoa = 0; |
|
196 |
m.device.data['aoa-auto'] = 0; |
|
197 |
m.device.data.mapclip = { |
|
198 |
top: math.ceil(m.screenElements['PFD-Map-bg'].getTransformedBounds()[1]) - 1, |
|
199 |
right: math.ceil(m.screenElements['PFD-Map-bg'].getTransformedBounds()[2]) - 1, |
|
200 |
bottom: math.ceil(m.screenElements['PFD-Map-bg'].getTransformedBounds()[3]) - 1, |
|
201 |
left: math.ceil(m.screenElements['PFD-Map-bg'].getTransformedBounds()[0]) - 1, |
|
makes map available for PFD ...
|
202 |
}; |
séparation configuration PFD...
|
203 |
} |
animation texts EIS + power ...
|
204 |
else { |
massive code reorganisation ...
|
205 |
m.device.data.mapclip = { |
206 |
top: math.ceil(m.screenElements['Header'].getTransformedBounds()[3]), |
|
207 |
right: m.display.get('view[0]'), |
|
208 |
bottom: math.ceil(m.screenElements['SoftKeysTexts'].getTransformedBounds()[1]), |
|
209 |
left: contains(m.screenElements, 'EIS') ? math.ceil(m.screenElements['EIS'].getTransformedBounds()[2]) : 0, |
|
set MFD map size relative to...
|
210 |
}; |
makes map available for PFD ...
|
211 |
} |
massive code reorganisation ...
|
212 |
return m; |
213 |
}, |
|
214 |
#}}} |
|
makes map available for PFD ...
|
215 | |
massive code reorganisation ...
|
216 |
# timers stuff {{{ |
217 |
timers : {}, |
|
218 | ||
219 |
timerTrigger : func { |
|
220 |
var now = systime(); |
|
221 |
foreach (var id; keys(me.timers)) { |
|
222 |
if (me.timers[id] < now) { |
|
223 |
me.screenElements[id].hide(); |
|
224 |
delete(me.timers, id); |
|
225 |
} |
|
commit initial
|
226 |
} |
massive code reorganisation ...
|
227 |
settimer(func me.timerTrigger(), 1); |
228 |
}, |
|
229 | ||
230 |
addTimer : func (duration, element) { |
|
231 |
if (typeof(element) == 'scalar') |
|
232 |
element = [ element ]; |
|
233 |
var end = systime() + duration; |
|
234 |
foreach (var e; element) |
|
235 |
me.timers[e] = end; |
|
commit initial
|
236 |
}, |
cosmétique: folding pour les...
|
237 |
#}}} |
commit initial
|
238 | |
massive code reorganisation ...
|
239 |
showInitProgress : func { |
cosmétique: folding pour les...
|
240 |
#{{{ |
massive code reorganisation ...
|
241 |
if (me.device.role == 'PFD') { |
242 |
me.updateAI(); |
|
243 |
me.updateVSI(); |
|
244 |
me.updateIAS(); |
|
245 |
me.updateALT(); |
|
246 |
me.updateHSI(); |
|
247 |
me.updateTIME(); |
|
248 |
me.updateOAT(); |
|
249 |
me.updateTAS(); |
|
250 |
me.updateBRG(); |
|
251 |
me.updateXPDR(); |
|
252 |
me.updateBARO(); |
|
253 |
me.updateOMI(); |
|
254 |
me.timerTrigger(); |
|
255 |
me.screen.show(); |
|
256 |
} |
|
257 |
else { |
|
258 |
me.updateEIS(); |
|
259 |
io.load_nasal(data.zkv1000_dir ~ 'Nasal/MFD.pages.nas', 'zkv1000'); |
|
260 |
me['page selected'] = 0; |
|
261 |
me.setMFDPages(); |
|
262 |
me.device.buttons.MENU = me.device.buttons.MapMenu; |
|
263 |
} |
|
commit initial
|
264 | |
massive code reorganisation ...
|
265 |
me.updateNAV({auto:'nav', tune: radios.getNode('nav-tune').getValue()}); |
266 |
me.updateCOMM({auto:'comm', tune: radios.getNode('comm-tune').getValue()}); |
|
267 |
me.softkeys_inactivity(); |
|
268 |
me.updateSoftKeys(); |
|
add navigation infos on head...
|
269 |
me.updateNavigationBox(); |
commit initial
|
270 |
}, |
cosmétique: folding pour les...
|
271 |
#}}} |
commit initial
|
272 | |
some added comments
|
273 |
colors : { |
274 |
# set of predefined colors {{{ |
|
275 |
green : [0, 1, 0], |
|
276 |
white : [1, 1, 1], |
|
277 |
black : [0, 0, 0], |
|
278 |
lightblue : [0, 1, 1], |
|
279 |
darkblue : [0, 0, 1], |
|
280 |
red : [1, 0, 0], |
|
adds CDI
|
281 |
magenta : [1, 0, 1], |
some added comments
|
282 |
}, |
283 |
#}}} |
|
284 | ||
écriture du wrapper pour le ...
|
285 |
loadGroup : func (h) { |
cosmétique: folding pour les...
|
286 |
#{{{ |
écriture du wrapper pour le ...
|
287 |
if (typeof(h) != 'hash') { |
288 |
msg_dbg(sprintf("%s need a hash, but get a %s from %s", |
|
289 |
caller(0)[0], |
|
290 |
typeof(h), |
|
291 |
caller(1)[0])); |
|
292 |
return; |
|
commit initial
|
293 |
} |
écriture du wrapper pour le ...
|
294 |
var setMethod = func (e, t) { |
295 |
if (t == 'hide') |
|
296 |
me.screenElements[e].hide(); |
|
297 |
elsif (t == 'show') |
|
298 |
me.screenElements[e].show(); |
|
AI disponible
|
299 |
elsif (t == 'rot' or t == 'trans') { |
300 |
if (! contains(me.screenElements[e], t)) |
|
301 |
me.screenElements[e][t] = me.screenElements[e].createTransform(); |
|
302 |
} |
|
303 |
elsif (t == 'clip') { |
|
304 |
if (contains(me.clips, e)) |
|
305 |
me.screenElements[e].set("clip", me.clips[e]); |
|
306 |
else |
|
printlog deprecated + consta...
|
307 |
logprint(LOG_WARN, 'no defined clip for ' ~ e); |
AI disponible
|
308 |
} |
animation VSI
|
309 |
elsif (t == 'text') { |
310 |
if (contains(me.texts, e)) { |
|
311 |
if (contains(me.texts[e], 'alignment')) |
|
312 |
me.screenElements[e].setAlignment(me.texts[e].alignment); |
|
313 |
if (contains(me.texts[e], 'default')) |
|
314 |
me.screenElements[e].setText(me.texts[e].default); |
|
NAV disponible (hors CDI)
|
315 |
if (contains(me.texts[e], 'color')) |
316 |
me.screenElements[e].setColor(me.texts[e].color); |
|
adds CDI
|
317 |
if (contains(me.texts[e], 'visible')) |
318 |
me.screenElements[e].setVisible(me.texts[e].visible); |
|
animation VSI
|
319 |
} |
printlog with adapted level ...
|
320 |
else |
printlog deprecated + consta...
|
321 |
logprint(LOG_DEBUG, 'no text format for ' ~ e); |
animation VSI
|
322 |
} |
commit initial
|
323 |
else |
printlog deprecated + consta...
|
324 |
logprint(LOG_WARN, 'unknown method ' ~ t); |
écriture du wrapper pour le ...
|
325 |
}; |
326 |
foreach (var todo; keys(h)) { |
|
327 |
if (typeof(h[todo]) != 'vector') h[todo] = [ h[todo] ]; |
|
328 |
foreach (var id; h[todo]) { |
|
329 |
if (! contains(me.screenElements, id)) { |
|
330 |
me.screenElements[id] = me.screen.getElementById(id); |
|
331 |
if (me.screenElements[id] != nil) |
|
332 |
setMethod(id, todo); |
|
333 |
else |
|
printlog deprecated + consta...
|
334 |
logprint(LOG_WARN, 'SVG ID ' ~ id ~ ' not found'); |
écriture du wrapper pour le ...
|
335 |
} |
336 |
else |
|
337 |
setMethod(id, todo); |
|
338 |
} |
|
commit initial
|
339 |
} |
340 |
}, |
|
cosmétique: folding pour les...
|
341 |
#}}} |
AI disponible
|
342 | |
343 |
clips : { |
|
cosmétique: folding pour les...
|
344 |
#{{{ |
clean pre-merge
|
345 |
PitchScale : "rect(70,664,370,256)", |
346 |
SpeedLint1 : "rect(252,226,318,204)", |
|
347 |
SpeedTape : "rect(115,239,455,156)", |
|
348 |
LintAlt : "rect(115,808,455,704)", |
|
animation ALT
|
349 |
AltLint00011 : "rect(252,804,318,771)", |
AI disponible
|
350 |
}, |
cosmétique: folding pour les...
|
351 |
#}}} |
AI disponible
|
352 | |
animation VSI
|
353 |
texts : { |
cosmétique: folding pour les...
|
354 |
#{{{ |
animation VSI
|
355 |
VSIText : { |
356 |
alignment: "right-bottom", default : num('0'), |
|
357 |
}, |
|
animation IAS
|
358 |
Speed110 : { |
NAV disponible (hors CDI)
|
359 |
alignment : 'left-bottom' |
animation IAS
|
360 |
}, |
animation ALT (2)
|
361 |
Alt11100 : { |
NAV disponible (hors CDI)
|
362 |
alignment:'left-bottom' |
animation ALT (2)
|
363 |
}, |
clean pre-merge
|
364 |
"HDG-text" : { |
365 |
default: '---°' |
|
366 |
}, |
|
NAV disponible (hors CDI)
|
367 |
'nav1-standby-freq' : { |
368 |
color: [0, 1, 1], |
|
369 |
}, |
|
370 |
'nav1-id' : { |
|
371 |
default: '' |
|
372 |
}, |
|
373 |
'nav2-id' : { |
|
374 |
default: '' |
|
375 |
}, |
|
adds CDI
|
376 |
'CDI-GPS-ANN-text' : { |
377 |
visible : 0 |
|
378 |
}, |
|
379 |
'CDI-GPS-XTK-text' : { |
|
380 |
visible : 0 |
|
381 |
}, |
|
382 |
'CDI-SRC-text' : { |
|
383 |
visible : 0 |
|
384 |
}, |
|
adds BARO settings
|
385 |
'BARO-text' : { |
386 |
alignment : 'left-bottom', |
|
387 |
} |
|
some added comments
|
388 |
# 'TAS-text' : { |
389 |
# alignment : 'right-bottom', |
|
390 |
# }, |
|
391 |
# 'GSPD-text' : { |
|
392 |
# alignment : 'right-bottom', |
|
393 |
# }, |
|
animation VSI
|
394 |
}, |
cosmétique: folding pour les...
|
395 |
#}}} |
animation VSI
|
396 | |
Softkeys revert to the previ...
|
397 |
softkeys_inactivity : func { |
398 |
# automagically back to previous level after some delay {{{ |
|
399 |
me.timers2.softkeys_inactivity = maketimer ( |
|
400 |
me.softkeys_inactivity_delay, |
|
401 |
func { |
|
402 |
pop(me.device.softkeys.path); |
|
403 |
me.updateSoftKeys(); |
|
404 |
}, me); |
|
405 |
me.timers2.softkeys_inactivity.singleShot = 1; |
|
406 |
}, |
|
407 |
#}}} |
|
408 | ||
softkey is implemented by de...
|
409 |
setSoftKeyColor : func (n, active, implemented = 1, alert = 0) { |
add softkeys colors
|
410 |
# set colors for active softkeys {{{ |
411 |
var sftk = sprintf('SoftKey%02i-', n); |
|
412 |
if (active) { |
|
413 |
var bg = alert ? 1 : 0.5; |
|
414 |
me.screenElements[sftk ~ 'bg'] |
|
415 |
.setColorFill(bg,bg,bg); |
|
416 |
me.screenElements[sftk ~ 'text'] |
|
417 |
.setColor(0,0,0); |
|
418 |
} |
|
419 |
else { |
|
not yet implemented softkeys...
|
420 |
var tc = implemented ? 1 : 0.5; |
add softkeys colors
|
421 |
me.screenElements[sftk ~ 'bg'] |
422 |
.setColorFill(0,0,0); |
|
423 |
me.screenElements[sftk ~ 'text'] |
|
not yet implemented softkeys...
|
424 |
.setColor(tc,tc,tc); |
add softkeys colors
|
425 |
} |
426 |
}, |
|
427 |
#}}} |
|
428 | ||
adds MFD menu for Aux/System...
|
429 |
updateNavigationBox : func (getDataFields = 0) { |
add navigation infos on head...
|
430 |
# update Navigation Box on MFD and PFD header {{{ |
431 |
var route = me.device.map.layers.route; |
|
432 |
var fpSize = size(route.flightPlan); |
|
433 |
var navbox = { |
|
434 |
DTK: func { |
|
435 |
var dtk = getprop('/instrumentation/gps/wp/wp[1]/desired-course-deg'); |
|
436 |
if (dtk == nil) |
|
437 |
return '---°'; |
|
438 |
else |
|
439 |
return sprintf('%03i°', dtk); |
|
440 |
}, |
|
441 |
ETE: func { |
|
442 |
if (fpSize == 0) return '--:--'; |
|
443 |
var eteSeconds = getprop('/autopilot/route-manager/ete'); |
|
444 |
var eteHours = math.floor(eteSeconds / 3600); |
|
445 |
var eteMinutes = int((eteSeconds - (eteHours * 3600)) / 60); |
|
446 |
return sprintf(eteHours > 99 ? '--:--' : '%02i:%02i', eteHours, eteMinutes); |
|
447 |
}, |
|
448 |
DIS: func { |
|
449 |
if (fpSize == 0) return '---NM'; |
|
450 |
var dist = getprop('/autopilot/route-manager/distance-remaining-nm'); |
|
451 |
return sprintf(dist >= 100 ? '%i' : '%.1f', dist); |
|
452 |
}, |
|
453 |
LEG: func { |
|
454 |
if (fpSize == 0) return ''; |
|
455 |
var wp = route.flightPlan[route.currentLeg.index]; |
|
456 |
return wp[0].name ~ ' > ' ~ wp[1].name; |
|
457 |
}, |
|
458 |
GS : func return sprintf('%iKT', getprop('/velocities/groundspeed-kt')), |
|
459 |
TRK: func return sprintf('%03i°', getprop('/orientation/track-deg')), |
|
460 |
TAS: func return sprintf('%i', getprop('/instrumentation/airspeed-indicator/true-speed-kt')), |
|
461 |
BRG: func return '---°', |
|
462 |
END: func return '---NM', |
|
463 |
ESA: func return '-----', |
|
464 |
ETA: func return '--:--', |
|
465 |
FOB: func return '---lbs', |
|
466 |
ISA: func return '-----', |
|
467 |
LDG: func return '--:--', |
|
468 |
MSA: func return '----ft', |
|
469 |
TKE: func return '---°', |
|
470 |
VSR: func return '----', |
|
471 |
XTK: func return '---NM', |
|
472 |
}; |
|
adds MFD menu for Aux/System...
|
473 |
if (getDataFields) |
474 |
return keys(navbox); |
|
add navigation infos on head...
|
475 |
if (me.device.role == 'MFD') { |
476 |
for (var i=1; i<=4; i+=1) |
|
477 |
me.screenElements['DATA-FIELD' ~ i ~ '-VAL-text'] |
|
478 |
.setText( |
|
479 |
navbox[me.screenElements['DATA-FIELD' ~ i ~ '-ID-text'].get('text')]() |
|
480 |
); |
|
481 |
settimer(func me.updateNavigationBox(), 0.6); |
|
482 |
} |
|
483 |
else { # PFD |
|
484 |
me.screenElements['ETE-text'].setText(navbox.ETE()); |
|
485 |
me.screenElements['DIS-text'].setText(navbox.DIS()); |
|
486 |
me.screenElements['LEG-text'].setText(navbox.LEG()); |
|
487 |
settimer(func me.updateNavigationBox(), 0.3); |
|
488 |
} |
|
489 |
}, |
|
490 |
#}}} |
|
491 | ||
softkeys are available now
|
492 |
updateSoftKeys : func { |
493 |
# update SoftKeys boxes {{{ |
|
494 |
# on PFD the last boxes are always BACK and ALERTS |
|
improves role/name variables...
|
495 |
if (me.device.role == 'PFD') { |
softkeys are available now
|
496 |
me.screenElements[sprintf("SoftKey%02i-text", 11)] |
497 |
.setText('ALERTS'); |
|
498 |
if (size(me.device.softkeys.path) != 0) |
|
499 |
me.screenElements[sprintf("SoftKey%02i-text", 10)] |
|
not yet implemented softkeys...
|
500 |
.setText('BACK') |
501 |
.setColor(1,1,1); |
|
softkeys are available now
|
502 |
} |
503 | ||
improves role/name variables...
|
504 |
var path = keyMap[me.device.role]; |
not yet implemented softkeys...
|
505 |
var bindings = me.device.softkeys.bindings[me.device.role]; |
improves softkeys coloring
|
506 |
var pathid = ''; |
507 |
foreach (var p; me.device.softkeys.path) { |
|
softkeys are available now
|
508 |
path = path[p]; |
improves softkeys coloring
|
509 |
pathid ~= p; |
not yet implemented softkeys...
|
510 |
if (contains(bindings, p)) |
511 |
bindings = bindings[p]; |
|
improves softkeys coloring
|
512 |
} |
softkeys are available now
|
513 | |
514 |
# feeding with empty menus the first boxes |
|
515 |
var start = (contains(path, 'first')) ? path.first : 0; |
|
516 |
for (var k = 0; k < start; k+=1) { |
|
improves softkeys coloring
|
517 |
var sftk = sprintf("SoftKey%02i-", k); |
518 |
me.screenElements[sftk ~ 'text'] |
|
softkeys are available now
|
519 |
.setText(''); |
improves softkeys coloring
|
520 |
me.screenElements[sftk ~ 'bg'] |
521 |
.setColorFill(0,0,0); |
|
softkeys are available now
|
522 |
} |
523 |
# filling with the content the next boxes |
|
524 |
forindex (var k; path.texts) { |
|
525 |
var i = k + start; |
|
526 |
me.screenElements[sprintf("SoftKey%02i-text", i)] |
|
527 |
.setText(path.texts[k]); |
|
improves softkeys coloring
|
528 |
me.setSoftKeyColor(i, |
not yet implemented softkeys...
|
529 |
contains(me.device.softkeys.colored, pathid ~ path.texts[k]), |
530 |
contains(bindings, path.texts[k])); |
|
softkeys are available now
|
531 |
} |
532 |
# feeding the last boxes with empty string |
|
improves role/name variables...
|
533 |
var end = (me.device.role == 'PFD') ? 10 : 12; |
softkeys are available now
|
534 |
if (size(path.texts) + start < end) { |
535 |
start = size(path.texts) + start; |
|
improves softkeys coloring
|
536 |
for (var k = start; k < end; k += 1) { |
537 |
var sftk = sprintf("SoftKey%02i-", k); |
|
538 |
me.screenElements[sftk ~ 'text'] |
|
softkeys are available now
|
539 |
.setText(''); |
improves softkeys coloring
|
540 |
me.screenElements[sftk ~ 'bg'] |
541 |
.setColorFill(0,0,0); |
|
542 |
} |
|
softkeys are available now
|
543 |
} |
Softkeys revert to the previ...
|
544 | |
545 |
if (size(me.device.softkeys.path)) |
|
546 |
me.timers2.softkeys_inactivity.restart(me.softkeys_inactivity_delay); |
|
547 |
else |
|
548 |
me.timers2.softkeys_inactivity.stop(); |
|
softkeys are available now
|
549 |
}, |
550 |
#}}} |
|
551 | ||
adds OAT, TAS, GSPD, WindDat...
|
552 |
updateAI: func(){ |
cosmétique: folding pour les...
|
553 |
#{{{ |
make some data common to all...
|
554 |
var pitch = data.pitch; |
555 |
var roll = data.roll; |
|
AI disponible
|
556 |
if (pitch > 80) |
557 |
pitch = 80; |
|
clean pre-merge
|
558 |
elsif (pitch < -80) |
AI disponible
|
559 |
pitch = -80; |
560 |
me.screenElements.Horizon |
|
fix AI animation
|
561 |
.setCenter(459, 282.8 - 6.849 * pitch) |
AI disponible
|
562 |
.setRotation(-roll * D2R) |
fix AI animation
|
563 |
.setTranslation(0, pitch * 6.849); |
AI disponible, avec bankPoin...
|
564 |
me.screenElements.bankPointer |
565 |
.setRotation(-roll * D2R); |
|
adds slipskid animation
|
566 |
me.screenElements['SlipSkid'] |
567 |
.setTranslation(getprop("/instrumentation/slip-skid-ball/indicated-slip-skid") * 10, 0); |
|
add TCAS
|
568 |
me.screenElements['Traffic'] |
569 |
.setVisible(size(data.tcas)); |
|
adds OAT, TAS, GSPD, WindDat...
|
570 |
settimer(func me.updateAI(), 0.1); |
AI disponible
|
571 |
}, |
cosmétique: folding pour les...
|
572 |
#}}} |
animation VSI
|
573 | |
adds OAT, TAS, GSPD, WindDat...
|
574 |
updateVSI: func () { |
comment on the folds
|
575 |
# animate VSI {{{ |
make some data common to all...
|
576 |
var vsi = data.vsi; |
animation VSI
|
577 |
me.screenElements.VSIText |
578 |
.setText(num(math.round(vsi, 10))); |
|
579 |
if (vsi > 4500) |
|
580 |
vsi = 4500; |
|
581 |
elsif (vsi < -4500) |
|
582 |
vsi = -4500; |
|
583 |
me.screenElements.VSI |
|
584 |
.setTranslation(0, vsi * -0.03465); |
|
adds OAT, TAS, GSPD, WindDat...
|
585 |
settimer(func me.updateVSI(), 0.1); |
animation VSI
|
586 |
}, |
cosmétique: folding pour les...
|
587 |
#}}} |
animation IAS
|
588 | |
adds OAT, TAS, GSPD, WindDat...
|
589 |
updateIAS: func () { |
comment on the folds
|
590 |
# animates the IAS lint (PFD) {{{ |
make some data common to all...
|
591 |
var ias = data.ias; |
animation IAS
|
592 |
if (ias >= 10) |
593 |
me.screenElements.Speed110 |
|
594 |
.setText(sprintf("% 2u",num(math.floor(ias/10)))); |
|
595 |
else |
|
596 |
me.screenElements.Speed110 |
|
597 |
.setText(''); |
|
598 |
me.screenElements.SpeedLint1 |
|
599 |
.setTranslation(0,(math.mod(ias,10) + (ias >= 10)*10) * 36); |
|
600 |
me.screenElements.SpeedTape |
|
601 |
.setTranslation(0,ias * 5.711); |
|
put Vspeeds in common data s...
|
602 |
if (ias > data.Vne and ! me._ias_already_exceeded) { # easier than .getColorFill |
adds OAT, TAS, GSPD, WindDat...
|
603 |
me._ias_already_exceeded = 1; |
604 |
me.screenElements['IAS-bg'] |
|
605 |
.setColorFill(1,0,0); |
|
606 |
} |
|
put Vspeeds in common data s...
|
607 |
elsif (ias < data.Vne and me._ias_already_exceeded) { # easier than .getColorFill |
adds OAT, TAS, GSPD, WindDat...
|
608 |
me._ias_already_exceeded = 0; |
609 |
me.screenElements['IAS-bg'] |
|
610 |
.setColorFill(0,0,0); |
|
611 |
} |
|
add V-speeds bugs
|
612 |
foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide']) { |
put Vspeeds in common data s...
|
613 |
if (me.device.data[v ~ '-visible'] and abs(data[v] - ias) < 30) |
add V-speeds bugs
|
614 |
me.screenElements['IAS-' ~ v] |
put Vspeeds in common data s...
|
615 |
.setTranslation(0, (ias - data[v]) * 5.711) |
add V-speeds bugs
|
616 |
.show(); |
617 |
else |
|
618 |
me.screenElements['IAS-' ~ v] |
|
619 |
.hide(); |
|
620 |
} |
|
621 | ||
trends animation
|
622 |
var now = systime(); |
623 |
# estimated speed in 6s |
|
624 |
var Sy = 6 * (ias - me._last_ias_kt) / (now - me._last_ias_s); |
|
625 |
if (abs(Sy) > 30) |
|
626 |
Sy = 30 * abs(Sy)/Sy; # = -30 or 30 |
|
627 |
me.screenElements['Airspeed-Trend-Indicator'] |
|
628 |
.setScale(1,Sy) |
|
629 |
.setTranslation(0, -284.5 * (Sy - 1)); |
|
630 |
me._last_ias_kt = ias; |
|
631 |
me._last_ias_s = now; |
|
adds OAT, TAS, GSPD, WindDat...
|
632 |
settimer(func me.updateIAS(), 0.1); |
animation IAS
|
633 |
}, |
trends animation
|
634 |
_last_ias_kt : 0, |
635 |
_last_ias_s : systime(), |
|
adds OAT, TAS, GSPD, WindDat...
|
636 |
_ias_already_exceeded : 0, |
cosmétique: folding pour les...
|
637 |
#}}} |
animation ALT
|
638 | |
adds OAT, TAS, GSPD, WindDat...
|
639 |
updateTAS: func { |
640 |
# updates the True Airspeed and GroundSpeed indicators {{{ |
|
641 |
me.screenElements['TAS-text'] |
|
642 |
.setText(sprintf('%iKT', getprop('/instrumentation/airspeed-indicator/true-speed-kt'))); |
|
643 |
me.screenElements['GSPD-text'] |
|
644 |
.setText(sprintf('%iKT', getprop('/velocities/groundspeed-kt'))); |
|
645 |
settimer(func me.updateTAS(), 0.5); |
|
646 |
}, |
|
647 |
#}}} |
|
648 | ||
649 |
updateALT: func () { |
|
650 |
# animates the altitude lint (PFD) {{{ |
|
make some data common to all...
|
651 |
var alt = data.alt; |
animation ALT
|
652 |
if (alt < 0) |
653 |
me.screenElements.Alt11100 |
|
654 |
.setText(sprintf("% 3i",math.ceil(alt/100))); |
|
655 |
elsif (alt < 100) |
|
656 |
me.screenElements.Alt11100 |
|
657 |
.setText(''); |
|
658 |
else |
|
659 |
me.screenElements.Alt11100 |
|
660 |
.setText(sprintf("% 3i",math.floor(alt/100))); |
|
661 |
me.screenElements.AltLint00011 |
|
662 |
.setTranslation(0,math.fmod(alt,100) * 1.24); |
|
663 | ||
664 |
# From Farmin/G1000 http://wiki.flightgear.org/Project_Farmin/FG1000 |
|
665 |
if (alt> -1000 and alt< 1000000) { |
|
666 |
var Offset10 = 0; |
|
667 |
var Offset100 = 0; |
|
668 |
var Offset1000 = 0; |
|
669 |
if (alt< 0) { |
|
670 |
var Ne = 1; |
|
671 |
var alt= -alt; |
|
672 |
} |
|
673 |
else |
|
674 |
var Ne = 0; |
|
675 | ||
676 |
var Alt10 = math.mod(alt,100); |
|
677 |
var Alt100 = int(math.mod(alt/100,10)); |
|
678 |
var Alt1000 = int(math.mod(alt/1000,10)); |
|
679 |
var Alt10000 = int(math.mod(alt/10000,10)); |
|
680 |
var Alt20 = math.mod(Alt10,20)/20; |
|
681 |
if (Alt10 >= 80) |
|
682 |
var Alt100 += Alt20; |
|
683 | ||
684 |
if (Alt10 >= 80 and Alt100 >= 9) |
|
685 |
var Alt1000 += Alt20; |
|
686 | ||
687 |
if (Alt10 >= 80 and Alt100 >= 9 and Alt1000 >= 9) |
|
688 |
var Alt10000 += Alt20; |
|
689 | ||
690 |
if (alt> 100) |
|
691 |
var Offset10 = 100; |
|
692 | ||
693 |
if (alt> 1000) |
|
694 |
var Offset100 = 10; |
|
695 | ||
696 |
if (alt> 10000) |
|
697 |
var Offset1000 = 10; |
|
698 | ||
699 |
if (!Ne) { |
|
700 |
me.screenElements.LintAlt.setTranslation(0,(math.mod(alt,100))*0.57375); |
|
701 |
var altCentral = (int(alt/100)*100); |
|
702 |
} |
|
703 |
elsif (Ne) { |
|
704 |
me.screenElements.LintAlt.setTranslation(0,(math.mod(alt,100))*-0.57375); |
|
705 |
var altCentral = -(int(alt/100)*100); |
|
706 |
} |
|
707 |
me.screenElements["AltBigC"].setText(""); |
|
708 |
me.screenElements["AltSmallC"].setText(""); |
|
709 |
for (var place = 1; place <= 6; place += 1) { |
|
710 |
var altUP = altCentral + (place*100); |
|
711 |
var offset = -30.078; |
|
712 |
if (altUP < 0) { |
|
713 |
var altUP = -altUP; |
|
714 |
var prefix = "-"; |
|
715 |
var offset += 15.039; |
|
716 |
} |
|
717 |
else |
|
718 |
var prefix = ""; |
|
719 | ||
720 |
if (altUP == 0) { |
|
721 |
var AltBigUP = ""; |
|
722 |
var AltSmallUP = "0"; |
|
723 | ||
724 |
} |
|
725 |
elsif (math.mod(altUP,500) == 0 and altUP != 0) { |
|
726 |
var AltBigUP = sprintf(prefix~"%1d", altUP); |
|
727 |
var AltSmallUP = ""; |
|
728 |
} |
|
729 |
elsif (altUP < 1000 and (math.mod(altUP,500))) { |
|
730 |
var AltBigUP = ""; |
|
731 |
var AltSmallUP = sprintf(prefix~"%1d", int(math.mod(altUP,1000))); |
|
732 |
var offset = -30.078; |
|
733 |
} |
|
734 |
elsif ((altUP < 10000) and (altUP >= 1000) and (math.mod(altUP,500))) { |
|
735 |
var AltBigUP = sprintf(prefix~"%1d", int(altUP/1000)); |
|
736 |
var AltSmallUP = sprintf("%1d", int(math.mod(altUP,1000))); |
|
737 |
var offset += 15.039; |
|
738 |
} |
|
739 |
else { |
|
740 |
var AltBigUP = sprintf(prefix~"%1d", int(altUP/1000)); |
|
741 |
var mod = int(math.mod(altUP,1000)); |
|
742 |
var AltSmallUP = sprintf("%1d", mod); |
|
743 |
var offset += 30.078; |
|
744 |
} |
|
745 | ||
746 |
me.screenElements["AltBigU"~place].setText(AltBigUP); |
|
747 |
me.screenElements["AltSmallU"~place].setText(AltSmallUP); |
|
748 |
me.screenElements["AltSmallU"~place].setTranslation(offset,0); |
|
749 |
var altDOWN = altCentral - (place*100); |
|
750 |
var offset = -30.078; |
|
751 |
if (altDOWN < 0) { |
|
752 |
var altDOWN = -altDOWN; |
|
753 |
var prefix = "-"; |
|
754 |
var offset += 15.039; |
|
755 |
} |
|
756 |
else |
|
757 |
var prefix = ""; |
|
758 | ||
759 |
if (altDOWN == 0) { |
|
760 |
var AltBigDOWN = ""; |
|
761 |
var AltSmallDOWN = "0"; |
|
762 |
} |
|
763 |
elsif (math.mod(altDOWN,500) == 0 and altDOWN != 0) { |
|
764 |
var AltBigDOWN = sprintf(prefix~"%1d", altDOWN); |
|
765 |
var AltSmallDOWN = ""; |
|
766 |
} |
|
767 |
elsif (altDOWN < 1000 and (math.mod(altDOWN,500))) { |
|
768 |
var AltBigDOWN = ""; |
|
769 |
var AltSmallDOWN = sprintf(prefix~"%1d", int(math.mod(altDOWN,1000))); |
|
770 |
var offset = -30.078; |
|
771 |
} |
|
772 |
elsif ((altDOWN < 10000) and (altDOWN >= 1000) and (math.mod(altDOWN,500))) { |
|
773 |
var AltBigDOWN = sprintf(prefix~"%1d", int(altDOWN/1000)); |
|
774 |
var AltSmallDOWN = sprintf("%1d", int(math.mod(altDOWN,1000))); |
|
775 |
var offset += 15.039; |
|
776 |
} |
|
777 |
else { |
|
778 |
var AltBigDOWN = sprintf(prefix~"%1d", int(altDOWN/1000)); |
|
779 |
var mod = int(math.mod(altDOWN,1000)); |
|
780 |
var AltSmallDOWN = sprintf("%1d", mod); |
|
781 |
var offset += 30.078; |
|
782 |
} |
|
783 |
me.screenElements["AltBigD"~place].setText(AltBigDOWN); |
|
784 |
me.screenElements["AltSmallD"~place].setText(AltSmallDOWN); |
|
785 |
me.screenElements["AltSmallD"~place].setTranslation(offset,0); |
|
786 |
} |
|
787 |
} |
|
adds OAT, TAS, GSPD, WindDat...
|
788 |
me.updateSelectedALT(); |
trends animation
|
789 |
var now = systime(); |
790 |
# altitude in 6s |
|
791 |
var Sy = .3 * (alt - me._last_alt_ft) / (now - me._last_alt_s); # scale = 1/20ft |
|
792 |
if (abs(Sy) > 15) |
|
793 |
Sy = 15 * abs(Sy)/Sy; # = -15 or 15 |
|
794 |
me.screenElements['Altitude-Trend-Indicator'] |
|
795 |
.setScale(1,Sy) |
|
796 |
.setTranslation(0, -284.5 * (Sy - 1)); |
|
797 |
me._last_alt_ft = alt; |
|
798 |
me._last_alt_s = now; |
|
adds OAT, TAS, GSPD, WindDat...
|
799 |
settimer(func me.updateALT(), 0.2); |
animation ALT
|
800 |
}, |
trends animation
|
801 |
_last_alt_ft : 0, |
802 |
_last_alt_s : systime(), |
|
cosmétique: folding pour les...
|
803 |
#}}} |
animation HSI
|
804 | |
adds BARO settings
|
805 |
updateBARO : func () { |
806 |
# update BARO widget {{{ |
|
807 |
var fmt = me._baro_unit == 'inhg' ? '%.2f%s' : '%i%s'; |
|
808 |
me.screenElements['BARO-text'] |
|
809 |
.setText(sprintf(fmt, |
|
810 |
getprop('/instrumentation/altimeter/setting-' ~ me._baro_unit), |
|
811 |
me._baro_unit == 'inhg' ? 'in' : 'hPa') |
|
812 |
); |
|
813 |
}, |
|
814 |
_baro_unit : 'inhg', |
|
815 |
#}}} |
|
816 | ||
adds OAT, TAS, GSPD, WindDat...
|
817 |
updateHSI : func () { |
comment on the folds
|
818 |
# rotates the compass (PFD) {{{ |
make some data common to all...
|
819 |
var hdg = data.hdg; |
animation HSI
|
820 |
me.screenElements.Rose |
821 |
.setRotation(-hdg * D2R); |
|
822 |
me.screenElements['HDG-text'] |
|
823 |
.setText(sprintf("%03u°", hdg)); |
|
adds OAT, TAS, GSPD, WindDat...
|
824 |
settimer(func me.updateHSI(), 0.1); |
animation HSI
|
825 |
}, |
cosmétique: folding pour les...
|
826 |
#}}} |
NAV disponible (hors CDI)
|
827 | |
removes unecessary listeners
|
828 |
updateHDG : func () { |
comment on the folds
|
829 |
# moves the heading bug and display heading-deg for 3 seconds (PFD) {{{ |
improves role/name variables...
|
830 |
if (me.device.role == 'MFD') |
animation HDG bug
|
831 |
return; |
remove hardcoded properties ...
|
832 |
var hdg = afcs.getValue('heading-bug-deg'); |
animation HDG bug
|
833 |
me.screenElements['Heading-bug'] |
834 |
.setRotation(hdg * D2R); |
|
835 |
me.screenElements['SelectedHDG-bg'] |
|
836 |
.show(); |
|
837 |
me.screenElements['SelectedHDG-bgtext'] |
|
838 |
.show(); |
|
839 |
me.screenElements['SelectedHDG-text'] |
|
840 |
.setText(sprintf('%03d°%s', hdg, '')) |
|
841 |
.show(); |
|
842 |
me.addTimer(3, ['SelectedHDG-text', 'SelectedHDG-bgtext', 'SelectedHDG-bg']); |
|
843 |
}, |
|
cosmétique: folding pour les...
|
844 |
#}}} |
animation HDG bug
|
845 | |
adds CDI
|
846 |
updateCRS : func () { |
anime CRS
|
847 |
# TODO: update display for NAV/GPS/BRG courses {{{ |
improves role/name variables...
|
848 |
if (me.device.role == 'MFD') |
anime CRS
|
849 |
return; |
remove hardcoded properties ...
|
850 |
var source = cdi.getValue('source'); |
adds CDI
|
851 |
if (source == 'OFF') |
852 |
return; |
|
remove hardcoded properties ...
|
853 |
var crs = cdi.getValue('course'); |
adds CDI
|
854 |
if (crs == nil) |
855 |
return; |
|
anime CRS
|
856 |
me.screenElements['SelectedCRS-bg'] |
857 |
.show(); |
|
858 |
me.screenElements['SelectedCRS-bgtext'] |
|
859 |
.show(); |
|
860 |
me.screenElements['SelectedCRS-text'] |
|
861 |
.setText(sprintf('%03d°%s', crs, '')) |
|
adds CDI
|
862 |
.setColor(source == 'GPS' ? me.colors.magenta : me.colors.green) |
anime CRS
|
863 |
.show(); |
864 |
me.addTimer(3, ['SelectedCRS-text', 'SelectedCRS-bgtext', 'SelectedCRS-bg']); |
|
865 |
}, |
|
866 |
#}}} |
|
867 | ||
adds OAT, TAS, GSPD, WindDat...
|
868 |
updateSelectedALT : func { |
869 |
# animation for altitude section, called via updatedALT {{{ |
|
creates flightdeck hash to p...
|
870 |
if (! me.screenElements['SelectedALT'].getVisible()) |
fix Selected Altitude displa...
|
871 |
return; |
remove hardcoded properties ...
|
872 |
var selected_alt = afcs.getValue('selected-alt-ft'); |
make some data common to all...
|
873 |
var delta_alt = data.alt - selected_alt; |
adds OAT, TAS, GSPD, WindDat...
|
874 |
if (abs(delta_alt) > 300) |
875 |
delta_alt = 300 * abs(delta_alt)/delta_alt; |
|
fix Selected Altitude displa...
|
876 |
me.screenElements['SelectedALT-symbol'] |
877 |
.setVisible(abs(delta_alt) > 100); |
|
878 |
me.screenElements['SelectedALT-bg'] |
|
879 |
.setVisible(abs(delta_alt) > 100); |
|
880 |
me.screenElements['SelectedALT-text'] |
|
881 |
.setText(sprintf("%i", selected_alt)) |
|
adds OAT, TAS, GSPD, WindDat...
|
882 |
.setVisible(abs(delta_alt) > 100); |
fix Selected Altitude displa...
|
883 |
me.screenElements['SelectedALT-bug'] |
adds OAT, TAS, GSPD, WindDat...
|
884 |
.setTranslation(0, delta_alt * 0.567); # 170/300 = 0.567 |
885 |
}, |
|
886 |
#}}} |
|
887 | ||
adds CDI
|
888 |
updateCDI : func { |
889 |
# animation for CDI {{{ |
|
remove hardcoded properties ...
|
890 |
var source = cdi.getValue('source'); |
adds CDI
|
891 |
if (source == 'OFF') { |
892 |
foreach (var s; ['GPS', 'NAV1', 'NAV2']) |
|
893 |
foreach (var t; ['pointer', 'CDI']) |
|
894 |
me.screenElements[s ~ '-' ~ t].hide(); |
|
895 |
me.screenElements['CDI-GPS-ANN-text'].hide(); |
|
896 |
me.screenElements['CDI-GPS-XTK-text'].hide(); |
|
897 |
me.screenElements['CDI-SRC-text'].hide(); |
|
898 |
me.screenElements['CDI'].hide(); |
|
899 |
} |
|
900 |
else { |
|
remove hardcoded properties ...
|
901 |
var course = cdi.getValue('course'); |
make some data common to all...
|
902 |
var rot = (course - data.hdg) * D2R; |
adds CDI
|
903 |
me.screenElements['CDI'] |
makes the CDI available
|
904 |
.setRotation(rot) |
adds CDI
|
905 |
.show(); |
906 |
me.screenElements['GPS-CTI'] |
|
animates GPS-CTI
|
907 |
.setVisible(getprop('/instrumentation/gps/wp/wp[1]/valid')) |
908 |
.setRotation(getprop('/instrumentation/gps/wp/wp[1]/course-deviation-deg') * D2R); |
|
adds CDI
|
909 |
me.screenElements['GPS-CTI-diamond'] |
animates GPS-CTI
|
910 |
.setVisible(getprop('/instrumentation/gps/wp/wp[1]/valid')) |
911 |
.setRotation(getprop('/instrumentation/gps/wp/wp[1]/course-deviation-deg') * D2R); |
|
adds CDI
|
912 |
foreach (var s; ['GPS', 'NAV1', 'NAV2']) { |
913 |
me.screenElements[s ~ '-pointer'] |
|
914 |
.setRotation(rot) |
|
915 |
.setVisible(source == s); |
|
916 |
me.screenElements[s ~ '-CDI'] |
|
917 |
.setVisible(source == s); |
|
918 |
foreach (var f; ['FROM', 'TO']) |
|
919 |
me.screenElements[s ~ '-' ~ f] |
|
remove hardcoded properties ...
|
920 |
.setVisible(s == source and cdi.getValue(f ~ '-flag')); |
adds CDI
|
921 |
me.screenElements['CDI-SRC-text'] |
922 |
.setText(source) |
|
923 |
.setColor(source == 'GPS' ? me.colors.magenta : me.colors.green) |
|
924 |
.show(); |
|
925 |
} |
|
remove hardcoded properties ...
|
926 |
var deflection = cdi.getValue('course-deflection'); |
makes the CDI available
|
927 |
if (left(source, 3) == 'NAV') |
928 |
var scale = deflection / 4; |
|
929 |
else { # GPS |
|
930 |
# TODO: deviation depending of the flight phase |
|
931 |
# for now fixed 1 dot = 1 nm course error |
|
932 |
var abs_deflection = abs(deflection); |
|
933 |
me.screenElements['CDI-GPS-XTK-text'] |
|
934 |
.setText(sprintf('XTK %iNM', abs_deflection)) |
|
935 |
.setVisible(abs_deflection > 2.4); |
|
936 |
var scale = deflection / 2; |
|
937 |
} |
|
938 |
scale = (abs(scale) > 1.2) ? 1.2 : scale; |
|
939 |
me.screenElements[source ~ '-CDI'] |
|
940 |
.setTranslation(65 * scale, 0); |
|
941 |
settimer(func me.updateCDI(), 0.3); |
|
adds CDI
|
942 |
} |
943 |
}, |
|
944 |
#}}} |
|
945 | ||
ajout COMM, et factorisation...
|
946 |
_updateRadio: func { |
comment on the folds
|
947 |
# common parts for NAV/LOC/COMM radios{{{ |
ajout COMM, et factorisation...
|
948 |
# arg[0]._r = <comm|nav> |
949 |
if (contains(arg[0], "active")) { |
|
950 |
if (arg[0]['active'] == 'none') { |
|
951 |
me.screenElements[arg[0]._r ~ '1-selected-freq'] |
|
952 |
.setColor(1,1,1); |
|
953 |
me.screenElements[arg[0]._r ~ '2-selected-freq'] |
|
954 |
.setColor(1,1,1); |
|
955 |
} |
|
956 |
else { |
|
957 |
me.screenElements[arg[0]._r ~ arg[0]['active'] ~ '-selected-freq'] |
|
958 |
.setColor(0,1,0); |
|
959 |
me.screenElements[arg[0]._r ~ arg[0].inactive ~ '-selected-freq'] |
|
960 |
.setColor(1,1,1); |
|
961 |
} |
|
962 |
} |
|
963 |
if (contains(arg[0], 'tune')) { |
|
964 |
# n = 0 -> NAV1/COMM1 |
|
965 |
# n = 1 -> NAV1/COMM2 |
|
966 |
me.screenElements[arg[0]._r ~ '-freq-switch'] |
|
967 |
.setTranslation(0, arg[0].tune * 25); |
|
968 |
me.screenElements[arg[0]._r ~ (arg[0].tune + 1) ~ '-standby-freq'] |
|
969 |
.setColor(0,1,1); |
|
970 |
me.screenElements[arg[0]._r ~ ((arg[0].tune == 0) + 1) ~ '-standby-freq'] |
|
971 |
.setColor(1,1,1); |
|
972 |
} |
|
973 |
if (contains(arg[0], 'refresh')) { |
|
small stuff
|
974 |
# refresh only one line: NAV1/COMM1 or NAV2/COMM2 |
ajout COMM, et factorisation...
|
975 |
var fmt = (arg[0]._r == 'nav') ? '%.2f' : '%.3f'; |
976 |
me.screenElements[arg[0]._r ~ arg[0].refresh ~ '-selected-freq'] |
|
977 |
.setText(sprintf(fmt, getprop('/instrumentation/' |
|
978 |
~ arg[0]._r ~ '[' ~ (arg[0].refresh - 1) ~ ']/frequencies/selected-mhz'))); |
|
979 |
me.screenElements[arg[0]._r ~ arg[0].refresh ~ '-standby-freq'] |
|
980 |
.setText(sprintf(fmt, getprop('/instrumentation/' |
|
981 |
~ arg[0]._r ~ '[' ~ (arg[0].refresh - 1) ~ ']/frequencies/standby-mhz'))); |
|
982 |
} |
|
983 |
if (contains(arg[0], 'set')) { |
|
984 |
# positionne la valeur modifiée, les listeners "trigguent" en permanence ces propriétés, donc exit |
|
remove hardcoded properties ...
|
985 |
var n = radios.getValue(arg[0]._r ~ '-tune'); |
ajout COMM, et factorisation...
|
986 |
var fmt = (arg[0]._r == 'nav') ? '%.2f' : '%.3f'; |
987 |
me.screenElements[arg[0]._r ~ (n + 1) ~ '-standby-freq'] |
|
fix freq display while setti...
|
988 |
.setText(sprintf(fmt, getprop('/instrumentation/' ~ arg[0]._r ~ '[' ~ n ~ ']/frequencies/standby-mhz'))); |
ajout COMM, et factorisation...
|
989 |
} |
990 |
if (contains(arg[0], 'auto')) { |
|
991 |
# pour rafraichir automagiquement, toutes les deux secondes un refresh pour un NAV |
|
992 |
var radio = arg[0].auto; |
|
993 |
me._updateRadio({refresh: 1, _r: radio}); |
|
994 |
settimer(func me._updateRadio({refresh: 2, _r: radio}), 1); |
|
995 |
settimer(func me._updateRadio({auto: radio}), 2); |
|
996 |
} |
|
997 |
}, |
|
cosmétique: folding pour les...
|
998 |
#}}} |
ajout COMM, et factorisation...
|
999 | |
NAV disponible (hors CDI)
|
1000 |
updateNAV : func { |
comment on the folds
|
1001 |
# update NAV/LOC rodios display upper left (PFD/MFD){{{ |
NAV disponible (hors CDI)
|
1002 |
# made active via menu |
1003 |
if (contains(arg[0], "active")) { |
|
adds CDI
|
1004 |
arg[0]._r = 'nav'; |
NAV disponible (hors CDI)
|
1005 |
if (arg[0]['active'] == 'none') { |
ajout COMM, et factorisation...
|
1006 |
me._updateRadio(arg[0]); |
NAV disponible (hors CDI)
|
1007 |
me.screenElements['nav1-id'] |
1008 |
.setColor(1,1,1); |
|
1009 |
me.screenElements['nav2-id'] |
|
1010 |
.setColor(1,1,1); |
|
1011 |
me.screenElements['NAV1-pointer'] |
|
1012 |
.hide(); |
|
1013 |
me.screenElements['NAV2-pointer'] |
|
1014 |
.hide(); |
|
1015 |
} |
|
1016 |
else { |
|
ajout COMM, et factorisation...
|
1017 |
arg[0].inactive = (arg[0]['active'] == 1) + 1; |
1018 |
me._updateRadio(arg[0]); |
|
NAV disponible (hors CDI)
|
1019 |
me.screenElements['nav' ~ arg[0]['active'] ~ '-id'] |
1020 |
.setColor(0,1,0); |
|
1021 |
me.screenElements['NAV' ~ arg[0]['active'] ~ '-pointer'] |
|
1022 |
.show(); |
|
ajout COMM, et factorisation...
|
1023 |
me.screenElements['nav' ~ arg[0].inactive ~ '-id'] |
1024 |
.setColor(1,1,1); |
|
NAV disponible (hors CDI)
|
1025 |
# me.screenElements['HDI'] |
1026 |
# .setRotation(); |
|
1027 |
# me.screenElements['NAV' ~ inactive ~ '-pointer'] |
|
1028 |
# .hide(); |
|
1029 |
# foreach (var e; [ 'FROM', 'TO', 'CDI' ]) |
|
1030 |
# me.screenElements['NAV' ~ inactive ~ '-' ~ e] |
|
1031 |
# .hide(); |
|
1032 |
} |
|
1033 |
} |
|
ajout COMM, et factorisation...
|
1034 |
elsif (contains(arg[0], 'nav-id')) { |
Correction swap NAV tuning
|
1035 |
# TODO: récupérer la valeur via les paramètres transmis du listener |
ajout COMM, et factorisation...
|
1036 |
if (arg[0].val == nil) |
1037 |
arg[0].val = ''; |
|
NAV disponible (hors CDI)
|
1038 |
me.screenElements["nav" ~ arg[0]['nav-id'] ~ "-id"] |
ajout COMM, et factorisation...
|
1039 |
.setText(arg[0].val); |
NAV disponible (hors CDI)
|
1040 |
} |
ajout COMM, et factorisation...
|
1041 |
else { |
1042 |
arg[0]._r = 'nav'; |
|
1043 |
me._updateRadio(arg[0]); |
|
NAV disponible (hors CDI)
|
1044 |
} |
1045 |
}, |
|
cosmétique: folding pour les...
|
1046 |
#}}} |
ajout COMM, et factorisation...
|
1047 | |
1048 |
updateCOMM: func { |
|
comment on the folds
|
1049 |
# update COMM radios display upper right (PFD/MFD){{{ |
ajout COMM, et factorisation...
|
1050 |
arg[0]._r = 'comm'; |
1051 |
me._updateRadio(arg[0]); |
|
1052 |
}, |
|
cosmétique: folding pour les...
|
1053 |
#}}} |
anime time display
|
1054 | |
1055 |
updateTIME : func { |
|
1056 |
# updates the displayed time botoom left {{{ |
|
1057 |
me.screenElements['TIME-text'] |
|
1058 |
.setText(getprop('/sim/time/gmt-string')); |
|
1059 |
settimer(func me.updateTIME(), 1); |
|
1060 |
}, |
|
1061 |
#}}} |
|
adds OAT, TAS, GSPD, WindDat...
|
1062 | |
adds transponder
|
1063 |
updateXPDR : func { |
1064 |
# updates transponder display {{{ |
|
1065 |
for (var d = 0; d < 4; d+=1) |
|
1066 |
me.screenElements['XPDR-DIGIT-' ~ d ~ '-text'] |
|
1067 |
.setText(sprintf('%i', getprop('/instrumentation/transponder/inputs/digit[' ~ d ~ ']'))); |
|
remove hardcoded properties ...
|
1068 |
var tuning = radios.getValue('xpdr-tuning-digit'); |
1069 |
var fms = radios.getValue('xpdr-tuning-fms-method'); |
|
XPDR settings via knob or so...
|
1070 |
for (var d = 0; d < 4; d+=1) |
1071 |
me.screenElements['XPDR-DIGIT-' ~ d ~ '-text'] |
|
1072 |
.setColor(1,1,1); |
|
1073 |
if (tuning != nil) { |
|
1074 |
me.screenElements['XPDR-DIGIT-' ~ tuning ~ '-text'] |
|
1075 |
.setColor(0,1,1); |
|
1076 |
if (fms) |
|
1077 |
me.screenElements['XPDR-DIGIT-' ~ (tuning - 1) ~ '-text'] |
|
1078 |
.setColor(0,1,1); |
|
1079 |
} |
|
adds transponder
|
1080 |
else { |
1081 |
if (getprop('/instrumentation/transponder/ident')) |
|
1082 |
var mode = 'IDENT'; |
|
1083 |
else |
|
remove hardcoded properties ...
|
1084 |
var mode = radios.getValue('xpdr-mode'); |
adds transponder
|
1085 |
var wow = getprop('/gear/gear/wow'); |
1086 |
if (! wow and mode != 'STBY') |
|
1087 |
var color = [0, 1, 0]; |
|
1088 |
else |
|
1089 |
var color = [1, 1, 1]; |
|
1090 |
for (var d = 0; d < 4; d+=1) |
|
1091 |
me.screenElements['XPDR-DIGIT-' ~ d ~ '-text'] |
|
1092 |
.setColor(color); |
|
1093 |
me.screenElements['XPDR-MODE-text'] |
|
1094 |
.setColor(color) |
|
1095 |
.setText(mode); |
|
1096 |
} |
|
XPDR settings via knob or so...
|
1097 |
}, |
adds transponder
|
1098 |
#}}} |
1099 | ||
adds OAT, TAS, GSPD, WindDat...
|
1100 |
updateOAT : func { |
1101 |
# update OAT display on normal and reversionnary modes (every 3s) {{{ |
|
1102 |
var tmp = getprop('/environment/temperature-deg' ~ me._oat_unit); |
|
1103 |
me.screenElements['OAT-text'] |
|
1104 |
.setText(sprintf((abs(tmp) < 10) ? "%.1f %s" : "%i %s", tmp, (me._oat_unit == 'c') ? '°C' : 'F')); |
|
1105 |
settimer(func me.updateOAT(), 3); |
|
1106 |
}, |
|
1107 |
_oat_unit : 'c', |
|
1108 |
#}}} |
|
1109 | ||
1110 |
updateWindData : func { |
|
1111 |
# update the window text and arrows for OPTN1/2 {{{ |
|
1112 |
if (me._winddata_optn == 0) |
|
1113 |
return; |
|
make some data common to all...
|
1114 |
if (data.ias < 30) { |
improves WindData display
|
1115 |
me.screenElements['WindData-NODATA'] |
1116 |
.hide(); |
|
1117 |
var wind_hdg = getprop('/environment/wind-from-heading-deg'); |
|
1118 |
var wind_spd = getprop('/environment/wind-speed-kt'); |
|
make some data common to all...
|
1119 |
var alpha = wind_hdg - data.hdg; |
improves WindData display
|
1120 |
if (me._winddata_optn == 1) { |
1121 |
me.screenElements['WindData-OPTN1-HDG'] |
|
1122 |
.setRotation((alpha + 180) * D2R) |
|
1123 |
.show(); |
|
1124 |
me.screenElements['WindData-OPTN1-HDG-text'] |
|
1125 |
.setText(sprintf("%03i°", wind_hdg)) |
|
1126 |
.show(); |
|
1127 |
me.screenElements['WindData-OPTN1-SPD-text'] |
|
1128 |
.setText(int(wind_spd) ~ 'KT') |
|
1129 |
.show(); |
|
adds OAT, TAS, GSPD, WindDat...
|
1130 |
} |
improves WindData display
|
1131 |
else { # me._winddata_optn == 2 |
1132 |
alpha *= D2R; |
|
1133 |
var Vt = wind_spd * math.sin(alpha); |
|
1134 |
var Ve = wind_spd * math.cos(alpha); |
|
1135 |
if (Vt != 0) { |
|
1136 |
me.screenElements['WindData-OPTN2-crosswind-text'] |
|
1137 |
.setText(sprintf('%i', abs(Vt))) |
|
1138 |
.show(); |
|
1139 |
me.screenElements['WindData-OPTN2-crosswind'] |
|
1140 |
.setScale(-abs(Vt)/Vt, 1) |
|
1141 |
.setTranslation(-35 * (abs(Vt)/Vt + 1), 0) |
|
1142 |
.show(); |
|
1143 |
} |
|
1144 |
if (Ve != 0) { |
|
1145 |
me.screenElements['WindData-OPTN2-headwind-text'] |
|
1146 |
.setText(sprintf('%i', abs(Ve))) |
|
1147 |
.show(); |
|
1148 |
me.screenElements['WindData-OPTN2-headwind'] |
|
1149 |
.setScale(1, abs(Ve)/Ve) |
|
1150 |
.setTranslation(0, 515 * (1 - abs(Ve)/Ve)) |
|
1151 |
.show(); |
|
1152 |
} |
|
adds OAT, TAS, GSPD, WindDat...
|
1153 |
} |
1154 |
} |
|
improves WindData display
|
1155 |
else { |
1156 |
foreach (var e; [ |
|
1157 |
'WindData-OPTN1-HDG', |
|
1158 |
'WindData-OPTN1-HDG-text', |
|
1159 |
'WindData-OPTN1-SPD-text', |
|
1160 |
'WindData-OPTN2-crosswind-text', |
|
1161 |
'WindData-OPTN2-crosswind', |
|
1162 |
'WindData-OPTN2-headwind-text', |
|
1163 |
'WindData-OPTN2-headwind' |
|
1164 |
]) |
|
1165 |
me.screenElements[e].hide(); |
|
1166 |
me.screenElements['WindData-NODATA'].show(); |
|
1167 |
} |
|
adds OAT, TAS, GSPD, WindDat...
|
1168 |
settimer(func me.updateWindData(), 0.5); |
1169 |
}, |
|
1170 |
_winddata_optn : 0, |
|
1171 |
#}}} |
|
adds BRG1/2 animation
|
1172 | |
adds AOA display
|
1173 |
updateAOA : func { |
1174 |
# update Angle Of Attack {{{ |
|
1175 |
if (me.device.data.aoa == 0) |
|
1176 |
return; |
|
1177 |
var color = [1,1,1]; |
|
1178 |
var norm = data.aoa / data['stall-aoa']; |
|
nicer AOA display
|
1179 |
me.screenElements['AOA-text'] |
1180 |
.setText(sprintf('% .1f', norm)); |
|
adds AOA display
|
1181 |
if (norm > 1) norm = 1; |
1182 |
if (norm > 0.9) |
|
1183 |
color = [1,0,0]; |
|
1184 |
elsif (norm > 0.7) |
|
1185 |
color = [1,1,0]; |
|
1186 |
elsif (norm < 0) { |
|
1187 |
norm = 0; |
|
1188 |
color = [1,0,0]; |
|
1189 |
} |
|
1190 |
me.screenElements['AOA-needle'] |
|
1191 |
.setRotation(-norm * math.pi) |
|
nicer AOA display
|
1192 |
.setColorFill(color); |
1193 |
me.screenElements['AOA-text'] |
|
adds AOA display
|
1194 |
.setColor(color); |
1195 |
settimer(func me.updateAOA(), 0.1); |
|
1196 |
}, |
|
1197 |
# }}} |
|
1198 | ||
adds BRG1/2 animation
|
1199 |
updateBRG : func { |
some added comments
|
1200 |
# displays and update BRG1/2 {{{ |
adds BRG1/2 animation
|
1201 |
foreach (var brg; [1, 2]) { |
1202 |
var source = 'brg' ~ brg ~ '-source'; |
|
1203 | ||
1204 |
var dev = radios.getNode(source).getValue(); |
|
1205 |
var el = 'BRG' ~ brg; |
|
1206 |
if (dev != 'OFF') { |
|
1207 |
var info = { |
|
1208 |
pointer : nil, |
|
1209 |
id : 'NO DATA', |
|
1210 |
hdg : nil, |
|
1211 |
dst : '--.-NM' |
|
1212 |
}; |
|
1213 |
if (left(dev, 3) == 'NAV') { |
|
1214 |
info.pointer = getprop('/instrumentation/nav[' ~ (brg - 1) ~ ']/in-range'); |
|
1215 |
if (info.pointer) { |
|
1216 |
info.id = getprop('/instrumentation/nav[' ~ (brg - 1) ~ ']/nav-id'); |
|
1217 |
info.hdg = getprop('/instrumentation/nav[' ~ (brg - 1) ~ ']/heading-deg'); |
|
1218 |
info.dst = sprintf('%.1d', getprop('/instrumentation/nav[' ~ (brg - 1) ~ ']/nav-distance') / 1852); # m -> /1852 |
|
1219 |
} |
|
1220 |
} |
|
1221 |
elsif (dev == 'GPS') { |
|
1222 |
info.pointer = props.getNode('/instrumentation/gps/wp').getChild('wp[1])'); |
|
1223 |
if (info.pointer) { |
|
1224 |
info.id = getprop('/instrumentation/gps/wp/wp[1]/ID'); |
|
1225 |
info.hdg = getprop('/instrumentation/gps/wp/wp[1]/bearing-mag-deg'); |
|
1226 |
info.dst = sprintf('%.1d', getprop('/instrumentation/gps/wp/wp[1]/distance-nm')); |
|
1227 |
} |
|
1228 |
} |
|
1229 |
else { # there are 2 available ADF in FG, but instrument manage only 1 |
|
1230 |
info.pointer = getprop('/instrumentation/adf/in-range'); |
|
1231 |
if (info.pointer) { |
|
1232 |
info.id = getprop('/instrumentation/adf/ident'); |
|
1233 |
info.hdg = getprop('/instrumentation/adf/indicated-bearing-deg'); |
|
1234 |
} |
|
1235 |
} |
|
1236 | ||
1237 |
if (info.pointer) |
|
1238 |
me.screenElements[el ~ '-pointer'] |
|
make some data common to all...
|
1239 |
.setRotation(-info.hdg - data.hdg * D2R) |
adds BRG1/2 animation
|
1240 |
.show(); |
1241 |
else |
|
1242 |
me.screenElements[el ~ '-pointer'] |
|
1243 |
.hide(); |
|
1244 |
me.screenElements[el ~ '-SRC-text'] |
|
1245 |
.setText(dev); |
|
1246 |
me.screenElements[el ~ '-DST-text'] |
|
1247 |
.setText(info.dst); |
|
1248 |
me.screenElements[el ~ '-WPID-text'] |
|
1249 |
.setText(info.id); |
|
1250 |
me.screenElements['BRG' ~ brg] |
|
1251 |
.show(); |
|
1252 |
} |
|
1253 |
else { |
|
1254 |
me.screenElements['BRG' ~ brg] |
|
1255 |
.hide(); |
|
1256 |
} |
|
1257 |
} |
|
colorize BRG1/2 when needed,...
|
1258 |
settimer(func me.updateBRG(), 0.5); |
adds BRG1/2 animation
|
1259 |
}, |
some added comments
|
1260 |
#}}} |
softkeys are available now
|
1261 | |
adds OMI to PFD
|
1262 |
updateOMI : func { |
1263 |
# display marker baecon Outer, Middle, Inner {{{ |
|
1264 |
var marker = nil; |
|
1265 |
foreach (var m; ['outer', 'middle', 'inner']) |
|
1266 |
if (getprop('/instrumentation/marker-beacon/' ~ m)) { |
|
1267 |
marker = m; |
|
1268 |
me.screenElements['OMI'] |
|
1269 |
.show(); |
|
1270 |
break; |
|
1271 |
} |
|
1272 |
if (marker != nil) { |
|
1273 |
me.screenElements['MarkerText'] |
|
1274 |
.setText(me._omi_data[marker].t) |
|
1275 |
.show(); |
|
1276 |
me.screenElements['MarkerBG'] |
|
1277 |
.setColorFill(me._omi_data[marker].bg) |
|
1278 |
.show(); |
|
1279 |
} |
|
1280 |
else |
|
1281 |
me.screenElements['OMI'] |
|
1282 |
.hide(); |
|
1283 |
settimer(func me.updateOMI(), 1); |
|
1284 |
}, |
|
1285 |
_omi_data : { |
|
1286 |
'outer': {t: 'O', bg: [0,1,1]}, |
|
1287 |
'middle': {t: 'M', bg: [1,1,1]}, |
|
1288 |
'inner': {t: 'I', bg: [1,1,0]}, |
|
1289 |
}, |
|
1290 |
#}}} |
|
animation texts EIS + power ...
|
1291 |
}; |