<?xml version="1.0"?>

<!--

  Copyright (c) 2021 FlightGear Flight Simulator

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

********************************************************************

Written for the Cessna 172 and only tested on Raspberry Pi OS running
FlightGear 2020.3.6

********************************************************************
-->


<!--
********************************************************************
*
* Bindings for Honeycomb Aeronautical Bravo Trottle Quadrant
*
*
* Axis 0: Engine 1
* Axis 1: Speed brake
* Axis 2: Flaps
* Axis 3: Engine 4
* Axis 4: Engine 3
* Axis 5: Engine 2
* 
* Button  0:  Autopilot - Heading Hold 
* Button  1:  Autopilot - Nav Hold
* Button  2:  Autopilot - APR
* Button  3:  Autopilot - REV 
* Button  4:  Autopilot - ALT Hold
* Button  5:  Autopilot - Vertical Speed hold
* Button  6:  Autopilot - IAS Hold
* Button  7:  Autopilot - Toggle AP engage
* Button  8:  Reverse Thrust - Engine 1
* Button  9:  Reverse Thrust - Engine 2
* Button 10:  Reverse Thrust - Engine 3
* Button 11:  Reverse Thrust - Engine 4
* Button 12:  Increase  - IAS / CRS / HDG / VS / ALT
* Button 13:  Decrease  - IAS / CRS / HDG / VS / ALT
* Button 14:  Flaps Down
* Button 15:  Flaps UP
* Button 16:  Select IAS
* Button 17:  Select CRS
* Button 18:  Select HDG
* Button 19:  Select VS
* Button 20:  Select ALT
* Button 21: Trim Down
* Button 22: Trim Up
* Button 23: Handle 1 (left) - Fully down
* Button 24: Handle 2 (eng1) - Fully down
* Button 25: Handle 3 (eng2) - Fully down
* Button 26: Handle 4 (eng3) - Fully down
* Button 27: Handle 5 (eng4) - Fully down
* Button 28: - Switch on Handle 1
* Button 29: - 
* Button 30: Gear Up
* Button 31: Gear Down
* Button 32: Handle 6 (right) - Fully down
* Button 33: Switch 1 - up
* Button 34: Switch 1 - down
* Button 35: Switch 2 - up
* Button 36: Switch 2 - down
* Button 37: Switch 3 - up
* Button 38: Switch 3 - down
* Button 39: Switch 4 - up
* Button 40: Switch 4 - down
* Button 41: Switch 5 - up
* Button 42: switch 5 - down
* Button 43: Switch 6 - up
* Button 44: Switch 6 - down
* Button 45: Switch 7 - up
* Button 46: Switch 7 - down
* Button 47: 

********************************************************************
-->

