config / .fgfs / Input / Joysticks / T-Flight-Stick-X.xml /
Newer Older
430 lines | 13.82kb
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
1
<?xml version="1.0"?>
2

            
add comments for usage help
Sébastien MARQUE authored on 2020-11-15
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

            
ajoute l'affichage des POI
Sébastien MARQUE authored on 2022-03-04
13
Button 2  | heli view     | permanent heli view | show/hide pins      | declutter pins
add comments for usage help
Sébastien MARQUE authored on 2020-11-15
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
réglagle mixture et pas x10 ...
Sébastien MARQUE authored on 2022-12-23
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
add comments for usage help
Sébastien MARQUE authored on 2020-11-15
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

            
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
29
<PropertyList>
30
  <nasal>
31
    <script><![CDATA[
32
      var skipFlightControls = props.globals.getNode("/sim/mouse/skip-flight-controls-mode");
33
      setlistener("/sim/signals/fdm-initilized", func {
34
          skipFlightControls.setBoolValue(1);
35
          print("JOYSTICK set mouse flight control OFF: ", skipFlightControls.getValue());
36
      }, 1 );
37
      setlistener("/sim/signals/save", func {
38
          skipFlightControls.setBoolValue(0);
39
          print("JOYSTICK save mouse flight control ON: ", skipFlightControls.getValue());
40
      } );
41

            
42
      # determine Nasal namespace for this joystick
43
      # stored in js[0]
44
      string.scanf(cmdarg().getNode("module").getValue(), "__js%u", var js = []);
45

            
46
      # array with prop path for each button status
47
      var pressed_button = [];
48
      for (var i = 0; i < 12; i += 1)
49
        append(pressed_button, "/devices/status/joysticks/joystick[" ~ js[0] ~ "]/button[" ~ i ~ "]");
50

            
51
      var previousMouseMode = 0;
52
      var locked_view = 0;
53

            
54
      var chinese_hat = func (heading, pitch) {
55
        if (getprop(pressed_button[0])) {
56
          if    (pitch   > 0) view.decrease();
57
          elsif (pitch   < 0) view.increase();
58
          elsif (heading > 0){view.resetViewDir();view.resetFOV();}
59
          elsif (heading < 0) view.resetFOV();
60
        }
61
        elsif (getprop(pressed_button[10])) {
62
          if (pitch)
63
            controls.elevatorTrim(pitch);
64
          else
65
            controls.rudderTrim(heading);
66
        }
67
        elsif (getprop(pressed_button[11]) and heading) {
invert aileron trim directio...
Sébastien MARQUE authored on 2021-02-21
68
          controls.aileronTrim(-heading);
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
69
        }
70
        else {
71
          if (heading) {
72
            fgcommand("property-adjust", {
73
              property : "/sim/current-view/goal-heading-offset-deg",
74
              step : 2.0 * heading
75
            });
76
          }
77
          elsif (pitch) {
78
            fgcommand("property-adjust", {
79
              property : "/sim/current-view/goal-pitch-offset-deg",
80
              step : 2.0 * pitch
81
            });
82
          }
83
        }
84
      }
85

            
86
      var addSelectedEngine = func (i) {
87
        controls.engines[i].selected.setBoolValue(1);
88
        printf("engine %d added to joystick controls", i);
89
        gui.popupTip("engine " ~ i ~ " joystick controlled");
90
      }
91

            
92
      var removeSelectedEngine = func (i) {
93
        controls.engines[i].selected.setBoolValue(0);
94
        printf("engine %d removed from joystick controls", i);
95
        gui.popupTip("engine " ~ i ~ " joystick uncontrolled");
96
      }
97

            
98
      # key = button identifier as displayed on joystick
99
      joystick_button = {
100
        2 : func (pressed) {
101
          if (pressed) {
ajoute l'affichage des POI
Sébastien MARQUE authored on 2022-03-04
102
            if (getprop(pressed_button[10])) {
103
              setprop("/sim/marker-pins/master", !getprop("/sim/marker-pins/master"));
104
            }
105
            elsif (getprop(pressed_button[11])) {
106
              var clutter = {
107
                "airports": 1,
108
                "pois"    : 2,
109
                "traffic" : 4,
110
                "navaids" : 8,
111
                "fixes"   : 16
112
              };
113
              var clutter_sum = 0;
114
              foreach (var c; keys(clutter)) {
115
                clutter_sum += getprop("/sim/marker-pins/" ~ c) * clutter[c]
116
              }
117
              if (clutter_sum == 1) {
118
                setprop("/sim/marker-pins/fixes",    0);
119
                setprop("/sim/marker-pins/navaids",  0);
120
                setprop("/sim/marker-pins/airports", 1);
121
                setprop("/sim/marker-pins/pois",     1);
122
                setprop("/sim/marker-pins/traffic",  0);
123
                gui.popupTip("Pins: AIRPORTS + POI", 1);
124
              }
125
              elsif (clutter_sum == 3) {
126
                setprop("/sim/marker-pins/fixes",    0);
127
                setprop("/sim/marker-pins/navaids",  0);
128
                setprop("/sim/marker-pins/airports", 0);
129
                setprop("/sim/marker-pins/pois",     0);
130
                setprop("/sim/marker-pins/traffic",  1);
131
                gui.popupTip("Pins: TRAFFIC", 1);
132
              }
133
              elsif (clutter_sum == 4) {
134
                setprop("/sim/marker-pins/fixes",    1);
135
                setprop("/sim/marker-pins/navaids",  1);
136
                setprop("/sim/marker-pins/airports", 1);
137
                setprop("/sim/marker-pins/pois",     0);
138
                setprop("/sim/marker-pins/traffic",  0);
139
                gui.popupTip("Pins: AIRPORTS + NAVAIDS + FIXES", 1);
140
              }
141
              else {
142
                setprop("/sim/marker-pins/fixes",    0);
143
                setprop("/sim/marker-pins/navaids",  0);
144
                setprop("/sim/marker-pins/airports", 1);
145
                setprop("/sim/marker-pins/pois",     0);
146
                setprop("/sim/marker-pins/traffic",  0);
147
                gui.popupTip("Pins: AIRPORTS", 1);
148
              }
149
              setprop("/sim/marker-pins/master", 1);
150
            }
151
            else {
fix mouse mode while changin...
Sébastien MARQUE authored on 2022-03-06
152
              locked_view = getprop(pressed_button[0]);
153
              setprop("/devices/status/mice/mouse[0]/mode", 2);
154
              setprop("/sim/current-view/view-number", 1);
ajoute l'affichage des POI
Sébastien MARQUE authored on 2022-03-04
155
            }
156
          }
157
          else {
fix mouse mode while changin...
Sébastien MARQUE authored on 2022-03-06
158
            if (locked_view)
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
159
              return;
fix mouse mode while changin...
Sébastien MARQUE authored on 2022-03-06
160
            setprop("/devices/status/mice/mouse[0]/mode", 0);
161
            setprop("/sim/current-view/view-number", 0);
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
162
          }
163
        },
164

            
165
        3 : func (pressed) {
166
          controls.applyBrakes(pressed)
167
        },
168

            
add PTT
Sébastien MARQUE authored on 2020-11-15
169
        4 : func (pressed) {
170
          if (pressed) {
171
            var comm = getprop(pressed_button[0]) + 1;
172
            controls.ptt(comm);
173
            gui.popupTip("PTT COMM " ~ comm);
174
          }
175
          else {
176
            controls.ptt(0);
177
            gui.popupTip("PTT COMM ends", 0.5);
178
          }
179

            
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
180
        },
181

            
182
        5 : func {
add QNH setting
Sébastien MARQUE authored on 2020-11-15
183
          if (getprop(pressed_button[0]))
184
            fgcommand("property-adjust", {
185
              property: "/instrumentation/altimeter/setting-inhg",
186
              step: 0.01
187
            });
188
          else
189
            controls.flapsDown(1)
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
190
        },
191

            
192
        6 : func {
add QNH setting
Sébastien MARQUE authored on 2020-11-15
193
          if (getprop(pressed_button[0]))
194
            fgcommand("property-adjust", {
195
              property: "/instrumentation/altimeter/setting-inhg",
196
              step: -0.01
197
            });
198
          elsif (getprop(pressed_button[10])) {
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
199
            for (var i = 0; i < 4; i += 1)
200
              controls.engines[i].selected.setBoolValue(1);
201
            printf("all engines added to joystick controls");
202
            gui.popupTip("joystick controls all engines");
203
          }
204
          elsif (getprop(pressed_button[11])) {
205
            for (var i = 0; i < 4; i += 1)
206
              controls.engines[i].selected.setBoolValue(0);
207
            printf("joystick controls no engines", i);
208
            gui.popupTip("joystick controls no engine");
209
          }
210
          else
211
            controls.flapsDown(-1)
212
        },
213

            
214
        7 : func {
215
          if    (getprop(pressed_button[10])) addSelectedEngine(2);
216
          elsif (getprop(pressed_button[11])) removeSelectedEngine(2);
réglagle mixture et pas x10 ...
Sébastien MARQUE authored on 2022-12-23
217
          else controls.adjMixture(-0.1 - 0.9 * getprop(pressed_button[0]));
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
218
        },
219

            
220
        8 : func {
221
          if    (getprop(pressed_button[10])) addSelectedEngine(3);
222
          elsif (getprop(pressed_button[11])) removeSelectedEngine(3);
réglagle mixture et pas x10 ...
Sébastien MARQUE authored on 2022-12-23
223
          else controls.adjMixture(0.1 + 0.9 * getprop(pressed_button[0]));
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
224
        },
225

            
226
        9 : func {
227
          if    (getprop(pressed_button[10])) addSelectedEngine(1);
228
          elsif (getprop(pressed_button[11])) removeSelectedEngine(1);
réglagle mixture et pas x10 ...
Sébastien MARQUE authored on 2022-12-23
229
          else controls.adjPropeller(0.1 + 0.9 * getprop(pressed_button[0]));
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
230
        },
231

            
232
        10 : func {
233
          if    (getprop(pressed_button[10])) addSelectedEngine(0);
234
          elsif (getprop(pressed_button[11])) removeSelectedEngine(0);
réglagle mixture et pas x10 ...
Sébastien MARQUE authored on 2022-12-23
235
          else controls.adjPropeller(-0.1 - 0.9 * getprop(pressed_button[0]));
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
236
        },
237
      }
238
    ]]></script>
