Board index FlightGear Support Hardware

Joystick xml codes Library project - open for contributions  Topic is solved

Joysticks, pedals, monitors.

Re: Joystick xml codes Library project - open for contributi

Postby SurferTim » Sat Nov 16, 2019 1:02 am

Joystick file for Bodner BU0836. It has the 8 axis and 12 digital entries. Only a few assigned as examples.
In /Input/Joysticks , I created a folder named "Bodnar". In that folder goes this file named BU0836.xml
Code: Select all
<?xml version="1.0"?>

<PropertyList>
  <name type="string">Leo Bodnar Electronics BU0836 Interface</name>
  <axis>
    <desc type="string">Aileron</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string">/controls/flight/aileron</property>
      <factor type="double">1</factor>
      <offset type="double">0</offset>
    </binding>
  </axis>
  <axis n="1">
    <desc type="string">Elevator</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string">/controls/flight/elevator</property>
      <factor type="double">1</factor>
      <offset type="double">0</offset>
    </binding>
  </axis>
  <axis n="2">
    <desc type="string">Axis 2</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string"></property>
      <setting type="double">0</setting>
    </binding>
    <low>
      <binding>
      </binding>
    </low>
  </axis>
  <axis n="3">
    <desc type="string">Axis 3</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string"></property>
      <setting type="double">0</setting>
    </binding>
    <low>
      <binding>
      </binding>
    </low>
  </axis>
  <axis n="4">
    <desc type="string">Axis 4</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string"></property>
    </binding>
    <low>
      <binding>
      </binding>
    </low>
  </axis>
  <axis n="5">
    <desc type="string">Axis 5</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string"></property>
    </binding>
    <low>
      <binding>
      </binding>
    </low>
  </axis>
  <axis n="6">
    <desc type="string">Axis 6</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string"></property>
    </binding>
    <low>
      <binding>
      </binding>
    </low>
  </axis>
  <axis n="7">
    <desc type="string">Axis 7</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string"></property>
    </binding>
    <low>
      <binding>
      </binding>
    </low>
  </axis>
  <button>
    <desc type="string">View Cycle Forwards</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string">view.stepView(1);</script>
    </binding>
    <repeatable type="double">0</repeatable>
  </button>
  <button n="1">
    <desc type="string">Custom</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string">setprop("/controls/lighting/flight-comp", 1);</script>
    </binding>
    <mod-up>
      <binding>
        <command type="string">nasal</command>
        <script type="string">setprop("/controls/lighting/flight-comp", 0);</script>
      </binding>
    </mod-up>
  </button>
  <button n="2">
    <desc type="string">Custom</desc>
    <binding>
      <command type="string">property-toggle</command>
      <property type="string">/controls/lighting/flight-comp</property>
    </binding>
    <mod-up>
      <binding>
      </binding>
    </mod-up>
  </button>
  <button n="3">
    <desc type="string">Custom</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string"></script>
      <module type="string">__js2</module>
    </binding>
    <mod-up>
      <binding>
      </binding>
    </mod-up>
  </button>
  <button n="4">
    <desc type="string">Custom</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string"></script>
      <module type="string">__js2</module>
    </binding>
    <mod-up>
      <binding>
      </binding>
    </mod-up>
  </button>
  <button n="5">
    <desc type="string">Custom</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string"></script>
      <module type="string">__js2</module>
    </binding>
    <mod-up>
      <binding>
      </binding>
    </mod-up>
  </button>
  <button n="6">
    <desc type="string">Custom</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string"></script>
      <module type="string">__js2</module>
    </binding>
    <mod-up>
      <binding>
      </binding>
    </mod-up>
  </button>
  <button n="7">
    <desc type="string">Custom</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string"></script>
      <module type="string">__js2</module>
    </binding>
    <mod-up>
      <binding>
      </binding>
    </mod-up>
  </button>
  <button n="8">
    <desc type="string">Custom</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string"></script>
      <module type="string">__js2</module>
    </binding>
    <mod-up>
      <binding>
      </binding>
    </mod-up>
  </button>
  <button n="9">
    <desc type="string">Custom</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string"></script>
      <module type="string">__js2</module>
    </binding>
    <mod-up>
      <binding>
      </binding>
    </mod-up>
  </button>
  <button n="10">
    <desc type="string">Custom</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string"></script>
      <module type="string">__js2</module>
    </binding>
    <mod-up>
      <binding>
      </binding>
    </mod-up>
  </button>
  <button n="11">
    <desc type="string">Custom</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string"></script>
      <module type="string">__js2</module>
    </binding>
    <mod-up>
      <binding>
      </binding>
    </mod-up>
  </button>
</PropertyList>
Fly low. Fly slow. Land on a dime. Twin Otter. https://github.com/SurferTim/dhc6p
My other aircraft is a Citation-X https://github.com/SurferTim/CitationX
PirateAir videos at https://www.youtube.com/user/SurferTim850
User avatar
SurferTim
 
Posts: 1691
Joined: Sun Dec 09, 2018 6:49 pm
Location: Miramar Beach, FL
Callsign: Pirate
Version: 2020.4.0
OS: Ubuntu 18.04

Re: Joystick xml codes Library project - open for contributi

Postby mercster » Sat Mar 07, 2020 2:23 pm

