<?xml version="1.0"?>

<!--

************************************************************************

Bindings for Speedlink Defender joystick. 
Tested with FG-v2.6 on Windows and FG-v2.4 on Debian
 as no Mac testing possible, same mapping as Linux is assumed
 must be evaluated
                     win  lin  max
mapping of axis:
 ailernon             0    0    0?
 elevator             1    1    1?
 rudder               3    2    2?
 throttle             2    3    3?
 coolie hat           6    4    4?
 coolie hat           7    5    5?
mapping of buttons
 center view          0    0    0?
 all brakes           1    1    1?
 elevator trim up     2    2    2?
 elevator trim down   3    3    3?


2012-03-09 Nikolaus Kerner
************************************************************************

-->

<PropertyList>

 <name type="string">USB, 4-axis, 4-button joystick w/view finder</name> <!-- WinXP -->
 <name type="string">Padix Co. Ltd. USB, 4-axis, 4-button joystick w/view finder</name> <!-- Linux -->

 <axis>
  <desc type="string">Aileron</desc>
  <number>
   <windows>0</windows>
   <unix>0</unix>
   <mac>0</mac>
  </number>
  <binding>
   <command>property-scale</command>
   <property>/controls/flight/aileron</property>
   <dead-band type="double">0.02</dead-band>
   <offset    type="double">0.0</offset>
   <factor    type="double">1.0</factor>
   <power     type="double">1.5</power>
  </binding>
 </axis>

 <axis>
  <desc type="string">Elevator</desc>
  <number>
   <windows>1</windows>
   <unix>1</unix>
   <mac>1</mac>
  </number>
  <binding>
   <command>property-scale</command>
   <property>/controls/flight/elevator</property>
   <dead-band type="double">0.02</dead-band>
   <offset    type="double">0.0</offset>
   <factor    type="double">-1.0</factor>
   <power     type="double">1.5</power>
  </binding>
 </axis>

 <axis>
  <desc>Rudder</desc>
  <number>
   <windows>3</windows>
   <unix>2</unix>
   <mac>2</mac>
  </number>
  <binding>
   <command>property-scale</command>
   <property>/controls/flight/rudder</property>
   <dead-band type="double">0.02</dead-band>
   <offset    type="double">0.0</offset>
   <factor    type="double">1.0</factor>
   <power     type="double">1.5</power>
  </binding>
 </axis>

 <axis>
  <desc>Throttle</desc>
  <number>
   <windows>2</windows>
   <unix>3</unix>
   <mac>3</mac>
  </number>
  <binding>
   <command>nasal</command>
   <script>controls.throttleAxis()</script>
  </binding>
 </axis>

 <axis>
  <desc>View Direction</desc>
  <number>
   <windows>6</windows>
   <unix>4</unix>
   <mac>4</mac>
  </number>
  <low>
   <repeatable>true</repeatable>
   <binding>
    <command>property-adjust</command>
    <property>/sim/current-view/goal-heading-offset-deg</property>
    <step type="double">2.0</step>
   </binding>
  </low>
  <high>
   <repeatable>true</repeatable>
   <binding>
    <command>property-adjust</command>
    <property>/sim/current-view/goal-heading-offset-deg</property>
    <step type="double">-2.0</step>
   </binding>
  </high>
 </axis>

 <axis>
  <desc>View Elevation</desc>
  <number>
   <windows>7</windows>
   <unix>5</unix>
   <mac>5</mac>
  </number>
  <low>
   <repeatable>true</repeatable>
   <binding>
    <command>property-adjust</command>
    <property>/sim/current-view/goal-pitch-offset-deg</property>
    <step type="double">-2.0</step>
   </binding>
  </low>
  <high>
   <repeatable>true</repeatable>
   <binding>
    <command>property-adjust</command>
    <property>/sim/current-view/goal-pitch-offset-deg</property>
    <step type="double">2.0</step>
   </binding>
  </high>
 </axis>


 <button n="0">
  <desc>Center View</desc>
  <repeatable type="bool">false</repeatable>
  <binding>
   <command>nasal</command>
   <script>view.resetView()</script>
  </binding>
 </button>

 <button n="1">
  <desc>Brakes</desc>
  <binding>
   <command>nasal</command>
   <script>controls.applyBrakes(1, 0)</script>
  </binding>
  <mod-up>
   <binding>
    <command>nasal</command>
    <script>controls.applyBrakes(0, 0)</script>
   </binding>
  </mod-up>
 </button>

 <button n="2">
  <desc>Elevator trim up</desc>
  <repeatable type="bool">true</repeatable>
  <binding>
   <command>nasal</command>
   <script>controls.elevatorTrim(1)</script>
  </binding>
 </button>

 <button n="3">
  <desc>Elevator trim down</desc>
  <repeatable type="bool">true</repeatable>
  <binding>
   <command>nasal</command>
   <script>controls.elevatorTrim(-1)</script>
  </binding>
 </button>

 
 </PropertyList>

<!-- end of joystick.xml -->