commit initial
|
1 |
# Nasal files to be loaded at start |
2 |
# the order could be important as some files need other one to be loaded first |
|
3 |
files_to_load = [ |
|
4 |
'lib.nas', # some useful functions, should stay first loaded |
|
Correction swap NAV tuning
|
5 |
'radios.nas', # all about radios COMM, NAV, XPDR |
commit initial
|
6 |
'knobs.nas', # handles knobs |
7 |
'buttons.nas', # handles knobs and buttons |
|
8 |
'softkeys.nas',# handles softkeys and menus items |
|
adds Map on MFD
|
9 |
'map.nas', # moves the maps |
commit initial
|
10 |
'display.nas', |
add window management
|
11 |
'menu.nas', # manage windows |
commit initial
|
12 |
'core.nas', # the scheduler and switch on button |
13 |
]; |
|
14 |
# 'afcs.nas', # Automatic Flight Control System |
|
15 |
# 'routes.nas', # manages flightplans and routes |
|
16 |
# 'display.nas', # display messages and popups |
|
17 |
# 'infos.nas', # get informations from environment |
|
18 |
# 'alerts.nas', # in flight tests |
|
19 |
# 'mud.nas', # displays simple embedded GUI (Multi-Use Display) |
|
20 | ||
adds the avaibility to have ...
|
21 |
var flightdeck = {}; |
22 | ||
commit initial
|
23 |
var zkv = cdi = radios = alerts = infos = cursors = afcs = eis = nil; |
24 | ||
25 |
var init_props = func { |
|
26 |
zkv = props.globals.getNode('/instrumentation/zkv1000',1); |
|
adds the avaibility to have ...
|
27 |
foreach (var d; zkv.getChildren()) |
28 |
if (d.getNode('status') != nil) |
|
29 |
flightdeck[d.getName()] = nil; |
|
commit initial
|
30 |
zkv.getNode('emission',1).setDoubleValue(0.5); |
31 |
zkv.getNode('body-emission',1).setDoubleValue(0.0); |
|
32 |
zkv.getNode('body-texture',1).setValue(''); |
|
33 |
zkv.getNode('display-brightness-norm',1).setValue(0.5); |
|
34 | ||
35 |
radios = zkv.getNode('radios', 1); |
|
36 |
radios.getNode('nav1-selected',1).setIntValue(0); |
|
37 |
radios.getNode('nav1-standby',1).setIntValue(0); |
|
38 |
radios.getNode('nav2-selected',1).setIntValue(0); |
|
39 |
radios.getNode('nav2-standby',1).setIntValue(0); |
|
40 |
radios.getNode('nav-tune',1).setIntValue(0); |
|
41 |
radios.getNode('nav-freq-mhz',1).alias('/instrumentation/nav/frequencies/standby-mhz'); |
|
42 |
radios.getNode('comm1-selected',1).setIntValue(1); |
|
43 |
radios.getNode('comm2-selected',1).setIntValue(0); |
|
44 |
radios.getNode('comm-tune',1).setIntValue(0); |
|
45 |
radios.getNode('comm-freq-mhz',1).alias('/instrumentation/comm/frequencies/standby-mhz'); |
|
46 |
radios.getNode('xpdr-mode',1).setValue('GND'); |
|
adds BRG1/2 animation
|
47 |
radios.getNode('brg1-source',1).setValue('OFF'); |
48 |
radios.getNode('brg2-source',1).setValue('OFF'); |
|
commit initial
|
49 | |
adds CDI
|
50 |
cdi = zkv.getNode('cdi', 1); |
51 |
cdi.getNode('source', 1).setValue('OFF'); |
|
52 |
cdi.getNode('no-flag', 1).setBoolValue(0); |
|
53 |
cdi.getNode('FROM-flag', 1).alias('no-flag'); |
|
54 |
cdi.getNode('TO-flag', 1).alias('no-flag'); |
|
55 |
cdi.getNode('course', 1); |
|
56 |
cdi.getNode('course-deflection', 1); |
|
57 |
cdi.getNode('radial', 1); |
|
58 |
cdi.getNode('in-range', 1); |
|
59 | ||
commit initial
|
60 |
alerts = zkv.getNode('alerts',1); |
61 |
alerts.getNode('traffic-proximity',1).setIntValue(0); |
|
62 |
alerts.getNode('marker-beacon', 1).setIntValue(0); |
|
63 |
alerts.getNode('warning', 1).setBoolValue(0); |
|
64 |
alerts.getNode('alert', 1).setBoolValue(0); |
|
65 |
alerts.getNode('message', 1).setValue(''); |
|
add V-speeds bugs
|
66 |
var v = getprop('/instrumentation/zkv1000/alerts/Vx'); |
67 |
alerts.getNode('Vx', 1).setIntValue(v != nil ? v : 999); |
|
68 |
v = getprop('/instrumentation/zkv1000/alerts/Vy'); |
|
69 |
alerts.getNode('Vy', 1).setIntValue(v != nil ? v : 999); |
|
70 |
v = getprop('/instrumentation/zkv1000/alerts/Vr'); |
|
71 |
alerts.getNode('Vr', 1).setIntValue(v != nil ? v : 999); |
|
72 |
v = getprop('/instrumentation/zkv1000/alerts/Vglide'); |
|
73 |
alerts.getNode('Vglide', 1).setIntValue(v != nil ? v : 999); |
|
add Vne Vspeed specific to a...
|
74 |
v = getprop('/instrumentation/zkv1000/alerts/Vne'); |
75 |
alerts.getNode('Vne', 1).setIntValue(v != nil ? v : 999); |
|
commit initial
|
76 | |
77 |
afcs = zkv.getNode('afcs',1); |
|
78 |
afcs.getNode('fd-bars-visible',1).setBoolValue(0); |
|
79 |
afcs.getNode('alt-bug-visible',1).setBoolValue(0); |
|
80 |
afcs.getNode('heading-bug-deg',1).setDoubleValue(getprop('/orientation/heading-magnetic-deg')); |
|
81 |
afcs.getNode('target-pitch-deg',1).setDoubleValue(0.0); |
|
adds OAT, TAS, GSPD, WindDat...
|
82 |
afcs.getNode('selected-alt-ft',1).setIntValue(2000); |
commit initial
|
83 |
afcs.getNode('selected-alt-ft-diff',1).setDoubleValue(0.0); |
84 |
afcs.getNode('selected-ias-kt-diff',1).setDoubleValue(0.0); |
|
85 |
afcs.getNode('vertical-speed-fpm',1).setDoubleValue(0.0); |
|
86 |
afcs.getNode('roll-armed', 1).setBoolValue(0); |
|
87 |
afcs.getNode('pitch-armed', 1).setBoolValue(0); |
|
88 |
afcs.getNode('roll-armed-mode-text',1).setValue(''); |
|
89 |
afcs.getNode('roll-active-mode-text',1).setValue(''); |
|
90 |
afcs.getNode('roll-armed-mode',1).setIntValue(0); |
|
91 |
afcs.getNode('roll-active-mode',1).setIntValue(0); |
|
92 |
afcs.getNode('roll-active-mode-blink',1).setBoolValue(0); |
|
93 |
afcs.getNode('pit-armed-mode-text',1).setValue(''); |
|
94 |
afcs.getNode('pit-active-mode-text',1).setValue(''); |
|
95 |
afcs.getNode('pit-armed-mode',1).setIntValue(0); |
|
96 |
afcs.getNode('pit-active-mode',1).setIntValue(0); |
|
97 |
afcs.getNode('pit-active-mode-blink',1).setBoolValue(0); |
|
98 |
afcs.getNode('route',1); |
|
99 | ||
animation texts EIS + power ...
|
100 |
eis = zkv.getNode('eis',1); |
101 |
eis.getNode('fuel-qty-at-start', 1).setValue( |
|
102 |
getprop('/consumables/fuel/tank/level-gal_us') |
|
103 |
+ getprop('/consumables/fuel/tank/level-gal_us')); |
|
104 | ||
adds Map on MFD
|
105 |
setprop('/sim/gui/dialogs/map-canvas/draw-APT', 1); |
106 |
setprop('/sim/gui/dialogs/map-canvas/draw-FIX', 1); |
|
107 |
setprop('/sim/gui/dialogs/map-canvas/draw-VOR', 1); |
|
108 |
setprop('/sim/gui/dialogs/map-canvas/draw-DME', 1); |
|
109 |
setprop('/sim/gui/dialogs/map-canvas/draw-NDB', 1); |
|
110 |
setprop('/sim/gui/dialogs/map-canvas/draw-TFC', 1); |
|
111 |
setprop('/sim/gui/dialogs/map-canvas/draw-data', 1); |
|
112 |
setprop('/sim/gui/dialogs/map-canvas/draw-FLT', 1); |
|
113 |
setprop('/sim/gui/dialogs/map-canvas/draw-WXR', 1); |
|
114 |
setprop('/sim/gui/dialogs/map-canvas/draw-TUT', 1); |
|
115 |
setprop('/sim/gui/dialogs/map-canvas/aircraft-heading-up', 0); |
|
116 |
mfd = zkv.getNode('mfd', 1); |
|
117 |
var tiles_server = getprop('/sim/online-tiles-server'); |
|
118 |
var tiles_type = getprop('/sim/online-tiles-type'); |
|
fix tiles server
|
119 |
# see https://www.wikimedia.org/wiki/Maps |
120 |
mfd.getNode('online-tiles-server', 1).setValue(tiles_server != nil ? tiles_server : 'maps.wikimedia.org'); |
|
adds Map on MFD
|
121 |
mfd.getNode('online-tiles-type', 1).setValue(tiles_type != nil ? tiles_type : 'osm-intl'); |
122 | ||
commit initial
|
123 |
props.globals.getNode('/instrumentation/transponder/id-code',1).setIntValue(1200); |
124 |
props.globals.getNode('/instrumentation/transponder/serviceable',1).setBoolValue(1); |
|
125 |
props.globals.getNode('/autopilot/settings/heading-bug-deg', 1).alias('/instrumentation/zkv1000/afcs/heading-bug-deg'); |
|
126 |
props.globals.getNode('/autopilot/settings/target-altitude-ft',1).setDoubleValue(0.0); |
|
127 |
props.globals.getNode('/autopilot/settings/target-speed-kt',1).setDoubleValue(0.0); |
|
128 |
props.globals.getNode('/autopilot/settings/vertical-speed-fpm',1).setDoubleValue(0.0); |
|
129 |
props.globals.getNode('/autopilot/internal/target-pitch-deg',1).setDoubleValue(0.0); |
|
130 |
props.globals.getNode('/autopilot/internal/flc-altitude-pitch-deg',1).setDoubleValue(0.0); |
|
131 |
props.globals.getNode('/autopilot/internal/flc-airspeed-pitch-deg',1).setDoubleValue(0.0); |
|
132 |
props.globals.getNode('/autopilot/internal/target-roll-deg',1).setDoubleValue(0.0); |
|
133 |
props.globals.getNode('/autopilot/locks/pitch',1).setValue(''); |
|
134 |
props.globals.getNode('/autopilot/locks/roll',1).setValue(''); |
|
135 |
props.globals.getNode('/autopilot/locks/passive-mode', 1).setIntValue(1); |
|
136 |
} |
|
137 | ||
138 |
var set_listeners = func { |
|
139 |
# setlistener('/instrumentation/nav[0]/radials/selected-deg', popup_course_info, 0, 0); |
|
140 |
# setlistener('/instrumentation/nav[1]/radials/selected-deg', popup_course_info, 0, 0); |
|
141 |
# setlistener('/instrumentation/zkv1000/afcs/heading-bug-deg',popup_hdg_info, 0, 0); |
|
142 |
# setlistener('/instrumentation/zkv1000/afcs/selected-alt-ft',popup_selected_alt, 0, 0); |
|
143 |
# setlistener('/instrumentation/zkv1000/radios/nav-tune', setNavTune, 0, 0); |
|
144 |
# setlistener('/instrumentation/zkv1000/radios/comm-tune', setCommTune, 0, 0); |
|
145 |
} |
|
146 | ||
147 |
var load_nasal = func { |
|
148 |
var zkv1000_dir = getprop('/sim/fg-aircraft') ~ '/Instruments-3d/zkv1000/Nasal/'; |
|
149 |
for (var i = 0; i < size(files_to_load); i += 1) |
|
150 |
io.load_nasal(zkv1000_dir ~ files_to_load[i], 'zkv1000'); |
|
151 |
files_to_load = nil; |
|
152 |
} |
|
153 | ||
154 |
var load_multikey = func { |
|
155 |
fgcommand('loadxml', props.Node.new({ |
|
156 |
'filename': getprop('/sim/fg-aircraft') ~ '/Instruments-3d/zkv1000/Systems/multikey.xml', |
|
157 |
'targetnode': '/input/keyboard/' |
|
158 |
})); |
|
159 |
multikey.init(); |
|
160 |
} |
|
161 | ||
162 |
var zkv1000_init = func { |
|
init listener needed only on...
|
163 |
removelistener(init); |
commit initial
|
164 |
load_multikey(); |
165 |
load_nasal(); |
|
166 |
init_props(); |
|
167 |
set_listeners(); |
|
168 |
print('zkv1000 loaded'); |
|
169 |
} |
|
170 | ||
init listener needed only on...
|
171 |
var init = setlistener('/sim/signals/fdm-initialized', zkv1000_init, 0, 0); |
commit initial
|
172 |