239
  </nasal>
240

            
241
  <name type="string">T.Flight Stick X</name>
242
  <name type="string">Thrustmaster T.Flight Stick X</name>
243

            
244
  <axis n="0">
245
    <desc>Aileron</desc>
246
    <binding>
247
      <command>property-scale</command>
248
      <property>/controls/flight/aileron</property>
249
      <squared type="bool">true</squared>
250
    </binding>
251
  </axis>
252

            
253
  <axis n="1">
254
    <desc>Elevator</desc>
255
    <binding>
256
      <command>property-scale</command>
257
      <property>/controls/flight/elevator</property>
258
      <factor type="double">-1.0</factor>
259
      <squared type="bool">true</squared>
260
    </binding>
261
  </axis>
262

            
263
  <axis>
264
    <number>
265
      <windows>2</windows>
266
      <unix>3</unix>
267
    </number>
268
    <desc>Increase/Reduce Throttle</desc>
269
    <binding>
270
      <command>nasal</command>
271
      <script>controls.throttleAxis()</script>
272
    </binding>
273
  </axis>
274

            
275
  <axis>
276
    <number>
277
      <windows>3</windows>
278
      <unix>2</unix>
279
    </number>
280
    <desc>Rudder Left/Right</desc>
281
    <binding>
282
      <command>property-scale</command>
