Debian Codegraph @

Input/Joysticks/ThrustMaster/T-Flight-Hotas-X.xml

raw symbols SCIP
1 <?xml version="1.0"?>
2 <!--
3 Joystick binding for ThrustMaster T.Flight Hotas X
4 Adrien Bailly
5
6 Original file by 'flug':
7 http://www.flightgear.org/forums/viewtopic.php?f=2&t=5517
8
9
10 Axis # (direction) mapped to
11 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 axis 0: (left-right) aileron
13 axis 1: (forward-backward) elevator
14 axis 2: (slider) throttle
15 axis 3: (twist) rudder
16 axis 4: (top hat) view left/right
17
18 Note that internally, FG numbers buttons starting with 0. The markings on the
19 HOTAS-X start with Button 1, and I have used the HOTAS-X number markings below:
20
21 Button # Location Function
22 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 button 1: (joystick R1) Brakes & reset view
24 button 2: (joystick L1) Push-To-Talk (for fgcom)
25 button 3: (joystick R3) Trim nose down
26 button 4: (joystick L3) Trim nose up
27
28 NO MODIFIER:
29 button 5: (throttle) Flaps up
30 button 6: (throttle) Flaps down
31 button 7: (throttle) Gear up/down
32 button 8: (throttle) Switch view
33
34 MODIFIER 1 (keep button R2 down):
35 button 5: (throttle) Mixture rich
36 button 6: (throttle) Mixture lean
37 button 7 (throttle) Propeller coarse
38 button 8: (throttle) Propeller fine
39
40 MODIFIER 2 (keep button L2 down):
41 button 5: (throttle) Battery ON/OFF
42 button 6: (throttle) Fuel selector
43 button 7 (throttle) Magnetos
44 button 8: (throttle) ???
45
46 MODIFIER 1+2 (keep buttons L2 and R2 down):
47 button 5: (throttle) ???
48 button 6: (throttle) ???
49 button 7 (throttle) ???
50 button 8: (throttle) ???
51
52 button 9: (throttle R2) Modifier 1
53 button 10: (throttle L2) Modifier 2
54
55 button SE: (base SE) ???
56 button ST: (base ST) ???
57
58 HAT SWITCH
59 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60 With the rocker switch and throttle twist controlling view direction, it is easy
61 to look all around in different directions.
62 -->
63
64 <PropertyList>
65 <name type="string">T.Flight Hotas X</name>
66 <name type="string">Hotas X</name>
67 <name type="string">Thrustmaster Hotas X</name>
68 <name type="string">Thrustmaster T.Flight Hotas X</name>
69 <nasal>
70 <script>
71 <![CDATA[
72 setprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier1", 0);
73 setprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier2", 0);
74 ]]>
75 </script>
76 </nasal>
77
78 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~ Axis Bindings ~~~~~~~~~~~~~~~~~~~~~~~~ -->
79 <axis n="0">
80 <desc>Joystick: Aileron</desc>
81 <binding>
82 <command>property-scale</command>
83 <property>/controls/flight/aileron</property>
84 <factor type="double">1.0</factor>
85 <power type="double">1.0</power>
86 </binding>
87 </axis>
88
89 <axis n="1">
90 <desc>Joystick: Elevator</desc>
91 <binding>
92 <command>property-scale</command>
93 <property>/controls/flight/elevator</property>
94 <factor type="double">-1.0</factor>
95 <power type="double">1.0</power>
96 </binding>
97 </axis>
98
99 <axis n= "2">
100 <desc>Throttle</desc>
101 <binding>
102 <command>nasal</command>
103 <script>controls.throttleAxis()</script>
104 </binding>
105 </axis>
106
107 <axis n="3">
108 <desc>Rudder</desc>
109 <binding>
110 <command>property-scale</command>
111 <property>/controls/flight/rudder</property>
112 <power type="double">1.0</power>
113 </binding>
114 </axis>
115
116 <!-- Throttle rocker switch axis pans l/r -->
117 <axis n="4">
118 <desc>Throttle rocker switch: View Left/Right</desc>
119 <dead-band type="double">0.05</dead-band>
120 <binding>
121 <command>property-scale</command>
122 <property>/sim/current-view/heading-offset-deg</property>
123 <factor type="double">-180</factor>
124 <power type="double">1.2</power>
125 </binding>
126 </axis>
127
128 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~ Hat Switch ~~~~~~~~~~~~~~~~~~~~~~~~ -->
129 <axis>
130 <desc>Hat Switch: View Direction (use mod buttons for different effects)</desc>
131 <number>
132 <unix>5</unix>
133 <mac>5</mac>
134 <windows>6</windows>
135 </number>
136 <low>
137 <repeatable>true</repeatable>
138 <binding>
139 <command>property-adjust</command>
140 <property>/sim/current-view/goal-heading-offset-deg</property>
141 <step type="double">5.0</step>
142 </binding>
143 </low>
144 <high>
145 <repeatable>true</repeatable>
146 <binding>
147 <command>property-adjust</command>
148 <property>/sim/current-view/goal-heading-offset-deg</property>
149 <step type="double">-5.0</step>
150 </binding>
151 </high>
152 </axis>
153
154 <axis>
155 <desc>Hat Switch: View Elevation (use mod buttons for different effects)</desc>
156 <number>
157 <unix>6</unix>
158 <mac>6</mac>
159 <windows>7</windows>
160 </number>
161 <low>
162 <repeatable>true</repeatable>
163 <binding>
164 <command>property-adjust</command>
165 <property>/sim/current-view/goal-pitch-offset-deg</property>
166 <step type="double">5.0</step>
167 </binding>
168 </low>
169 <high>
170 <repeatable>true</repeatable>
171 <binding>
172 <command>property-adjust</command>
173 <property>/sim/current-view/goal-pitch-offset-deg</property>
174 <step type="double">-5.0</step>
175 </binding>
176 </high>
177 </axis>
178
179 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~ Button Bindings ~~~~~~~~~~~~~~~~~~~~~~~~ -->
180
181 <!-- Trigger (R1) -->
182 <button n="0">
183 <desc>Button R1(1) (trigger): Brakes + reset to pilot view</desc>
184 <repeatable type="bool">true</repeatable>
185 <binding>
186 <command>nasal</command>
187 <script>
188 controls.applyBrakes(1.0);
189 setprop("/sim/current-view/view-number", 0);
190 view.resetView();
191 </script>
192 </binding>
193 <mod-up>
194 <binding>
195 <command>nasal</command>
196 <script>
197 controls.applyBrakes(0.0);
198 </script>
199 </binding>
200 </mod-up>
201 </button>
202
203 <!-- Button right of Hat switch, Labeled L1(2) -->
204 <button n="1">
205 <desc>Button L1(2) (joystick center): Push-To-Talk (for fgcom)</desc>
206 <binding>
207 <command>nasal</command>
208 <script>
209 controls.ptt(1); # push-to-talk (fgcom) ON
210 </script>
211 </binding>
212 <mod-up>
213 <binding>
214 <command>nasal</command>
215 <script>
216 controls.ptt(0); # push-to-talk (fgcom) OFF
217 </script>
218 </binding>
219 </mod-up>
220 </button>
221
222
223 <!-- Front button, right of trigger, (R3) -->
224 <button n="2">
225 <desc>Button R3(3): Elevator trim down</desc>
226 <repeatable type="bool">true</repeatable>
227 <binding>
228 <command>nasal</command>
229 <script>
230 controls.elevatorTrim(1);
231 gui.popupTip(sprintf("Elevator trim: %d", 100 * getprop("/controls/flight/elevator-trim")));
232 </script>
233 </binding>
234 </button>
235
236
237 <!-- Button far right of Hat switch, Labeled L3(4) -->
238 <button n="3">
239 <desc>Button L3(4): Elevator trim down</desc>
240 <repeatable type="bool">true</repeatable>
241 <binding>
242 <command>nasal</command>
243 <script>
244 controls.elevatorTrim(-1);
245 gui.popupTip(sprintf("Elevator trim: %d", 100 * getprop("/controls/flight/elevator-trim")));
246 </script>
247 </binding>
248 </button>
249
250
251 <!-- Throttle Button labeled 5 -->
252 <button n="4">
253 <desc>Button (5): Flaps up / Mixture rich / Battery on-off / ???</desc>
254 <repeatable type="bool">false</repeatable>
255 <binding>
256 <command>nasal</command>
257 <script>
258 mod1 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier1");
259 mod2 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier2");
260 if(mod1==0 and mod2==0) {
261 controls.flapsDown(-1);
262 }
263 elsif(mod1==1 and mod2==0) {
264 controls.adjMixture(10);
265 gui.popupTip(sprintf("Mixture rich"));
266 }
267 elsif(mod1 == 0 and mod2==1) {
268 j = getprop("/controls/electric/battery-switch");
269 if(j == 0) {
270 setprop("/controls/electric/battery-switch", 1);
271 gui.popupTip(sprintf("Battery ON"));
272 } else {
273 setprop("/controls/electric/battery-switch", 0);
274 gui.popupTip(sprintf("Battery OFF"));
275 }
276 }
277 elsif(mod1==1 and mod2==1) {
278
279 }
280 </script>
281 </binding>
282 <mod-up>
283 <binding>
284 <command>nasal</command>
285 <script>
286 mod1 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier1");
287 mod2 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier2");
288 if(mod1==0 and mod2==0) {
289 controls.flapsDown(0);
290 }
291 elsif(mod1==1 and mod2==0) {
292 # mixture
293 }
294 elsif(mod1 == 0 and mod2==1) {
295
296 }
297 elsif(mod1==1 and mod2==1) {
298
299 }
300 </script>
301 </binding>
302 </mod-up>
303 </button>
304
305 <!-- Throttle Button labeled 6 -->
306 <button n="5">
307 <desc>Button (6): Flaps down / Mixture lean / Fuel selector / ???</desc>
308 <repeatable type="bool">false</repeatable>
309 <binding>
310 <command>nasal</command>
311 <script>
312 mod1 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier1");
313 mod2 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier2");
314 if(mod1==0 and mod2==0) {
315 controls.flapsDown(1);
316 }
317 elsif(mod1==1 and mod2==0) {
318 controls.adjMixture(-10);
319 gui.popupTip(sprintf("Mixture lean"));
320 }
321 elsif(mod1 == 0 and mod2==1) {
322 k = getprop("/controls/fuel/tank/fuel_selector");
323 if (k == 0) {
324 setprop("/controls/fuel/tank/fuel_selector", 1);
325 setprop("/controls/engines/engine/fuel-pump", 1);
326 } else {
327 setprop("/controls/fuel/tank/fuel_selector", 0);
328 setprop("/controls/engines/engine/fuel-pump", 0);
329 }
330 }
331 elsif(mod1==1 and mod2==1) {
332
333 }
334 </script>
335 </binding>
336 <mod-up>
337 <binding>
338 <command>nasal</command>
339 <script>
340 mod1 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier1");
341 mod2 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier2");
342 if(mod1==0 and mod2==0) {
343 controls.flapsDown(0);
344 }
345 elsif(mod1==1 and mod2==0) {
346 # mixture
347 }
348 elsif(mod1 == 0 and mod2==1) {
349
350 }
351 elsif(mod1==1 and mod2==1) {
352
353 }
354 </script>
355 </binding>
356 </mod-up>
357 </button>
358
359 <!-- Throttle Button labeled 7 (circle)-->
360 <button n="6">
361 <desc>Button (7): Landing Gear Toggle / Propeller coarse / Magnetos / ???</desc>
362 <repeatable type="bool">false</repeatable>
363 <binding>
364 <command>nasal</command>
365 <script>
366 mod1 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier1");
367 mod2 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier2");
368 if(mod1==0 and mod2==0) {
369 controls.gearToggle();
370 }
371 elsif(mod1==1 and mod2==0) {
372 controls.adjPropeller(10);
373 gui.popupTip(sprintf("Propeller coarse"));
374 }
375 elsif(mod1 == 0 and mod2==1) {
376 l = getprop("/controls/engines/engine/magnetos");
377 if (l == 0) {
378 props.setAll("/controls/engines/engine", "magnetos", 1);
379 } elsif ( l == 1 ) {
380 props.setAll("/controls/engines/engine", "magnetos", 2);
381 } elsif ( l == 2 ) {
382 props.setAll("/controls/engines/engine", "magnetos", 3);
383 } elsif ( l == 3 ) {
384 props.setAll("/controls/engines/engine", "magnetos", 0);
385 }
386 }
387 elsif(mod1==1 and mod2==1) {
388
389 }
390 </script>
391 </binding>
392 <mod-up>
393 <binding>
394 <command>nasal</command>
395 <script>
396 mod1 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier1");
397 mod2 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier2");
398 if(mod1==0 and mod2==0) {
399 # gear
400 }
401 elsif(mod1==1 and mod2==0) {
402 # propeller
403 }
404 elsif(mod1 == 0 and mod2==1) {
405 # magnetos
406 }
407 elsif(mod1==1 and mod2==1) {
408
409 }
410 </script>
411 </binding>
412 </mod-up>
413 </button>
414
415 <!-- Throttle Button labeled 8 (triangle) -->
416 <button n="7">
417 <desc>Button (8): Switch view / Propeller fine / Starter / ???</desc>
418 <repeatable type="bool">false</repeatable>
419 <binding>
420 <command>nasal</command>
421 <script>
422 mod1 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier1");
423 mod2 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier2");
424 if(mod1==0 and mod2==0) {
425 view.stepView(1);
426 }
427 elsif(mod1==1 and mod2==0) {
428 controls.adjPropeller(-10);
429 gui.popupTip(sprintf("Propeller fine"));
430 }
431 elsif(mod1==0 and mod2==1) {
432 setprop("/controls/engines/engine/starter", 1);
433 setprop("/controls/engines/engine[1]/starter", 1);
434 setprop("/controls/engines/engine[2]/starter", 1);
435 setprop("/controls/engines/engine[3]/starter", 1);
436 setprop("/controls/engines/engine[4]/starter", 1);
437 gui.popupTip(sprintf("Cranking..."));
438 }
439 elsif(mod1==1 and mod2==1) {
440
441 }
442 </script>
443 </binding>
444 <mod-up>
445 <binding>
446 <command>nasal</command>
447 <script>
448 mod1 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier1");
449 mod2 = getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier2");
450 if(mod1==0 and mod2==0) {
451 # switch views
452 }
453 elsif(mod1==1 and mod2==0) {
454 # propeller
455 }
456 elsif(mod1==0 and mod2==1) {
457 setprop("/controls/engines/engine/starter", 0);
458 setprop("/controls/engines/engine[1]/starter", 0);
459 setprop("/controls/engines/engine[2]/starter", 0);
460 setprop("/controls/engines/engine[3]/starter", 0);
461 setprop("/controls/engines/engine[4]/starter", 0);
462 }
463 elsif(mod1==1 and mod2==1) {
464
465 }
466 </script>
467 </binding>
468 </mod-up>
469 </button>
470
471 <!-- Throttle Button labeled R2(9) -->
472 <button n="8">
473 <desc>Button R2(9): Modifier 1</desc>
474 <repeatable type="bool">false</repeatable>
475 <binding>
476 <command>nasal</command>
477 <script>
478 setprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier1", 1);
479 </script>
480 </binding>
481 <mod-up>
482 <binding>
483 <command>nasal</command>
484 <script>
485 setprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier1", 0);
486 </script>
487 </binding>
488 </mod-up>
489 </button>
490
491 <!-- Throttle Button labeled L2(10) -->
492 <button n="9">
493 <desc>Button L2(10): Modifier2</desc>
494 <repeatable type="bool">false</repeatable>
495 <binding>
496 <command>nasal</command>
497 <script>
498 setprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier2", 1);
499 </script>
500 </binding>
501 <mod-up>
502 <binding>
503 <command>nasal</command>
504 <script>
505 setprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier2", 0);
506 </script>
507 </binding>
508 </mod-up>
509 </button>
510
511 <!-- Base Button SE -->
512 <button n="10">
513 <desc>Button SE: ???</desc>
514 <repeatable type="bool">false</repeatable>
515 <binding>
516 <command>nasal</command>
517 <script>
518 gui.popupTip(sprintf("Button n=10 unused"));
519 </script>
520 </binding>
521 </button>
522
523 <!-- Base Button ST -->
524 <button n="11">
525 <desc>Button ST: ???</desc>
526 <repeatable type="bool">false</repeatable>
527 <binding>
528 <command>nasal</command>
529 <script>
530 gui.popupTip(sprintf("Button n=11 unused"));
531 </script>
532 </binding>
533 </button>
534 </PropertyList>