Hey folks, try as I might... can't find a TWCS-Throttle.xml. Can someone share or point me in the right direction? I'm using Linux, and I can edit the file if need be, but I'm too new to write it from scratch... need a skeleton or something. The throttle has some basic functionality, but I'd like to get it set up better (mostly the paddles for rudder control... seems some people use them for brakes, but you can't press both at the same time?) also wanna do the hats. Thank you. I'm going to cross post in the main hardware forum for more visibility.

EDIT: @dg-505 provided me his file, thank you very much! I post it here for future reference:

Code: Select all
<?xml version="1.0"?>

<PropertyList>
  <name type="string">Thrustmaster TWCS Throttle</name>
  <axis>
    <desc type="string">Nose wheel</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string">controls/gear/tiller</property>
      <setting type="double">0</setting>
    </binding>
    <binding n="1">
      <command type="string">property-scale</command>
      <property type="string">controls/gear/tiller-cmd-norm</property>
      <setting type="double">0</setting>
    </binding>
  </axis>
  <axis n="2">
    <desc type="string">Throttle (all)</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string">controls.throttleAxis();</script>
    </binding>
  </axis>
  <axis n="5">
    <desc type="string">View Horizontal Axis</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string">/sim/current-view/goal-heading-offset-deg</property>
      <factor type="double">-60</factor>
      <offset type="double">0</offset>
    </binding>
  </axis>
  <axis n="7">
    <desc type="string">Flaps</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string">/controls/flight/flaplever</property>
      <factor type="double">0.5</factor>
      <offset type="double">1</offset>
    </binding>
    <binding>
                <condition>
                    <property>controls/flight/flaps-serviceable</property>
                </condition>
                <command>nasal</command>
                <script>gui.popupTip(sprintf("Flaps: %3.1f deg", 37.5*getprop("/controls/flight/flaps")));</script>
            </binding>
            <binding>
                <condition>
                    <not>
                        <property>controls/flight/flaps-serviceable</property>
                    </not>
                </condition>
                <command>nasal</command>
                <script>gui.popupTip("Flap operation requires hydraulic pressure!");</script>
            </binding>
  </axis>
  <button>
    <desc type="string">Custom</desc>
    <binding>
      <command type="string">pause</command>
      <offset type="double">1</offset>
    </binding>
  </button>
  <button n="1">
    <desc type="string">Custom</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string">controls.applyBrakes(1, -1)</script>
      <module type="string">__js1</module>
      <offset type="double">1</offset>
    </binding>
    <mod-up>
      <binding>
        <command type="string">nasal</command>
        <script type="string">controls.applyBrakes(0, -1)</script>
        <module type="string">__js1</module>
        <offset type="double">1</offset>
      </binding>
    </mod-up>
  </button>
  <button n="2">
    <desc type="string">Custom</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string">controls.applyBrakes(1, 1)</script>
      <module type="string">__js1</module>
      <offset type="double">1</offset>
    </binding>
    <mod-up>
      <binding>
        <command type="string">nasal</command>
        <script type="string">controls.applyBrakes(0, 1)</script>
        <module type="string">__js1</module>
        <offset type="double">1</offset>
      </binding>
    </mod-up>
  </button>
  <button n="3">
    <desc type="string">View Increase</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string">view.increase(0.75);</script>
    </binding>
    <repeatable type="double">1</repeatable>
  </button>
  <button n="4">
    <desc type="string">View Decrease</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string">view.decrease(0.75);</script>
    </binding>
    <repeatable type="double">1</repeatable>
  </button>
</PropertyList>
mercster
 
Posts: 37
Joined: Sat Mar 07, 2020 2:12 pm

Re: Joystick xml codes Library project - open for contributi

Postby Johan G » Sun Mar 15, 2020 3:21 pm

mercster wrote in Sat Mar 07, 2020 2:23 pm:I post it here for future reference

Thank you! :)
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6625
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Joystick xml codes Library project - open for contributi

Postby asqn34 » Wed May 06, 2020 10:56 pm

Hi all,

gui.popupTip for the flaps. Working with my Saitel Cyborg X and FG 2019.1.1.
I wanted the flap info displayed on the screen to be the exact match of the flap control in the cabine rather than the info from flaps_path in the plane.nas
I am mainly flying the Citation X so you could change the text in bracket to suit your need and add more flap position if needed.
Remove the mod-up binding if not needed.
Enjoy

Code: Select all
<button n="1">
    <desc>2 Flaps down, Cycle View</desc>
    <repeatable>false</repeatable>
    <binding>
      <command>nasal</command>
      <script>
                mod = getprop("/input/joysticks/js[0]/Saitek-Cyborg-X-modifier");            
                if (mod == nil or mod == 0)   {
                controls.flapsDown(1);
            var flaps_select = getprop ("controls/flight/flaps-select");         
                if ( flaps_select == 4 ) {
                gui.popupTip("Flaps FULL");
            } if ( flaps_select == 3 ) {
               gui.popupTip("Flaps 15");
            } if  (flaps_select == 2 ) {
               gui.popupTip("Flaps 5");
            } if (flaps_select == 1 ) {
                    gui.popupTip("Flaps SLAT");
                }
            controls.flapsDown(0);
                } elsif (mod == 1) {
            #
            }
</script>
    </binding>
    <mod-up>
      <binding>
        <command>nasal</command>
        <script>
            if (mod == nil or mod == 0) {
               #
               } elsif (mod == 1) {
                  i = view.stepView(1);
               }
   </script>
      </binding>
    </mod-up>
  </button>

<button n="2">
    <desc>3 Flaps up, Center View</desc>
    <repeatable>false</repeatable>
    <binding>
      <command>nasal</command>
      <script>
       mod = getprop("/input/joysticks/js[0]/Saitek-Cyborg-X-modifier");            
                if (mod == nil or mod == 0)   {               
                controls.flapsDown(-1);
            var flaps_select = getprop ("controls/flight/flaps-select");         
                if ( flaps_select == 0 ) {
                gui.popupTip("Flaps UP");
            } if ( flaps_select == 3 ) {
               gui.popupTip("Flaps 15");
            } if  (flaps_select == 2 ) {
               gui.popupTip("Flaps 5");
            } if (flaps_select == 1 ) {
                    gui.popupTip("Flaps SLAT");
                }
            controls.flapsDown(0);
                } elsif (mod == 1) {
            #
            }
</script>
    </binding>
    <mod-up>
      <binding>
        <command>nasal</command>
        <script>   
      if (mod == nil or mod == 0) {
               #
               } elsif (mod == 1) {
                  i = view.resetView(0);
               }
</script>
      </binding>
    </mod-up>
  </button>


asqn34
 
Posts: 5
Joined: Wed Jun 09, 2010 7:52 pm
Callsign: CL1906
OS: Linuxmint 19.3

