config / .fgfs / Input / Joysticks / Microsoft-SideWinder-Joystick.xml /
Newer Older
311 lines | 8.468kb
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[
controles de vol par la sour...
Sébastien MARQUE authored on 2020-04-17
29
      var skipFlightControls = props.globals.getNode("/sim/mouse/skip-flight-controls-mode");
30
      setlistener("/sim/signals/fdm-initilized", func {
31
          skipFlightControls.setBoolValue(1);
32
          print("JOYSTICK set mouse flight control OFF: ", skipFlightControls.getValue());
33
      }, 1 );
34
      setlistener("/sim/signals/save", func {
35
          skipFlightControls.setBoolValue(0);
36
          print("JOYSTICK save mouse flight control ON: ", skipFlightControls.getValue());
37
      } );
38

            
ajout conf perso pour flight...
Sébastien MARQUE authored on 2017-05-11
39
      var shift = props.globals.getNode("/devices/status/keyboard/shift");
40
      var ctrl = props.globals.getNode("/devices/status/keyboard/ctrl");
41
      var alt = props.globals.getNode("/devices/status/keyboard/alt");
42

            
43
      var get_modifiers = func {
44
          shift.getValue() + 2 * ctrl.getValue() + 4 * alt.getValue();
45
      }
46

            
47
      var space_release = func {}
48
      var space = func(state, mod) {
49
          if (!state) {
50
              space_release();
51
              return space_release = func {};
52
          }
53
          if (mod == 0 or mod == 1) {
54
              controls.ptt(mod + 1);
55
              space_release = func { controls.ptt(0) }
56
          }
57
      }
58

            
59
      var button0 = func {}
60
      var gunned = props.globals.getNode("/controls/armament/trigger");
61
      if (gunned != nil)
62
          button0 = func (v) { 
63
	      setprop("/ai/submodels/trigger", v);
64
	      setprop("/controls/armament/trigger", v);
cosmetics
Sébastien MARQUE authored on 2020-04-17
65
	    }
ajout conf perso pour flight...
Sébastien MARQUE authored on 2017-05-11
66
      else
67
          button0 = func (v) { setprop("/sim/current-view/view-number", v); 
68
      }
69
    ]]></script>
70
  </nasal>
71

            
72
  <name>Microsoft SideWinder Joystick</name>
73

            
74
  <axis n="0">
75
    <desc>Rudder if not heli (auto-coordination), on ground and in air</desc>
76
    <binding>
77
      <condition>
78
        <not>
fix gestion gouverne de dire...
moi authored on 2020-04-12
79
          <property>/rotors/rotor/brake</property>
ajout conf perso pour flight...
Sébastien MARQUE authored on 2017-05-11
80
        </not>
81
      </condition>
82
      <command>property-scale</command>
83
      <property>/controls/flight/rudder</property>
84
      <squared type="bool">true</squared>
85
    </binding>
86
    <desc>Aileron, only in air</desc>
87
    <binding>
88
      <condition>
89
        <not>
90
          <and>
91
            <property>/gear/gear[1]/wow</property>
92
            <property>/gear/gear[2]/wow</property>
93
          </and>
94
        </not>
95
      </condition>
96
      <command>property-scale</command>
97
      <property>/controls/flight/aileron</property>
98
      <squared type="bool">true</squared>
99
    </binding>
100
  </axis>
101

            
102
  <axis n="1">
103
    <desc>Elevator</desc>
104
    <binding>
105
      <command>property-scale</command>
106
      <property>/controls/flight/elevator</property>
107
      <factor type="double">-1.0</factor>
108
      <squared type="bool">true</squared>
109
    </binding>
110
  </axis>
111

            
112
  <axis n="2">
113
    <desc>Throttle</desc>
114
    <binding>
115
      <command>nasal</command>
116
      <script>controls.throttleAxis()</script>
117
    </binding>
118
  </axis>
119

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

            
170
  <button n="1">
171
    <desc>PTT - Push To Talk (via VoIP)</desc>
