I am currently using an Xbox One controller with Flight Gear 2020.8.3 on windows 10, trying to fly with a Cessna 172. Everything seems to be working except the parking break command.
Here is the code in the .xml file (took it from here : viewtopic.php?t=29576# and only changed the controller's name):
- Code: Select all
<?xml version="1.0" ?>
<!--
**************X360 Controller for Windows layout****************
Axes 0,1 (Left-stick): View direction and elevation
Axis 2 (Trigger buttons LT/RT): Rudder
Axis 3 (Right-stick U/D): Elevator
Axis 4 (Right-stick L/R): Ailerons
Axis 6 (D-pad L/R): Aileron trim
Axis 7 (D-pad U/D): Elevator trim
Button 0 (A): Flaps down
Button 1 (B): Brakes
Button 2 (X): Flaps up
Button 3 (Y): Park brake toggle
Button 4 (Left shoulder): Throttle decrease
Button 5 (Right shoulder): Throttle increase
Button 6 (Back): Landing gear toggle
Button 7 (Start): Pause
Button 8 (Press left-stick): Reset view
****************************************************************
-->
<PropertyList>
<name>Controller (Xbox One For Windows)</name>
<axis n="0">
<desc>View Direction</desc>
<low>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-heading-offset-deg</property>
<step type="double">2</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</step>
</binding>
</high>
</axis>
<axis n="1">
<desc>View Elevation</desc>
<low>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-pitch-offset-deg</property>
<step type="double">-1</step>
</binding>
</low>
<high>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-pitch-offset-deg</property>
<step type="double">1</step>
</binding>
</high>
</axis>
<axis n="2">
<desc>Rudder</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/rudder</property>
<factor type="double">-1.0</factor>
</binding>
</axis>
<axis n="3">
<desc>Elevator</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/elevator</property>
<factor type="double">-1.0</factor>
<squared type="bool">true</squared>
</binding>
</axis>
<axis n="4">
<desc>Aileron</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/aileron</property>
<squared type="bool">true</squared>
</binding>
</axis>
<axis n="6">
<desc>Aileron trim</desc>
<low>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/controls/flight/aileron-trim</property>
<step type="double">-0.002</step>
</binding>
</low>
<high>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/controls/flight/aileron-trim</property>
<step type="double">0.002</step>
</binding>
</high>
</axis>
<axis n="7">
<desc>Elevator trim</desc>
<low>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/controls/flight/elevator-trim</property>
<step type="double">-1.5</step>
</binding>
</low>
<high>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/controls/flight/elevator-trim</property>
<step type="double">1.5</step>
</binding>
</high>
</axis>
<button n="0">
<desc>Flaps Down</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>controls.flapsDown(1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.flapsDown(0)</script>
</binding>
</mod-up>
</button>
<button n="1">
<desc>Brakes</desc>
<binding>
<command>nasal</command>
<script>controls.applyBrakes(1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.applyBrakes(0)</script>
</binding>
</mod-up>
</button>
<button n="2">
<desc>Flaps Up</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>controls.flapsDown(-1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.flapsDown(0)</script>
</binding>
</mod-up>
</button>
<button n="3">
<desc>Parking brake</desc>
<repeatable type="bool">false</repeatable>
<binding>
<command>nasal</command>
<script>
var pb = !getprop("/controls/gear/brake-parking");
pb = pb!;
setprop ("/controls/gear/brake-parking",pb);
</script>
</binding>
</button>
<button n="4">
<desc>Decrease throttle</desc>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>
controls.incThrottle(-0.01, -1.0)
</script>
</binding>
</button>
<button n="5">
<desc>Increase throttle</desc>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>
controls.incThrottle(0.01, 1.0)
</script>
</binding>
<mod-shift>
<desc>full throttle</desc>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>
props.setAll("/controls/engines/engine", "throttle", 1)
</script>
</binding>
</mod-shift>
</button>
<button n="6">
<desc>Landing gear toggle</desc>
<repeatable type="bool">false</repeatable>
<binding>
<command>nasal</command>
<script>
controls.gearToggle()
</script>
</binding>
</button>
<button n="7">
<desc>Pause</desc>
<repeatable type="bool">false</repeatable>
<binding>
<command>nasal</command>
<script>
var p =getprop ("/sim/freeze/master");
p = !p;
setprop ("sim/freeze/master",p);
setprop ("sim/freeze/clock",p)
</script>
</binding>
</button>
<button n="8">
<desc>Center View</desc>
<repeatable type="bool">false</repeatable>
<binding>
<command>nasal</command>
<script>view.resetView()</script>
</binding>
</button>
</PropertyList>
As I said, everything else seems to be working.
The button on the controller should be Y, as it is recognised directly in FlightGear and I can't figure out why the parking brake doesn't move when I press it...
I tried to look up for the button number via js_demo. The controller is detected but none of the buttons get displayed in the program when I press them; even though they work fine in FlightGear.
(And yes, I can use shift+b on the keyboard, it works, but I was just wondering if there was any fix for the controller )
Any clue on what's wrong here ?
Thanks