cockpit icon indicating copy to clipboard operation
cockpit copied to clipboard

Joystick: Allow using axis as a button

Open RaulTrombin opened this issue 1 year ago • 3 comments

Issue: can't map buttons using d-pad (axis 6 & 7); image

Tryng to set 8BitDO controller; Details: OS: Linux ThinkPad-T495 6.5.0-17-generic #17~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 16 14:32:32 UTC 2 x86_64 x86_64 x86_64 GNU/Linux Controller: 8Bitdo SN30 Pro (Vendor: 2dc8 Product: 6101) *power on D-mode ( B + Start ), pair with Ubuntu as normal. *X-mode doesn't work properly

RaulTrombin avatar Feb 08 '24 12:02 RaulTrombin

Just to get the problem more clearly, you're in a situation where two of your joystick buttons are interpreted as axes by the Gamepad API, right?

This is indeed something we should support at some points, specially because this can be the case for buttons that are analogic, and so have a floating range (instead of a boolean value).

rafaellehmkuhl avatar Feb 08 '24 13:02 rafaellehmkuhl

The simplest approach I can think of for this would be allowing each axis to be configured as a function that triggers when the axis moves above or below a given threshold.

More advanced ideas could allow:

  • supporting some form of automated hysteresis/debouncing
  • user-selectable length of time in a particular value region before triggering the associated function
  • assigning a variable-length list of functions to specific value ranges
    • e.g. for multi-position sliders and knobs that aren't spring-loaded
  • passing the axis value directly to some kind of Action
    • relevant to #644, but focused more on general functionalities rather than specifically motion control axes
    • likely with some kind of scaling and offset options as "calibration"
      • relevant to #616
    • would be helpful for making full use of #826
    • this should maybe be its own issue, but raising it here since the features are related

ES-Alexander avatar Apr 08 '24 09:04 ES-Alexander

#1658 could provide a workaround for situations like this, with a bonus of relatively advanced functionality options at the cost of currently accessing those through a reasonably complex set of interface operations.

ES-Alexander avatar Mar 18 '25 13:03 ES-Alexander