283
      <property>/controls/flight/rudder</property>
284
      <factor type="double">1.0</factor>
285
    </binding>
286
  </axis>
287

            
288
  <axis>
289
    <number>
290
      <windows>6</windows>
291
      <unix>4</unix>
292
    </number>
293
    <desc>View Direction | reset FoV | reset view direction</desc>
294
    <low>
295
      <repeatable>true</repeatable>
296
      <binding>
297
        <command>nasal</command>
298
        <script>chinese_hat(1, 0)</script>
299
      </binding>
300
    </low>
301
    <high>
302
      <repeatable>true</repeatable>
303
      <binding>
304
        <command>nasal</command>
305
        <script>chinese_hat(-1, 0)</script>
306
      </binding>
307
    </high>
308
  </axis>
309

            
310
  <axis>
311
    <number>
312
      <windows>7</windows>
313
      <unix>5</unix>
314
    </number>
315
    <desc>Orientation up or down / Increase or decrease FoV</desc>
316
    <low>
317
      <repeatable>true</repeatable>
318
      <binding>
319
        <command>nasal</command>
320
        <script>chinese_hat(0, 1)</script>
321
      </binding>
322
    </low>
323
    <high>
324
      <repeatable>true</repeatable>
325
      <binding>
326
        <command>nasal</command>