Re: Joystick xml codes Library project - open for contributi

Postby StuartC » Mon Jul 20, 2020 10:23 pm

Want to use this to fly in Flight Gear ? Now you can.

Image


DOWNLOAD:-

http://www.fguk.me/hangar/download/10-o ... ration-xml



For those serious about choppers, they need serious controls.

The ProFlightPuma is a popular choice for many, and all too often I hear " My puma does not work correctly with Flight Gear".

Well, its actually does. Every Axis and every button combination has been manually discovered and mapped in this ready to use XML file.

HOW TO INSTALL:-

Unzip and copy the file Pro-Flight-Trainercom.xml to one of the following locations :-



WINDOWS USERS:- C:Users(your user name )AppDataRoamingflightgear.orgInputJoysticks

LINUX USERS:- /home/[USERNAME]/.fgfs/Input/Joysticks

MAC users:- ~/Library/Application Support/FlightGear/Input/Joysticks

The Puma should now be available from the pull down Joystics menu in the Joystick configuration screen.



Please read the included PDF file as it has a chart of all the functions of the control set and what they are mapped to in this XML file.
StuartC
 
Posts: 3168
Joined: Fri Jun 18, 2010 9:18 pm
Location: Arse end of the Universe
Callsign: WF01
Version: 2019.1
OS: W10 64 bit

Re: Joystick xml codes Library project - open for contributi

Postby Richard » Tue Jul 21, 2020 9:44 am

StuartC wrote in Mon Jul 20, 2020 10:23 pm:Want to use this to fly in Flight Gear ? Now you can.
Please read the included PDF file as it has a chart of all the functions of the control set and what they are mapped to in this XML file.


Stuart - do you think we should include this in the next version of FlightGear directly?
Richard
 
Posts: 810
Joined: Sun Nov 02, 2014 11:17 pm
Version: Git
OS: Win10

Re: Joystick xml codes Library project - open for contributi

Postby StuartC » Tue Jul 21, 2020 10:18 am

If you like, yes.
You can only change the button and axis setting via xml though. the Joystick configurator will load the XML but you cant alter anything from it.
StuartC
 
Posts: 3168
Joined: Fri Jun 18, 2010 9:18 pm
Location: Arse end of the Universe
Callsign: WF01
Version: 2019.1
OS: W10 64 bit

Re: Joystick xml codes Library project - open for contributi

Postby tom_nl » Tue Aug 04, 2020 4:16 pm

My contribution - xml file for saitek yoke set up for the Cessna 172. Flaps controlled in steps by the right lever. The three way switch behind the right handle acts as a shift to change the throttle quadrant button function depending on position.

This is for OS X- I believe the button assignment numbers in windows and linux are different.

Tom

Code: Select all
<?xml version="1.0"?>

<!-- Saitek Pro Flight Yoke control assignment

Yoke - elevator and aileron
Left lever - throttle
Middle Lever - mixture
Right Lever - flaps (in steps)
Hat - look around

Buttons:
E (behind left - button 0) - reset view forwards
D (top right - button 1) - change view forwards, with shift change view backwards
A1 (button 2) - altimeter pressure up
A2 (button 3) - altimeter pressure down
B1 (button 4) - elevator trim down
B2 (button 5)  - elevator trim up
C1 (button 6) - rudder trim left
C2 (button 7) - rudder trim right
MODE switch (buttons 8,9,10) - shift modes 1, 2 and 3
Function (button 11) - unassigned
start-stop (button 12) - unassigned
Reset (button 13) - unassigned

quadrant buttons
button      mode 1            mode 2         mode 3   
T1 (14)      Master Alternator   Pitot Heat      Increase Magnetos
T2 (15)      Engine Primer      Nav Lights      Decrease Magnetos
T3 (16)      Battery Master      Taxi Lights      Starter
T4 (17)      Parking Brake      Beacon         Unassigned (Beacon)
T5 (18)      Avionics         Landing Lights   altimeter pressure up
T6 (19)      Carb Heat         Strobes         altimeter pressure down

Lever pulled back buttons
Left Lever (20) - unassigned
Centre Lever (21) - unassigned
Right Lever (22) - unassigned

-->

<PropertyList>
  <name type="string">Saitek Pro Flight Yoke</name>
  <axis>
    <desc type="string">Aileron</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string">/controls/flight/aileron</property>
      <factor type="double">1</factor>
      <offset type="double">0</offset>
      <power type="double">1</power>
    </binding>
  </axis>
  <axis n="1">
    <desc type="string">Elevator</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string">/controls/flight/elevator</property>
      <factor type="double">-1</factor>
      <offset type="double">0</offset>
      <power type="double">1</power>
    </binding>
  </axis>
  <axis n="2">
    <desc type="string">Throttle (all)</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string">controls.throttleAxis();</script>
    </binding>
  </axis>
  <axis n="3">
    <desc type="string">Mixture All Engines</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string">/controls/engines/mixture-all</property>
      <factor type="double">1</factor>
      <offset type="double">0</offset>
      <power type="double">1</power>
    </binding>
  </axis>
 
 
 <axis n="4">
        <name>Flaps</name>
      <desc type="string">Flaps</desc>
      <binding>
               <command>nasal</command>
               <script>
               <![CDATA[
 var flapset = getprop("/devices/status/joysticks/joystick[1]/axis[4]");
       var flapinput = 1;
                if(flapset > 0.8) {
                flapinput = 1;
                } elsif (flapset > 0) {
                flapinput = 0.666;
                } elsif (flapset > -0.8) {
                flapinput = 0.333;
                }
            else {
                flapinput = 0;
                }
                  setprop("/controls/flight/flaps", flapinput);
                ]]>
               </script>
      </binding>
      </axis>
 
 
  <axis n="5">
    <desc type="string">View (horizontal)</desc>
    <low>
      <binding>
        <command type="string">nasal</command>
        <script type="string">setprop("/sim/current-view/goal-heading-offset-deg", getprop("/sim/current-view/goal-heading-offset-deg") + 2);</script>
      </binding>
      <repeatable type="bool">true</repeatable>
    </low>
    <high>
      <binding>
        <command type="string">nasal</command>
        <script type="string">setprop("/sim/current-view/goal-heading-offset-deg", getprop("/sim/current-view/goal-heading-offset-deg") - 2);</script>
      </binding>
      <repeatable type="bool">true</repeatable>
    </high>
  </axis>
  <axis n="6">
    <desc type="string">View (vertical)</desc>
    <low>
      <binding>
        <command type="string">nasal</command>
        <script type="string">setprop("/sim/current-view/goal-pitch-offset-deg", getprop("/sim/current-view/goal-pitch-offset-deg") - 1);</script>
      </binding>
      <repeatable type="bool">true</repeatable>
    </low>
    <high>
      <binding>
        <command type="string">nasal</command>
        <script type="string">setprop("/sim/current-view/goal-pitch-offset-deg", getprop("/sim/current-view/goal-pitch-offset-deg") + 1);</script>
      </binding>
      <repeatable type="bool">true</repeatable>
    </high>
  </axis>
 
 
  <button>
    <desc type="string">Front VIew</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string">
