... | ... |
@@ -1,429 +0,0 @@ |
1 |
-<?xml version="1.0"?> |
|
2 |
- |
|
3 |
-<!-- |
|
4 |
-Buttons 1, 11 and 12 are modifiers |
|
5 |
- |
|
6 |
-Modifier | | button 1 | button 11 | button 12 |
|
7 |
-============================================================================================= |
|
8 |
-Hat up | look up | zoom in | trim elevator up | |
|
9 |
-Hat down | look down | zoom out | trim elevator down | |
|
10 |
-Hat left | look left | reset FoV + heading | trim rudder left | trim aileron left |
|
11 |
-Hat right | look right | reset FoV | trim rudder right | trim aileron right |
|
12 |
- |
|
13 |
-Button 2 | heli view | permanent heli view | show/hide pins | declutter pins |
|
14 |
-Button 3 | brakes | | | |
|
15 |
-Button 4 | PTT COMM 1 | PTT COMM 2 | | |
|
16 |
-Button 5 | flaps down | inHg += 0.01 | | |
|
17 |
-Button 6 | flaps up | inHg -= 0.01 | control all engines | uncontrol all engines |
|
18 |
-Button 7 | inc mixture | inc mixture (x10) | control engine 2 | uncontrol engine 2 |
|
19 |
-Button 8 | dec mixture | dec mixture (x10) | control engine 3 | uncontrol engine 3 |
|
20 |
-Button 9 | inc proppitch | inc proppitch (x10) | control engine 1 | uncontrol engine 1 |
|
21 |
-Button 10 | dec proppitch | dec proppitch (x10) | control engine 0 | uncontrol engine 0 |
|
22 |
- |
|
23 |
-Mouse mode: |
|
24 |
-the mouse mode to control aicraft will be disabled, and restored at the end of the session. |
|
25 |
-Pressing button 2 will also set the mouse mode to control the view direction, and restore its previous |
|
26 |
-state when back to normal view |
|
27 |
- |
|
28 |
-<PropertyList> |
|
29 |
- <nasal> |
|
30 |
- <script><![CDATA[ |
|
31 |
- var skipFlightControls = props.globals.getNode("/sim/mouse/skip-flight-controls-mode"); |
|
32 |
- setlistener("/sim/signals/fdm-initilized", func { |
|
33 |
- skipFlightControls.setBoolValue(1); |
|
34 |
- print("JOYSTICK set mouse flight control OFF: ", skipFlightControls.getValue()); |
|
35 |
- }, 1 ); |
|
36 |
- setlistener("/sim/signals/save", func { |
|
37 |
- skipFlightControls.setBoolValue(0); |
|
38 |
- print("JOYSTICK save mouse flight control ON: ", skipFlightControls.getValue()); |
|
39 |
- } ); |
|
40 |
- |
|
41 |
- # determine Nasal namespace for this joystick |
|
42 |
- # stored in js[0] |
|
43 |
- string.scanf(cmdarg().getNode("module").getValue(), "__js%u", var js = []); |
|
44 |
- |
|
45 |
- # array with prop path for each button status |
|
46 |
- var pressed_button = []; |
|
47 |
- for (var i = 0; i < 12; i += 1) |
|
48 |
- append(pressed_button, "/devices/status/joysticks/joystick[" ~ js[0] ~ "]/button[" ~ i ~ "]"); |
|
49 |
- |
|
50 |
- var previousMouseMode = 0; |
|
51 |
- var locked_view = 0; |
|
52 |
- |
|
53 |
- var chinese_hat = func (heading, pitch) { |
|
54 |
- if (getprop(pressed_button[0])) { |
|
55 |
- if (pitch > 0) view.decrease(); |
|
56 |
- elsif (pitch < 0) view.increase(); |
|
57 |
- elsif (heading > 0){view.resetViewDir();view.resetFOV();} |
|
58 |
- elsif (heading < 0) view.resetFOV(); |
|
59 |
- } |
|
60 |
- elsif (getprop(pressed_button[10])) { |
|
61 |
- if (pitch) |
|
62 |
- controls.elevatorTrim(pitch); |
|
63 |
- else |
|
64 |
- controls.rudderTrim(heading); |
|
65 |
- } |
|
66 |
- elsif (getprop(pressed_button[11]) and heading) { |
|
67 |
- controls.aileronTrim(-heading); |
|
68 |
- } |
|
69 |
- else { |
|
70 |
- if (heading) { |
|
71 |
- fgcommand("property-adjust", { |
|
72 |
- property : "/sim/current-view/goal-heading-offset-deg", |
|
73 |
- step : 2.0 * heading |
|
74 |
- }); |
|
75 |
- } |
|
76 |
- elsif (pitch) { |
|
77 |
- fgcommand("property-adjust", { |
|
78 |
- property : "/sim/current-view/goal-pitch-offset-deg", |
|
79 |
- step : 2.0 * pitch |
|
80 |
- }); |
|
81 |
- } |
|
82 |
- } |
|
83 |
- } |
|
84 |
- |
|
85 |
- var addSelectedEngine = func (i) { |
|
86 |
- controls.engines[i].selected.setBoolValue(1); |
|
87 |
- printf("engine %d added to joystick controls", i); |
|
88 |
- gui.popupTip("engine " ~ i ~ " joystick controlled"); |
|
89 |
- } |
|
90 |
- |
|
91 |
- var removeSelectedEngine = func (i) { |
|
92 |
- controls.engines[i].selected.setBoolValue(0); |
|
93 |
- printf("engine %d removed from joystick controls", i); |
|
94 |
- gui.popupTip("engine " ~ i ~ " joystick uncontrolled"); |
|
95 |
- } |
|
96 |
- |
|
97 |
- # key = button identifier as displayed on joystick |
|
98 |
- joystick_button = { |
|
99 |
- 2 : func (pressed) { |
|
100 |
- if (pressed) { |
|
101 |
- if (getprop(pressed_button[10])) { |
|
102 |
- setprop("/sim/marker-pins/master", !getprop("/sim/marker-pins/master")); |
|
103 |
- } |
|
104 |
- elsif (getprop(pressed_button[11])) { |
|
105 |
- var clutter = { |
|
106 |
- "airports": 1, |
|
107 |
- "pois" : 2, |
|
108 |
- "traffic" : 4, |
|
109 |
- "navaids" : 8, |
|
110 |
- "fixes" : 16 |
|
111 |
- }; |
|
112 |
- var clutter_sum = 0; |
|
113 |
- foreach (var c; keys(clutter)) { |
|
114 |
- clutter_sum += getprop("/sim/marker-pins/" ~ c) * clutter[c] |
|
115 |
- } |
|
116 |
- if (clutter_sum == 1) { |
|
117 |
- setprop("/sim/marker-pins/fixes", 0); |
|
118 |
- setprop("/sim/marker-pins/navaids", 0); |
|
119 |
- setprop("/sim/marker-pins/airports", 1); |
|
120 |
- setprop("/sim/marker-pins/pois", 1); |
|
121 |
- setprop("/sim/marker-pins/traffic", 0); |
|
122 |
- gui.popupTip("Pins: AIRPORTS + POI", 1); |
|
123 |
- } |
|
124 |
- elsif (clutter_sum == 3) { |
|
125 |
- setprop("/sim/marker-pins/fixes", 0); |
|
126 |
- setprop("/sim/marker-pins/navaids", 0); |
|
127 |
- setprop("/sim/marker-pins/airports", 0); |
|
128 |
- setprop("/sim/marker-pins/pois", 0); |
|
129 |
- setprop("/sim/marker-pins/traffic", 1); |
|
130 |
- gui.popupTip("Pins: TRAFFIC", 1); |
|
131 |
- } |
|
132 |
- elsif (clutter_sum == 4) { |
|
133 |
- setprop("/sim/marker-pins/fixes", 1); |
|
134 |
- setprop("/sim/marker-pins/navaids", 1); |
|
135 |
- setprop("/sim/marker-pins/airports", 1); |
|
136 |
- setprop("/sim/marker-pins/pois", 0); |
|
137 |
- setprop("/sim/marker-pins/traffic", 0); |
|
138 |
- gui.popupTip("Pins: AIRPORTS + NAVAIDS + FIXES", 1); |
|
139 |
- } |
|
140 |
- else { |
|
141 |
- setprop("/sim/marker-pins/fixes", 0); |
|
142 |
- setprop("/sim/marker-pins/navaids", 0); |
|
143 |
- setprop("/sim/marker-pins/airports", 1); |
|
144 |
- setprop("/sim/marker-pins/pois", 0); |
|
145 |
- setprop("/sim/marker-pins/traffic", 0); |
|
146 |
- gui.popupTip("Pins: AIRPORTS", 1); |
|
147 |
- } |
|
148 |
- setprop("/sim/marker-pins/master", 1); |
|
149 |
- } |
|
150 |
- else { |
|
151 |
- locked_view = getprop(pressed_button[0]); |
|
152 |
- setprop("/devices/status/mice/mouse[0]/mode", 2); |
|
153 |
- setprop("/sim/current-view/view-number", 1); |
|
154 |
- } |
|
155 |
- } |
|
156 |
- else { |
|
157 |
- if (locked_view) |
|
158 |
- return; |
|
159 |
- setprop("/devices/status/mice/mouse[0]/mode", 0); |
|
160 |
- setprop("/sim/current-view/view-number", 0); |
|
161 |
- } |
|
162 |
- }, |
|
163 |
- |
|
164 |
- 3 : func (pressed) { |
|
165 |
- controls.applyBrakes(pressed) |
|
166 |
- }, |
|
167 |
- |
|
168 |
- 4 : func (pressed) { |
|
169 |
- if (pressed) { |
|
170 |
- var comm = getprop(pressed_button[0]) + 1; |
|
171 |
- controls.ptt(comm); |
|
172 |
- gui.popupTip("PTT COMM " ~ comm); |
|
173 |
- } |
|
174 |
- else { |
|
175 |
- controls.ptt(0); |
|
176 |
- gui.popupTip("PTT COMM ends", 0.5); |
|
177 |
- } |
|
178 |
- |
|
179 |
- }, |
|
180 |
- |
|
181 |
- 5 : func { |
|
182 |
- if (getprop(pressed_button[0])) |
|
183 |
- fgcommand("property-adjust", { |
|
184 |
- property: "/instrumentation/altimeter/setting-inhg", |
|
185 |
- step: 0.01 |
|
186 |
- }); |
|
187 |
- else |
|
188 |
- controls.flapsDown(1) |
|
189 |
- }, |
|
190 |
- |
|
191 |
- 6 : func { |
|
192 |
- if (getprop(pressed_button[0])) |
|
193 |
- fgcommand("property-adjust", { |
|
194 |
- property: "/instrumentation/altimeter/setting-inhg", |
|
195 |
- step: -0.01 |
|
196 |
- }); |
|
197 |
- elsif (getprop(pressed_button[10])) { |
|
198 |
- for (var i = 0; i < 4; i += 1) |
|
199 |
- controls.engines[i].selected.setBoolValue(1); |
|
200 |
- printf("all engines added to joystick controls"); |
|
201 |
- gui.popupTip("joystick controls all engines"); |
|
202 |
- } |
|
203 |
- elsif (getprop(pressed_button[11])) { |
|
204 |
- for (var i = 0; i < 4; i += 1) |
|
205 |
- controls.engines[i].selected.setBoolValue(0); |
|
206 |
- printf("joystick controls no engines", i); |
|
207 |
- gui.popupTip("joystick controls no engine"); |
|
208 |
- } |
|
209 |
- else |
|
210 |
- controls.flapsDown(-1) |
|
211 |
- }, |
|
212 |
- |
|
213 |
- 7 : func { |
|
214 |
- if (getprop(pressed_button[10])) addSelectedEngine(2); |
|
215 |
- elsif (getprop(pressed_button[11])) removeSelectedEngine(2); |
|
216 |
- else controls.adjMixture(-0.1 - 0.9 * getprop(pressed_button[0])); |
|
217 |
- }, |
|
218 |
- |
|
219 |
- 8 : func { |
|
220 |
- if (getprop(pressed_button[10])) addSelectedEngine(3); |
|
221 |
- elsif (getprop(pressed_button[11])) removeSelectedEngine(3); |
|
222 |
- else controls.adjMixture(0.1 + 0.9 * getprop(pressed_button[0])); |
|
223 |
- }, |
|
224 |
- |
|
225 |
- 9 : func { |
|
226 |
- if (getprop(pressed_button[10])) addSelectedEngine(1); |
|
227 |
- elsif (getprop(pressed_button[11])) removeSelectedEngine(1); |
|
228 |
- else controls.adjPropeller(0.1 + 0.9 * getprop(pressed_button[0])); |
|
229 |
- }, |
|
230 |
- |
|
231 |
- 10 : func { |
|
232 |
- if (getprop(pressed_button[10])) addSelectedEngine(0); |
|
233 |
- elsif (getprop(pressed_button[11])) removeSelectedEngine(0); |
|
234 |
- else controls.adjPropeller(-0.1 - 0.9 * getprop(pressed_button[0])); |
|
235 |
- }, |
|
236 |
- } |
|
237 |
- ]]></script> |
|
238 |
- </nasal> |
|
239 |
- |
|
240 |
- <name type="string">DragonRise Inc. Generic USB Joystick </name> |
|
241 |
- |
|
242 |
- <axis n="0"> |
|
243 |
- <desc>Aileron</desc> |
|
244 |
- <binding> |
|
245 |
- <command>property-scale</command> |
|
246 |
- <property>/controls/flight/aileron</property> |
|
247 |
- <squared type="bool">true</squared> |
|
248 |
- </binding> |
|
249 |
- </axis> |
|
250 |
- |
|
251 |
- <axis n="1"> |
|
252 |
- <desc>Elevator</desc> |
|
253 |
- <binding> |
|
254 |
- <command>property-scale</command> |
|
255 |
- <property>/controls/flight/elevator</property> |
|
256 |
- <factor type="double">-1.0</factor> |
|
257 |
- <squared type="bool">true</squared> |
|
258 |
- </binding> |
|
259 |
- </axis> |
|
260 |
- |
|
261 |
- <axis> |
|
262 |
- <number> |
|
263 |
- <windows>2</windows> |
|
264 |
- <unix>3</unix> |
|
265 |
- </number> |
|
266 |
- <desc>Increase/Reduce Throttle</desc> |
|
267 |
- <binding> |
|
268 |
- <command>nasal</command> |
|
269 |
- <script>controls.throttleAxis()</script> |
|
270 |
- </binding> |
|
271 |
- </axis> |
|
272 |
- |
|
273 |
- <axis> |
|
274 |
- <number> |
|
275 |
- <windows>3</windows> |
|
276 |
- <unix>2</unix> |
|
277 |
- </number> |
|
278 |
- <desc>Rudder Left/Right</desc> |
|
279 |
- <binding> |
|
280 |
- <command>property-scale</command> |
|
281 |
- <property>/controls/flight/rudder</property> |
|
282 |
- <factor type="double">1.0</factor> |
|
283 |
- </binding> |
|
284 |
- </axis> |
|
285 |
- |
|
286 |
- <axis> |
|
287 |
- <number> |
|
288 |
- <windows>6</windows> |
|
289 |
- <unix>4</unix> |
|
290 |
- </number> |
|
291 |
- <desc>View Direction | reset FoV | reset view direction</desc> |
|
292 |
- <low> |
|
293 |
- <repeatable>true</repeatable> |
|
294 |
- <binding> |
|
295 |
- <command>nasal</command> |
|
296 |
- <script>chinese_hat(1, 0)</script> |
|
297 |
- </binding> |
|
298 |
- </low> |
|
299 |
- <high> |
|
300 |
- <repeatable>true</repeatable> |
|
301 |
- <binding> |
|
302 |
- <command>nasal</command> |
|
303 |
- <script>chinese_hat(-1, 0)</script> |
|
304 |
- </binding> |
|
305 |
- </high> |
|
306 |
- </axis> |
|
307 |
- |
|
308 |
- <axis> |
|
309 |
- <number> |
|
310 |
- <windows>7</windows> |
|
311 |
- <unix>5</unix> |
|
312 |
- </number> |
|
313 |
- <desc>Orientation up or down / Increase or decrease FoV</desc> |
|
314 |
- <low> |
|
315 |
- <repeatable>true</repeatable> |
|
316 |
- <binding> |
|
317 |
- <command>nasal</command> |
|
318 |
- <script>chinese_hat(0, 1)</script> |
|
319 |
- </binding> |
|
320 |
- </low> |
|
321 |
- <high> |
|
322 |
- <repeatable>true</repeatable> |
|
323 |
- <binding> |
|
324 |
- <command>nasal</command> |
|
325 |
- <script>chinese_hat(0, -1)</script> |
|
326 |
- </binding> |
|
327 |
- </high> |
|
328 |
- </axis> |
|
329 |
- |
|
330 |
- <button n="1"> |
|
331 |
- <desc>Swap first and second views | pins POIs</desc> |
|
332 |
- <binding> |
|
333 |
- <command>nasal</command> |
|
334 |
- <script>joystick_button[2](1)</script> |
|
335 |
- </binding> |
|
336 |
- <mod-up> |
|
337 |
- <binding> |
|
338 |
- <command>nasal</command> |
|
339 |
- <script>joystick_button[2](0)</script> |
|
340 |
- </binding> |
|
341 |
- </mod-up> |
|
342 |
- </button> |
|
343 |
- |
|
344 |
- <button n="2"> |
|
345 |
- <desc>Apply brakes</desc> |
|
346 |
- <binding> |
|
347 |
- <command>nasal</command> |
|
348 |
- <script>joystick_button[3](1)</script> |
|
349 |
- </binding> |
|
350 |
- <mod-up> |
|
351 |
- <binding> |
|
352 |
- <command>nasal</command> |
|
353 |
- <script>joystick_button[3](0)</script> |
|
354 |
- </binding> |
|
355 |
- </mod-up> |
|
356 |
- </button> |
|
357 |
- |
|
358 |
- <button n="3"> |
|
359 |
- <desc>PTT - Push To Talk (via FGCom)</desc> |
|
360 |
- <binding> |
|
361 |
- <command>nasal</command> |
|
362 |
- <script>joystick_button[4](1)</script> |
|
363 |
- </binding> |
|
364 |
- <mod-up> |
|
365 |
- <binding> |
|
366 |
- <command>nasal</command> |
|
367 |
- <script>joystick_button[4](0)</script> |
|
368 |
- </binding> |
|
369 |
- </mod-up> |
|
370 |
- </button> |
|
371 |
- |
|
372 |
- <button n="4"> |
|
373 |
- <desc>Extend Flaps Incrementally</desc> |
|
374 |
- <repeatable>false</repeatable> |
|
375 |
- <binding> |
|
376 |
- <command>nasal</command> |
|
377 |
- <script>joystick_button[5]()</script> |
|
378 |
- </binding> |
|
379 |
- </button> |
|
380 |
- |
|
381 |
- <button n="5"> |
|
382 |
- <desc>Retract Flaps Incrementally</desc> |
|
383 |
- <repeatable>false</repeatable> |
|
384 |
- <binding> |
|
385 |
- <command>nasal</command> |
|
386 |
- <script>joystick_button[6]()</script> |
|
387 |
- </binding> |
|
388 |
- </button> |
|
389 |
- |
|
390 |
- <button n="6"> |
|
391 |
- <desc>Handle mixture | add or remove engine 0</desc> |
|
392 |
- <repeatable>true</repeatable> |
|
393 |
- <binding> |
|
394 |
- <command>nasal</command> |
|
395 |
- <script>joystick_button[7]()</script> |
|
396 |
- </binding> |
|
397 |
- </button> |
|
398 |
- |
|
399 |
- <button n="7"> |
|
400 |
- <desc>Handle mixture | add or remove engine 1</desc> |
|
401 |
- <repeatable>true</repeatable> |
|
402 |
- <binding> |
|
403 |
- <command>nasal</command> |
|
404 |
- <script>joystick_button[8]()</script> |
|
405 |
- </binding> |
|
406 |
- </button> |
|
407 |
- |
|
408 |
- <button n="8"> |
|
409 |
- <desc>Handle prop-pitch | add or remove engine 2</desc> |
|
410 |
- <repeatable>true</repeatable> |
|
411 |
- <binding> |
|
412 |
- <command>nasal</command> |
|
413 |
- <script>joystick_button[9]()</script> |
|
414 |
- </binding> |
|
415 |
- </button> |
|
416 |
- |
|
417 |
- <button n="9"> |
|
418 |
- <desc>Handle prop-pitch | add or remove engine 3</desc> |
|
419 |
- <repeatable>true</repeatable> |
|
420 |
- <binding> |
|
421 |
- <command>nasal</command> |
|
422 |
- <script>joystick_button[10]()</script> |
|
423 |
- </binding> |
|
424 |
- </button> |
|
425 |
- |
|
426 |
-</PropertyList> |
|
427 |
- |
|
428 |
-<!-- end of T.Flight Stick X.xml --> |