Board index FlightGear Support Hardware

Idea for Saitek yoke with 2 throttle quadrants

Joysticks, pedals, monitors.

Idea for Saitek yoke with 2 throttle quadrants

Postby macnab » Sun Oct 07, 2012 2:57 am

Before I start coding, here is my initial idea. I would like suggestions for different approaches. I could even do more than 1!

Three modes for the levers:
Mode 1: 1 engine. Layout standard using left quadrant only.
Mode 2: 2 engines. Levers from left to right are Throttle 1 Throttle 2 Pitch 1 Pitch 2 Mixture 1 Mixture 2
Mode 3: 3 to 6 engines. Levers from left to right are Throttle 1 to 6. Modifier + buttons below levers to adjust pitch and mixture. Repeatable. Display of pitch on screen.

If anybody has a Saitek Pro Flight with 2 throttle quadrants, does the system load Pro-Flight-Yoke.xml and Pro-Flight-Quadrant.xml. I only have 1 quadrant at the moment.

I won't expect a rush of suggestions today - Japanese Grand Prix and ICC T20 finals on!!!
macnab
 
Posts: 886
Joined: Tue Aug 02, 2011 7:20 am
Location: Johannesburg, South Africa
Callsign: ZS-ILH
Version: Git
OS: Win7Pro 64bit SP1

Re: Idea for Saitek yoke with 2 throttle quadrants

Postby Philosopher » Sun Oct 07, 2012 3:26 am

That sounds very nice! I like the idea of displaying pitch on the screen, I'll have to include that in my bindings! It sounds like you are on the right track. Maybe you also want the mixture axis to control condition, which is used on many turboprops?

P.S. Fling the DHC-6 with that setup would be real sweet :D. Ooh boy, that would be awesome.
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: Idea for Saitek yoke with 2 throttle quadrants

Postby macnab » Sun Oct 07, 2012 5:01 am

Maybe you also want the mixture axis to control condition, which is used on many turboprops?
This is a 2-state, or 3-state on some aircraft, setting. Using an axis means assigning it to something (mixture as you suggest), then reading the value, then saying that if it is between certain values, set a specific condition, if between other values set it to a different one. Much easier to assign a modded button.

Fortunately, using setprop to a non existent property causes no harm, but implementing the above means that the pilot has to set the lever in specific areas. Or use full for high, 0 for low and reverse thrust for cut. That wouldn't be too hard, and easier for the pilot. Might as well add it.

Just successfully tested showing throttle value on screen.

Need a suggestion for an aircraft that has 2 engines, with propeller pitch so I can test.
macnab
 
Posts: 886
Joined: Tue Aug 02, 2011 7:20 am
Location: Johannesburg, South Africa
Callsign: ZS-ILH
Version: Git
OS: Win7Pro 64bit SP1

Re: Idea for Saitek yoke with 2 throttle quadrants

Postby macnab » Mon Oct 08, 2012 11:55 am

Done (I hope) with coding. Only have 1 quadrant, so can't test the 2nd quadrant. But have tested with the c172 and with the B1900.

Is there someone with 2 quadrants who cant test? It would be much appreciated. All the info for operation is at the beginning of the yoke file. You will have to move your current Pro-Flight-Yoke.xml and Pro-Flight-Quadrant to a safe place before putting these in your Saitek joystick folder.