setprop("/sim/current-view/goal-pitch-offset-deg", getprop("/sim/view/config/default-pitch-deg"));
setprop("/sim/current-view/goal-heading-offset-deg", getprop("/sim/view/config/default-heading-deg"));
setprop("/sim/current-view/field-of-view", getprop("/sim/view/config/default-field-of-view-deg"));
setprop("/sim/current-view/x-offset-m", getprop("/sim/view/config/x-offset-m"));
setprop("/sim/current-view/y-offset-m", getprop("/sim/view/config/y-offset-m"));
setprop("/sim/current-view/z-offset-m", getprop("/sim/view/config/z-offset-m"));
setprop("/sim/current-view/view-number","0");</script>
      <module type="string">__js1</module>
    </binding>
  </button>
 
 
 <!--  <button n="1"> --> <!-- left front button -->
    <button n="1">
        <desc>Cycle View</desc>
        <repeatable>false</repeatable>
        <binding>
             <condition>
 <property>/devices/status/joysticks/joystick[1]/button[8]</property>
 </condition>
            <command>nasal</command>
            <script>view.stepView(1)</script>
        </binding>
                <binding>
             <condition>
 <property>/devices/status/joysticks/joystick[1]/button[9]</property>
 </condition>
            <command>nasal</command>
            <script>view.stepView(-1)</script>
        </binding>
                        <binding>
             <condition>
 <property>/devices/status/joysticks/joystick[1]/button[10]</property>
 </condition>
            <command>nasal</command>
            <script>view.stepView(-1)</script>
        </binding>
    </button>
 
  <button n="2"> <!-- A1  button -->
    <desc type="string">altimeter pressure up</desc>
        <repeatable type="string">true</repeatable>
      <binding>
   <command>property-adjust</command>
   <property>/instrumentation/altimeter/setting-inhg</property>
   <step type="double">+0.001</step>
  </binding>
         </button>
 
    <button n="3"> <!-- A2  button -->
    <desc type="string">altimeter pressure  down</desc>
         <repeatable type="string">true</repeatable>
      <binding>
   <command>property-adjust</command>
   <property>/instrumentation/altimeter/setting-inhg</property>
   <step type="double">-0.001</step>
  </binding>
         </button>   
 
  <button n="4"> <!-- B1 button -->
    <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="5"> <!-- B2 button -->
    <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>
 
  <button n="6"> <!-- C1 button -->
    <desc type="string">Rudder Trim Left</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string">controls.rudderTrim(-1);</script>
    </binding>
    <repeatable type="double">1</repeatable>
  </button>
 
  <button n="7"> <!-- C2 button -->
    <desc type="string">Rudder Trim Right</desc>
    <binding>
      <command type="string">nasal</command>
      <script type="string">controls.rudderTrim(1);</script>
    </binding>
    <repeatable type="double">1</repeatable>
  </button>
 
 <!-- quadrant buttons -->
  <!-- T1 -->
<!--    <button n="14">
    <desc type="string">Master Alternator Switch or pitot heat (shifted)</desc>
    <repeatable type="string">false</repeatable>
<binding>
<command type="string">nasal</command>
<script>
var mode = 1;
if (getprop("/devices/status/joysticks/joystick[1]/button[8]") == 1) {
mode = 1;
}
else {mode=2;}
    if(mode==1)
       {
        if(getprop("/controls/switches/master-alt") == 0)
          {
          setprop("/controls/switches/master-alt",1) ;
          }
       else {
          setprop("/controls/switches/master-alt",0);
          }
       }
    if(mode==2) {
        if(getprop("/controls/anti-ice/pitot-heat") == 0)
          {
          setprop("/controls/anti-ice/pitot-heat",1) ;
          }
       else {
          setprop("/controls/anti-ice/pitot-heat",0);
          }
       }
 
</script>
</binding>
  </button>  -->
 
