Skip to content

Enabling some axes causes others to fail to report. #312

@Zenilogix-Carl

Description

@Zenilogix-Carl

Description of Issue

As the following sketch demonstrates, although 4 axes are enabled (Rx,Ry,Rz,Rudder), only 3 work (Rx,Ry,Rz). This can be seen in joy.cpl as only the Rx,Ry,Rz appear. In DIView, although all 4 axes appear, only the Rx,Ry,Rz update.

If Rz is disabled, behavior is as expected - all enabled axes appear correctly in both joy.cpl and DIView.

Tested with several other axis combinations. Some combinations work as expected, for some combinations one or more of the enabled axes will fail to appear/update as described. If any axes are affected, it seems rudder will always be among them, but other axes are affected in varying combinations. If all axes are enabled, affected axes are rudder, accelerator, brake, and steering.

Technical Details

  • Arduino Micro
  • Host OS Windows 11 25H2
  • Arduino IDE 2.3.7

Sketch File that Reproduces Issue

// Sketch to demonstrate issue with axes not reporting

#include <Joystick.h>

// A class to make some automated movement easier
// Each time Next() is called, it will return a value that will cycle back and forth between 0 and the specified limit
class C {
private:
  int Limit;
  int Increment;
  int Value;

public:

  C(
    int increment,  // How much to increment up or down
    int limit       // Upper limit
  ) {
    Value = limit / 2;
    Increment = increment;
    Limit = limit;
  }

  // Get the next value
  inline int Next() {
    Value += Increment;
    if (((Value < 0) && (Increment < 0)) || ((Value > Limit) && (Increment > 0))) {
      Increment = -Increment;
    }
    return Value;
  }
};

C One(1, 1024);
C Two(2, 1024);
C Three(4, 1024);

C Four(3, 1024);
C Five(5, 1024);
C Six(-2, 1024);
C Seven(-4, 1024);
C Eight(-3, 1024);
C Nine(-5, 1024);
C Ten(7, 1024);
C Eleven(-7, 1024);


Joystick_ Joystick(
  JOYSTICK_DEFAULT_REPORT_ID, JOYSTICK_TYPE_JOYSTICK,  // report ID, joystick type
  0, 0,                                                // button/switch counts
  false, false, false,                                 // x,y,z
  true, true, true,                                    // r x,y,z
  true,                                                // rudder
  false,                                               // throttle
  false, false,                                        // accelerator, brake
  false                                                // steering
);

void setup() {
  Joystick.begin();

  Joystick.setXAxisRange(0, 1024);
  Joystick.setYAxisRange(0, 1024);
  Joystick.setZAxisRange(0, 1024);

  Joystick.setRxAxisRange(0, 1024);
  Joystick.setRyAxisRange(0, 1024);
  Joystick.setRzAxisRange(0, 1024);

  Joystick.setRudderRange(0, 1024);
  Joystick.setThrottleRange(0, 1024);

  Joystick.setAcceleratorRange(0, 1024);
  Joystick.setBrakeRange(0, 1024);
  Joystick.setSteeringRange(0, 1024);
}

void loop() {

  Joystick.setXAxis(One.Next());
  Joystick.setYAxis(Two.Next());
  Joystick.setZAxis(Three.Next());

  Joystick.setRxAxis(Four.Next());
  Joystick.setRyAxis(Five.Next());
  Joystick.setRzAxis(Six.Next());

  Joystick.setRudder(Seven.Next());
  Joystick.setThrottle(Eight.Next());

  Joystick.setAccelerator(Nine.Next());
  Joystick.setBrake(Ten.Next());
  Joystick.setSteering(Eleven.Next());

  delay(10);
}

Wiring Details

Can be demonstrated with USB connection only; no other dependencies.

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions