make some data common to all...
|
1 |
data = { # set of data common to all devices |
2 |
roll : 0, |
|
3 |
pitch : 0, |
|
4 |
vsi : 0, |
|
5 |
ias : 0, |
|
6 |
alt : 0, |
|
7 |
hdg : 0, |
|
8 |
wow : 1, |
|
9 |
timers : { |
|
10 |
'20Hz': maketimer ( |
|
11 |
0.05, |
|
12 |
func { |
|
13 |
data.roll = getprop('/orientation/roll-deg'); |
|
14 |
data.pitch = getprop('orientation/pitch-deg'); |
|
15 |
data.vsi = getprop('/instrumentation/vertical-speed-indicator/indicated-speed-fpm'); |
|
16 |
data.ias = getprop('/velocities/airspeed-kt'); |
|
17 |
data.alt = getprop('/instrumentation/altimeter/indicated-altitude-ft'); |
|
18 |
data.hdg = getprop('/orientation/heading-deg'); |
|
19 |
} |
|
20 |
), |
|
21 |
'1Hz': maketimer ( |
|
22 |
1, |
|
23 |
func { |
|
24 |
data.wow = getprop('/gear/gear/wow'); |
|
25 |
} |
|
26 |
), |
|
27 |
}, |
|
28 |
}; |
|
29 | ||
NAV disponible (hors CDI)
|
30 |
var setListeners = func { |
31 |
setlistener('/instrumentation/nav/nav-id', |
|
correction listeners
|
32 |
func (n) { |
33 |
var val = n.getValue(); |
|
creates flightdeck hash to p...
|
34 |
foreach (var c; keys(flightdeck)) |
removes unecessary listeners
|
35 |
flightdeck[c].display.updateNAV({'nav-id': 1, val: val}); |
NAV disponible (hors CDI)
|
36 |
}, 1, 2); |
37 |
setlistener('/instrumentation/nav[1]/nav-id', |
|
correction listeners
|
38 |
func (n) { |
39 |
var val = n.getValue(); |
|
creates flightdeck hash to p...
|
40 |
foreach (var c; keys(flightdeck)) |
removes unecessary listeners
|
41 |
flightdeck[c].display.updateNAV({'nav-id': 2, val: val}); |
NAV disponible (hors CDI)
|
42 |
}, 1, 2); |
removes unecessary listeners
|
43 |
# keep this listener as long as the code is to heavy to be modified in multiple places |
adds OAT, TAS, GSPD, WindDat...
|
44 |
setlistener('/instrumentation/zkv1000/afcs/selected-alt-ft', |
45 |
func (n) { |
|
46 |
var val = n.getValue(); |
|
creates flightdeck hash to p...
|
47 |
if (val != nil) |
48 |
foreach (var c; keys(flightdeck)) |
|
removes unecessary listeners
|
49 |
if (flightdeck[c].role == 'PFD') { |
creates flightdeck hash to p...
|
50 |
if (! flightdeck[c].display.screenElements['SelectedALT'].getVisible()) { |
51 |
flightdeck[c].display.screenElements['SelectedALT'].show(); |
|
52 |
flightdeck[c].display.screenElements['SelectedALT-text'].show(); |
|
53 |
flightdeck[c].display.screenElements['SelectedALT-symbol'].show(); |
|
54 |
flightdeck[c].display.screenElements['SelectedALT-bug'].show(); |
|
55 |
flightdeck[c].display.screenElements['SelectedALT-bg'].show(); |
|
56 |
} |
|
57 |
flightdeck[c].display.updateSelectedALT(); |
|
58 |
} |
|
adds OAT, TAS, GSPD, WindDat...
|
59 |
}, 0, 2); |
adds transponder
|
60 |
setlistener('/gear/gear/wow', |
creates flightdeck hash to p...
|
61 |
func foreach (var c; keys(flightdeck)) |
removes unecessary listeners
|
62 |
if (flightdeck[c].role == 'PFD') |
creates flightdeck hash to p...
|
63 |
flightdeck[c].display.updateXPDR(), |
adds transponder
|
64 |
0, 0); |
adds BARO settings
|
65 |
setlistener('/instrumentation/altimeter/setting-inhg', |
creates flightdeck hash to p...
|
66 |
func foreach (var c; keys(flightdeck)) |
removes unecessary listeners
|
67 |
if (flightdeck[c].role == 'PFD') |
creates flightdeck hash to p...
|
68 |
flightdeck[c].display.updateBARO(), 0, 2); |
NAV disponible (hors CDI)
|
69 |
} |
70 | ||
commit initial
|
71 |
var deviceClass = { |
improves role/name variables...
|
72 |
new: func (name) { |
commit initial
|
73 |
var m = { parents: [ deviceClass ] }; |
improves role/name variables...
|
74 |
m.name = name; |
75 |
m.role = substr(name, 0, 3); |
|
76 |
m.node = zkv.getNode(name, 1); |
|
add V-speeds bugs
|
77 |
m.data = {}; |
78 |
foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide']) { |
|
79 |
m.data[v] = alerts.getNode(v).getValue(); |
|
80 |
m.data[v ~ '-visible'] = 1; |
|
81 |
} |
|
improves role/name variables...
|
82 |
m.display = displayClass.new(m); |
83 |
m.display.showInitProgress(m.name); |
|
84 |
m.softkeys = softkeysClass.new(m); |
|
85 |
m.buttons = buttonsClass.new(m); |
|
XPDR settings via knob or so...
|
86 |
m.knobs = knobsClass.new(m); |
commit initial
|
87 |
m.display.loadsvg(); |
AI disponible
|
88 |
m.display.loadGroup({ |
89 |
hide : [ |
|
commit initial
|
90 |
'Failures', |
91 |
'SoftKeysTexts', |
|
92 |
'PFD-Widgets', |
|
93 |
'COMM', |
|
94 |
'XPDR-TIME', |
|
95 |
'NAV', |
|
96 |
'FlightInstruments', |
|
97 |
'VDI', |
|
98 |
'OMI', |
|
AI disponible
|
99 |
], |
100 |
clip : 'PitchScale', |
|
101 |
}); |
|
TMR/REF window
|
102 |
m.windows = pageClass.new(m); |
improves role/name variables...
|
103 |
zkv.getNode(m.name ~ '-init').setIntValue(0); |
104 |
setprop('/instrumentation/zkv1000/' ~ m.name ~ '/status', 1); |
|
105 |
msg(m.name ~ ' switched on!'); |
|
commit initial
|
106 |
return m; |
107 |
}, |
|
108 |
}; |
|
109 | ||
PFD+MFD allumés ensemble
|
110 |
var powerOn = func { |
improves role/name variables...
|
111 |
foreach (var name; keys(flightdeck)) |
112 |
if (zkv.getNode(name) != nil) |
|
new var organistaion (and fi...
|
113 |
# thread.newthread(func { |
improves role/name variables...
|
114 |
flightdeck[name] = deviceClass.new(name); |
new var organistaion (and fi...
|
115 |
# }); |
correction listeners
|
116 |
settimer(setListeners, 5); |
commit initial
|
117 |
} |