<button n="14"> <!-- T1 -->
    <desc type="string">Master Alternator Switch (mode 1), pitot heat (mode 2), magnetos up (mode3)</desc>
    <repeatable type="string">false</repeatable>
    <binding>
     <condition>
 <property>/devices/status/joysticks/joystick[1]/button[8]</property>
 </condition>
      <command type="string">property-toggle</command>
      <property type="string">/controls/switches/master-alt</property>
    </binding>
   
             <binding>
        <condition>
 <property>/devices/status/joysticks/joystick[1]/button[9]</property>
 </condition>
      <command type="string">property-toggle</command>
      <property type="string">/controls/anti-ice/pitot-heat</property>
        </binding>
       
                <binding>
        <condition>
 <property>/devices/status/joysticks/joystick[1]/button[10]</property>
 </condition>
      <command>nasal</command>
      <script>controls.stepMagnetos(1)</script>
    </binding>
 <!--     <mod-up>
   <binding>
    <command>nasal</command>
    <script>controls.stepMagnetos(0)</script>
   </binding>
  </mod-up> -->

  </button> 
 
 
  <button n="15"> <!-- Button T2 -->
    <desc type="string">engine primer (mode 1), nav lights (mode 2), magnetos down (mode 3)</desc>
        <repeatable type="string">false</repeatable>
      <binding>
                     <condition>
 <property>/devices/status/joysticks/joystick[1]/button[8]</property>
 </condition>
      <command type="string">property-toggle</command>
  <property type="string">/controls/engines/engine/primer-lever</property>

  </binding>
        <binding>
                       <condition>
 <property>/devices/status/joysticks/joystick[1]/button[8]</property>
 </condition>
   <command>property-adjust</command>
   <property>/controls/engines/engine/primer</property>
   <step type="double">+0.5/</step>
  </binding>

             <binding>
        <condition>
 <property>/devices/status/joysticks/joystick[1]/button[9]</property>
 </condition>
      <command type="string">property-toggle</command>
      <property type="string">/controls/lighting/nav-lights</property>
        </binding>
       
                <binding>
        <condition>
 <property>/devices/status/joysticks/joystick[1]/button[10]</property>
 </condition>
   <command>nasal</command>
   <script>controls.stepMagnetos(-1)</script>
  </binding>
<!--  <mod-up>
   <binding>
    <command>nasal</command>
    <script>controls.stepMagnetos(0)</script>
   </binding>
  </mod-up> -->

         </button>
 
 
    <button n="16"> <!-- T3 button-->
    <desc type="string">Battery Switch (mode 1), taxi lights (mode 2), starter (mode 3)</desc>
    <repeatable type="string">false</repeatable>
   
    <binding>
     <condition>
 <property>/devices/status/joysticks/joystick[1]/button[8]</property>
 </condition>
      <command type="string">property-toggle</command>
      <property type="string">/controls/switches/master-bat</property>
    </binding>
   
             <binding>
        <condition>
 <property>/devices/status/joysticks/joystick[1]/button[9]</property>
 </condition>
      <command type="string">property-toggle</command>
      <property type="string">/controls/lighting/taxi-light</property>
        </binding>
       
                <binding>
        <condition>
 <property>/devices/status/joysticks/joystick[1]/button[10]</property>
 </condition>

      <command type="string">property-assign</command>
      <property type="string">/controls/engines/engine/starter</property>
      <value type="bool">true</value>
    </binding>
   
         <binding>
                 <condition>
 <property>/devices/status/joysticks/joystick[1]/button[10]</property>
 </condition>
      <command type="string">property-assign</command>
      <property type="string">/controls/switches/starter</property>
      <value type="bool">true</value>
    </binding>
   
        <mod-up>
      <binding>
              <condition>
 <property>/devices/status/joysticks/joystick[1]/button[10]</property>
 </condition>
        <command type="string">property-assign</command>
        <property type="string">/controls/engines/engine/starter</property>
        <value type="bool">false</value>
      </binding>
     
      <binding>
              <condition>
 <property>/devices/status/joysticks/joystick[1]/button[10]</property>
 </condition>
        <command type="string">property-assign</command>
        <property type="string">/controls/switches/starter</property>
        <value type="bool">false</value>
      </binding>
    </mod-up>
 
 
   
  </button>
 
 
 

     <button n="17"> <!-- T4 button-->
       <desc>Parking Brake (mode 1) or beacon (mode 2 and 3)</desc>
       <binding>
               <condition>
 <property>/devices/status/joysticks/joystick[1]/button[8]</property>
 </condition>
          <command>nasal</command>
          <script>
             brake = !getprop("/controls/gear/brake-parking");
             if (brake) {
                gui.popupTip("Parking Brake ON");
             } else {
                gui.popupTip("Parking Brake OFF");
             }
             controls.applyParkingBrake(1)
          </script>
       </binding>
                     <binding>
        <condition>
 <property>/devices/status/joysticks/joystick[1]/button[9]</property>
 </condition>
      <command type="string">property-toggle</command>
      <property type="string">/controls/lighting/beacon</property>
        </binding>
       
                <binding>
        <condition>
 <property>/devices/status/joysticks/joystick[1]/button[10]</property>
 </condition>
      <command type="string">property-toggle</command>
      <property type="string">/controls/lighting/beacon</property>
    </binding>
    </button>
 
    <button n="18"> <!-- T5 button-->
    <desc type="string">Avionics Switch (mode 1) or landing lights (mode 2 and 3)</desc>
    <repeatable type="string">false</repeatable>
    <binding>
        <condition>
 <property>/devices/status/joysticks/joystick[1]/button[8]</property>
 </condition>
      <command type="string">property-toggle</command>
      <property type="string">/controls/switches/master-avionics</property>
    </binding>
               <binding>
        <condition>
 <property>/devices/status/joysticks/joystick[1]/button[9]</property>
 </condition>
      <command type="string">property-toggle</command>
      <property type="string">/controls/lighting/landing-lights</property>
        </binding>
       
                <binding>
        <condition>
 <property>/devices/status/joysticks/joystick[1]/button[10]</property>
 </condition>
      <command type="string">property-toggle</command>
      <property type="string">/controls/lighting/landing-lights</property>
    </binding>
  </button>


 
 
 
  <button n="19"> <!-- T6 Button -->
    <desc type="string">carb heat (mode 1) or strobes (mode 2 and 3)</desc>

      <binding>
             <condition>
 <property>/devices/status/joysticks/joystick[1]/button[8]</property>
 </condition>
      <command type="string">property-toggle</command>
  <property type="string">/controls/engines/current-engine/carb-heat</property>
  </binding>

     
      <binding>
        <condition>
 <property>/devices/status/joysticks/joystick[1]/button[9]</property>
 </condition>
      <command type="string">property-toggle</command>
      <property type="string">/controls/lighting/strobe</property>
        </binding>
       
                <binding>
           
        <condition>
 <property>/devices/status/joysticks/joystick[1]/button[10]</property>
 </condition>
      <command type="string">property-toggle</command>
      <property type="string">/controls/lighting/strobe</property>
    </binding>
  </button>
 

 
   <!-- magnetos-->    
 <!--
        <button n="8">
    <desc type="string">magneto off</desc>
    <repeatable type="string">false</repeatable>
    <binding>
      <command type="string">property-assign</command>
      <property type="string">/controls/engines/engine/magnetos</property>
      <value type="double">0</value>
    </binding>
     <binding>
      <command type="string">property-assign</command>
      <property type="string">/controls/switches/magnetos</property>
      <value type="double">0</value>
    </binding>
   
    </button>
        <button n="9">
    <desc type="string">magneto both</desc>
    <repeatable type="string">false</repeatable>
    <binding>
      <command type="string">property-assign</command>
      <property type="string">/controls/engines/engine/magnetos</property>
      <value type="double">3</value>
    </binding>
         <binding>
      <command type="string">property-assign</command>
      <property type="string">/controls/switches/magnetos</property>
      <value type="double">3</value>
    </binding>
    </button>
        <button n="10">
    <desc type="string">engine start</desc>
    <repeatable type="string">true</repeatable>
      <binding>
      <command type="string">property-assign</command>
      <property type="string">/controls/engines/engine/magnetos</property>
      <value type="double">3</value>
    </binding>
    <binding>
      <command type="string">property-assign</command>
      <property type="string">/controls/engines/engine/starter</property>
      <value type="bool">true</value>
    </binding>
         <binding>
      <command type="string">property-assign</command>
      <property type="string">/controls/switches/starter</property>
      <value type="bool">true</value>
    </binding>
        <mod-up>
      <binding>
        <command type="string">property-assign</command>
        <property type="string">/controls/engines/engine/starter</property>
        <value type="bool">false</value>
      </binding>
      <binding>
        <command type="string">property-assign</command>
        <property type="string">/controls/switches/starter</property>
        <value type="bool">false</value>
      </binding>
    </mod-up>
    </button>
  -->
 
