config / .fgfs / Input / Joysticks / Microsoft-SideWinder-Joystick.xml /
Newer Older
301 lines | 7.967kb
ajout conf perso pour flight...
Sébastien MARQUE authored on 2017-05-11
1
<?xml version="1.0"?>
2

            
3
<!--
4
************************************************************************
5
* Bindings for Microsoft SideWinder Joystick.
6
*
7
*
8
* Axis 0: ailerons in air, rudder on ground if not heli
9
* Axis 1: elevator
10
* Axis 2: throttle
11
*
12
* Button 1: all brakes on ground, heli view in air
13
* Button 2: Push To Talk with FGCOM
14
* Button 3: left aileron trim for aircrafts, left pedal for helis
15
* Button 4: right aileron trim for aircrafts, right pedal for helis
16
* Button 5: elevator trim up
17
* Button 6: elevator trim down
18
* Button 7: flaps up
19
* Button 8: flaps down
20

            
21
************************************************************************
22
$Id: sidewinder.xml,v 1.5 2005/06/22 13:08:02 mfranz Exp $
23
modified by zakharov
24
-->
25

            
26
<PropertyList>
27
  <nasal>
28
    <script><![CDATA[
29
      var shift = props.globals.getNode("/devices/status/keyboard/shift");
30
      var ctrl = props.globals.getNode("/devices/status/keyboard/ctrl");
31
      var alt = props.globals.getNode("/devices/status/keyboard/alt");
32

            
33
      var get_modifiers = func {
34
          shift.getValue() + 2 * ctrl.getValue() + 4 * alt.getValue();
35
      }
36

            
37
      var space_release = func {}
38
      var space = func(state, mod) {
39
          if (!state) {
40
              space_release();
41
              return space_release = func {};
42
          }
43
          if (mod == 0 or mod == 1) {
44
              controls.ptt(mod + 1);
45
              space_release = func { controls.ptt(0) }
46
          }
47
      }
48

            
49
      var button0 = func {}
50
      var gunned = props.globals.getNode("/controls/armament/trigger");
51
      if (gunned != nil)
52
          button0 = func (v) { 
53
	      setprop("/ai/submodels/trigger", v);
54
	      setprop("/controls/armament/trigger", v);
55
	  }
56
      else
57
          button0 = func (v) { setprop("/sim/current-view/view-number", v); 
58
      }
59
    ]]></script>
60
  </nasal>
61

            
62
  <name>Microsoft SideWinder Joystick</name>
63

            
64
  <axis n="0">
65
    <desc>Rudder if not heli (auto-coordination), on ground and in air</desc>
66
    <binding>
67
      <condition>
68
        <not>
69
          <property>/rotors/tail/rpm</property>
70
        </not>
71
      </condition>
72
      <command>property-scale</command>
73
      <property>/controls/flight/rudder</property>
74
      <squared type="bool">true</squared>
75
    </binding>
76
    <desc>Aileron, only in air</desc>
77
    <binding>
78
      <condition>
79
        <not>
80
          <and>
81
            <property>/gear/gear[1]/wow</property>
82
            <property>/gear/gear[2]/wow</property>
83
          </and>
84
        </not>
85
      </condition>
86
      <command>property-scale</command>
87
      <property>/controls/flight/aileron</property>
88
      <squared type="bool">true</squared>
89
    </binding>
90
  </axis>
91

            
92
  <axis n="1">
93
    <desc>Elevator</desc>
94
    <binding>
95
      <command>property-scale</command>
96
      <property>/controls/flight/elevator</property>
97
      <factor type="double">-1.0</factor>
98
      <squared type="bool">true</squared>
99
    </binding>
100
  </axis>
101

            
102
  <axis n="2">
103
    <desc>Throttle</desc>
104
    <binding>
105
      <command>nasal</command>
106
      <script>controls.throttleAxis()</script>
107
    </binding>
108
  </axis>
109

            
110
  <button n="0">
111
    <desc>Brakes on ground, change view or fire gun if exists on air</desc>
112
    <binding>
113
      <condition>
114
        <and>
115
          <property>/gear/gear[1]/wow</property>
116
          <property>/gear/gear[2]/wow</property>
117
        </and>
118
      </condition>
119
      <command>nasal</command>
120
      <script>controls.applyBrakes(1)</script>
121
    </binding>
122
    <binding>
123
      <condition>
124
        <not>
125
          <and>
126
            <property>/gear/gear[1]/wow</property>
127
            <property>/gear/gear[2]/wow</property>
128
          </and>
129
        </not>
130
      </condition>
131
      <command>nasal</command>
132
      <script>button0(1)</script>
133
    </binding>
134
    <mod-up>
135
      <binding>
136
        <condition>
137
          <not>
138
            <and>
139
              <property>/gear/gear[1]/wow</property>
140
              <property>/gear/gear[2]/wow</property>
141
            </and>
