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); |
NAV disponible (hors CDI)
|
61 |
} |
62 | ||
commit initial
|
63 |
var deviceClass = { |
64 |
new: func (d) { |
|
65 |
var m = { parents: [ deviceClass ] }; |
|
66 |
m.role = d ? 'MFD' : 'PFD'; |
|
67 |
m.node = zkv.getNode('device[' ~ d ~ ']', 1); |
|
68 |
m.display = displayClass.new(m.node, m.role); |
|
69 |
m.display.showInitProgress(m.role); |
|
70 |
m.buttons = buttonsClass.new(m.node); |
|
71 |
m.knobs = knobsClass.new(m.node); |
|
72 |
m.softkeys = softkeysClass.new(m.node, m.role); |
|
73 |
m.display.loadsvg(); |
|
AI disponible
|
74 |
m.display.loadGroup({ |
75 |
hide : [ |
|
commit initial
|
76 |
'Failures', |
77 |
'SoftKeysTexts', |
|
78 |
'PFD-Widgets', |
|
79 |
'COMM', |
|
80 |
'XPDR-TIME', |
|
81 |
'NAV', |
|
82 |
'FlightInstruments', |
|
83 |
'VDI', |
|
84 |
'OMI', |
|
AI disponible
|
85 |
], |
86 |
clip : 'PitchScale', |
|
87 |
}); |
|
commit initial
|
88 |
zkv.getNode(m.role ~ 'init').setIntValue(0); |
89 |
m.setstatus(d + 1); |
|
PFD+MFD allumés ensemble
|
90 |
msg(m.role ~ ' switched on!'); |
commit initial
|
91 |
return m; |
92 |
}, |
|
93 | ||
94 |
status: 0, |
|
95 | ||
96 |
role: '', |
|
97 | ||
98 |
setstatus: func (s) { |
|
99 |
if (s == 1) { |
|
100 |
} |
|
101 |
elsif (s == 2) { |
|
102 |
me.rootmenu = 12; |
|
103 |
me.node.getNode('mfd-title',1).setValue('TOPO'); |
|
104 |
} |
|
105 |
me.status = s; |
|
106 |
me.node.getNode('status', 1).setIntValue(s); |
|
107 |
}, |
|
108 | ||
109 |
|
|
110 |
MFD: func { |
|
111 |
m.rootmenu = 12; |
|
112 |
m.newstatus(2); |
|
113 |
m.node.getNode('mfd-title',1).setValue('TOPO'); |
|
114 |
}, |
|
115 | ||
116 | ||
117 |
MENUkeyItems: {}, |
|
118 | ||
119 |
set_MENUkeyItems: func { |
|
120 |
me.MENUkeyItems = { |
|
121 |
'MAIN MENU': [ |
|
122 |
[['ROUTE MANAGER'], func { me.MENUsoftkey('ROUTE MANAGER') }], |
|
123 |
[['GENERAL OPTIONS'], func { me.MENUsoftkey('GENERAL OPTIONS') }], |
|
124 |
], |
|
125 |
'ROUTE MANAGER': [ |
|
126 |
[[sprintf('%sACTIVATE ROUTE MANAGER', getprop('/autopilot/route-manager/active') ? 'DES' : ''), ' '], |
|
127 |
func { |
|
128 |
getprop('/autopilot/route-manager/route/num') or return; |
|
129 |
setprop('/autopilot/route-manager/current-wp', 0); |
|
130 |
var v = getprop('/autopilot/route-manager/active'); |
|
131 |
setprop('/autopilot/route-manager/active', !v); |
|
132 |
me.mud.node.getNode('line[' ~ me.mud.selected.first_line ~ ']').setValue(sprintf('%sACTIVATE ROUTE MANAGER', v ? '' : 'DES')); |
|
133 |
}], |
|
134 |
[['SEARCH AIRPORT'], void], |
|
135 |
[['SEARCH NAVAID'], void], |
|
136 |
[['SEARCH FIX'], void], |
|
137 |
[['BACK'], func { me.MENUsoftkey('MAIN MENU') }], |
|
138 |
], |
|
139 |
'BACKLIGHT LEVEL': [ |
|
140 |
[['HIGH'], func { setprop('/instrumentation/zkv1000/emission', 1.0) }], |
|
141 |
[['MEDIUM HIGH'], func { setprop('/instrumentation/zkv1000/emission', 0.6) }], |
|
142 |
[['MEDIUM LOW'], func { setprop('/instrumentation/zkv1000/emission', 0.4) }], |
|
143 |
[['LOW'], func { setprop('/instrumentation/zkv1000/emission', 0.2) }], |
|
144 |
[[' ', 'BACK'], func { me.MENUsoftkey('GENERAL OPTIONS') }], |
|
145 |
], |
|
146 |
'GENERAL OPTIONS': [ |
|
147 |
[['ADJUST BACKLIGHT'], func { me.MENUsoftkey('BACKLIGHT LEVEL') }], |
|
148 |
[['MAX NAVAIDS SHOW'], void], |
|
149 |
], |
|
150 |
}; |
|
151 |
}, |
|
152 |
}; |
|
153 | ||
PFD+MFD allumés ensemble
|
154 |
var powerOn = func { |
155 |
device[0] = deviceClass.new(0); |
|
156 |
device[1] = deviceClass.new(1); |
|
correction listeners
|
157 |
settimer(setListeners, 5); |
commit initial
|
158 |
} |