</PropertyList>
tom_nl
 
Posts: 84
Joined: Tue Aug 04, 2020 11:41 am
Location: Netherlands
OS: OS X Big Sur

Re: Joystick xml codes Library project - open for contributi

Postby Puffergas » Thu Feb 25, 2021 8:05 pm

Honeycomb Yoke
Written for the Cessna 172
Tested only on Raspberry Pi OS and FlightGear 2020.3.6
Code: Select all
<?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 Alpha Flight Controls - Yoke
*
*
* Axis 0: ailerons
* Axis 1: elevator
* Axes 2 and 3 (hat): view direction
*
* Button  0: YOKE white-Trigger left-handle  >>>>>>>>  View, Cycle Forwards
* Button  1: YOKE white-top-Button left-handle  >>>>>  View, Reset
* Button  2: YOKE white-top-Button right-handle
* Button  3: YOKE red-top-Button right-handle
* Button  4: YOKE outer-Rocker down left-handle  >>>>  Elevator Trim, Up
* Button  5: YOKE outer-Rocker up left-handle  >>>>>>  Elevator Trim, Down
* Button  6: YOKE inner-Rocker down left-handle  >>>>  Flaps, Down
* Button  7: YOKE inner-Rocker up left-handle  >>>>>>  Flaps, Up
* Button  8: YOKE top-Rocker inward right-handle  >>>  Rudder Trim, Left
* Button  9: YOKE top-Rocker outward right-handle  >>  Rudder Trim, Right
* Button 10: YOKE bottom-Rocker inward right-handle
* Button 11: YOKE bottom-Rocker outward right-handle
* Button 12: BASE Master Alternator up  >>>>>>>>>>>>>  Master Alternator, ON OFF
* Button 13: BASE Master Alternator down
* Button 14: BASE Master Battery up  >>>>>>>>>>>>>>>>  Battery, ON OFF
* Button 15: BASE Master Battery down
* Button 16: BASE Avionics Bus1 up  >>>>>>>>>>>>>>>>>  Master Avionics, ON OFF
* Button 17: BASE Avionics Bus1 down
* Button 18: BASE Avionics Bus2 up
* Button 19: BASE Avionics Bus2 down
* Button 20: BASE Beacon up  >>>>>>>>>>>>>>>>>>>>>>>>  Beacon, ON OFF
* Button 21: BASE Beacon down
* Button 22: BASE Land up  >>>>>>>>>>>>>>>>>>>>>>>>>>  Landing Lights, ON OFF
* Button 23: BASE Land down
* Button 24: BASE Taxi up  >>>>>>>>>>>>>>>>>>>>>>>>>>  Taxi Lights, ON OFF
* Button 25: BASE Taxi down
* Button 26: BASE Nav up  >>>>>>>>>>>>>>>>>>>>>>>>>>>  Navigation Lights, ON OFF
* Button 27: BASE Nav down
* Button 28: BASE Strobe up  >>>>>>>>>>>>>>>>>>>>>>>>  Strobe Light, ON OFF
* Button 29: BASE Strobe down
* Button 30: BASE Off  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  Magneto, OFF
* Button 31: BASE Right Mag  >>>>>>>>>>>>>>>>>>>>>>>>  Magneto, Right
* Button 32: BASE Left Mag  >>>>>>>>>>>>>>>>>>>>>>>>>  See note below
* Button 33: BASE Both Mag  >>>>>>>>>>>>>>>>>>>>>>>>>  See note below
* Button 34: BASE Start  >>>>>>>>>>>>>>>>>>>>>>>>>>>>  See note below

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

