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 |
# les listeners triggent en permanence sur les fréquences... |
31 |
var setListeners = func { |
|
32 |
setlistener('/instrumentation/nav/nav-id', |
|
correction listeners
|
33 |
func (n) { |
34 |
var val = n.getValue(); |
|
creates flightdeck hash to p...
|
35 |
foreach (var c; keys(flightdeck)) |
36 |
if (flightdeck[c] != nil) |
|
37 |
flightdeck[c].display.updateNAV({'nav-id': 1, val: val}); |
|
NAV disponible (hors CDI)
|
38 |
}, 1, 2); |
39 |
setlistener('/instrumentation/nav[1]/nav-id', |
|
correction listeners
|
40 |
func (n) { |
41 |
var val = n.getValue(); |
|
creates flightdeck hash to p...
|
42 |
foreach (var c; keys(flightdeck)) |
43 |
if (flightdeck[c] != nil) |
|
44 |
flightdeck[c].display.updateNAV({'nav-id': 2, val: val}); |
|
NAV disponible (hors CDI)
|
45 |
}, 1, 2); |
Correction swap NAV tuning
|
46 |
setlistener('/instrumentation/zkv1000/radios/nav-tune', |
correction listeners
|
47 |
func (n) { |
48 |
var val = n.getValue(); |
|
Correction swap NAV tuning
|
49 |
setNavTune(); |
creates flightdeck hash to p...
|
50 |
foreach (var c; keys(flightdeck)) |
51 |
if (flightdeck[c] != nil) |
|
52 |
flightdeck[c].display.updateNAV({tune: val}); |
|
correction listeners
|
53 |
}, 1, 2); |
54 |
setlistener('/instrumentation/zkv1000/radios/comm-tune', |
|
55 |
func (n) { |
|
56 |
var val = n.getValue(); |
|
57 |
setCommTune(); |
|
creates flightdeck hash to p...
|
58 |
foreach (var c; keys(flightdeck)) |
59 |
if (flightdeck[c] != nil) |
|
60 |
flightdeck[c].display.updateCOMM({tune: val}); |
|
Correction swap NAV tuning
|
61 |
}, 1, 2); |
animation HDG bug
|
62 |
setlistener('/instrumentation/zkv1000/afcs/heading-bug-deg', |
63 |
func (n) { |
|
64 |
var val = n.getValue(); |
|
65 |
if (val != nil) { |
|
creates flightdeck hash to p...
|
66 |
foreach (var c; keys(flightdeck)) |
67 |
if (flightdeck[c] != nil and flightdeck[c].role == 'PFD') |
|
68 |
flightdeck[c].display.updateHDG(val); |
|
animation HDG bug
|
69 |
} |
70 |
}, 0, 2); |
|
new var organistaion (and fi...
|
71 |
setlistener('/instrumentation/zkv1000/PFD/knobs/CRS', |
anime CRS
|
72 |
func (n) { |
73 |
var val = n.getValue(); |
|
74 |
if (val != nil) { |
|
creates flightdeck hash to p...
|
75 |
foreach (var c; keys(flightdeck)) |
76 |
if (flightdeck[c] != nil and flightdeck[c].role == 'PFD') |
|
77 |
flightdeck[c].display.updateCRS(); |
|
anime CRS
|
78 |
} |
79 |
}, 0, 2); |
|
adds OAT, TAS, GSPD, WindDat...
|
80 |
setlistener('/instrumentation/zkv1000/afcs/selected-alt-ft', |
81 |
func (n) { |
|
82 |
var val = n.getValue(); |
|
creates flightdeck hash to p...
|
83 |
if (val != nil) |
84 |
foreach (var c; keys(flightdeck)) |
|
85 |
if (flightdeck[c] != nil and flightdeck[c].role == 'PFD') { |
|
86 |
if (! flightdeck[c].display.screenElements['SelectedALT'].getVisible()) { |
|
87 |
flightdeck[c].display.screenElements['SelectedALT'].show(); |
|
88 |
flightdeck[c].display.screenElements['SelectedALT-text'].show(); |
|
89 |
flightdeck[c].display.screenElements['SelectedALT-symbol'].show(); |
|
90 |
flightdeck[c].display.screenElements['SelectedALT-bug'].show(); |
|
91 |
flightdeck[c].display.screenElements['SelectedALT-bg'].show(); |
|
92 |
} |
|
93 |
flightdeck[c].display.updateSelectedALT(); |
|
94 |
} |
|
adds OAT, TAS, GSPD, WindDat...
|
95 |
}, 0, 2); |
adds transponder
|
96 |
setlistener('/gear/gear/wow', |
creates flightdeck hash to p...
|
97 |
func foreach (var c; keys(flightdeck)) |
98 |
if (flightdeck[c] != nil and flightdeck[c].role == 'PFD') |
|
99 |
flightdeck[c].display.updateXPDR(), |
|
adds transponder
|
100 |
0, 0); |
adds BARO settings
|
101 |
setlistener('/instrumentation/altimeter/setting-inhg', |
creates flightdeck hash to p...
|
102 |
func foreach (var c; keys(flightdeck)) |
103 |
if (flightdeck[c] != nil and flightdeck[c].role == 'PFD') |
|
104 |
flightdeck[c].display.updateBARO(), 0, 2); |
|
NAV disponible (hors CDI)
|
105 |
} |
106 | ||
commit initial
|
107 |
var deviceClass = { |
new var organistaion (and fi...
|
108 |
new: func (role) { |
commit initial
|
109 |
var m = { parents: [ deviceClass ] }; |
new var organistaion (and fi...
|
110 |
m.role = role; |
111 |
m.node = zkv.getNode(role, 1); |
|
add V-speeds bugs
|
112 |
m.data = {}; |
113 |
foreach (var v; ['Vx', 'Vy', 'Vr', 'Vglide']) { |
|
114 |
m.data[v] = alerts.getNode(v).getValue(); |
|
115 |
m.data[v ~ '-visible'] = 1; |
|
116 |
} |
|
pass device pointer to displ...
|
117 |
m.display = displayClass.new(m, m.role); |
commit initial
|
118 |
m.display.showInitProgress(m.role); |
softkeys are available now
|
119 |
m.softkeys = softkeysClass.new(m, m.node, m.role); |
XPDR settings via knob or so...
|
120 |
m.buttons = buttonsClass.new(m.node); |
121 |
m.knobs = knobsClass.new(m); |
|
commit initial
|
122 |
m.display.loadsvg(); |
AI disponible
|
123 |
m.display.loadGroup({ |
124 |
hide : [ |
|
commit initial
|
125 |
'Failures', |
126 |
'SoftKeysTexts', |
|
127 |
'PFD-Widgets', |
|
128 |
'COMM', |
|
129 |
'XPDR-TIME', |
|
130 |
'NAV', |
|
131 |
'FlightInstruments', |
|
132 |
'VDI', |
|
133 |
'OMI', |
|
AI disponible
|
134 |
], |
135 |
clip : 'PitchScale', |
|
136 |
}); |
|
TMR/REF window
|
137 |
m.windows = pageClass.new(m); |
commit initial
|
138 |
zkv.getNode(m.role ~ 'init').setIntValue(0); |
new var organistaion (and fi...
|
139 |
setprop('/instrumentation/zkv1000/' ~ m.role ~ '/status', 1); |
PFD+MFD allumés ensemble
|
140 |
msg(m.role ~ ' switched on!'); |
commit initial
|
141 |
return m; |
142 |
}, |
|
143 |
}; |
|
144 | ||
PFD+MFD allumés ensemble
|
145 |
var powerOn = func { |
creates flightdeck hash to p...
|
146 |
foreach (var role; keys(flightdeck)) |
new var organistaion (and fi...
|
147 |
if (zkv.getNode(role) != nil) |
148 |
# thread.newthread(func { |
|
creates flightdeck hash to p...
|
149 |
flightdeck[role] = deviceClass.new(role); |
new var organistaion (and fi...
|
150 |
# }); |
correction listeners
|
151 |
settimer(setListeners, 5); |
commit initial
|
152 |
} |