172
    <binding>
173
      <command>nasal</command>
174
      <script>
175
        var m = get_modifiers();
176
        if (m == 4) aircraft.autotrim.start();
177
        else space(1, m);
178
      </script>
179
    </binding>
180
    <mod-up>
181
      <binding>
182
        <command>nasal</command>
183
        <script>
184
          var m = get_modifiers();
185
          if (m == 4) aircraft.autotrim.stop();
186
          else space(0, m);
187
        </script>
188
      </binding>
189
    </mod-up>
190
  </button>
191

            
192
  <button n="4">
193
    <desc>Elevator trim down</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="5">
203
    <desc>Elevator trim up</desc>
204
    <repeatable type="bool">true</repeatable>
205
    <binding>
206
      <command>property-adjust</command>
207
      <property>/controls/flight/elevator-trim</property>
208
      <step type="double">0.002</step>
209
    </binding>
210
  </button>
211

            
212
  <button n="6">
213
    <desc>Flaps up</desc>
214
    <repeatable>false</repeatable>
215
    <binding>
216
      <command>nasal</command>
217
      <script>controls.flapsDown(-1)</script>
218
    </binding>
219
    <mod-up>
220
      <binding>
221
        <command>nasal</command>
222
        <script>controls.flapsDown(0)</script>
223
      </binding>
224
    </mod-up>
225
  </button>
226

            
227
  <button n="7">
228
    <desc>Flaps down</desc>
229
    <repeatable>false</repeatable>
230
    <binding>
231
      <command>nasal</command>
232
      <script>controls.flapsDown(1)</script>
233
    </binding>
234
    <mod-up>
235
      <binding>
236
        <command>nasal</command>
237
        <script>controls.flapsDown(0)</script>
238
      </binding>
239
    </mod-up>
240
  </button>
241

            
242

            
243
  <button n="2">
244
    <desc>Aileron trim left</desc>
245
    <repeatable>true</repeatable>
246
    <binding>
247
      <command>nasal</command>
248
      <script>controls.applyBrakes(1, -1)</script>
249
    </binding>
250
    <mod-up>
251
      <binding>
252
        <command>nasal</command>
253
        <script>controls.applyBrakes(0, -1)</script>
254
      </binding>
255
    </mod-up>
256
    <binding>
257
      <condition>
258
        <not>
259
          <property>/rotors/tail/rpm</property>
260
        </not>
261
      </condition>
262
      <command>property-adjust</command>
263
      <property>/controls/flight/aileron-trim</property>
264
      <step type="double">-0.001</step>
265
    </binding>
266
    <desc>Rudder for helis</desc>
267
    <binding>
268
      <condition>
269
        <property>/rotors/tail/rpm</property>
270
      </condition>
271
      <command>property-adjust</command>
272
      <property>/controls/flight/rudder</property>
273
      <step type="double">-0.01</step>
274
    </binding>
275
  </button>
276

            
277
  <button n="3">
278
    <desc>Aileron trim right</desc>
279
    <repeatable>true</repeatable>
280
    <binding>
281
      <command>nasal</command>
282
      <script>controls.applyBrakes(1, 1)</script>
283
    </binding>
284
    <mod-up>
285
      <binding>
286
        <command>nasal</command>
287
        <script>controls.applyBrakes(0, 1)</script>
288
      </binding>
289
    </mod-up>
290
    <binding>
291
      <condition>
292
        <not>
293
          <property>/rotors/tail/rpm</property>
294
        </not>
295
      </condition>
296
      <command>property-adjust</command>
297
      <property>/controls/flight/aileron-trim</property>
298
      <step type="double">0.001</step>
299
    </binding>
300
    <desc>Rudder for helis</desc>
301
    <binding>
302
      <condition>
303
        <property>/rotors/tail/rpm</property>
304
      </condition>
305
      <command>property-adjust</command>
306
      <property>/controls/flight/rudder</property>
307
      <step type="double">0.01</step>
308
    </binding>
309
  </button>
310

            
311
</PropertyList>