142
          </not>
143
        </condition>
144
        <command>nasal</command>
145
        <script>button0(0)</script>
146
      </binding>
147
      <binding>
148
        <condition>
149
          <and>
150
            <property>/gear/gear[1]/wow</property>
151
            <property>/gear/gear[2]/wow</property>
152
          </and>
153
        </condition>
154
        <command>nasal</command>
155
        <script>controls.applyBrakes(0)</script>
156
      </binding>
157
    </mod-up>
158
  </button>
159

            
160
  <button n="1">
161
    <desc>PTT - Push To Talk (via VoIP)</desc>
162
    <binding>
163
      <command>nasal</command>
164
      <script>
165
        var m = get_modifiers();
166
        if (m == 4) aircraft.autotrim.start();
167
        else space(1, m);
168
      </script>
169
    </binding>
170
    <mod-up>
171
      <binding>
172
        <command>nasal</command>
173
        <script>
174
          var m = get_modifiers();
175
          if (m == 4) aircraft.autotrim.stop();
176
          else space(0, m);
177
        </script>
178
      </binding>
179
    </mod-up>
180
  </button>
181

            
182
  <button n="4">
183
    <desc>Elevator trim down</desc>
184
    <repeatable type="bool">true</repeatable>
185
    <binding>
186
      <command>property-adjust</command>
187
      <property>/controls/flight/elevator-trim</property>
188
      <step type="double">-0.002</step>
189
    </binding>
190
  </button>
191

            
192
  <button n="5">
193
    <desc>Elevator trim up</desc>
194
    <repeatable type="bool">true</repeatable>
195
    <binding>
196
      <command>property-adjust</command>
197
      <property>/controls/flight/elevator-trim</property>
198
      <step type="double">0.002</step>
199
    </binding>
200
  </button>
201

            
202
  <button n="6">
203
    <desc>Flaps up</desc>
204
    <repeatable>false</repeatable>
205
    <binding>
206
      <command>nasal</command>
207
      <script>controls.flapsDown(-1)</script>
208
    </binding>
209
    <mod-up>
210
      <binding>
211
        <command>nasal</command>
212
        <script>controls.flapsDown(0)</script>
213
      </binding>
214
    </mod-up>
215
  </button>
216

            
217
  <button n="7">
218
    <desc>Flaps down</desc>
219
    <repeatable>false</repeatable>
220
    <binding>
221
      <command>nasal</command>
222
      <script>controls.flapsDown(1)</script>
223
    </binding>
224
    <mod-up>
225
      <binding>
226
        <command>nasal</command>
227
        <script>controls.flapsDown(0)</script>
228
      </binding>
229
    </mod-up>
230
  </button>
231

            
232

            
233
  <button n="2">
234
    <desc>Aileron trim left</desc>
235
    <repeatable>true</repeatable>
236
    <binding>
237
      <command>nasal</command>
238
      <script>controls.applyBrakes(1, -1)</script>
239
    </binding>
240
    <mod-up>
241
      <binding>
242
        <command>nasal</command>
243
        <script>controls.applyBrakes(0, -1)</script>
244
      </binding>
245
    </mod-up>
246
    <binding>
247
      <condition>
248
        <not>
249
          <property>/rotors/tail/rpm</property>
250
        </not>
251
      </condition>
252
      <command>property-adjust</command>
253
      <property>/controls/flight/aileron-trim</property>
254
      <step type="double">-0.001</step>
255
    </binding>
256
    <desc>Rudder for helis</desc>
257
    <binding>
258
      <condition>
259
        <property>/rotors/tail/rpm</property>
260
      </condition>
261
      <command>property-adjust</command>
262
      <property>/controls/flight/rudder</property>
263
      <step type="double">-0.01</step>
264
    </binding>
265
  </button>
266

            
267
  <button n="3">
268
    <desc>Aileron trim right</desc>
269
    <repeatable>true</repeatable>
270
    <binding>
271
      <command>nasal</command>
272
      <script>controls.applyBrakes(1, 1)</script>
273
    </binding>
274
    <mod-up>
275
      <binding>
276
        <command>nasal</command>
277
        <script>controls.applyBrakes(0, 1)</script>
278
      </binding>
279
    </mod-up>
280
    <binding>
281
      <condition>
282
        <not>
283
          <property>/rotors/tail/rpm</property>
284
        </not>
285
      </condition>
286
      <command>property-adjust</command>
287
      <property>/controls/flight/aileron-trim</property>
288
      <step type="double">0.001</step>
289
    </binding>
290
    <desc>Rudder for helis</desc>
291
    <binding>
292
      <condition>
293
        <property>/rotors/tail/rpm</property>
294
      </condition>
295
      <command>property-adjust</command>
296
      <property>/controls/flight/rudder</property>
297
      <step type="double">0.01</step>
298
    </binding>
299
  </button>
300

            
301
</PropertyList>