improve single prop EIS
|
1 |
# This is most an example than a really efficient EIS |
2 |
# power % is throttle % |
|
3 |
# assumes that there are two tanks with equals quantity... |
|
EIS can be aircraft specific
|
4 |
displayClass.showEIS = func (groups) { |
path and relpath to zkv1000 ...
|
5 |
canvas.parsesvg(me.screen, data.zkv1000_reldir ~ 'Systems/EIS/single-prop.svg'); |
improve single prop EIS
|
6 |
append(groups.show, 'EIS', 'POWER-pointer', 'FUEL-RIGHT-pointer', 'FUEL-LEFT-pointer'); |
EIS can be aircraft specific
|
7 |
append(groups.text, |
8 |
'RPM-text', 'EGT-text', 'CHT-text', 'FUEL-USED-text', |
|
9 |
'FUEL-FLOW-text', 'MAN-Hg-text', 'POWER-PERCENT-text', |
|
10 |
'RPM-text', 'BUS-V-text', 'BATT-text', 'PSI-text', |
|
11 |
'OIL-TEMP-text' |
|
12 |
); |
|
13 |
}; |
|
14 | ||
15 |
displayClass.updateEIS = func { |
|
16 |
# displays Engine Informations System |
|
massive code reorganisation ...
|
17 |
var running = getprop('/engines/engine/running'); |
18 |
if (running != nil) { |
|
19 |
var power = getprop('/controls/engines/engine/throttle') * running; |
|
20 |
me.screenElements['POWER-pointer'] |
|
21 |
.setRotation(D2R * 140 * power); |
|
22 |
me.screenElements['POWER-PERCENT-text'] |
|
23 |
.setText(sprintf('% 3u', power * 100)); |
|
24 |
me.screenElements['RPM-text'] |
|
25 |
.setText(sprintf(math.round(getprop('/engines/engine/rpm'), 50))); |
|
26 |
me.screenElements['MAN-Hg-text'] |
|
27 |
.setText(sprintf('%.1d', getprop('/engines/engine/mp-inhg'))); |
|
28 |
me.screenElements['FUEL-FLOW-text'] |
|
29 |
.setText(sprintf('%.1f', getprop('/engines/engine/fuel-flow-gph'))); |
|
30 |
if (math.mod(me._eis_count, 10) == 0) { |
|
31 |
var psi = getprop('/engines/engine/oil-pressure-psi'); |
|
32 |
me.screenElements['PSI-text'] |
|
33 |
.setText(psi == nil ? '--' : sprintf('%u', psi)); |
|
34 |
me.screenElements['OIL-TEMP-text'] |
|
35 |
.setText(sprintf('%i', getprop('/engines/engine/oil-temperature-degf'))); |
|
36 |
var full = getprop('/instrumentation/zkv1000/eis/fuel-qty-at-start'); |
|
37 |
var right = getprop('/consumables/fuel/tank/level-gal_us'); |
|
38 |
var left = getprop('/consumables/fuel/tank[1]/level-gal_us'); |
|
39 |
var used_fuel = full - (right + left); |
|
40 |
me.screenElements['FUEL-USED-text'] |
|
41 |
.setText(sprintf('%.1d', used_fuel > 0 ? used_fuel : 0)); |
|
42 |
me.screenElements['FUEL-RIGHT-pointer'] |
|
43 |
.setTranslation( |
|
44 |
0, |
|
fix fuel pointer move
|
45 |
(1 - right / (full/2)) * 80 |
massive code reorganisation ...
|
46 |
); |
47 |
me.screenElements['FUEL-LEFT-pointer'] |
|
48 |
.setTranslation( |
|
49 |
0, |
|
fix fuel pointer move
|
50 |
(1 - left / (full/2)) * 80 |
massive code reorganisation ...
|
51 |
); |
52 |
me.screenElements['BUS-V-text'] |
|
53 |
.setText(sprintf('%.1i', getprop('/systems/electrical/outputs/bus'))); |
|
54 |
me.screenElements['BATT-text'] |
|
55 |
.setText(sprintf('%+i', getprop('/systems/electrical/amps'))); |
|
56 |
var cht = getprop('/engines/engine/cht-degf'); |
|
57 |
me.screenElements['CHT-text'] |
|
58 |
.setText(cht == nil ? '--' : sprintf('%i', cht)); |
|
59 |
me.screenElements['EGT-text'] |
|
60 |
.setText(sprintf('%i', getprop('/engines/engine/egt-degf'))); |
|
61 |
} |
|
EIS can be aircraft specific
|
62 |
} |
improve single prop EIS
|
63 |
settimer(func me.updateEIS(), 0.2); |
EIS can be aircraft specific
|
64 |
me._eis_count += 1; |
65 |
}; |
|
66 | ||
67 |
displayClass._eis_count = 0; |