commit initial
|
1 |
var main_loop_id = 0; |
2 |
var loop_check_functions_max_index = 0; |
|
3 |
var loop_check_functions = []; |
|
4 |
var device = [nil, nil]; |
|
5 |
var deviceClass = {}; |
|
6 | ||
7 |
var init_main_loop = func { |
|
8 |
loop_check_functions = [ |
|
9 |
pfdCursors, |
|
10 |
checkTrafficProximity, |
|
11 |
checkMarkerBaecon, |
|
12 |
device[0] == nil ? void : func { moveMap (0) }, |
|
13 |
checkRollAcquisition, |
|
14 |
checkPitchAcquisition, |
|
15 |
pfdCursors, |
|
16 |
computeAltitudeDiff, |
|
17 |
computeAirspeedDiff, |
|
18 |
device[1] == nil ? void : func { moveMap(1) }, |
|
19 |
checkAlerts, |
|
20 |
]; |
|
21 |
loop_check_functions_max_index = size(loop_check_functions); |
|
22 |
} |
|
23 | ||
24 |
var main_loop = func () { |
|
25 |
getData(); |
|
26 |
FLCcomputation(); |
|
27 |
loop_check_functions[main_loop_id](); |
|
28 |
main_loop_id += 1; |
|
29 |
if (main_loop_id == loop_check_functions_max_index) main_loop_id = 0; |
|
30 |
settimer(main_loop, 0); |
|
31 |
} |
|
32 | ||
NAV disponible (hors CDI)
|
33 |
# les listeners triggent en permanence sur les fréquences... |
34 |
var setListeners = func { |
|
35 |
setlistener('/instrumentation/nav/nav-id', |
|
correction listeners
|
36 |
func (n) { |
37 |
var val = n.getValue(); |
|
38 |
device[0].display.updateNAV({'nav-id': 1, val: val}); |
|
39 |
device[0].display.updateNAV({'nav-id': 1, val: val}); |
|
NAV disponible (hors CDI)
|
40 |
}, 1, 2); |
41 |
setlistener('/instrumentation/nav[1]/nav-id', |
|
correction listeners
|
42 |
func (n) { |
43 |
var val = n.getValue(); |
|
44 |
device[0].display.updateNAV({'nav-id': 2, val: val}); |
|
45 |
device[1].display.updateNAV({'nav-id': 2, val: val}); |
|
NAV disponible (hors CDI)
|
46 |
}, 1, 2); |
Correction swap NAV tuning
|
47 |
setlistener('/instrumentation/zkv1000/radios/nav-tune', |
correction listeners
|
48 |
func (n) { |
49 |
var val = n.getValue(); |
|
Correction swap NAV tuning
|
50 |
setNavTune(); |
correction listeners
|
51 |
device[0].display.updateNAV({tune: val}); |
52 |
device[1].display.updateNAV({tune: val}); |
|
53 |
}, 1, 2); |
|
54 |
setlistener('/instrumentation/zkv1000/radios/comm-tune', |
|
55 |
func (n) { |
|
56 |
var val = n.getValue(); |
|
57 |
setCommTune(); |
|
58 |
device[0].display.updateCOMM({tune: val}); |
|
59 |
device[1].display.updateCOMM({tune: val}); |
|
Correction swap NAV tuning
|
60 |
}, 1, 2); |
animation HDG bug
|
61 |
setlistener('/instrumentation/zkv1000/afcs/heading-bug-deg', |
62 |
func (n) { |
|
63 |
var val = n.getValue(); |
|
64 |
if (val != nil) { |
|
65 |
device[0].display.updateHDG(val); |
|
66 |
device[1].display.updateHDG(val); |
|
67 |
} |
|
68 |
}, 0, 2); |
|
anime CRS
|
69 |
setlistener('/instrumentation/zkv1000/cdi/course', |
70 |
func (n) { |
|
71 |
var val = n.getValue(); |
|
72 |
if (val != nil) { |
|
73 |
device[0].display.updateCRS(val); |
|
74 |
device[1].display.updateCRS(val); |
|
75 |
} |
|
76 |
}, 0, 2); |
|
adds OAT, TAS, GSPD, WindDat...
|
77 |
setlistener('/instrumentation/zkv1000/afcs/selected-alt-ft', |
78 |
func (n) { |
|
79 |
print('/instrumentation/zkv1000/afcs/selected-alt-ft'); |
|
80 |
var val = n.getValue(); |
|
81 |
if (val != nil) { |
|
82 |
device[0].display.screenElements['SelectedAlt-bug'].show(); |
|
83 |
device[0].display.screenElements['SelectedAlt-top'].show(); |
|
84 |
device[0].display.updateSelectedALT(); |
|
85 |
} |
|
86 |
}, 0, 2); |
|
adds transponder
|
87 |
setlistener('/gear/gear/wow', |
88 |
func device[0].display.updateXPDR(), |
|
89 |
0, 0); |
|
NAV disponible (hors CDI)
|
90 |
} |
91 | ||
commit initial
|
92 |
var deviceClass = { |
93 |
new: func (d) { |
|
94 |
var m = { parents: [ deviceClass ] }; |
|
95 |
m.role = d ? 'MFD' : 'PFD'; |
|
96 |
m.node = zkv.getNode('device[' ~ d ~ ']', 1); |
|
pass device pointer to displ...
|
97 |
m.display = displayClass.new(m, m.role); |
commit initial
|
98 |
m.display.showInitProgress(m.role); |
99 |
m.buttons = buttonsClass.new(m.node); |
|
100 |
m.knobs = knobsClass.new(m.node); |
|
softkeys are available now
|
101 |
m.softkeys = softkeysClass.new(m, m.node, m.role); |
adds OAT, TAS, GSPD, WindDat...
|
102 |
#m.softkeys.clean(); |
commit initial
|
103 |
m.display.loadsvg(); |
AI disponible
|
104 |
m.display.loadGroup({ |
105 |
hide : [ |
|
commit initial
|
106 |
'Failures', |
107 |
'SoftKeysTexts', |
|
108 |
'PFD-Widgets', |
|
109 |
'COMM', |
|
110 |
'XPDR-TIME', |
|
111 |
'NAV', |
|
112 |
'FlightInstruments', |
|
113 |
'VDI', |
|
114 |
'OMI', |
|
AI disponible
|
115 |
], |
116 |
clip : 'PitchScale', |
|
117 |
}); |
|
commit initial
|
118 |
zkv.getNode(m.role ~ 'init').setIntValue(0); |
119 |
m.setstatus(d + 1); |
|
PFD+MFD allumés ensemble
|
120 |
msg(m.role ~ ' switched on!'); |
commit initial
|
121 |
return m; |
122 |
}, |
|
123 | ||
124 |
status: 0, |
|
125 | ||
126 |
role: '', |
|
127 | ||
128 |
setstatus: func (s) { |
|
129 |
if (s == 1) { |
|
130 |
} |
|
131 |
elsif (s == 2) { |
|
132 |
me.rootmenu = 12; |
|
133 |
me.node.getNode('mfd-title',1).setValue('TOPO'); |
|
134 |
} |
|
135 |
me.status = s; |
|
136 |
me.node.getNode('status', 1).setIntValue(s); |
|
137 |
}, |
|
138 | ||
139 |
|
|
140 |
MFD: func { |
|
141 |
m.rootmenu = 12; |
|
142 |
m.newstatus(2); |
|
143 |
m.node.getNode('mfd-title',1).setValue('TOPO'); |
|
144 |
}, |
|
145 | ||
146 | ||
147 |
MENUkeyItems: {}, |
|
148 | ||
149 |
set_MENUkeyItems: func { |
|
150 |
me.MENUkeyItems = { |
|
151 |
'MAIN MENU': [ |
|
152 |
[['ROUTE MANAGER'], func { me.MENUsoftkey('ROUTE MANAGER') }], |
|
153 |
[['GENERAL OPTIONS'], func { me.MENUsoftkey('GENERAL OPTIONS') }], |
|
154 |
], |
|
155 |
'ROUTE MANAGER': [ |
|
156 |
[[sprintf('%sACTIVATE ROUTE MANAGER', getprop('/autopilot/route-manager/active') ? 'DES' : ''), ' '], |
|
157 |
func { |
|
158 |
getprop('/autopilot/route-manager/route/num') or return; |
|
159 |
setprop('/autopilot/route-manager/current-wp', 0); |
|
160 |
var v = getprop('/autopilot/route-manager/active'); |
|
161 |
setprop('/autopilot/route-manager/active', !v); |
|
162 |
me.mud.node.getNode('line[' ~ me.mud.selected.first_line ~ ']').setValue(sprintf('%sACTIVATE ROUTE MANAGER', v ? '' : 'DES')); |
|
163 |
}], |
|
164 |
[['SEARCH AIRPORT'], void], |
|
165 |
[['SEARCH NAVAID'], void], |
|
166 |
[['SEARCH FIX'], void], |
|
167 |
[['BACK'], func { me.MENUsoftkey('MAIN MENU') }], |
|
168 |
], |
|
169 |
'BACKLIGHT LEVEL': [ |
|
170 |
[['HIGH'], func { setprop('/instrumentation/zkv1000/emission', 1.0) }], |
|
171 |
[['MEDIUM HIGH'], func { setprop('/instrumentation/zkv1000/emission', 0.6) }], |
|
172 |
[['MEDIUM LOW'], func { setprop('/instrumentation/zkv1000/emission', 0.4) }], |
|
173 |
[['LOW'], func { setprop('/instrumentation/zkv1000/emission', 0.2) }], |
|
174 |
[[' ', 'BACK'], func { me.MENUsoftkey('GENERAL OPTIONS') }], |
|
175 |
], |
|
176 |
'GENERAL OPTIONS': [ |
|
177 |
[['ADJUST BACKLIGHT'], func { me.MENUsoftkey('BACKLIGHT LEVEL') }], |
|
178 |
[['MAX NAVAIDS SHOW'], void], |
|
179 |
], |
|
180 |
}; |
|
181 |
}, |
|
182 |
}; |
|
183 | ||
PFD+MFD allumés ensemble
|
184 |
var powerOn = func { |
185 |
device[0] = deviceClass.new(0); |
|
186 |
device[1] = deviceClass.new(1); |
|
correction listeners
|
187 |
settimer(setListeners, 5); |
commit initial
|
188 |
} |