commit initial
|
1 |
var buttonsClass = { |
improves role/name variables...
|
2 |
new : func (device) { |
commit initial
|
3 |
var m = { parents: [ buttonsClass ] }; |
improves role/name variables...
|
4 |
m.device = device; |
commit initial
|
5 |
return m; |
6 |
}, |
|
7 | ||
8 |
PAN : func (xdir = 0, ydir = 0) { |
|
9 |
}, |
|
10 | ||
11 |
AsSwitchNAV : func { |
|
12 |
var n = getprop('/instrumentation/zkv1000/radios/nav-tune'); |
|
13 |
var tmp = getprop('/instrumentation/nav[' ~ n ~ ']/frequencies/selected-mhz'); |
|
14 |
setprop('/instrumentation/nav[' ~ n ~ ']/frequencies/selected-mhz', getprop('/instrumentation/nav[' ~ n ~ ']/frequencies/standby-mhz')); |
|
15 |
setprop('/instrumentation/nav[' ~ n ~ ']/frequencies/standby-mhz', tmp); |
|
creates flightdeck hash to p...
|
16 |
foreach (var c; keys(flightdeck)) |
17 |
if (contains(flightdeck[c], 'display')) |
|
18 |
flightdeck[c].display.updateNAV({refresh: n+1}); |
|
commit initial
|
19 |
}, |
20 | ||
ajout de l'animation des bou...
|
21 |
AsSwitchCOM : func (x) { |
commit initial
|
22 |
if (x) { |
ajout de l'animation des bou...
|
23 |
me.AsSwitchCOM_pushed = getprop('/sim/time/elapsed-sec'); |
commit initial
|
24 |
} |
ajout de l'animation des bou...
|
25 |
else { |
26 |
var pressed = getprop('/sim/time/elapsed-sec') - me.AsSwitchCOM_pushed; |
|
27 |
if (pressed > 2) { |
|
28 |
setprop('/instrumentation/comm/frequencies/selected-mhz', 121.500); |
|
29 |
setprop('/instrumentation/zkv1000/radios/comm1-selected', 1); |
|
30 |
setprop('/instrumentation/zkv1000/radios/comm2-selected', 0); |
|
fix COMM display standby fre...
|
31 |
foreach (var d; keys(flightdeck)) |
32 |
if (contains(flightdeck[d], 'display')) { |
|
33 |
flightdeck[d].display.updateCOMM({refresh: 1}); |
|
34 |
flightdeck[d].display.updateCOMM({refresh: 2}); |
|
35 |
} |
|
ajout de l'animation des bou...
|
36 |
} |
37 |
else { |
|
38 |
var c = getprop('/instrumentation/zkv1000/radios/comm-tune'); |
|
39 |
var tmp = getprop('/instrumentation/comm[' ~ c ~ ']/frequencies/selected-mhz'); |
|
40 |
setprop('/instrumentation/comm[' ~ c ~ ']/frequencies/selected-mhz', getprop('/instrumentation/comm[' ~ c ~ ']/frequencies/standby-mhz')); |
|
41 |
setprop('/instrumentation/comm[' ~ c ~ ']/frequencies/standby-mhz', tmp); |
|
fix COMM display standby fre...
|
42 |
foreach (var d; keys(flightdeck)) |
43 |
if (contains(flightdeck[d], 'display')) |
|
44 |
flightdeck[d].display.updateCOMM({refresh: c+1}); |
|
ajout de l'animation des bou...
|
45 |
} |
commit initial
|
46 |
} |
47 |
}, |
|
48 | ||
ajout de l'animation des bou...
|
49 |
ALT : func () { |
50 |
var alt = getprop('instrumentation/altimeter/indicated-altitude-ft'); |
|
51 |
setprop('/instrumentation/zkv1000/afcs/selected-alt-ft', math.round(alt, 10)); |
|
commit initial
|
52 |
}, |
53 | ||
TMR/REF available
|
54 |
ValidateTMRREF : func (a = 0) { |
55 |
if (a) |
|
56 |
return; |
|
57 |
var (id, selected) = split('-', me.device.windows.selected); |
|
58 |
var state = me.device.windows.state[id]; |
|
59 |
selected += state.scroll.offset; |
|
60 |
if (contains(state.objects[selected], 'callback')) |
|
61 |
call(state.objects[selected].callback, [id, selected], me); |
|
62 |
}, |
|
63 | ||
64 |
ClearTMRREF : func (a = 0) { |
|
65 |
if (a) |
|
66 |
return; |
|
67 |
me.device.windows.del(); |
|
68 |
me.device.data.TMRtimer = nil; |
|
69 |
me.device.knobs.FmsInner = func; |
|
70 |
me.device.knobs.FmsOuter = func; |
|
71 |
me.device.buttons.ENT = func; |
|
72 |
me.device.buttons.FMS = func; |
|
73 |
me.device.buttons.CLR = func; |
|
74 |
}, |
|
75 | ||
fix MFD page selection syste...
|
76 |
MFD_page_wrapper : func (id, selected) { |
77 |
var s = me.device.data[id][me.device.display['page selected']]; |
|
78 |
var group = s.name; |
|
79 |
var subpage = s.objects[selected].text; |
|
80 | ||
81 |
if (contains(me.device.display.MFD, group)) { |
|
82 |
if (contains(me.device.display.MFD[group], subpage)) |
|
83 |
me.device.display.MFD[group][subpage](); |
|
84 |
else |
|
85 |
msg('page ' ~ group ~ '/' ~ subpage ~ ' not yet implemented'); |
|
86 |
} |
|
87 |
else |
|
88 |
msg('nothing is implemented yet in group ' ~ group); |
|
89 | ||
90 |
foreach (var k; keys(me.device.windows.window)) |
|
91 |
if (find(id, k) == 0) |
|
92 |
me.device.windows.del(k); |
|
93 |
me.device.buttons.ENT = func; |
|
94 |
me.device.knobs.FmsInner = func; |
|
95 |
}, |
|
96 | ||
massive code reorganisation ...
|
97 |
MapMenu : func (a = 0) { |
98 |
if (a == 1) |
|
99 |
return; |
|
100 |
var menu_label = 'MAP MENU'; |
|
101 |
if (!contains(me.device.windows.window, menu_label ~ '-bg')) { |
|
102 |
var level_min = 13; |
|
103 |
var level_max = 7; |
|
104 |
var levels = [ sprintf(' % 2u >', level_max) ]; |
|
105 |
for (var i = level_max + 1; i <= level_min; i += 1) |
|
106 |
append(levels, sprintf(i < level_min ? '< % 2u >' : '< % 2u ', i)); |
|
107 |
var orientation = [ ' NORTH UP >', '< TRK UP >' ]; |
|
108 |
if (getprop('/instrumentation/gps/route-distance-nm') != nil) |
|
109 |
append(orientation, '< DTK UP >'); |
|
110 |
append(orientation, '< HDG UP '); |
|
111 |
me.device.windows.draw( |
|
112 |
menu_label, |
|
113 |
{x: 720, y: 100, w: 300, l:3, sep: 1}, |
|
114 |
[ |
|
115 |
{text: menu_label, type: 'title'}, |
|
116 |
{type: 'separator'}, |
|
117 |
{text: 'ZOOM LEVEL', type: 'normal'}, |
|
118 |
{text: sprintf('%s % 2u %s', |
|
119 |
me.device.data.zoom > level_max ? '<' : ' ', |
|
120 |
me.device.data.zoom, |
|
121 |
me.device.data.zoom < level_min ? '>' : ' '), |
|
122 |
type: 'selected|end-of-line', |
|
123 |
choices: levels, |
|
124 |
callback: func (id, selected) { |
|
125 |
var z = me.device.windows.state[id].objects[selected].text; |
|
126 |
foreach (var c; [' ', '<', '>']) |
|
127 |
z = string.replace(z, c, ''); |
|
128 |
me.device.data.zoom = z; |
|
129 |
me.device.map.changeZoom(); |
|
130 |
me.device.map.update(); |
|
131 |
} |
|
132 |
}, |
|
133 |
{text: 'ORIENTATION', type: 'normal'}, |
|
134 |
{text: (func foreach (var o; orientation) if (find(me.device.data.orientation.text, o) > -1) return o;)(), |
|
135 |
type: 'editable|end-of-line', |
|
136 |
choices: orientation, |
|
137 |
callback: func (id, selected) { |
|
138 |
var o = me.device.windows.state[id].objects[selected].text; |
|
139 |
o = substr(o, 2); |
|
140 |
o = substr(o, 0, size(o) - 2); |
|
141 |
o = string.trim(o); |
|
142 |
me.device.data.orientation.text = o; |
|
143 |
me.device.map.update(); |
|
144 |
} |
|
145 |
}, |
|
146 |
] |
|
147 |
); |
|
148 |
me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu; |
|
149 |
me.device.knobs.FmsInner = me.device.knobs.MenuSettings; |
|
150 |
me.device.buttons.CLR = me.device.buttons.MapMenu; |
|
151 |
me.device.buttons.ENT = me.device.buttons.ValidateTMRREF; |
|
152 |
} |
|
153 |
else { |
|
154 |
me.device.buttons.ENT = func; |
|
155 |
me.device.buttons.CLR = func; |
|
156 |
me.device.knobs.FmsInner = func; |
|
157 |
me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group; |
|
158 |
me.device.windows.del(menu_label); |
|
159 |
} |
|
160 |
}, |
|
161 | ||
commit initial
|
162 |
DirectTo : void, |
163 |
MENU : void, |
|
164 |
FPL : void, |
|
165 |
PROC : void, |
|
166 |
CLR : void, |
|
167 |
ENT : void, |
|
168 |
FMS : void, |
|
169 |
}; |