<PropertyList>
  <name type="string">Honeycomb Aeronautical Alpha Flight Controls</name>

  <axis>
      <desc>Aileron</desc>
      <binding>
          <command>property-scale</command>
          <property>/controls/flight/aileron</property>
          <factor type="double">1</factor>
          <offset type="double">0</offset>
      </binding>
  </axis>

  <axis n="1">
      <desc>Elevator</desc>
      <binding>
          <command>property-scale</command>
          <property>/controls/flight/elevator</property>
          <factor type="double">-1</factor>
          <offset type="double">0</offset>
      </binding>
  </axis>

  <axis n="2">
      <desc>View, Direction</desc>
      <direction>left</direction>
      <low>
          <repeatable>true</repeatable>
          <binding>
              <command>nasal</command>
              <script>view.panViewDir(1)</script>
              <module>__js1</module>
              <offset type="double">1</offset>
          </binding>
      </low>
      <high>
          <repeatable>true</repeatable>
          <binding>
              <command>nasal</command>
              <script>view.panViewDir(-1)</script>
              <module>__js1</module>
              <offset type="double">1</offset>
          </binding>
      </high>
  </axis>

  <axis n="3">
      <desc>View, Elevation</desc>
      <direction>upward</direction>
      <low>
          <repeatable>true</repeatable>
          <binding>
              <command>nasal</command>
              <script>view.panViewPitch(1)</script>
              <module>__js1</module>
              <offset type="double">1</offset>
          </binding>
     </low>
     <high>
          <repeatable>true</repeatable>
          <binding>
              <command>nasal</command>
              <script>view.panViewPitch(-1)</script>
              <module>__js1</module>
              <offset type="double">1</offset>
          </binding>
      </high>
  </axis>
 
  <button n="0">
      <desc>View, Cycle Forwards</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>view.stepView(1)</script>
      </binding>
  </button>

  <button n="1">
      <desc>View, Reset</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>
              setprop("/sim/current-view/view-number", 0);
              view.resetView()
          </script>
      </binding>
  </button>

  <button n="4">
      <desc>Elevator Trim, Up</desc>
      <repeatable>true</repeatable>
      <binding>
          <command>nasal</command>
          <script>controls.elevatorTrim(-1)</script>
      </binding>
  </button>

  <button n="5">
      <desc>Elevator Trim, Down</desc>
      <repeatable>true</repeatable>
      <binding>
          <command>nasal</command>
          <script>controls.elevatorTrim(1)</script>
      </binding>
  </button>

  <button n="6">
      <desc>Flaps, Down</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>controls.flapsDown(1)</script>
      </binding>
  </button>

  <button n="7">
      <desc>Flaps, Up</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>controls.flapsDown(-1)</script>
      </binding>
  </button>

  <button n="8">
      <desc>Rudder Trim, Left</desc>
      <repeatable>true</repeatable>
      <binding>
          <command>nasal</command>
          <script>controls.rudderTrim(-1)</script>
      </binding>
  </button>

  <button n="9">
      <desc>Rudder Trim, Right</desc>
      <repeatable>true</repeatable>
      <binding>
          <command>nasal</command>
          <script>controls.rudderTrim(1)</script>
      </binding>
  </button>

  <button n="12">
      <desc>Master Alternator, ON OFF</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>setprop("/controls/switches/master-alt", 1);</script>
      </binding>
      <mod-up>
          <binding>
              <command>nasal</command>
              <script>setprop("/controls/switches/master-alt", 0)</script>
          </binding>
      </mod-up>
  </button>

  <button n="14">
      <desc>Battery, ON OFF</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>setprop("/controls/switches/master-bat", 1)</script>
      </binding>
      <mod-up>
          <binding>
              <command>nasal</command>
              <script>setprop("/controls/switches/master-bat", 0)</script>
          </binding>
      </mod-up>
      </button>

  <button n="16">
      <desc>Master Avionics, ON OFF</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>setprop("/controls/switches/master-avionics", 1)</script>
      </binding>
      <mod-up>
          <binding>
              <command>nasal</command>
              <script>setprop("/controls/switches/master-avionics", 0)</script>
          </binding>
      </mod-up>
  </button>

  <button n="20">
      <desc>Beacon, ON OFF</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>setprop("/controls/lighting/beacon", 1)</script>
      </binding>
      <mod-up>
          <binding>
              <command>nasal</command>
              <script>setprop("/controls/lighting/beacon", 0)</script>
          </binding>
      </mod-up>
  </button>

  <button n="22">
      <desc>Landing Lights, ON OFF</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>setprop("/controls/lighting/landing-lights", 1)</script>
      </binding>
      <mod-up>
          <binding>
              <command>nasal</command>
              <script>setprop("/controls/lighting/landing-lights", 0)</script>
          </binding>
      </mod-up>
  </button>

  <button n="24">
      <desc>Taxi Lights, ON OFF</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>setprop("/controls/lighting/taxi-light", 1)</script>
      </binding>
      <mod-up>
          <binding>
              <command>nasal</command>
              <script>setprop("/controls/lighting/taxi-light", 0)</script>
          </binding>
      </mod-up>
  </button>

  <button n="26">
      <desc>Navigation Lights, ON OFF</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>setprop("/controls/lighting/nav-lights", 1)</script>
      </binding>
      <mod-up>
          <binding>
              <command>nasal</command>
              <script>setprop("/controls/lighting/nav-lights", 0)</script>
          </binding>
      </mod-up>
  </button>

  <button n="28">
      <desc>Strobe Light, ON OFF</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>setprop("/controls/lighting/strobe", 1)</script>
      </binding>
      <mod-up>
          <binding>
              <command>nasal</command>
              <script>setprop("/controls/lighting/strobe", 0)</script>
          </binding>
      </mod-up>
  </button>

  <button n="30">
      <desc>Magneto, OFF</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>setprop("/controls/switches/magnetos", 0)</script>
      </binding>
  </button>

  <button n="31">
      <desc>Magneto, Right</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>setprop("/controls/switches/magnetos", 1)</script>
      </binding>
  </button>

<!-- Linux and FlightGear does not handle more than 32 USB buttons.
     See FlightGear Ticket 2212.

  <button n="32">
      <desc>Magneto, Left</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>setprop("/controls/switches/magnetos", 2)</script>
      </binding>
  </button>

  <button n="33">
      <desc>Magneto, Both</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>setprop("/controls/switches/magnetos", 3)</script>
      </binding>
  </button>

  <button n="34">
      <desc>Starter, ON OFF</desc>
      <repeatable>false</repeatable>
      <binding>
          <command>nasal</command>
          <script>setprop("/controls/lighting/strobe", 1)</script>
      </binding>
      <mod-up>
          <binding>
              <command>nasal</command>
              <script>setprop("/controls/lighting/strobe", 0)</script>
          </binding>
      </mod-up>
  </button>
