From 92fdbe3f1ba9939916ebfba2cbc62e5b3d86f479 Mon Sep 17 00:00:00 2001 From: mfranz <mfranz> Date: Wed, 12 Dec 2007 21:52:56 +0000 Subject: [PATCH] Arvid NORLANDER: trigger, aircraft specific stuff, cleanup, ... --- Input/Joysticks/Saitek/X52-pro.xml | 135 ++++++++++++++++++----------- 1 file changed, 82 insertions(+), 53 deletions(-) diff --git a/Input/Joysticks/Saitek/X52-pro.xml b/Input/Joysticks/Saitek/X52-pro.xml index fb6227c50..9f554eab8 100644 --- a/Input/Joysticks/Saitek/X52-pro.xml +++ b/Input/Joysticks/Saitek/X52-pro.xml @@ -3,7 +3,7 @@ Based on X52.xml and Aviator.xml Modified by Arvid Norlander; 2007-12-03 - This file is released under the GPL license. + This file is released under the GPL license version 2 or later. --> <!-- @@ -13,7 +13,8 @@ Common Axis/Buttons + Bottom stick hat: View directions (Increase/Decrease visibility & Zoom In/Out when shifted) + Throttle foreside hat: Up/down: View cycles (Shift: flaps up/down). Left/right: Rudder trim + Throttle slider: Boost Control (if available) - + Tirgger: Apply all brakes + + Trigger: Apply all brakes + + Trigger (fully pressed): Fire weapons + Fire button: Toggle parking brake + Stick button "A": Gear up (Shift: gear down) + Stick button "B": HUD master switch @@ -22,33 +23,41 @@ Common Axis/Buttons + Throttle button "D": Right brake + Throttle button "E": Left brake + Throttle button "i": PTT (Push to talk, for fgcom) - + Throttle mouse button: Start Selected Engine(s) + T1/T2: Hook up/down (Increase/Decrease spoilers when shifted) + T3/T4: Increase/Decrease slats + T5/T6: Increase/Decrease Speedbrake (Increase/Decrease magneto when shifted) +The modes below has been selected to provide generic functions even if there is +no specific support for the current aircraft. Mode 3 is likely best if there is +support for the aircraft in question. + Mode 1: Propeller Aircraft + Top rotary dial: Mixture + Bottom rotary dial: Prop Advance - + Throttle mouse button: Start Selected Engine(s) Mode 2: Jet Aircraft + Top rotary dial: Carb Heat -Mode 3: Not implemented yet +Mode 3: Aircraft specific. + Harrier: + + Throttle: + * Bottom "rotary dial" Thrust vector + Lightning: + + Throttle: + * Shifted "D" Braking chute Linux Axis Numbers (no idea about window/mac ones, and they are not same as plain X52 axis numbers on linux at least): - 0 Roll (positive == right) - 1 Pitch (positive == down/back/nose-up) - 2 Throttle (positive == back/down/idle) - 3 Bottom "rotary dial" on the throttle (positive == CW) - 4 Top "rotary dial" on the throttle (positive == CCW) + 0 Roll ........................................... (positive == right) + 1 Pitch .......................................... (positive == down/back/nose-up) + 2 Throttle ....................................... (positive == back/down/idle) + 3 Bottom "rotary dial" on the throttle ........... (positive == CW) + 4 Top "rotary dial" on the throttle .............. (positive == CCW) 5 Rocker switch ("rudder" control) on the throttle (positive == right) - 6 Slider on the throttle (positive == forward) - 7 Lower right hat horizontal axis (positive == right) - 8 Lower right hat vertical axis (positive == down (Mac positive is UP)) - 9 Mouse Y (positive = up) - 10 Mouse X (positive = right) + 6 Slider on the throttle ......................... (positive == forward) + 7 Lower right hat horizontal axis ................ (positive == right) + 8 Lower right hat vertical axis .................. (positive == down) + 9 Mouse Y (positive = up) (Please don't use this, some of us want to map this to mouse in X) + 10 Mouse X (positive = right) (Please don't use this, some of us want to map this to mouse in X) Button Numbers (Probably identical b/w Linux/Windows/Mac): 0 Trigger (half pressed) @@ -65,7 +74,8 @@ Button Numbers (Probably identical b/w Linux/Windows/Mac): 11 T4 12 T5 13 T6 -15 Throttle mouse switch +14 Trigger (fully pressed) +15 Throttle mouse switch (Please don't use this, some of us want to map this to mouse in X) 16 Throttle forefinger wheel scroll down 17 Throttle forefinger wheel scroll up 18 Throttle forefinger wheel click @@ -89,6 +99,7 @@ Button Numbers (Probably identical b/w Linux/Windows/Mac): 36 MFD-select wheel below MFD up 37 MFD-select wheel below MFD down 38 MFD-select wheel below MFD click + $Id$ --> <PropertyList> @@ -109,6 +120,11 @@ $Id$ var data = self.getNode("data"); var modifier = data.getNode("modifier"); var mode = data.getNode("mode"); + # This does not change during a session. + # Not called plain "aircraft" to prevent + # overwriting the Nasal/aircraft.nas scope + # as we need to access that too from here. + var aircraftModel = getprop("/sim/aircraft"); ]]> </script> </nasal> @@ -151,7 +167,7 @@ $Id$ <script> <![CDATA[ if (modifier.getValue()) { - # fgcommand("increase-visibility", "/null"); + fgcommand("increase-visibility"); } else { view.panViewDir(1); } @@ -166,7 +182,7 @@ $Id$ <script> <![CDATA[ if (modifier.getValue()) { - # fgcommand("decrease-visibility", "/null"); + fgcommand("decrease-visibility"); } else { view.panViewDir(-1); } @@ -246,6 +262,10 @@ $Id$ var val = mode.getValue(); if (val == 1) { controls.propellerAxis(-1); + } elsif (val == 3) { + if (aircraftModel == "harrier") { + controls.mixtureAxis(); + } } ]]> </script> @@ -272,6 +292,8 @@ $Id$ </binding> </axis> + <!-- Buttons --> + <!-- Trigger --> <button n="0"> <desc>Brakes</desc> @@ -292,7 +314,7 @@ $Id$ <desc>Toggle parking brake on or off</desc> <binding> <command>nasal</command> - <script>controls.applyParkingBrake(1);</script> + <script>controls.applyParkingBrake(1)</script> </binding> </button> @@ -314,17 +336,17 @@ $Id$ <mod-up> <binding> <command>nasal</command> - <script>controls.gearDown(0);</script> + <script>controls.gearDown(0)</script> </binding> </mod-up> </button> <!-- Button "B" --> <button n="3"> - <desc>HUD Master Switch</desc> + <desc>Cycle HUD colour</desc> <binding> <command>nasal</command> - <script>aircraft.HUD.cycle_color();</script> + <script>aircraft.HUD.cycle_color()</script> </binding> </button> @@ -354,12 +376,12 @@ $Id$ <desc>Shift switch for X52</desc> <binding> <command>nasal</command> - <script>modifier.setBoolValue(1);</script> + <script>modifier.setBoolValue(1)</script> </binding> <mod-up> <binding> <command>nasal</command> - <script>modifier.setBoolValue(0);</script> + <script>modifier.setBoolValue(0)</script> </binding> </mod-up> </button> @@ -369,12 +391,25 @@ $Id$ <desc>Right Brake</desc> <binding> <command>nasal</command> - <script>controls.applyBrakes(1, 1);</script> + <script>controls.applyBrakes(1, 1)</script> </binding> <mod-up> <binding> <command>nasal</command> - <script>controls.applyBrakes(0, 1);</script> + <script> + <![CDATA[ + if (modifier.getValue()) { + if (mode.getValue() == 3) { + if (aircraftModel == "lightning") { + setprop("/sim/model/lightning/controls/flight/chute_deployed", 1); + setprop("/sim/model/lightning/controls/flight/chute_open", 1); + } + } + } else { + controls.applyBrakes(0, 1); + } + ]]> + </script> </binding> </mod-up> </button> @@ -389,7 +424,7 @@ $Id$ <mod-up> <binding> <command>nasal</command> - <script>controls.applyBrakes(0, -1);</script> + <script>controls.applyBrakes(0, -1)</script> </binding> </mod-up> </button> @@ -428,12 +463,12 @@ $Id$ </binding> </button> - <!-- Flap control on the T3/T4 --> + <!-- Slats control on the T3/T4 --> <button n="10"> <desc>Increase slats</desc> <binding> <command>nasal</command> - <script>controls.stepSlats(1);</script> + <script>controls.stepSlats(1)</script> </binding> </button> @@ -441,11 +476,11 @@ $Id$ <desc>Decrease slats</desc> <binding> <command>nasal</command> - <script>controls.stepSlats(-1);</script> + <script>controls.stepSlats(-1)</script> </binding> </button> - <!-- per mode functions on the T6/T5 --> + <!-- Per mode functions on the T6/T5 --> <button n="12"> <desc>Increase speedbrake; Shift: Increase Magneto</desc> <binding> @@ -479,10 +514,19 @@ $Id$ </button> <!-- Button "Trigger Maximum pressed" --> - <!-- Not implemented yet <button n="14"> + <desc>Fire weapons</desc> + <binding> + <command>nasal</command> + <script>controls.trigger(1)</script> + </binding> + <mod-up> + <binding> + <command>nasal</command> + <script>controls.trigger(0)</script> + </binding> + </mod-up> </button> - --> <!-- Trim (upper) hat on the stick --> <button n="19"> @@ -649,7 +693,7 @@ $Id$ <desc>Mode 1</desc> <binding> <command>nasal</command> - <script>mode.setIntValue(1);</script> + <script>mode.setIntValue(1)</script> </binding> </button> @@ -657,7 +701,7 @@ $Id$ <desc>Mode 2</desc> <binding> <command>nasal</command> - <script>mode.setIntValue(2);</script> + <script>mode.setIntValue(2)</script> </binding> </button> @@ -665,7 +709,7 @@ $Id$ <desc>Mode 3</desc> <binding> <command>nasal</command> - <script>mode.setIntValue(3);</script> + <script>mode.setIntValue(3)</script> </binding> </button> @@ -674,27 +718,12 @@ $Id$ <desc>PTT (for fgcom)</desc> <binding> <command>nasal</command> - <script>controls.ptt(1);</script> + <script>controls.ptt(1)</script> </binding> <mod-up> <binding> <command>nasal</command> - <script>controls.ptt(0);</script> - </binding> - </mod-up> - </button> - - <!-- mouse button on the throttle --> - <button n="15"> - <desc>Fire Starter on Selected Engine(s)</desc> - <binding> - <command>nasal</command> - <script>controls.startEngine();</script> - </binding> - <mod-up> - <binding> - <command>nasal</command> - <script>props.setAll("/controls/engines/engine", "starter", 0);</script> + <script>controls.ptt(0)</script> </binding> </mod-up> </button>