NAV disponible (hors CDI)
|
1 |
var setListeners = func { |
listeners stored in data str...
|
2 |
var prop = '/instrumentation/nav/nav-id'; |
3 |
data.listeners[prop] = setlistener(prop, |
|
correction listeners
|
4 |
func (n) { |
5 |
var val = n.getValue(); |
|
creates flightdeck hash to p...
|
6 |
foreach (var c; keys(flightdeck)) |
removes unecessary listeners
|
7 |
flightdeck[c].display.updateNAV({'nav-id': 1, val: val}); |
NAV disponible (hors CDI)
|
8 |
}, 1, 2); |
listeners stored in data str...
|
9 | |
10 |
prop = '/instrumentation/nav[1]/nav-id'; |
|
11 |
data.listeners[prop] = setlistener(prop, |
|
correction listeners
|
12 |
func (n) { |
13 |
var val = n.getValue(); |
|
creates flightdeck hash to p...
|
14 |
foreach (var c; keys(flightdeck)) |
removes unecessary listeners
|
15 |
flightdeck[c].display.updateNAV({'nav-id': 2, val: val}); |
NAV disponible (hors CDI)
|
16 |
}, 1, 2); |
listeners stored in data str...
|
17 | |
18 |
# keep this listener as long as the code is to heavy to be modified in multiple places |
|
remove hardcoded properties ...
|
19 |
prop = afcs.getNode('selected-alt-ft').getPath(); |
listeners stored in data str...
|
20 |
data.listeners[prop] = setlistener(prop, |
adds OAT, TAS, GSPD, WindDat...
|
21 |
func (n) { |
22 |
var val = n.getValue(); |
|
creates flightdeck hash to p...
|
23 |
if (val != nil) |
24 |
foreach (var c; keys(flightdeck)) |
|
removes unecessary listeners
|
25 |
if (flightdeck[c].role == 'PFD') { |
creates flightdeck hash to p...
|
26 |
if (! flightdeck[c].display.screenElements['SelectedALT'].getVisible()) { |
27 |
flightdeck[c].display.screenElements['SelectedALT'].show(); |
|
28 |
flightdeck[c].display.screenElements['SelectedALT-text'].show(); |
|
29 |
flightdeck[c].display.screenElements['SelectedALT-symbol'].show(); |
|
30 |
flightdeck[c].display.screenElements['SelectedALT-bug'].show(); |
|
31 |
flightdeck[c].display.screenElements['SelectedALT-bg'].show(); |
|
32 |
} |
|
33 |
flightdeck[c].display.updateSelectedALT(); |
|
34 |
} |
|
adds OAT, TAS, GSPD, WindDat...
|
35 |
}, 0, 2); |
listeners stored in data str...
|
36 | |
37 |
prop = '/gear/gear/wow'; |
|
38 |
data.listeners[prop] = setlistener(prop, |
|
creates flightdeck hash to p...
|
39 |
func foreach (var c; keys(flightdeck)) |
removes unecessary listeners
|
40 |
if (flightdeck[c].role == 'PFD') |
creates flightdeck hash to p...
|
41 |
flightdeck[c].display.updateXPDR(), |
adds transponder
|
42 |
0, 0); |
listeners stored in data str...
|
43 | |
fix setlistener on tied prop...
|
44 |
prop = misc.getNode('alt-setting-inhg').getPath(); |
listeners stored in data str...
|
45 |
data.listeners[prop] = setlistener(prop, |
creates flightdeck hash to p...
|
46 |
func foreach (var c; keys(flightdeck)) |
removes unecessary listeners
|
47 |
if (flightdeck[c].role == 'PFD') |
creates flightdeck hash to p...
|
48 |
flightdeck[c].display.updateBARO(), 0, 2); |
adds route display on map
|
49 | |
50 |
prop = '/autopilot/route-manager/signals/edited'; |
|
51 |
data.listeners[prop] = setlistener(prop, |
|
52 |
func foreach (var c; keys(flightdeck)) |
|
53 |
flightdeck[c].map.layers.route.onFlightPlanChange(), |
|
54 |
0, 1); |
|
55 | ||
56 |
prop = '/autopilot/route-manager/current-wp'; |
|
57 |
data.listeners[prop] = setlistener(prop, |
|
fix map display makes FG to ...
|
58 |
func (n) { |
59 |
var delay = maketimer(2, func { |
|
60 |
foreach (var c; keys(flightdeck)) |
|
61 |
flightdeck[c].map.layers.route.onCurrentWaypointChange( |
|
62 |
props.globals.getNode('/autopilot/route-manager/current-wp')); |
|
63 |
}); |
|
64 |
delay.singleShot = 1; |
|
65 |
delay.start(); |
|
66 |
}, 0, 1); |
|
adds route display on map
|
67 | |
68 |
prop = '/autopilot/route-manager/active'; |
|
69 |
data.listeners[prop] = setlistener(prop, |
|
70 |
func foreach (var c; keys(flightdeck)) |
|
71 |
flightdeck[c].map.layers.route.onCurrentWaypointChange(props.globals.getNode('/autopilot/route-manager/current-wp')), |
|
72 |
0, 1); |
|
NAV disponible (hors CDI)
|
73 |
} |
74 | ||
commit initial
|
75 |
var deviceClass = { |
improves role/name variables...
|
76 |
new: func (name) { |
commit initial
|
77 |
var m = { parents: [ deviceClass ] }; |
improves role/name variables...
|
78 |
m.name = name; |
79 |
m.role = substr(name, 0, 3); |
|
80 |
m.node = zkv.getNode(name, 1); |
|
add V-speeds bugs
|
81 |
m.data = {}; |
first attempt to centralize ...
|
82 |
m.timers = {}; |
put Vspeeds in common data s...
|
83 |
foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide']) |
add V-speeds bugs
|
84 |
m.data[v ~ '-visible'] = 1; |
configurable display size, v...
|
85 |
foreach (var v; ['screen-object', 'screen-view', 'screen-size']) |
remove hardcoded properties ...
|
86 |
m.data[v] = getprop(zkv.getPath() ~ '/' ~ name ~ '/' ~ v); |
massive code reorganisation ...
|
87 | |
improves role/name variables...
|
88 |
m.display = displayClass.new(m); |
89 |
m.softkeys = softkeysClass.new(m); |
|
90 |
m.buttons = buttonsClass.new(m); |
|
XPDR settings via knob or so...
|
91 |
m.knobs = knobsClass.new(m); |
just a alignment
|
92 |
m.map = mapClass.new(m); |
TMR/REF window
|
93 |
m.windows = pageClass.new(m); |
massive code reorganisation ...
|
94 | |
fix setlistener on tied prop...
|
95 |
if (! contains(data.timers, 'alt-setting-inhg')) { |
96 |
data.timers['alt-setting-inhg'] = maketimer(0.1, m, func { |
|
97 |
var inhg = getprop('/instrumentation/altimeter/setting-inhg'); |
|
98 |
if (inhg != misc.getValue('alt-setting-inhg')) |
|
99 |
misc.getNode('alt-setting-inhg').setValue(inhg); |
|
100 |
}); |
|
101 |
data.timers['alt-setting-inhg'].start(); |
|
102 |
} |
|
massive code reorganisation ...
|
103 |
if (! contains(data.timers, 'map')) { |
104 |
data.timers.map = maketimer(1, m, func { |
|
105 |
foreach (var d; keys(flightdeck)) |
|
106 |
flightdeck[d].map.update(); |
|
107 |
var gspd = getprop('/velocities/groundspeed-kt'); |
|
108 |
if (gspd != 0) |
|
109 |
var next = (me.data['range-nm']/(gspd/3600))/(me.display.display.get('view[1]')/2); |
|
110 |
else |
|
111 |
var next = 10; |
|
112 |
if (next > 10) |
|
113 |
next = 10; |
|
114 |
data.timers.map.restart(next); |
|
115 |
}); |
|
116 |
data.timers.map.singleShot = 1; |
|
117 |
data.timers.map.start(); |
|
118 |
} |
|
add TCAS
|
119 |
if (getprop('/instrumentation/tcas/serviceable') != nil) { |
120 |
m.data.tcas = 0; |
|
121 |
if (!contains(data.timers, 'tcas')) { |
|
122 |
data.timers.tcas = maketimer ( 1, |
|
123 |
func { |
|
124 |
var tcas_dirty = []; |
|
125 |
var _range = 6; |
|
126 |
var _minLevel = -1; |
|
127 |
foreach (var ac; props.globals.getNode("/ai/models").getChildren("multiplayer")) { |
|
128 |
if (ac.getValue("valid")) { |
|
129 |
var range = ac.getNode("radar/range-nm").getValue(); |
|
130 |
if (range != nil) { |
|
131 |
if (debug.isnan(range) == 0) { |
|
132 |
if ( (range > 0) and (range <= _range) ) { |
|
133 |
var nTcasThreat = ac.getNode("tcas/threat-level"); |
|
134 |
if (nTcasThreat != nil) { |
|
135 |
var level = nTcasThreat.getValue(); |
|
136 |
if (level > _minLevel) { |
|
137 |
var lat = ac.getNode("position/latitude-deg").getValue(); |
|
138 |
var lon = ac.getNode("position/longitude-deg").getValue(); |
|
139 |
var aAlt = ac.getNode("position/altitude-ft").getValue(); |
|
140 |
var vs = ac.getNode("velocities/vertical-speed-fps").getValue(); |
|
141 |
var alt = math.floor(((aAlt - data.alt) / 100) + 0.5); |
|
142 |
if (debug.isnan(lat) == 0 and |
|
143 |
debug.isnan(lon) == 0 and |
|
144 |
debug.isnan(vs) == 0 and |
|
145 |
debug.isnan(alt) == 0) { |
|
146 |
append(tcas_dirty, { |
|
147 |
lat: lat, |
|
148 |
lon: lon, |
|
149 |
vs: vs, |
|
150 |
alt: alt, |
|
151 |
level: level, |
|
152 |
}); |
|
153 |
} } } } } } } } |
|
154 |
data.tcas = tcas_dirty; |
|
155 |
} |
|
156 |
); |
|
157 |
data.timers.tcas.start(); |
|
158 |
} |
|
159 |
} |
|
160 |
else { |
|
161 |
delete(m.softkeys.bindings.PFD.INSET, 'TRAFFIC'); |
|
162 |
delete(m.softkeys.bindings.MFD.MAP, 'TRAFFIC'); |
|
163 |
} |
|
massive code reorganisation ...
|
164 |
m.display.showInitProgress(); |
165 | ||
remove hardcoded properties ...
|
166 |
setprop(zkv.getPath() ~ '/' ~ m.name ~ '/status', 1); |
improves role/name variables...
|
167 |
msg(m.name ~ ' switched on!'); |
commit initial
|
168 |
return m; |
169 |
}, |
|
170 |
}; |
|
171 | ||
PFD+MFD allumés ensemble
|
172 |
var powerOn = func { |
global timers started at pow...
|
173 |
foreach (var freq; keys(data.timers)) |
174 |
data.timers[freq].start(); |
|
175 | ||
improves role/name variables...
|
176 |
foreach (var name; keys(flightdeck)) |
177 |
if (zkv.getNode(name) != nil) |
|
new var organistaion (and fi...
|
178 |
# thread.newthread(func { |
improves role/name variables...
|
179 |
flightdeck[name] = deviceClass.new(name); |
new var organistaion (and fi...
|
180 |
# }); |
correction listeners
|
181 |
settimer(setListeners, 5); |
commit initial
|
182 |
} |