-->

</PropertyList>


Cheers
Puffergas
 
Posts: 56
Joined: Thu Jan 02, 2020 2:09 am

Re: Joystick xml codes Library project - open for contributi

Postby zayamatias » Wed Jul 26, 2023 8:49 am

Puffergas wrote in Thu Feb 25, 2021 8:05 pm:Honeycomb Yoke
Written for the Cessna 172
Tested only on Raspberry Pi OS and FlightGear 2020.3.6


Hi Puffergas,

To solve the extra buttons not working try this:

Under .fgfs/Input directory, create an "Event" directory, quotes not included pls.

Create a file called "Honeycomb-Aeronautical-Bravo-Throttle-Quadrant.xml"

And in it, put the following:

Code: Select all
<?xml version="1.0"?>

<PropertyList>
  <name type="string">Honeycomb Aeronautical Alpha Flight Controls</name>
  <debug-events type="bool">true</debug-events>
  <event>
    <desc>LEFT Magnetos switch</desc>
    <name>button-720</name>
    <binding>
      <command>property-assign</command>
      <property>/controls/engines/engine/magnetos</property>
      <value type="string">2</value>
    </binding>
  </event>
  <event>
    <desc>BOTH Magnetos switch</desc>
    <name>button-721</name>
    <binding>
      <command>property-assign</command>
      <property>/controls/engines/engine/magnetos</property>
      <value>3</value>
    </binding>
  </event>
  <event>
    <desc>STARTER</desc>
    <name>button-722</name>
    <binding>
      <command>property-assign</command>
      <property>/controls/engines/engine/starter_cmd</property>
      <value>true</value>
    </binding>
    <mod-up>
    <binding>
      <command>property-assign</command>
      <property>/controls/engines/engine/starter_cmd</property>
      <value>false</value>
    </binding>
  </mod-up>
  </event>
</PropertyList>


This should allow you to switch both magnetos on and even use the starter from the yoke (you may have to change the property value according to the aircraft you're using it with).

If anyone is interested, I'm also working on the Bravo throttle and got the LEDS working and everything (pls see viewtopic.php?f=24&t=41557)

BTW, anyone knows if there's a possibility to have different .xml files for joystick & events per Aircraft? I'm configuring my yoke+throttle for different airplanes (for example with different names/under different directories) but it is a burden to have to rename files manually every time.

Thanks!
zayamatias
 
Posts: 38
Joined: Thu Jul 13, 2023 7:29 pm

Re: Joystick xml codes Library project - open for contributi

Postby wkitty42 » Wed Jul 26, 2023 2:50 pm

zayamatias wrote in Wed Jul 26, 2023 8:49 am:BTW, anyone knows if there's a possibility to have different .xml files for joystick & events per Aircraft? I'm configuring my yoke+throttle for different airplanes (for example with different names/under different directories) but it is a burden to have to rename files manually every time.

it is not possible to have different config files for one joystick depending on which craft is being flown... the only current method being used is for the joystick config file to detect which craft is being flown and to use the settings for it... it is basically little more than an XML formatted "if/then" statement...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9125
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Joystick xml codes Library project - open for contributi

Postby zayamatias » Wed Jul 26, 2023 3:16 pm

wkitty42 wrote in Wed Jul 26, 2023 2:50 pm:it is not possible to have different config files for one joystick depending on which craft is being flown... the only current method being used is for the joystick config file to detect which craft is being flown and to use the settings for it... it is basically little more than an XML formatted "if/then" statement...


Hi, thanks for the answer, thought about that possibility, but, will it not have an impact on performance? I mean, I could eventually end up with a huge XML that needs to be parsed for every single action :shock: .

I was hoping for an 'Input' directory under each Aircraft directory. Maybe I should start removing the rust on my c++ :D
zayamatias
 
Posts: 38
Joined: Thu Jul 13, 2023 7:29 pm

Re: Joystick xml codes Library project - open for contributi

Postby wlbragg » Wed Jul 26, 2023 5:21 pm

it is not possible to have different config files for one joystick depending on which craft is being flown... the only current method being used is for the joystick config file to detect which craft is being flown and to use the settings for it... it is basically little more than an XML formatted "if/then" statement...


Does this apply to Variants? For example, do each of the c172p variants which record their own cache data count as an individual aircraft? If they do you could make a Variant name for each JS config you want to save for the same aircraft. It i a hack to be sure, but not really difficult to do,
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7574
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Joystick xml codes Library project - open for contributi

Postby wkitty42 » Wed Jul 26, 2023 7:36 pm

zayamatias wrote in Wed Jul 26, 2023 3:16 pm:I was hoping for an 'Input' directory under each Aircraft directory. Maybe I should start removing the rust on my c++ :D

since these would be custom controller files, i would place them in the "personal" Input tree where modified by the in-sim configuration editor ones are placed... either add the aircraft name to the filename or look for a subdirectory named the same as the craft and find the normal controller file name in there...

for example:
Code: Select all
(on linux)
~/.fgfs/Input/Joysticks/ThrustMaster/T16000M.xml           global modified from original
~/.fgfs/Input/Joysticks/ThrustMaster/c172p/T16000M.xml     specific to the c172p
~/.fgfs/Input/Joysticks/ThrustMaster/f16/T16000M.xml       specific to the f16
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9125
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Joystick xml codes Library project - open for contributi

Postby wlbragg » Wed Jul 26, 2023 7:59 pm

it is not possible to have different config files for one joystick depending on which craft is being flown

I read that wrong.

the only current method being used is for the joystick config file to detect which craft is being flown and to use the settings for it

will it not have an impact on performance? I mean, I could eventually end up with a huge XML that needs to be parsed for every single action

I think you could structure it such that it wouldn't be a huge performance hit.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7574
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

PreviousNext

Return to Hardware

Who is online

Users browsing this forum: No registered users and 2 guests

cron