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