commit initial
|
1 |
var softkeysClass = { |
softkeys are available now
|
2 |
new : func (device, node, role) { |
commit initial
|
3 |
var m = { parents: [ softkeysClass ] }; |
4 |
m.node = node; |
|
softkeys are available now
|
5 |
m.device = device; |
commit initial
|
6 |
m.role = role; |
softkeys are available now
|
7 |
m.path = []; |
commit initial
|
8 |
return m; |
9 |
}, |
|
10 | ||
softkeys are available now
|
11 |
SoftKey : func (n, a) { |
12 |
# released key not yet managed |
|
13 |
if (a == 1) |
|
14 |
return; |
|
15 | ||
16 |
var key = me.device.display.screenElements[sprintf("SoftKey%02i-text",n)].get('text'); |
|
17 |
if (key == '' or key == nil) |
|
18 |
return; |
|
19 | ||
20 |
var path = keyMap[me.role]; |
|
21 |
foreach(var p; me.path) { |
|
22 |
if (contains(path, p)) |
|
23 |
path = path[p]; |
|
24 |
else |
|
25 |
break; |
|
commit initial
|
26 |
} |
27 | ||
softkeys are available now
|
28 |
var bindings = me.bindings[me.role]; |
29 |
foreach(var p; me.path) { |
|
30 |
if (contains(bindings, p)) |
|
31 |
bindings = bindings[p]; |
|
32 |
else |
|
33 |
break; |
|
commit initial
|
34 |
} |
35 | ||
softkeys are available now
|
36 |
if (contains(path, key)) { |
37 |
append(me.path, key); |
|
fix issue with some menus
|
38 |
if (contains(bindings, key)) |
39 |
if (contains(bindings[key], 'hook')) |
|
40 |
call(bindings[key].hook, [], me); |
|
softkeys are available now
|
41 |
me.device.display.updateSoftKeys(); |
commit initial
|
42 |
} |
softkeys are available now
|
43 |
elsif (contains(bindings, key)) { |
44 |
call(bindings[key], [], me); |
|
commit initial
|
45 |
} |
softkeys are available now
|
46 |
elsif (key == 'BACK') { |
47 |
pop(me.path); |
|
48 |
me.device.display.updateSoftKeys(); |
|
commit initial
|
49 |
} |
show the complete path menu ...
|
50 |
else { |
51 |
var list_path = ''; |
|
52 |
foreach(var p; me.path) list_path ~= p ~ '/'; |
|
53 |
print(me.device.role ~ ':' ~ list_path ~ key ~ ' : not yet implemented'); |
|
54 |
} |
|
softkeys are available now
|
55 |
}, |
56 | ||
57 |
bindings : { |
|
58 |
PFD : { |
|
59 |
INSET: { |
|
60 |
OFF: func { |
|
61 |
pop(me.path); |
|
62 |
me.device.display.updateSoftKeys(); |
|
63 |
}, |
|
64 |
}, |
|
65 |
PFD: { |
|
adds OAT, TAS, GSPD, WindDat...
|
66 |
'AOA/WIND' : { |
67 |
WIND : { |
|
68 |
OPTN1 : func { |
|
69 |
me.device.display._winddata_optn = 1; |
|
70 |
me.device.display.screenElements['WindData'].show(); |
|
71 |
me.device.display.screenElements['WindData-OPTN1'].show(); |
|
72 |
me.device.display.screenElements['WindData-OPTN1-HDG'].show(); |
|
73 |
me.device.display.screenElements['WindData-OPTN2'].hide(); |
|
74 |
me.device.display.updateWindData(); |
|
75 |
}, |
|
76 |
OPTN2 : func { |
|
77 |
me.device.display._winddata_optn = 2; |
|
78 |
me.device.display.screenElements['WindData'].show(); |
|
79 |
me.device.display.screenElements['WindData-OPTN1'].hide(); |
|
80 |
me.device.display.screenElements['WindData-OPTN2'].show(); |
|
81 |
me.device.display.screenElements['WindData-OPTN2-symbol'].show(); |
|
82 |
me.device.display.screenElements['WindData-OPTN2-headwind'].show(); |
|
83 |
me.device.display.screenElements['WindData-OPTN2-crosswind'].show(); |
|
84 |
me.device.display.updateWindData(); |
|
85 |
}, |
|
86 |
OFF : func { |
|
87 |
me.device.display._winddata_optn = 0; |
|
88 |
me.device.display.screenElements['WindData'].hide(); |
|
89 |
me.device.display.screenElements['WindData-OPTN1'].hide(); |
|
90 |
me.device.display.screenElements['WindData-OPTN2'].hide(); |
|
91 |
}, |
|
92 |
}, |
|
93 |
}, |
|
adds BRG1/2 animation
|
94 |
BRG1 : func (brg = 1){ |
95 |
var source = 'brg' ~ brg ~ '-source'; |
|
96 |
var list = ['NAV' ~ brg, 'GPS', 'ADF', 'OFF']; |
|
97 |
var index = std.Vector |
|
98 |
.new(list) |
|
99 |
.index(radios.getNode(source).getValue()); |
|
100 |
var next = (index == size(list) -1) ? 0 : index + 1; |
|
101 |
radios.getNode(source).setValue(list[next]); |
|
102 |
}, |
|
103 |
BRG2 : func { |
|
104 |
call(me.bindings.PFD.PFD.BRG1, [ 2 ], me); |
|
105 |
}, |
|
adds BARO settings
|
106 |
'STD BARO' : func { |
107 |
setprop('/instrumentation/altimeter/setting-inhg', 29.92); |
|
108 |
me.device.display.updateBARO(); |
|
109 |
pop(me.path); |
|
110 |
me.device.display.updateSoftKeys(); |
|
111 |
}, |
|
112 |
IN : func { |
|
113 |
me.device.display._baro_unit = 'inhg'; |
|
114 |
me.device.display.updateBARO(); |
|
115 |
}, |
|
116 |
HPA : func { |
|
117 |
me.device.display._baro_unit = 'hpa'; |
|
118 |
me.device.display.updateBARO(); |
|
119 |
}, |
|
softkeys are available now
|
120 |
}, |
121 |
XPDR: { |
|
adds transponder
|
122 |
STBY : func { |
123 |
setprop('/instrumentation/transponder/ident', 0); |
|
124 |
setprop('/instrumentation/transponder/knob-mode', 1); |
|
125 |
setprop('/instrumentation/zkv1000/radio/xpdr-mode', 'STBY'); |
|
126 |
me.device.display.updateXPDR(); |
|
127 |
}, |
|
128 |
ON : func { |
|
129 |
setprop('/instrumentation/transponder/ident', 1); |
|
130 |
setprop('/instrumentation/transponder/knob-mode', 4); |
|
131 |
setprop('/instrumentation/zkv1000/radio/xpdr-mode', 'ON'); |
|
132 |
me.device.display.updateXPDR(); |
|
133 |
}, |
|
134 |
ALT : func { |
|
135 |
setprop('/instrumentation/transponder/ident', 1); |
|
136 |
setprop('/instrumentation/transponder/knob-mode', 5); |
|
137 |
setprop('/instrumentation/zkv1000/radio/xpdr-mode', 'ALT'); |
|
138 |
me.device.display.updateXPDR(); |
|
139 |
}, |
|
140 |
VFR : func { |
|
141 |
setprop('/instrumentation/transponder/id-code', '1200'); |
|
142 |
me.device.display.updateXPDR(); |
|
143 |
}, |
|
144 |
IDENT : func { |
|
145 |
call(me.bindings.PFD.IDENT, [], me); |
|
146 |
}, |
|
147 |
CODE : { |
|
148 |
'0' : func (n = 0) { |
|
XPDR settings via knob or so...
|
149 |
if (getprop('/instrumentation/zkv1000/radios/xpdr-tuning-fms-method')) |
150 |
return; |
|
151 |
me.device.display.timers2.softkeys_inactivity.stop(); |
|
Softkeys revert to the previ...
|
152 |
me.bindings.PFD.XPDR.CODE.inactivity.restart(me.device.display.softkeys_inactivity_delay); |
XPDR settings via knob or so...
|
153 |
# disable FMS knob entering method |
154 |
me.device.knobs.FmsInner = void; |
|
155 |
# When entering the code, the next softkey in sequence |
|
156 |
# must be pressed within 10 seconds, or the entry is cancelled |
|
157 |
# and restored to the previous code |
|
158 |
if (!contains(me.bindings.PFD.XPDR.CODE, 'on_change_inactivity')) { |
|
159 |
me.bindings.PFD.XPDR.CODE.on_change_inactivity = maketimer(10, |
|
160 |
func { |
|
161 |
setprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit', 3); |
|
162 |
me.device.knobs.FmsInner = me.device.knobs.XPDRCodeSetDigits; |
|
163 |
me.device.knobs.FmsOuter = me.device.knobs.XPDRCodeNextDigits; |
|
164 |
call(me.bindings.PFD.XPDR.CODE.restore, [], me); |
|
165 |
}); |
|
166 |
me.bindings.PFD.XPDR.CODE.on_change_inactivity.singleShot = 1; |
|
167 |
me.bindings.PFD.XPDR.CODE.on_change_inactivity.start(); |
|
168 |
} |
|
169 |
else |
|
170 |
me.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10); |
|
adds transponder
|
171 |
var tuning = radios.getNode('xpdr-tuning-digit'); |
172 |
var d = tuning.getValue(); |
|
173 |
setprop('/instrumentation/transponder/inputs/digit[' ~ d ~ ']', n); |
|
XPDR settings via knob or so...
|
174 |
if (d == 1) { |
175 |
if (!contains(me.bindings.PFD.XPDR.CODE, 'on_change_auto_validation')) |
|
176 |
me.bindings.PFD.XPDR.CODE.on_change_auto_validation = maketimer(5, |
|
177 |
func call(me.bindings.PFD.IDENT, [], me)); |
|
178 |
me.bindings.PFD.XPDR.CODE.on_change_auto_validation.singleShot = 1; |
|
179 |
me.bindings.PFD.XPDR.CODE.on_change_auto_validation.start(); |
|
180 |
} |
|
181 |
else { |
|
182 |
d -= 1; |
|
183 |
tuning.setValue(d); |
|
184 |
} |
|
adds transponder
|
185 |
me.device.display.updateXPDR(); |
186 |
}, |
|
187 |
'1' : func { |
|
188 |
call(me.bindings.PFD.XPDR.CODE['0'], [ 1 ], me); |
|
189 |
}, |
|
190 |
'2' : func { |
|
191 |
call(me.bindings.PFD.XPDR.CODE['0'], [ 2 ], me); |
|
192 |
}, |
|
193 |
'3' : func { |
|
194 |
call(me.bindings.PFD.XPDR.CODE['0'], [ 3 ], me); |
|
195 |
}, |
|
196 |
'4' : func { |
|
197 |
call(me.bindings.PFD.XPDR.CODE['0'], [ 4 ], me); |
|
198 |
}, |
|
199 |
'5' : func { |
|
200 |
call(me.bindings.PFD.XPDR.CODE['0'], [ 5 ], me); |
|
201 |
}, |
|
202 |
'6' : func { |
|
203 |
call(me.bindings.PFD.XPDR.CODE['0'], [ 6 ], me); |
|
204 |
}, |
|
205 |
'7' : func { |
|
206 |
call(me.bindings.PFD.XPDR.CODE['0'], [ 7 ], me); |
|
207 |
}, |
|
softkeys are available now
|
208 |
IDENT: func { |
Softkeys revert to the previ...
|
209 |
me.bindings.PFD.XPDR.CODE.inactivity.restart(me.device.display.softkeys_inactivity_delay); |
210 |
me.device.display.timers2.softkeys_inactivity.restart(me.device.display.softkeys_inactivity_delay); |
|
adds transponder
|
211 |
call(me.bindings.PFD.IDENT, [], me); |
212 |
}, |
|
213 |
BKSP: func { |
|
XPDR settings via knob or so...
|
214 |
if (getprop('/instrumentation/zkv1000/radios/xpdr-tuning-fms-method')) |
215 |
return; |
|
216 |
if (contains(me.bindings.PFD.XPDR.CODE, 'on_change_inactivity')) |
|
217 |
me.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10); |
|
218 |
if (contains(me.bindings.PFD.XPDR.CODE, 'on_change_auto_validation')) |
|
219 |
me.bindings.PFD.XPDR.CODE.on_change_auto_validation.stop(); |
|
adds transponder
|
220 |
var tuning = radios.getNode('xpdr-tuning-digit'); |
221 |
var d = tuning.getValue(); |
|
XPDR settings via knob or so...
|
222 |
if (d < 3) { |
223 |
d += 1; |
|
224 |
tuning.setValue(d); |
|
225 |
} |
|
adds transponder
|
226 |
me.device.display.updateXPDR(); |
softkeys are available now
|
227 |
}, |
adds transponder
|
228 |
BACK : func (inactive = 0) { |
XPDR settings via knob or so...
|
229 |
call(me.bindings.PFD.XPDR.CODE.restore, [], me); |
adds transponder
|
230 |
pop(me.path); |
XPDR settings via knob or so...
|
231 |
call(me.bindings.PFD.XPDR.CODE.exit, [me.path], me); |
232 |
}, |
|
233 |
restore : func { |
|
234 |
setprop('/instrumentation/transponder/id-code', |
|
235 |
sprintf('%s', getprop('/instrumentation/zkv1000/radios/xpdr-backup-code'))); |
|
236 |
me.device.display.updateXPDR(); |
|
adds transponder
|
237 |
}, |
238 |
exit : func (p) { |
|
Softkeys revert to the previ...
|
239 |
if (contains(me.bindings.PFD.XPDR.CODE, 'inactivity')) # does not exists if IDENT pressed from top-level |
240 |
me.bindings.PFD.XPDR.CODE.inactivity.stop(); |
|
adds transponder
|
241 |
radios.removeChild('xpdr-tuning-digit', 0); |
242 |
radios.removeChild('xpdr-backup-code', 0); |
|
XPDR settings via knob or so...
|
243 |
radios.removeChild('xpdr-tuning-fms-method', 0); |
adds transponder
|
244 |
me.path = p; |
245 |
me.device.display.updateXPDR(); |
|
softkeys are available now
|
246 |
me.device.display.updateSoftKeys(); |
XPDR settings via knob or so...
|
247 |
me.device.knobs.FmsInner = void; |
248 |
me.device.knobs.FmsOuter = void; |
|
249 |
me.device.display.timers2.softkeys_inactivity.restart(me.device.display.softkeys_inactivity_delay); |
|
softkeys are available now
|
250 |
}, |
adds transponder
|
251 |
hook : func { |
XPDR settings via knob or so...
|
252 |
# this level has its own timer as we may need to revert changes, and got different timers |
253 |
me.device.display.timers2.softkeys_inactivity.stop(); |
|
Softkeys revert to the previ...
|
254 |
me.bindings.PFD.XPDR.CODE.inactivity = maketimer( |
255 |
me.device.display.softkeys_inactivity_delay, |
|
XPDR settings via knob or so...
|
256 |
func call(me.bindings.PFD.XPDR.CODE.BACK, [], me)); |
Softkeys revert to the previ...
|
257 |
me.bindings.PFD.XPDR.CODE.inactivity.singleShot = 1; |
258 |
me.bindings.PFD.XPDR.CODE.inactivity.start(); |
|
adds transponder
|
259 |
var tuning = getprop('/instrument/zkv1000/radios/xpdr-tuning-digit'); |
260 |
if (tuning == nil) { |
|
261 |
radios.getNode('xpdr-tuning-digit', 1).setValue(3); |
|
262 |
radios.getNode('xpdr-backup-code', 1).setValue(getprop('/instrumentation/transponder/id-code')); |
|
XPDR settings via knob or so...
|
263 |
radios.getNode('xpdr-tuning-fms-method', 1).setValue(0); |
adds transponder
|
264 |
me.device.display.updateXPDR(); |
265 |
} |
|
XPDR settings via knob or so...
|
266 |
me.device.knobs.FmsInner = me.device.knobs.XPDRCodeSetDigits; |
267 |
me.device.knobs.FmsOuter = me.device.knobs.XPDRCodeNextDigits; |
|
adds transponder
|
268 |
}, |
softkeys are available now
|
269 |
}, |
adds transponder
|
270 |
}, |
271 |
IDENT : func { |
|
272 |
if (getprop('/instrumentation/zkv1000/radio/xpdr-mode') == 'STBY') |
|
273 |
return; |
|
274 |
setprop('/instrumentation/transponder/ident', 1); |
|
275 |
me.bindings.PFD.XPDR.ident = maketimer(18, |
|
276 |
func { |
|
277 |
setprop('/instrumentation/transponder/ident', 0); |
|
278 |
me.device.display.updateXPDR(); |
|
279 |
}); |
|
280 |
me.bindings.PFD.XPDR.ident.singleShot = 1; |
|
281 |
me.bindings.PFD.XPDR.ident.start(); |
|
XPDR settings via knob or so...
|
282 |
call(me.bindings.PFD.XPDR.CODE.exit, [], me); |
softkeys are available now
|
283 |
}, |
adds CDI
|
284 |
CDI : func { |
285 |
var list = ['OFF']; |
|
286 |
if (getprop('/instrumentation/gps/route-distance-nm') != nil) |
|
287 |
append(list, 'GPS'); |
|
288 |
if (getprop('/instrumentation/nav/in-range') != nil) |
|
289 |
append(list, 'NAV1'); |
|
290 |
if (getprop('/instrumentation/nav[1]/in-range') != nil) |
|
291 |
append(list, 'NAV2'); |
|
292 |
var index = std.Vector |
|
293 |
.new(list) |
|
294 |
.index(cdi.getNode('source').getValue()); |
|
295 |
var next = (index == size(list) -1) ? 0 : index + 1; |
|
296 |
cdi.getNode('source').setValue(list[next]); |
|
297 |
CDIfromSOURCE(list[next]); |
|
298 |
me.device.display.updateCDI(); |
|
299 |
}, |
|
TMR/REF window
|
300 |
'TMR/REF' : func { |
301 |
if (!contains(me.device.windows.state, 'TMR/REF')) { |
|
302 |
me.device.windows.draw( |
|
303 |
'TMR/REF', |
|
304 |
{x: 720, y: 535, w: 300, l: 5, sep: 3}, |
|
TMR/REF window adaptation
|
305 |
[ # objects infos |
TMR/REF window
|
306 |
{text: 'REFERENCES', type: 'title'}, |
307 |
{type: 'separator'}, |
|
308 |
{text: 'TIMER', type: 'normal'}, |
|
309 |
{text: '00:00:00', type: 'selected|time', }, |
|
TMR/REF window adaptation
|
310 |
{text: '< UP >', type: 'editable', choices: ['< UP >', '<DOWN>'], callback: func}, |
311 |
{text: 'START?', type: 'editable|end-of-line|choices', choices: ['START?', 'RESET?', 'STOP?'], callback: func}, |
|
TMR/REF window
|
312 |
{type: 'separator'}, |
TMR/REF window adaptation
|
313 |
{text: 'Vx 20KT', type: 'normal', scrollgroup:0}, |
314 |
{text: '< ON >', type: 'editable|end-of-line', choices: ['< ON >', '< OFF >'], scrollgroup:0, callback: func}, |
|
315 |
{text: 'Vy 50KT', type: 'normal', scrollgroup:1}, |
|
316 |
{text: '< ON >', type: 'editable|end-of-line', choices: ['< ON >', '< OFF >'], scrollgroup:1, callback: func}, |
|
317 |
{text: 'Vr 70KT', type: 'normal', scrollgroup:2}, |
|
318 |
{text: '< ON >', type: 'editable|end-of-line', choices: ['< ON >', '< OFF >'], scrollgroup:2, callback: func}, |
|
319 |
{text: 'Vglide 100KT', type: 'normal', scrollgroup:3}, |
|
320 |
{text: '< ON >', type: 'editable|end-of-line', choices: ['< ON >', '< OFF >'], scrollgroup:3, callback: func}, |
|
321 |
{text: 'Vfoo bar baz', type: 'normal', scrollgroup:4}, |
|
322 |
{text: '< ON >', type: 'editable|end-of-line', choices: ['< ON >', '< OFF >'], scrollgroup:4, callback: func}, |
|
TMR/REF window
|
323 |
{type: 'separator'}, |
324 |
{text: 'MINIMUMS', type: 'normal'}, |
|
TMR/REF window adaptation
|
325 |
{text: ' BARO >', type: 'editable', choices: [' BARO >','< TST1 >','< TST2 '], callback: func}, |
326 |
{text: ' 1000FT', type: 'editable', format: '% 5iFT', factor: 100, callback: func}, |
|
327 |
], |
|
328 |
{ # scrolling info, see menu.nas |
|
329 |
lines : 3, |
|
330 |
columns : 2, |
|
331 |
} |
|
TMR/REF window
|
332 |
); |
333 |
me.device.knobs.FmsInner = me.device.knobs.MenuSettings; |
|
334 |
me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu; |
|
335 |
} |
|
336 |
else { |
|
337 |
me.device.knobs.FmsInner = func; |
|
338 |
me.device.knobs.FmsOuter = func; |
|
339 |
me.device.windows.del(); |
|
340 |
} |
|
341 |
}, |
|
softkeys are available now
|
342 |
}, |
343 |
MFD : { |
|
344 |
ENGINE: { |
|
345 |
FUEL: { |
|
346 |
UNDO: func { |
|
347 |
pop(me.path); |
|
348 |
me.device.display.updateSoftKeys(); |
|
349 |
}, |
|
350 |
ENTER: func { |
|
351 |
pop(me.path); |
|
352 |
me.device.display.updateSoftKeys(); |
|
353 |
}, |
|
354 |
}, |
|
355 |
ENGINE: func { |
|
356 |
me.path = []; |
|
357 |
me.device.display.updateSoftKeys(); |
|
358 |
}, |
|
359 |
}, |
|
add missing exit to MFD/CHKL...
|
360 |
CHKLIST : { |
361 |
EXIT: func { |
|
362 |
me.path = []; |
|
363 |
me.device.display.updateSoftKeys(); |
|
364 |
}, |
|
365 |
}, |
|
softkeys are available now
|
366 |
}, |
commit initial
|
367 |
}, |
368 |
}; |