... | ... |
@@ -42,6 +42,12 @@ var setListeners = func { |
42 | 42 |
device[0].display.updateNAV({'nav-id': 2}); |
43 | 43 |
device[1].display.updateNAV({'nav-id': 2}); |
44 | 44 |
}, 1, 2); |
45 |
+ setlistener('/instrumentation/zkv1000/radios/nav-tune', |
|
46 |
+ func { |
|
47 |
+ setNavTune(); |
|
48 |
+ device[0].display.updateNAV({tune: 1}); |
|
49 |
+ device[1].display.updateNAV({tune: 1}); |
|
50 |
+ }, 1, 2); |
|
45 | 51 |
} |
46 | 52 |
|
47 | 53 |
var deviceClass = { |
... | ... |
@@ -429,14 +429,18 @@ var displayClass = { |
429 | 429 |
} |
430 | 430 |
} |
431 | 431 |
if (contains(arg[0], 'tune')) { |
432 |
+ var n = getprop('/instrumentation/zkv1000/radios/nav-tune'); |
|
433 |
+ # n = 0 -> NAV1 |
|
434 |
+ # n = 1 -> NAV2 |
|
432 | 435 |
me.screenElements['nav-freq-switch'] |
433 |
- .setTranslation(0, (arg[0]['tune'] - 1) * 25); |
|
434 |
- me.screenElements['nav' ~ arg[0]['tune'] ~ '-standby-freq'] |
|
436 |
+ .setTranslation(0, n * 25); |
|
437 |
+ me.screenElements['nav' ~ (n + 1) ~ '-standby-freq'] |
|
435 | 438 |
.setColor(0,1,1); |
436 |
- me.screenElements['nav' ~ ((arg[0]['tune'] == 1) + 1) ~ '-standby-freq'] |
|
439 |
+ me.screenElements['nav' ~ ((n == 0) + 1) ~ '-standby-freq'] |
|
437 | 440 |
.setColor(1,1,1); |
438 | 441 |
} |
439 | 442 |
if (contains(arg[0], 'nav-id')) { |
443 |
+ # TODO: récupérer la valeur via les paramètres transmis du listener |
|
440 | 444 |
var navid = getprop('/instrumentation/nav[' ~ (arg[0]['nav-id'] - 1) ~ ']/nav-id'); |
441 | 445 |
if (navid == nil) |
442 | 446 |
navid = ''; |
... | ... |
@@ -444,17 +448,20 @@ var displayClass = { |
444 | 448 |
.setText(navid); # veut pas exister au début... |
445 | 449 |
} |
446 | 450 |
if (contains(arg[0], 'refresh')) { |
451 |
+ # rafraichi une seule ligne NAV1 ou NAV2 |
|
447 | 452 |
me.screenElements['nav' ~ arg[0].refresh ~ '-selected-freq'] |
448 | 453 |
.setText(getprop('/instrumentation/nav[' ~ (arg[0].refresh - 1) ~ ']/frequencies/selected-mhz-fmt')); |
449 | 454 |
me.screenElements['nav' ~ arg[0].refresh ~ '-standby-freq'] |
450 | 455 |
.setText(getprop('/instrumentation/nav[' ~ (arg[0].refresh - 1) ~ ']/frequencies/standby-mhz-fmt')); |
451 | 456 |
} |
452 | 457 |
if (contains(arg[0], 'set')) { |
458 |
+ # positionne la valeur modifiée, les listeners "trigguent" en permanence ces propriétés, donc exit |
|
453 | 459 |
var n = getprop('/instrumentation/zkv1000/radios/nav-tune'); |
454 | 460 |
me.screenElements['nav' ~ (n + 1) ~ '-standby-freq'] |
455 | 461 |
.setText(getprop('/instrumentation/nav[' ~ n ~ ']/frequencies/standby-mhz-fmt')); |
456 | 462 |
} |
457 | 463 |
if (contains(arg[0], 'auto')) { |
464 |
+ # pour rafraichir automagiquement, toutes les deux secondes un refresh pour un NAV |
|
458 | 465 |
me.updateNAV({refresh: 1}); |
459 | 466 |
settimer(func me.updateNAV({refresh: 2}), 1); |
460 | 467 |
settimer(func me.updateNAV({auto:1}), 2); |
... | ... |
@@ -2,15 +2,14 @@ |
2 | 2 |
# the order could be important as some files need other one to be loaded first |
3 | 3 |
files_to_load = [ |
4 | 4 |
'lib.nas', # some useful functions, should stay first loaded |
5 |
- 'menu.nas', # manages menu entries andd perform some simple actions |
|
5 |
+ 'radios.nas', # all about radios COMM, NAV, XPDR |
|
6 | 6 |
'knobs.nas', # handles knobs |
7 | 7 |
'buttons.nas', # handles knobs and buttons |
8 | 8 |
'softkeys.nas',# handles softkeys and menus items |
9 | 9 |
'display.nas', |
10 |
- 'canvas.nas', |
|
11 | 10 |
'core.nas', # the scheduler and switch on button |
12 | 11 |
]; |
13 |
-# 'radios.nas', # all about radios COMM, NAV, XPDR |
|
12 |
+# 'menu.nas', # manages menu entries andd perform some simple actions |
|
14 | 13 |
# 'afcs.nas', # Automatic Flight Control System |
15 | 14 |
# 'routes.nas', # manages flightplans and routes |
16 | 15 |
# 'display.nas', # display messages and popups |