327
        <script>chinese_hat(0, -1)</script>
328
      </binding>
329
    </high>
330
  </axis>
331

            
332
  <button n="1">
add comment
Sébastien MARQUE authored on 2022-03-06
333
    <desc>Swap first and second views | pins POIs</desc>
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
334
    <binding>
335
      <command>nasal</command>
336
      <script>joystick_button[2](1)</script>
337
    </binding>
338
    <mod-up>
339
      <binding>
340
        <command>nasal</command>
341
        <script>joystick_button[2](0)</script>
342
      </binding>
343
    </mod-up>
344
  </button>
345

            
346
  <button n="2">
347
    <desc>Apply brakes</desc>
348
    <binding>
349
      <command>nasal</command>
invert brakes
Sébastien MARQUE authored on 2022-03-06
350
      <script>joystick_button[3](1)</script>
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
351
    </binding>
352
    <mod-up>
353
      <binding>
354
        <command>nasal</command>
invert brakes
Sébastien MARQUE authored on 2022-03-06
355
        <script>joystick_button[3](0)</script>
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
356
      </binding>
357
    </mod-up>
358
  </button>
359

            
add PTT
Sébastien MARQUE authored on 2020-11-15
360
  <button n="3">
361
    <desc>PTT - Push To Talk (via FGCom)</desc>
362
    <binding>
363
      <command>nasal</command>
364
      <script>joystick_button[4](1)</script>
365
    </binding>
366
    <mod-up>
367
      <binding>
368
        <command>nasal</command>
369
        <script>joystick_button[4](0)</script>
370
      </binding>
371
    </mod-up>
372
  </button>
373

            
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
374
  <button n="4">
375
    <desc>Extend Flaps Incrementally</desc>
376
    <repeatable>false</repeatable>
377
    <binding>
378
      <command>nasal</command>
379
      <script>joystick_button[5]()</script>
380
    </binding>
381
  </button>
382

            
383
  <button n="5">
384
    <desc>Retract Flaps Incrementally</desc>
385
    <repeatable>false</repeatable>
386
    <binding>
387
      <command>nasal</command>
388
      <script>joystick_button[6]()</script>
389
    </binding>
390
  </button>
391

            
392
  <button n="6">
393
    <desc>Handle mixture | add or remove engine 0</desc>
394
    <repeatable>true</repeatable>
395
    <binding>
396
      <command>nasal</command>
397
      <script>joystick_button[7]()</script>
398
    </binding>
399
  </button>
400

            
401
  <button n="7">
402
    <desc>Handle mixture | add or remove engine 1</desc>
403
    <repeatable>true</repeatable>
404
    <binding>
405
      <command>nasal</command>
406
      <script>joystick_button[8]()</script>
407
    </binding>
408
  </button>
409

            
410
  <button n="8">
correct comments
Sébastien MARQUE authored on 2021-02-13
411
    <desc>Handle prop-pitch | add or remove engine 2</desc>
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
412
    <repeatable>true</repeatable>
413
    <binding>
414
      <command>nasal</command>
415
      <script>joystick_button[9]()</script>
416
    </binding>
417
  </button>
418

            
419
  <button n="9">
correct comments
Sébastien MARQUE authored on 2021-02-13
420
    <desc>Handle prop-pitch | add or remove engine 3</desc>
UNIX end of line + some fixe...
Sébastien MARQUE authored on 2020-11-14
421
    <repeatable>true</repeatable>
422
    <binding>
423
      <command>nasal</command>
424
      <script>joystick_button[10]()</script>
425
    </binding>
426
  </button>
427

            
428
</PropertyList>
429

            
430
<!-- end of T.Flight Stick X.xml -->