From de4319af19c1fb7a0efa35e440c619027c506cd6 Mon Sep 17 00:00:00 2001
From: Henrik Pihl <ahvenas@gmail.com>
Date: Mon, 15 Nov 2010 15:49:25 +0200
Subject: [PATCH 1/2] New joystick definition.

---
 Input/Joysticks/SpeedLink/ps2.xml | 256 ++++++++++++++++++++++++++++++
 1 file changed, 256 insertions(+)
 create mode 100644 Input/Joysticks/SpeedLink/ps2.xml

diff --git a/Input/Joysticks/SpeedLink/ps2.xml b/Input/Joysticks/SpeedLink/ps2.xml
new file mode 100644
index 000000000..cff09a9ae
--- /dev/null
+++ b/Input/Joysticks/SpeedLink/ps2.xml
@@ -0,0 +1,256 @@
+<?xml version="1.0"?>
+<!--
+************************************************************************
+* Bindings for Sony Playstation 2 DualShock Analog Controller (SCPH-1200)
+* connected via Speedlink PS2 to PC adapter SL6502 
+* (USB hardware id: 0e8f:0003, as of linux kernel 2.6.2x)
+* http://www.speedlink.com/?p=2&cat=319&pid=20205&paus=1 
+* (working link as of 29.10.2010)
+* 
+* Tested under Linux and Windows XP (32bit)
+*
+* Axis 0 (left joystick): ailerons
+* Axis 1 (left joystick): elevator
+* Axis 2: not used, or we won't have a stable rudder
+* Axis 3 (right joystick): rudder
+* Axes 4 and 5 (d-pad): view direction (6 and 7 respectively under Windows)
+* NOTE to Windows users: axis 7 is inverted and currently there is 
+* no way to fix it per OS basis.
+*
+* Buttons according to the gamepad:
+* 
+* Button 3 (square): throttle up
+* Button 2 (cross): throttle down
+* Button 1 (circle): flap down
+* Button 0 (triangle): flap up
+* Button 6 (L1): elevator trim up
+* Button 7 (R1): elevator trim down
+* Button 4 (L2): left brake only
+* Button 5 (R2): right brake only
+* Button 9 (start): gear toggle
+* Button 8 (select): currently unused
+* Button 10 (left joystick button): view change
+* Button 11 (right joystick button): parking brake toggle
+
+************************************************************************
+-->
+
+<PropertyList>
+  <name>GreenAsia Inc.    USB Joystick     </name>
+  <name>USB Joystick     </name>
+  <name>SPEED-LINK DUAL SHOCK ADAPTER</name>
+  
+  <nasal>
+    <script>
+      gui.popupTip("Enable analog mode!", 10);
+    </script>
+  </nasal>
+
+  <axis n="0">
+    <desc>Aileron</desc>
+    <binding>
+      <command>property-scale</command>
+      <property>/controls/flight/aileron</property>
+      <factor type="double">0.6</factor>
+      <squared type="bool">true</squared>
+      <dead-band type="double">0.2</dead-band>
+    </binding>
+  </axis>
+
+  <axis n="1">
+    <desc>Elevator</desc>
+    <binding>
+      <command>property-scale</command>
+      <property>/controls/flight/elevator</property>
+      <factor type="double">-0.6</factor>
+      <squared type="bool">true</squared>
+      <dead-band type="double">0.2</dead-band>
+    </binding>
+  </axis>
+
+#  <axis n="3">
+#    <desc>Rudder</desc>
+#    <binding>
+#      <command>property-scale</command>
+#      <property>/controls/flight/rudder</property>
+#      <factor type="double">0.5</factor>
+#    </binding>
+#  </axis>
+
+  <axis>
+    <desc>View direction</desc>
+    <number>
+      <windows>6</windows>
+      <unix>4</unix>
+    </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>
+    </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="6">
+    <desc>Elevator trim up</desc>
+    <repeatable type="bool">true</repeatable>
+    <binding>
+      <command>property-adjust</command>
+      <property>/controls/flight/elevator-trim</property>
+      <step type="double">0.001</step>
+    </binding>
+  </button>
+
+  <button n="7">
+    <desc>Elevator trim down</desc>
+    <repeatable type="bool">true</repeatable>
+    <binding>
+      <command>property-adjust</command>
+      <property>/controls/flight/elevator-trim</property>
+      <step type="double">-0.001</step>
+    </binding>
+  </button>
+
+  <button n="0">
+    <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="1">
+    <desc>Flaps down</desc>
+    <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="4">
+    <desc>Left brake</desc>
+    <binding>
+      <command>nasal</command>
+      <script>controls.applyBrakes(1,-1)</script>
+    </binding>
+    <mod-up>
+      <binding>
+        <command>nasal</command>
+        <script>controls.applyBrakes(0, -1)</script>
+      </binding>
+    </mod-up>
+  </button>
+
+  <button n="5">
+    <desc>Right brake</desc>
+    <binding>
+      <command>nasal</command>
+      <script>controls.applyBrakes(1,1)</script>
+    </binding>
+    <mod-up>
+      <binding>
+        <command>nasal</command>
+        <script>controls.applyBrakes(0, 1)</script>
+      </binding>
+    </mod-up>
+  </button>
+
+  <button n="9">
+    <desc>Landing gear toggle</desc>
+    <repeatable>false</repeatable>
+    <binding>
+      <command>nasal</command>
+      <script>controls.gearToggle()</script>
+    </binding>
+  </button>
+
+  <button n="3">
+    <desc>Throttle up</desc>
+    <repeatable>true</repeatable>
+    <binding>
+      <command>nasal</command>
+      <script>_ = sprintf("Throttle = %.3f", controls.adjThrottle(0.5))</script>
+    </binding>
+  </button>
+
+  <button n="2">
+    <desc>Throttle down</desc>
+    <repeatable>true</repeatable>
+    <binding>
+      <command>nasal</command>
+      <script>_ = sprintf("Throttle = %.3f", controls.adjThrottle(-0.5))</script>
+    </binding>
+  </button>
+
+  <button n="8">
+    <desc>Not used</desc>
+    <repeatable>false</repeatable>
+    <binding>
+    </binding>
+  </button>
+
+  <button n="10">
+    <desc>View</desc>
+    <repeatable>false</repeatable>
+    <binding>
+      <command>nasal</command>
+      <script>view.stepView(1)</script>
+    </binding>
+  </button>
+
+  <button n="11">
+    <desc>Parking brake toggle</desc>
+    <repeatable>false</repeatable>
+    <binding>
+      <command>property-toggle</command>
+      <property>/controls/gear/brake-parking</property>
+    </binding>
+  </button>
+</PropertyList>

