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 = { |
new var organistaion (and fi...
|
72 |
new: func (role) { |
commit initial
|
73 |
var m = { parents: [ deviceClass ] }; |
new var organistaion (and fi...
|
74 |
m.role = role; |
75 |
m.node = zkv.getNode(role, 1); |
|
add V-speeds bugs
|
76 |
m.data = {}; |
77 |
foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide']) { |
|
78 |
m.data[v] = alerts.getNode(v).getValue(); |
|
79 |
m.data[v ~ '-visible'] = 1; |
|
80 |
} |
|
pass device pointer to displ...
|
81 |
m.display = displayClass.new(m, m.role); |
commit initial
|
82 |
m.display.showInitProgress(m.role); |
softkeys are available now
|
83 |
m.softkeys = softkeysClass.new(m, m.node, m.role); |
XPDR settings via knob or so...
|
84 |
m.buttons = buttonsClass.new(m.node); |
85 |
m.knobs = knobsClass.new(m); |
|
commit initial
|
86 |
m.display.loadsvg(); |
AI disponible
|
87 |
m.display.loadGroup({ |
88 |
hide : [ |
|
commit initial
|
89 |
'Failures', |
90 |
'SoftKeysTexts', |
|
91 |
'PFD-Widgets', |
|
92 |
'COMM', |
|
93 |
'XPDR-TIME', |
|
94 |
'NAV', |
|
95 |
'FlightInstruments', |
|
96 |
'VDI', |
|
97 |
'OMI', |
|
AI disponible
|
98 |
], |
99 |
clip : 'PitchScale', |
|
100 |
}); |
|
TMR/REF window
|
101 |
m.windows = pageClass.new(m); |
commit initial
|
102 |
zkv.getNode(m.role ~ 'init').setIntValue(0); |
new var organistaion (and fi...
|
103 |
setprop('/instrumentation/zkv1000/' ~ m.role ~ '/status', 1); |
PFD+MFD allumés ensemble
|
104 |
msg(m.role ~ ' switched on!'); |
commit initial
|
105 |
return m; |
106 |
}, |
|
107 |
}; |
|
108 | ||
PFD+MFD allumés ensemble
|
109 |
var powerOn = func { |
creates flightdeck hash to p...
|
110 |
foreach (var role; keys(flightdeck)) |
new var organistaion (and fi...
|
111 |
if (zkv.getNode(role) != nil) |
112 |
# thread.newthread(func { |
|
creates flightdeck hash to p...
|
113 |
flightdeck[role] = deviceClass.new(role); |
new var organistaion (and fi...
|
114 |
# }); |
correction listeners
|
115 |
settimer(setListeners, 5); |
commit initial
|
116 |
} |