<PropertyList>
  <name type="string">Honeycomb Aeronautical Bravo Throttle Quadrant</name>
  
  <!--
  <axis>
    <desc type="string">Throttle Engine 1</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string">/controls/engines/engine[1]/throttle</property>
      <factor type="double">0.5</factor>
      <offset type="double">1</offset>
      <power type="double">1</power>
    </binding>
  </axis>
  <axis n="1">
    <desc type="string">Throttle Engine 0</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string">/controls/engines/engine[0]/throttle</property>
      <factor type="double">0.5</factor>
      <offset type="double">1</offset>
      <power type="double">1</power>
    </binding>
  </axis>
  <axis n="2">
    <desc type="string">Mixture Engine 1</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string">/controls/engines/engine[1]/mixture</property>
      <factor type="double">0.5</factor>
      <offset type="double">1</offset>
      <power type="double">1</power>
    </binding>
  </axis>
  
  <axis n="3">
    <desc type="string">Mixture Engine 0</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string">/controls/engines/engine[0]/mixture</property>
      <factor type="double">0.5</factor>
      <offset type="double">1</offset>
      <power type="double">1</power>
    </binding>
  </axis>
  
  1<axis n="4">
    <desc type="string">Propeller Pitch Engine 1</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string">/controls/engines/engine[1]/propeller-pitch</property>
      <factor type="double">0.5</factor>
      <offset type="double">1</offset>
      <power type="double">1</power>
    </binding>
  </axis>
  <axis n="5">
    <desc type="string">Propeller Pitch Engine 0</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string">/controls/engines/engine[0]/propeller-pitch</property>
      <factor type="double">0.5</factor>
      <offset type="double">1</offset>
      <power type="double">1</power>
    </binding>
  </axis>
  
  <button n="0">
      <desc type="string">AP: Select Heading Hold</desc>
      <binding>
          <command type="string">nasal</command>
          <script>
              node = props.globals.getNode("/controls/autopilot/inputs/lateral", 1);
              if ( node.getValue() == "dg-heading-hold" ) {
                node.setValue( "" );
              } else {
                node.setValue( "dg-heading-hold" );
              }
          </script>
      </binding>
  </button>
  
  <button n="1">
      <desc type="string">AP: Select NAV1 Hold</desc>
      <binding>
          <command type="string">nasal</command>
          <script>
              node = props.globals.getNode("/controls/autopilot/inputs/lateral", 1);
              if ( node.getValue() == "dg-nav1-hold" ) {
                node.setValue( "" );
              } else {
                node.setValue( "dg-nav1-hold" );
              }
          </script>
      </binding>
  </button>
  
  <button n="2">
      <desc type="string">AP: Select Approach Hold</desc>
      <binding>
          <command type="string">nasal</command>
          <script>
              node = props.globals.getNode("/controls/autopilot/inputs/lateral", 1);
              if ( node.getValue() == "dg-apr-hold" ) {
                node.setValue( "" );
              } else {
                node.setValue( "dg-apr-hold" );
              }
              node = props.globals.getNode("/controls/autopilot/inputs/vertical", 1);
              if ( node.getValue() == "dg-apr-hold" ) {
                node.setValue( "" );
              } else {
                node.setValue( "dg-apr-hold" );
              }
          </script>
      </binding>
  </button>
  <button n="3">
      <desc type="string">AP: Select REV Hold</desc>
      <binding>
          <command type="string">nasal</command>
          <script>
              node = props.globals.getNode("/controls/autopilot/inputs/lateral", 1);
              if ( node.getValue() == "dg-rev-hold" ) {
                node.setValue( "" );
              } else {
                node.setValue( "dg-rev-hold" );
              }
          </script>
      </binding>
  </button>
  <button n="4">
      <desc type="string">AP: Select ALT Hold</desc>
      <binding>
          <command type="string">nasal</command>
          <script>
              node = props.globals.getNode("/controls/autopilot/inputs/vertical", 1);
              if ( node.getValue() == "dg-alt-hold" ) {
                node.setValue( "" );
              } else {
                node.setValue( "dg-alt-hold" );
              }
          </script>
      </binding>
  </button>
  <button n="5">
      <desc type="string">AP: Select VS Hold</desc>
      <binding>
          <command type="string">nasal</command>
          <script>
              node = props.globals.getNode("/controls/autopilot/inputs/vertical", 1);
              if ( node.getValue() == "dg-vs-hold" ) {
                node.setValue( "" );
              } else {
                node.setValue( "dg-vs-hold" );
              }
          </script>
      </binding>
  </button>
   <button n="6">
      <desc type="string">AP: Select VS Hold</desc>
      <binding>
          <command type="string">nasal</command>
          <script>
              node = props.globals.getNode("/controls/autopilot/inputs/speed", 1);
              if ( node.getValue() == "ias" ) {
                node.setValue( "" );
              } else {
                node.setValue( "ias" );
              }
          </script>
      </binding>
  </button>
  
    <button n="7">
      <desc type="string">AP: Master Switch</desc>
      <binding>
          <command type="string">nasal</command>
          <script>
              node = props.globals.getNode("/controls/autopilot/inputs/master", 1);
              if ( node.getValue() == "active" ) {
                node.setValue( "" );
              } else {
                node.setValue( "active" );
              }
          </script>
      </binding>
  </button>
  <button n="14">
    <desc type="string">Flaps Down</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string">controls.flapsDown(1);</script>
    </binding>
    <repeatable type="double">0</repeatable>
  </button>
  <button n="15">
    <desc type="string">Flaps Up</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string">controls.flapsDown(-1);</script>
    </binding>
    <repeatable type="double">0</repeatable>
  </button>
  
  <button n="16">
      <desc type="string">AP: Change IAS</desc>
      <binding>
          <command type="string">nasal</command>
          <script>
              node = props.globals.getNode("/controls/autopilot/inputs/selector", 1);
                node.setValue( "ias" );
          </script>
      </binding>
  </button>

  <button n="17">
      <desc type="string">AP: Change CRS</desc>
      <binding>
          <command type="string">nasal</command>
          <script>
              node = props.globals.getNode("/controls/autopilot/inputs/selector", 1);
              node.setValue( "crs" );
          </script>
      </binding>
  </button>

  <button n="18">
      <desc type="string">AP: Change HDG</desc>
      <binding>
          <command type="string">nasal</command>
          <script>
              node = props.globals.getNode("/controls/autopilot/inputs/selector", 1);
              node.setValue( "hdg" );
          </script>
      </binding>
  </button>
  
   <button n="19">
      <desc type="string">AP: Change VS</desc>
      <binding>
          <command type="string">nasal</command>
          <script>
              node = props.globals.getNode("/controls/autopilot/inputs/selector", 1);
              node.setValue( "vs" );
          </script>
      </binding>
  </button>
  
     <button n="20">
      <desc type="string">AP: Change ALT</desc>
      <binding>
          <command type="string">nasal</command>
          <script>
              node = props.globals.getNode("/controls/autopilot/inputs/selector", 1);
              node.setValue( "alt" );
          </script>
      </binding>
  </button>

  
  <button n="21">
    <desc type="string">Elevator Trim Down</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string">controls.elevatorTrim(1);</script>
    </binding>
    <repeatable type="double">1</repeatable>
  </button>
  <button n="22">
    <desc type="string">Elevator Trim Up</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string">controls.elevatorTrim(-1);</script>
    </binding>
    <repeatable type="double">1</repeatable>
  </button>
  -->
 

</PropertyList>