Pro-Flight-Yoke-Multi.xml
Code: Select all
<?xml version="1.0"?>
<!-- Saitek Pro Flight Yoke - Pro-Flight-Yoke-Multi.xml
     
    Saitek Pro Flight Yoke with Quadrant with Lever Assignment
       (Best with 2 quadrants with Pro-Flight-Quadrant-Multi.xml

     Copyright (C) 2008  Oliver Schroeder  (fgfs(at)o-schroeder.de)
     This file is released under the GPL license.

     Modified 2012 by Nigel Mackay, in collaboration with others, for SaitekMultiMode to make quadrants multi-purpose.
     
     FG must be run with prop:SaitekMultiMode = 1 in the commandline. (Add your own - signs, not allowed in XML file.)

     SaitekMultiMode value assigns use of each quadrant lever according to this table.

     Mode Lever1 Lever2 Lever3 Leve4 Lever5 Lever 6
       1    T      P       M     .      .      .
       2    T      T       P     .      .      .
       3    T      T       M     .      .      .
       4    T      T       P     M      .      .
       5    T      T       P     P      M      .
       6    T      T       P     M      M      .
       7    T      T       P     P      M      M
       8    T      T       T     P      M      .
       9    T      T       T     T      P      M

     Where
        T = Throttle
        P = Propeller-pitch
        M = Mixture and condition
        . = Not assigned

     If there is only one T, P or M it does all engines.
     Where there are more than one they do the engines individually from left to right.

     Levers 1 to 3 are on the quadrant plugged into the yoke with a PS2 connector.
     Levers 4 to 6 are plugged with USB into the yoke or the PC.

     Assignment of SaitekMultiMode is done with Ctrl-Shift-T1 (decrease) and Ctrl-Shift-T2 (increase.)
     The mode and the lever assignment are shown on screen when changing. Displayed for 3 seconds to give you time to
     read it. If you want to change this time, there are 2 lines which must be edited. Change the 3 to however
     many seconds you want:
           gui.popupTip(sprintf("Mode %d %s", SaitekMultiMode, ModeStr), 3);

     Reverse-thrust will work per engine or for all engines, depending on mode.

     Propeller-feathering will work per engine or for all engines, depending on mode.

     Additional changes:
        While adjusting elevator-trim the value is shown on screen from -4.5 to +4.5.
        While adjusting aileron-trim the value is shown on-screen from -1 to +1.


-->

<PropertyList>
    <name>Saitek Saitek Pro Flight Yoke</name>
    <name>Saitek Pro Flight Yoke</name>

    var SaitekMultiMode
    var ModeStr

    <axis n="0">
        <desc>Aileron</desc>
        <binding>
            <command>property-scale</command>
            <property>/controls/flight/aileron</property>
            <squared type="bool">true</squared>
        </binding>
    </axis>
    <axis n="1">
        <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>

   <!-- Throttle Quadrant -->
   <!--  Lever 1  -->
   <axis n="2">
     <desc>Depends on SaitekMultiMode</desc>
     <binding>
       <command>nasal</command>
       <script>
         SaitekMultiMode = getprop("SaitekMultiMode");
         if (SaitekMultiMode == 1) {
           controls.throttleAxis()
         }
         else {
          controls.perEngineSelectedAxisHandler(0)(0)
         }
       </script>
    </binding>
    </axis>
 
   <!--  Lever 2  -->
    <axis>
      <number>
        <unix>3</unix>
        <windows>4</windows>
      </number>
      <desc>Depends on SaitekMultiMode</desc>
      <binding>
        <command>nasal</command>
          <script>
            SaitekMultiMode = getprop("SaitekMultiMode");
            if (SaitekMultiMode == 1) {
              controls.propellerAxis()
            }
            else {
              controls.perEngineSelectedAxisHandler(0)(1)
            }
          </script>
      </binding>
    </axis>

   <!--  Lever 3  -->
    <axis>
      <number>
        <unix>4</unix>
        <windows>3</windows>
      </number>
      <desc>Depends on SaitekMultiMode</desc>
      <binding>
        <command>nasal</command>
          <script><![CDATA[
            SaitekMultiMode = getprop("SaitekMultiMode");
            if ((SaitekMultiMode == 1) or (SaitekMultiMode == 3)) {
              controls.mixtureAxis();
              props.setAll("controls/engines/engine", "condition", getprop("controls/engines/engine/mixture"))
            }
            if ((SaitekMultiMode == 2) or (SaitekMultiMode == 4) or (SaitekMultiMode == 6)) {
                controls.propellerAxis()
            }
            if ((SaitekMultiMode == 5) or (SaitekMultiMode == 7)) {
              controls.perEngineSelectedAxisHandler(2)(0)
            }
            if (SaitekMultiMode > 7) {
              controls.perEngineSelectedAxisHandler(0)(2);
            }
            ]]>
          </script>
      </binding>
    </axis>

   <!-- Coolie Hat -->
    <axis>
        <number>
            <unix>5</unix>
            <windows>6</windows>
        </number>
        <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">1.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">-1.0</step>
            </binding>
        </high>
    </axis>
    <axis>
        <number>
            <unix>6</unix>
        </number>
        <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.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">-1.0</step>
            </binding>
        </high>
    </axis>
    <axis>
        <number>
            <windows>7</windows>
        </number>
        <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.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">1.0</step>
            </binding>
        </high>
    </axis>

    <!-- Buttons on the Yoke -->
    <button n="0">
        <desc>Cycle View</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>nasal</command>
            <script>view.stepView(1)</script>
        </binding>
    </button>

    <button n="1"> <!-- Labled as D -->
      <desc>Toggle parking break</desc>
      <binding>
        <command>property-toggle</command>
        <property>/controls/gear/brake-parking</property>
       </binding>
    </button>
   
    <button n="2"> <!-- Labled as A1 -->
      <desc>Elevator trim down</desc>
      <repeatable>true</repeatable>
      <binding>
        <command>nasal</command>
        <script>
          controls.elevatorTrim(0.75);
          gui.popupTip(sprintf("Elevator-trim: %.2f", 4.5 * getprop("/controls/flight/elevator-trim")));
        </script>
      </binding>
    </button>
    <button n="3"> <!-- Labled as A2 -->
      <desc>Elevator trim up</desc>
      <repeatable>true</repeatable>
      <binding>
        <command>nasal</command>
        <script>
          controls.elevatorTrim(-0.75);
          gui.popupTip(sprintf("Elevator-trim: %.2f", 4.5 * getprop("/controls/flight/elevator-trim")));
        </script>
      </binding>
    </button>


    <button n="4"> <!-- Labled as B1 -->
      <desc>Zoom In</desc>
      <repeatable>true</repeatable>
      <binding>
        <command>property-adjust</command>
        <property>/sim/current-view/field-of-view</property>
        <step type="double">-0.5</step>
      </binding>
    </button>
    <button n="5"> <!-- Labled as B2 -->
      <desc>Zoom Out</desc>
      <repeatable>true</repeatable>
      <binding>
        <command>property-adjust</command>
        <property>/sim/current-view/field-of-view</property>
        <step type="double">+0.5</step>
      </binding>
    </button>

    <button n="6"> <!-- Labled as C1 -->
      <desc>Aileron trim left</desc>
      <repeatable>true</repeatable>
      <binding>
        <command>nasal</command>
        <script>
          controls.aileronTrim(-0.75);
          gui.popupTip(sprintf("Aileron-trim: %.3f", getprop("/controls/flight/aileron-trim")));
        </script>
      </binding>
    </button>
    <button n="7"> <!-- Labled as C2 -->
      <desc>Aileron trim right</desc>
      <repeatable>true</repeatable>
      <binding>
        <command>nasal</command>
        <script>
          controls.aileronTrim(0.75);
          gui.popupTip(sprintf("Aileron-trim: %.3f", getprop("/controls/flight/aileron-trim")));
        </script>
      </binding>
    </button>
   
   <!-- Buttons on the throttle Quadrant -->
   <!--  Set SaitekMultiMode  -->
   <button n="14"> <!-- Labled as T1 -->
     <desc>Flaps up/SaitekMultiMode Less</desc>
     <repeatable>false</repeatable>
     <mod-ctrl>
       <mod-shift>
         <binding>
           <command>nasal</command>
           <script>
             SaitekMultiMode = getprop("SaitekMultiMode");
             SaitekMultiMode = SaitekMultiMode - 1;
             if (SaitekMultiMode == 0) {
               SaitekMultiMode = 9
             }
             if (SaitekMultiMode == 1) {
               ModeStr = ": T P M . . ."
             }
             if (SaitekMultiMode == 2) {
               ModeStr = ": T T P . . ."
             }
             if (SaitekMultiMode == 3) {
               ModeStr = ": T T M . . ."
             }
             if (SaitekMultiMode == 4) {
               ModeStr = ": T T P M . ."
             }
             if (SaitekMultiMode == 5) {
               ModeStr = ": T T P P M ."
             }
             if (SaitekMultiMode == 6) {
               ModeStr = ": T T P M M ."
             }
             if (SaitekMultiMode == 7) {
               ModeStr = ": T T P P M M"
             }
             if (SaitekMultiMode == 8) {
               ModeStr = ": T T T P M ."
             }
             if (SaitekMultiMode == 9) {
               ModeStr = ": T T T T P M"
             }
             gui.popupTip(sprintf("Mode %d %s", SaitekMultiMode, ModeStr), 3);
             setprop("SaitekMultiMode", SaitekMultiMode)
           </script>
         </binding>
       </mod-shift>
     </mod-ctrl>
     <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="15"> <!-- Labled as T2 -->
      <desc>Flaps down/SaitekMultiMode More</desc>
      <repeatable>false</repeatable>
      <binding>
        <command>nasal</command>
        <script>controls.flapsDown(1)</script>
      </binding>
      <mod-ctrl>
        <mod-shift>
          <binding>
            <command>nasal</command>
            <script>
              SaitekMultiMode = getprop("SaitekMultiMode");
              SaitekMultiMode = SaitekMultiMode + 1;
              if (SaitekMultiMode == 10) {
                SaitekMultiMode = 1
              }
              if (SaitekMultiMode == 1) {
                ModeStr = ": T P M . . ."
              }
              if (SaitekMultiMode == 2) {
                ModeStr = ": T T P . . ."
              }
              if (SaitekMultiMode == 3) {
                ModeStr = ": T T M . . ."
              }
              if (SaitekMultiMode == 4) {
                ModeStr = ": T T P M . ."
              }
              if (SaitekMultiMode == 5) {
                ModeStr = ": T T P P M ."
              }
              if (SaitekMultiMode == 6) {
                ModeStr = ": T T P M M ."
              }
              if (SaitekMultiMode == 7) {
               ModeStr = ": T T P P M M"
             }
             if (SaitekMultiMode == 8) {
                ModeStr = ": T T T P M ."
              }
              if (SaitekMultiMode == 9) {
                ModeStr = ": T T T T P M"
              }
              gui.popupTip(sprintf("Mode %d %s", SaitekMultiMode, ModeStr), 3);
              setprop("SaitekMultiMode", SaitekMultiMode)
            </script>
          </binding>
        </mod-shift>
      </mod-ctrl>
      <mod-up>
        <binding>
          <command>nasal</command>
          <script>controls.flapsDown(0)</script>
        </binding>
      </mod-up>
    </button>


    <button n="16"> <!-- Labled as T3 -->
        <desc>Gear up</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>nasal</command>
            <script>controls.gearDown(-1)</script>
        </binding>
        <mod-up>
            <binding>
                <command>nasal</command>
                <script>controls.gearDown(0)</script>
            </binding>
        </mod-up>
    </button>
    <button n="17"> <!-- Labled as T4 -->
        <desc>Gear down</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>nasal</command>
            <script>controls.gearDown(1)</script>
        </binding>
        <mod-up>
            <binding>
                <command>nasal</command>
                <script>controls.gearDown(0)</script>
            </binding>
        </mod-up>
    </button>
    <button n="18"> <!-- Labled as T5 -->
        <desc>Retract Spoilers</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>nasal</command>
            <script>controls.stepSpoilers(-1)</script>
        </binding>
        <mod-up>
            <binding>
                <command>nasal</command>
                <script>controls.stepSpoilers(0)</script>
            </binding>
        </mod-up>
    </button>
   
    <button n="19"> <!-- Labled as T6 -->
        <desc>Deploy Spoilers</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>nasal</command>
            <script>controls.stepSpoilers(1)</script>
        </binding>
        <mod-up>
            <binding>
                <command>nasal</command>
                <script>controls.stepSpoilers(0)</script>
            </binding>
        </mod-up>
    </button>
   
<!--  Throttle Indents  (Reverse switch area) -->
   <!-- Lever 1 -->
    <button n="20">
        <desc>thrust reverse</desc>
        <repeatable type="bool">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>
                SaitekMultiMode = getprop("SaitekMultiMode");
                if (SaitekMultiMode == 1) {
                  props.setAll("/controls/engines/engine", "reverser", 1);
                  props.setAll("/controls/engines/engine", "throttle", 1)
                }
                else {
                  setprop("/controls/engines/engine/reverser", 1);
                  setprop("/controls/engines/engine/throttle", 1)
               }
            </script>
        </binding>
        <mod-up>
            <binding>
                <command>nasal</command>
                <script>
                    if (SaitekMultiMode == 1) {
                      props.setAll("/controls/engines/engine", "reverser", 0);
                      props.setAll("/controls/engines/engine", "throttle", 0)
                    }
                    else {
                      setprop("/controls/engines/engine/reverser", 0);
                      setprop("/controls/engines/engine/throttle", 0)
                    }
                </script>
            </binding>
        </mod-up>
    </button>

   <!-- Lever 2 -->
    <button n="21">
        <desc>thrust reverse</desc>
        <repeatable type="bool">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>
                SaitekMultiMode = getprop("SaitekMultiMode");
                if (SaitekMultiMode == 1) {
                  props.setAll("controls/engines/engine", "propeller-feather", 1);
                }
                else {
                  setprop("/controls/engines/engine[1]/reverser", 1);
                  setprop("/controls/engines/engine[1]/throttle", 1)
               }
            </script>
        </binding>
        <mod-up>
            <binding>
                <command>nasal</command>
                <script>
                    if (SaitekMultiMode == 1) {
                      props.setAll("controls/engines/engine", "propeller-feather", 0);
                    }
                    else {
                      setprop("/controls/engines/engine[1]/reverser", 0);
                      setprop("/controls/engines/engine[1]/throttle", 0)
                    }
                </script>
            </binding>
        </mod-up>
    </button>

   <!-- Lever 3 -->
    <button n="22">
        <desc>thrust reverse</desc>
        <repeatable type="bool">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>
              if ((SaitekMultiMode == 2) or (SaitekMultiMode == 4) or (SaitekMultiMode ==6)) {
                props.setAll("controls/engines/engine", "propeller-feather", 1)
              }
              if (SaitekMultiMode == 5) {
                setprop("controls/engines/engine/propeller-feather", 1)
              }
              if (SaitekMultiMode > 6) {
                setprop("/controls/engines/engine[2]/reverser", 1);
                setprop("/controls/engines/engine[2]/throttle", 1)
              }
            </script>
        </binding>
        <mod-up>
            <binding>
                <command>nasal</command>
                <script>
                  if ((SaitekMultiMode == 2) or (SaitekMultiMode == 4) or (SaitekMultiMode == 6)) {
                   props.setAll("controls/engines/engine", "propeller-feather", 0)
                  }
                  if ((SaitekMultiMode == 5) or (SaitekMultiMode == 7)) {
                    setprop("controls/engines/engine/propeller-feather", 0)
                  }
                  if (SaitekMultiMode > 7) {
                    setprop("/controls/engines/engine[2]/reverser", 0);
                    setprop("/controls/engines/engine[2]/throttle", 0)
                  }
               </script>
            </binding>
        </mod-up>
    </button>

</PropertyList>



Pro-Flight-Quadrant-Multi.xml
Code: Select all
<?xml version="1.0"?>
<!-- Saitek Pro Flight Quadrant - Pro-Flight-Quadrant-Multi.xml

     To be used in conjunction with Pro-Flight-Yoke-Multi.xml.
     All information available there.

-->

<PropertyList>
 <name>Saitek Saitek Pro Flight Quadrant</name>
 <name>Saitek Pro Flight Quadrant</name>
 <name>Saitek Pro Flight Throttle Quadrant</name>


 var SaitekMultiMode

 <!-- Levers left to right. -->
 <axis>
  <name>Left lever</name>
  <number>
   <unix>0</unix>
   <mac>0</mac>
   <windows>0</windows>
  </number>
  <desc></desc>
  <binding>
   <command>nasal</command>
   <script>
     <!-- Modes 1, 2 & 3 available for your own stuff
          Don't forget Axis reverse area switches also available -->
     SaitekMultiMode = getprop("SaitekMultiMode");
     if (SaitekMultiMode == 4) {
       controls.mixtureAxis();
       props.setAll("controls/engines/engine", "condition", getprop("controls/engines/engine/mixture"))
     }
     if ((SaitekMultiMode == 5) or (SaitekMultiMode == 7)) {
       controls.perEngineSelectedAxisHandler(2)(1)
     }
     if (SaitekMultiMode == 6) {
       controls.perEngineSelectedAxisHandler(1)(0);
       setprop("controls/engines/engine[0]/condition", getprop("controls/engines/engine[0]/mixture")
     }
     if (SaitekMultiMode == 8) {
       controls.propellerAxis()
     }
     if (SaitekMultiMode == 9) {
       controls.perEngineSelectedAxisHandler(0)(3)
     }
   </script>
  </binding>
 </axis>


 <axis>
  <name>Middle lever</name>
  <number>
   <unix>1</unix>
   <mac>1</mac>
   <windows>1</windows>
  </number>
  <desc></desc>
  <binding>
   <command>nasal</command>
   <script>
     <!-- Modes 1, 2, 3 & 4 available for your own stuff
          Don't forget Axis reverse area switches also available -->
     SaitekMultiMode = getprop("SaitekMultiMode");
     if (SaitekMultiMode == 5) {
       controls.mixtureAxis();
       props.setAll("controls/engines/engine", "condition", getprop("controls/engines/engine/mixture"))
     }
     if (SaitekMultiMode == 6) {
       controls.perEngineSelectedAxisHandler(1)(1);
       setprop("controls/engines/engine[1]/condition", getprop("controls/engines/engine[1]/mixture")
     }
     if (SaitekMultiMode == 8) {
       controls.mixtureAxis();
       props.setAll("controls/engines/engine", "condition", getprop("controls/engines/engine/mixture"))
     }
     if (SaitekMultiMode == 9) {
       controls.propellerAxis();
     }
   </script>
  </binding>
 </axis>


 <axis>
  <name>Right lever</name>
  <number>
   <unix>2</unix>
   <mac>2</mac>
   <windows>2</windows>
  </number>
  <desc></desc>
  <binding>
   <command>nasal</command>
   <script>
     <!-- Modes 1 to 6 available for your own stuff
          Don't forget Axis reverse area switches also available -->
     SaitekMultiMode = getprop("SaitekMultiMode");
     if (SaitekMultiMode == 7) {
       controls.perEngineSelectedAxisHandler(1)(1);
       setprop("controls/engines/engine[1]/condition", getprop("controls/engines/engine[1]/mixture")
     }
     if (SaitekMultiMode == 9) {
       controls.mixtureAxis();
       props.setAll("controls/engines/engine", "condition", getprop("controls/engines/engine/mixture"))
     }
   </script>
  </binding>
 </axis>


 <!-- 2-way rocker switches. Left to right. -->
 <!--  No assignments -->
 <button>
  <name>Left button up</name>
  <number>
   <unix>0</unix>
   <mac>0</mac>
   <windows>0</windows>
  </number>
  <desc></desc>
  <repeatable>false</repeatable>
  <binding>
   <command>nasal</command>
   <script></script>
  </binding>
  <mod-up>
   <binding>
    <command>nasal</command>
    <script></script>
   </binding>
  </mod-up>
  <mod-shift>
   <binding>
    <command>nasal</command>
    <script></script>
   </binding>
  </mod-shift>
 </button>

 <button n="1">
  <name>Left button down</name>
  <number>
   <unix>1</unix>
   <mac>1</mac>
   <windows>1</windows>
  </number>
  <desc></desc>
  <repeatable>false</repeatable>
  <binding>
   <command>nasal</command>
   <script></script>
  </binding>
  <mod-shift>
   <binding>
    <command>nasal</command>
    <script></script>
   </binding>
  </mod-shift>
  <mod-up>
   <binding>
    <command>nasal</command>
    <script></script>
   </binding>
  </mod-up>
 </button>

 <button>
  <name>Middle button up</name>
  <number>
   <unix>2</unix>
   <mac>2</mac>
   <windows>2</windows>
  </number>
  <desc></desc>
  <repeatable>true</repeatable>
  <binding>
   <command>nasal</command>
   <script></script>
  </binding>
  <mod-shift>
   <binding>
    <command>nasal</command>
    <script></script>
   </binding>
  </mod-shift>
 </button>
 <button>
  <name>Middle button down</name>
  <number>
   <unix>3</unix>
   <mac>3</mac>
   <windows>3</windows>
  </number>
  <desc></desc>
  <repeatable>true</repeatable>
  <binding>
   <command>nasal</command>
   <script></script>
  </binding>
  <mod-shift>
   <binding>
    <command>nasal</command>
    <script></script>
   </binding>
  </mod-shift>
 </button>

 <button>
  <name>Right button up</name>
  <number>
   <unix>4</unix>
   <mac>4</mac>
   <windows>4</windows>
  </number>
  <desc>Gear up</desc>
  <repeatable>false</repeatable>
  <binding>
   <command>nasal</command>
   <script></script>
  </binding>
 </button>
 <button>
  <name>Right button down</name>
  <number>
   <unix>5</unix>
   <mac>5</mac>
   <windows>5</windows>
  </number>
  <desc>Gear down</desc>
  <repeatable>false</repeatable>
  <binding>
   <command>nasal</command>
   <script></script>
  </binding>
 </button>

 <!-- Axis reverse area switches. -->
 <button>
   <name>Left lever reverse</name>
   <number>
     <unix>6</unix>
     <mac>6</mac>
     <windows>6</windows>
   </number>
   <desc></desc>
   <repeatable>false</repeatable>
   <binding>
     <command>nasal</command>
     <script>
       SaitekMultiMode = getprop("SaitekMultiMode");
       if ((SaitekMultiMode == 5) or (SaitekMultiMode == 7)) {
         setprop("controls/engines/engine[1]/propeller-feather", 1)
       }
       if (SaitekMultiMode == 8) {
         props.setAll("controls/engines/engine", "propeller-feather", 1)
       }
       if (SaitekMultiMode == 9) {
         setprop("/controls/engines/engine[3]/reverser", 1);
         setprop("/controls/engines/engine[3]/throttle", 1)
       }
     </script>
   </binding>
   <mod-up>
     <binding>
       <command>nasal</command>
       <script>
         if (SaitekMultiMode == 5) {
           setprop("controls/engines/engine[1]/propeller-feather", 0)
         }
         if (SaitekMultiMode == 8) {
           props.setAll("controls/engines/engine", "propeller-feather", 0)
         }
         if (SaitekMultiMode == 9) {
           setprop("/controls/engines/engine[3]/reverser", 0);
           setprop("/controls/engines/engine[3]/throttle", 0)
         }
      </script>
     </binding>
    </mod-up>
 </button>

 <button>
   <name>Middle lever reverse</name>
   <number>
     <unix>7</unix>
     <mac>7</mac>
     <windows>7</windows>
   </number>
   <desc></desc>
   <repeatable>false</repeatable>
   <binding>
     <command>nasal</command>
     <script>
       SaitekMultiMode = getprop("SaitekMultiMode");
       if (SaitekMultiMode == 9) {
         props.setAll("controls/engines/engine", "propeller-feather", 1)
       }
     </script>
   </binding>
   <mod-up>
     <binding>
       <command>nasal</command>
       <script>
         if (SaitekMultiMode == 9) {
           props.setAll("controls/engines/engine", "propeller-feather", 0)
         }
       </script>
     </binding>
    </mod-up>
 </button>

 <button>
   <name>Right lever reverse</name>
   <number>
     <unix>8</unix>
     <mac>8</mac>
     <windows>8</windows>
   </number>
   <desc></desc>
   <repeatable>false</repeatable>
   <binding>
     <command>nasal</command>
     <script>
     </script>
   </binding>
   <mod-up>
     <binding>
       <command>nasal</command>
       <script>
       </script>
     </binding>
    </mod-up>
 </button>

</PropertyList>



EDIT: Changed it a bit to give a mode T T P P M M
EDIT: Changed gui.popupTip to display for 3 seconds, the default of 1 second is not long enough. You can change the , 3 at the end of the line(s) to another value if you want.
EDIT 11 Oct 2012: Use CDATA to make if x < 3 safe.
macnab
 
Posts: 886
Joined: Tue Aug 02, 2011 7:20 am
Location: Johannesburg, South Africa
Callsign: ZS-ILH
Version: Git
OS: Win7Pro 64bit SP1


Return to Hardware

Who is online

Users browsing this forum: No registered users and 5 guests