Hi,

The file data\Input\Joysticks\Saitek\Aviator.xml did not recognize my new Saitek Aviator because its identifying name does not match the name given by my device (it's "Saitek AV8R Classic Stick" when the XML file says "Saitek AV8R Joystick".

Changing that name makes FG recognize the stick but several axes and buttons are switched: the axes and button numbers in the file are wrong with respect to my joystick.

I made a corrected XML file which is here attached and works correctly with my Aviator joystick. I don't know if the original was wrong or there are variants of the device with a few modifications.

Regards,

Alvaro

<?xml version="1.0" ?>
<!-- $Id: Aviator.xml,v 1.2 2007-12-13 18:30:55 mfranz Exp $ -->
<!-- Saitek AV8R/Aviator

  Copyright (C) 2007  Anders Gidenstam  (anders(at)gidenstam.org)
  This file is released under the GPL license.
-->
<PropertyList>

	<name>Saitek AV8R Classic Stick</name>

	<data>
		<modifier type="bool">false</modifier>
		<quick-view-active type="int">0</quick-view-active>
	</data>

	<nasal>
		<script>
			<![CDATA[
				 var self = cmdarg().getParent();
				 var data = self.getNode("data");
				 var modifier            = data.getNode("modifier");
				 var quick_view_active   = data.getNode("quick-view-active");
				 var old_view            = view.point.save();
				 var pressed             = [0,0,0,0,0,0,0,0,0,0,0,0];

				 var goal_heading_offset =
					 props.globals.getNode("/sim/current-view/goal-heading-offset-deg", 1);
				 var goal_pitch_offset   =
					 props.globals.getNode("/sim/current-view/goal-pitch-offset-deg", 1);

				 var kbdshift = props.globals.getNode("/devices/status/keyboard/shift", 1);
				 var kbdctrl  = props.globals.getNode("/devices/status/keyboard/ctrl", 1);
				 var kbdalt   = props.globals.getNode("/devices/status/keyboard/alt", 1);

				 var quick_view = func {
					 dir = arg[0];
					 if (dir == 0) {
						 quick_view_active.setIntValue(0);
						 view.point.move(old_view, 0.1);
					 } else {
						 if (quick_view_active.getValue() == 0) {
							 quick_view_active.setIntValue(1);
							 old_view = view.point.save();

							 if (dir == 1) {
								 goal_heading_offset.setDoubleValue
									 (getprop("/sim/view/config/left-direction-deg"));
								 goal_pitch_offset.setDoubleValue
									 (getprop("/sim/view/config/pitch-offset-deg"));
								 view.fovProp.setDoubleValue
									 (getprop("/sim/view/config/default-field-of-view-deg"));
							 } if (dir == 2) {
								 goal_heading_offset.setDoubleValue
									 (getprop("/sim/view/config/right-direction-deg"));
								 goal_pitch_offset.setDoubleValue
									 (getprop("/sim/view/config/pitch-offset-deg"));
								 view.fovProp.setDoubleValue
									 (getprop("/sim/view/config/default-field-of-view-deg"));
							 } if (dir == 3) {
								 goal_heading_offset.setDoubleValue
									 (getprop("/sim/view/config/front-direction-deg"));
								 goal_pitch_offset.setDoubleValue
									 (getprop("/sim/view/config/pitch-offset-deg"));
								 view.fovProp.setDoubleValue
									 (getprop("/sim/view/config/default-field-of-view-deg"));
							 } if (dir == 4) {
								 goal_heading_offset.setDoubleValue
									 (getprop("/sim/view/config/back-direction-deg"));
								 goal_pitch_offset.setDoubleValue
									 (getprop("/sim/view/config/pitch-offset-deg"));
								 view.fovProp.setDoubleValue
									 (getprop("/sim/view/config/default-field-of-view-deg"));
							 }
						 }
					 }
				 }

				 var trace = func(str) {
					 # Uncomment the line below to trace button presses.
					 #print("AV8R.xml: " ~ str);
				 }
   ]]>
		</script>
	</nasal>

	<!-- Analog axis 0. Aileron -->
	<axis n="0">
		<desc>aileron</desc>
		<binding>
			<command>property-scale</command>
			<property>/controls/flight/aileron</property>
			<dead-band type="double">0.01</dead-band>
			<offset type="double">0.0</offset>
			<squared type="bool">true</squared>
		</binding>
	</axis>

	<!-- Analog axis 1. Elevator -->
	<axis n="1">
		<desc>elevator</desc>
		<binding>
			<command>property-scale</command>
			<property>/controls/flight/elevator</property>
			<dead-band type="double">0.01</dead-band>
			<offset type="double">0.0</offset>
			<factor type="double">-1.0</factor>
			<squared type="bool">true</squared>
		</binding>
	</axis>

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

	<!-- Analog axis 2. Throttle 1 -->
	<axis>
		<number>
			<unix>2</unix>
			<mac>3</mac>
			<windows>2</windows>
		</number>
		<desc>throttle</desc>
		<binding>
			<command>nasal</command>
			<script>controls.throttleAxis()</script>
		</binding>
	</axis>
	<!-- Analog axis 4. Throttle 2 -->
	<axis n="4">
		<desc>mixture, +mod: propeller pitch</desc>
		<binding>
			<command>nasal</command>
			<script>
				if (!modifier.getValue()) {
				controls.mixtureAxis();
				} else {
				controls.propellerAxis();
				}
			</script>
		</binding>
	</axis>

	<!-- Axis 5. Hat left/right -->
	<axis n="6">
		<desc>quick view left/right, +mod: horizontal view pan</desc>
		<low>
			<repeatable type="bool">true</repeatable>
			<binding>
				<command>nasal</command>
				<script>
					<![CDATA[
						 trace("Axis 5, Hat: low!");
							if (modifier.getValue()) {
							 view.panViewDir(0.5);
						 } else {
							 quick_view(1);
						 }
	 ]]>
				</script>
			</binding>
			<mod-up>
				<binding>
					<command>nasal</command>
					<script>
						if (!modifier.getValue()) {
						quick_view(0);
						}
					</script>
				</binding>
			</mod-up>
		</low>
		<high>
			<repeatable type="bool">true</repeatable>
			<binding>
				<command>nasal</command>
				<script>
					<![CDATA[
						 trace("Axis 5, Hat: high!");
							if (modifier.getValue()) {
								view.panViewDir(-0.5);
						 } else {
							 quick_view(2);
						 }
		 ]]>
				</script>
			</binding>
			<mod-up>
				<binding>
					<command>nasal</command>
					<script>
						trace("Axis 5, Hat: low released!");
						if (!modifier.getValue()) {
						quick_view(0);
						}
					</script>
				</binding>
			</mod-up>
		</high>
	</axis>

	<!-- Axis 6. Hat up/down -->
	<axis n="7">
		<desc>view reset/quick view front, +mod: vertical view pan</desc>
		<low>
			<repeatable type="bool">true</repeatable>
			<binding>
				<command>nasal</command>
				<script>
					<![CDATA[
						 trace("Axis 6, Hat: low!");
							if (modifier.getValue()) {
							 view.panViewPitch(0.5);
							} else {
							 view.resetView();
						 }
					 ]]>
				</script>
			</binding>
			<mod-up>
				<binding>
					<command>nasal</command>
					<script>
						if (!modifier.getValue()) {
						#quick_view(0);
						}
					</script>
				</binding>
			</mod-up>
		</low>
		<high>
			<repeatable type="bool">true</repeatable>
			<binding>
				<command>nasal</command>
				<script>
					<![CDATA[
						 trace("Axis 6, Hat: high!");
							if (modifier.getValue()) {
							 view.panViewPitch(-0.5);
							} else {
							 quick_view(3);
						 }
					 ]]>
				</script>
			</binding>
			<mod-up>
				<binding>
					<command>nasal</command>
					<script>
						if (!modifier.getValue()) {
						quick_view(0);
						}
					</script>
				</binding>
			</mod-up>
		</high>
	</axis>

	<!-- Trigger Button -->
	<button n="0">
		<name>Trigger</name>
		<desc>function modifier, +Shift: trigger</desc>
		<binding>
			<command>nasal</command>
			<script>
				trace("Button 0 pressed!");
				if (kbdshift.getBoolValue()) {
				controls.trigger(1);
				} else {
				modifier.setIntValue(1);
				}
			</script>
		</binding>
		<mod-up>
			<binding>
				<command>nasal</command>
				<script>
					modifier.setIntValue(0);
					controls.trigger(0);
				</script>
			</binding>
		</mod-up>
	</button>

	<!-- Center Button -->
	<button n="2">
		<name>Center button</name>
		<desc>brakes, +mod: Toggle parking brake</desc>
		<binding>
			<command>nasal</command>
			<script>
				trace("Button 2 pressed!");
				if (modifier.getBoolValue()) {
				controls.applyParkingBrake(1);
				} else {
				controls.applyBrakes(1);
				}
			</script>
		</binding>
		<mod-up>
			<binding>
				<command>nasal</command>
				<script>
					controls.applyBrakes(0);
				</script>
			</binding>
		</mod-up>
	</button>

	<!-- Left Button -->
	<button n="1">
		<name>Left button</name>
		<desc>left brake</desc>
		<binding>
			<command>nasal</command>
			<script>
				trace("Button 2 pressed!");
				controls.applyBrakes(1, -1);
			</script>
		</binding>
		<mod-up>
			<binding>
				<command>nasal</command>
				<script>
					controls.applyBrakes(0, -1);
				</script>
			</binding>
		</mod-up>
	</button>

	<!-- Right Button -->
	<button n="3">
		<name>Right button</name>
		<desc>right brake</desc>
		<binding>
			<command>nasal</command>
			<script>
				trace("Button 3 pressed!");
				controls.applyBrakes(1, 1);
			</script>
		</binding>
		<mod-up>
			<binding>
				<command>nasal</command>
				<script>
					controls.applyBrakes(0, 1);
				</script>
			</binding>
		</mod-up>
	</button>

	<!-- Button: T1 -->
	<button n="4">
		<name>T1</name>
		<desc>next view, +mod: zoom in +Shift: next weapon</desc>
		<repeatable type="bool">true</repeatable>
		<binding>
			<command>nasal</command>
			<script>
				trace("Button 4 pressed!");
				if (modifier.getBoolValue()) {
				view.decrease();
				} else {
				if (!pressed[4]) {
				pressed[4] = 1;
				if (kbdshift.getBoolValue()) {
				controls.weaponSelect(1);
				} else {
				view.stepView(1);
				}
				}
				}
			</script>
		</binding>
		<mod-up>
			<binding>
				<command>nasal</command>
				<script>
					pressed[4] = 0;
				</script>
			</binding>
		</mod-up>
	</button>

	<!-- Button: T2 -->
	<button n="5">
		<name>T2</name>
		<desc>previous view, +mod: zoom out, +Shift: previous weapon</desc>
		<repeatable type="bool">true</repeatable>
		<binding>
			<command>nasal</command>
			<script>
				trace("Button 5 pressed!");
				if (modifier.getBoolValue()) {
				view.increase();
				} else {
				if (!pressed[5]) {
				pressed[5] = 1;
				if (kbdshift.getBoolValue()) {
				controls.weaponSelect(-1);
				} else {
				view.stepView(-1);
				}
				}
				}
			</script>
		</binding>
		<mod-up>
			<binding>
				<command>nasal</command>
				<script>
					pressed[5] = 0;
				</script>
			</binding>
		</mod-up>
	</button>

	<!-- Button: T3 -->
	<button n="6">
		<name>T3</name>
		<desc>trim nose up, +mod: disarm speed brakes</desc>
		<repeatable type="bool">true</repeatable>
		<binding>
			<command>nasal</command>
			<script>
				trace("Button 6 pressed!");
				if (modifier.getValue()) {
				setprop("/controls/flight/speedbrake", 0.0);
				} else {
				controls.elevatorTrim(1);
				}
			</script>
		</binding>
	</button>

	<!-- Button: T4 -->
	<button n="7">
		<name>T4</name>
		<desc>trim nose down, +mod: deploy speed brakes</desc>
		<repeatable type="bool">true</repeatable>
		<binding>
			<command>nasal</command>
			<script>
				trace("Button 7 pressed!");
				if (modifier.getValue()) {
				setprop("/controls/flight/speedbrake", 1.0);
				} else {
				controls.elevatorTrim(-1);
				}
			</script>
		</binding>
	</button>

	<!-- Button: T5 -->
	<button n="8">
		<name>T5</name>
		<desc>retract flaps one step, +mod: gear up</desc>
		<binding>
			<command>nasal</command>
			<script>
				trace("Button 8 pressed!");
				if (!modifier.getValue()) {
				controls.flapsDown(-1);
				} else {
				controls.gearDown(-1);
				}
			</script>
		</binding>
		<mod-up>
			<binding>
				<command>nasal</command>
				<script>
					controls.flapsDown(0);
					controls.gearDown(0);
				</script>
			</binding>
		</mod-up>
	</button>

	<!-- Button: T6 -->
	<button n="9">
		<name>T6</name>
		<desc>deploy flaps one step, +mod: gear down</desc>
		<binding>
			<command>nasal</command>
			<script>
				trace("Button 9 pressed!");
				if (!modifier.getValue()) {
				controls.flapsDown(1);
				} else {
				controls.gearDown(1);
				}
			</script>
		</binding>
		<mod-up>
			<binding>
				<command>nasal</command>
				<script>
					controls.flapsDown(0);
					controls.gearDown(0);
				</script>
			</binding>
		</mod-up>
	</button>

	<!-- Button: T7 -->
	<button n="10">
		<name>T7</name>
		<desc>Increase magnetos</desc>
		<binding>
			<command>nasal</command>
			<script>
				trace("Button 10 pressed!");
				controls.stepMagnetos(1);
			</script>
		</binding>
	</button>

	<!-- Button: T8 -->
	<button n="11">
		<name>T8</name>
		<desc>Decrease magnetos</desc>
		<binding>
			<command>nasal</command>
			<script>
				trace("Button 11 pressed!");
				controls.stepMagnetos(-1);
			</script>
		</binding>
	</button>

</PropertyList>
<!--
 * Overrides tab width for this buffer in Emacs so the tab width is reasonable.
 * This must remain at the end of the file.
 * ===========================================================================
 * Local variables:
 * tab-width: 1
 * indent-tabs-mode: nil
 * End:
-->
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to