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