From 7062de844f4caf3fbca3d5391a98bfb7479806f4 Mon Sep 17 00:00:00 2001
From: Torsten Dreyer <Torsten@t3r.de>
Date: Fri, 26 Nov 2010 14:10:59 +0100
Subject: [PATCH 2/2] GlobalWx: Metar does not update high altitudes visibility

---
 Environment/metarinterpolator.xml |  6 +-----
 gui/dialogs/weather.xml           | 24 ------------------------
 2 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/Environment/metarinterpolator.xml b/Environment/metarinterpolator.xml
index 348f7bb92..2d784bc43 100644
--- a/Environment/metarinterpolator.xml
+++ b/Environment/metarinterpolator.xml
@@ -93,7 +93,7 @@
     <!--
       transfer the visibility to each layer of
       interpolation controller. We are not very creative here and 
-      use the same visibility for all layers but top three which
+      use the same visibility for all layers but top four which
       are left untouched.
     -->
     <name>MetarController:visibility-m</name>
@@ -109,10 +109,6 @@
     <output>/environment/config/boundary/entry[0]/visibility-m</output>
     <output>/environment/config/boundary/entry[1]/visibility-m</output>
     <output>/environment/config/aloft/entry[0]/visibility-m</output>
-    <output>/environment/config/aloft/entry[1]/visibility-m</output>
-    <output>/environment/config/aloft/entry[2]/visibility-m</output>
-    <output>/environment/config/aloft/entry[3]/visibility-m</output>
-    <output>/environment/config/aloft/entry[4]/visibility-m</output>
   </filter>
 
   <!-- split the wind vector into it's components -->
diff --git a/gui/dialogs/weather.xml b/gui/dialogs/weather.xml
index fd896f971..2d95e816d 100644
--- a/gui/dialogs/weather.xml
+++ b/gui/dialogs/weather.xml
@@ -615,12 +615,6 @@
               <row>1</row>
               <col>3</col>
               <pref-width>55</pref-width>
-              <enable>
-                <equals>
-                  <property>/sim/gui/dialogs/weather-scenario/state</property>
-                  <value type="int">1</value>
-                </equals>
-              </enable>
               <property>/environment/config/aloft/entry[4]/visibility-m</property>
               <live>true</live>
               <binding>
@@ -729,12 +723,6 @@
               <row>2</row>
               <col>3</col>
               <pref-width>55</pref-width>
-              <enable>
-                <equals>
-                  <property>/sim/gui/dialogs/weather-scenario/state</property>
-                  <value type="int">1</value>
-                </equals>
-              </enable>
               <property>/environment/config/aloft/entry[3]/visibility-m</property>
               <live>true</live>
               <binding>
@@ -843,12 +831,6 @@
               <row>3</row>
               <col>3</col>
               <pref-width>55</pref-width>
-              <enable>
-                <equals>
-                  <property>/sim/gui/dialogs/weather-scenario/state</property>
-                  <value type="int">1</value>
-                </equals>
-              </enable>
               <property>/environment/config/aloft/entry[2]/visibility-m</property>
               <live>true</live>
               <binding>
@@ -957,12 +939,6 @@
               <row>4</row>
               <col>3</col>
               <pref-width>55</pref-width>
-              <enable>
-                <equals>
-                  <property>/sim/gui/dialogs/weather-scenario/state</property>
-                  <value type="int">1</value>
-                </equals>
-              </enable>
               <property>/environment/config/aloft/entry[1]/visibility-m</property>
               <live>true</live>
               <binding>