Board index FlightGear Support Interfacing

Rotary knob 'shift' modifier

Connecting two computers, using generic protocol, connecting with Matlab?

Rotary knob 'shift' modifier

Postby Sonny_Jim » Sun Aug 08, 2021 5:23 am

Hi, I'm currently building a cheap cockpit using Arduinos and had a quick question:

Right now I'm using rotary encoders wired into a Teensy in such a way that each detent fires off a button press, then in the joystick config I have something like this

Code: Select all
  <button n="7">
    <desc>Heading bug right</desc>
    <binding>
      <command>property-adjust</command>
      <property>/autopilot/settings/heading-bug-deg</property>
      <step type="double">1</step>
     </binding>
  <repeatable type="double">1</repeatable>
  </button>
  <button n="8">
    <desc>Heading bug left</desc>
    <binding>
      <command>property-adjust</command>
      <property>/autopilot/settings/heading-bug-deg</property>
      <step type="double">-1</step>
     </binding>
  <repeatable type="double">-1</repeatable>
  </button>

This works great, but I'd like to be able to press another button to toggle between large and small step values. So I press a button, it switches the step value to +5/-5, I press it again and it returns the step value to +1/-1.

One idea I had was to do all the logic on the Teensy and use an extra two buttons like this:
Code: Select all
  <button n="9">
    <desc>Heading bug right</desc>
    <binding>
      <command>property-adjust</command>
      <property>/autopilot/settings/heading-bug-deg</property>
      <step type="double">1</step>
     </binding>
  <repeatable type="double">5</repeatable>
  </button>

Obviously this is not ideal and will chew up my button outputs fairly quickly. My question is there a way using Nasal scripting to apply a modifier to the step value if a button is pressed? Or any other solution that might be more elegant?

Thanks.
Sonny_Jim
 
Posts: 1
Joined: Sun Aug 08, 2021 4:50 am

Return to Interfacing

Who is online

Users browsing this forum: No registered users and 2 guests

cron