Open Bollos00 opened 4 years ago
Hi, maybe this has something to do with SDL and/or the driver of the joystick used by the system. If possible, could you please share what OS are you using?
I am using Ubuntu 18.04
in SDL_Joysticks.cpp line 138 comment out one switch case, since both get triggered on joystick movement.
case SDL_JOYAXISMOTION: case SDL_CONTROLLERAXISMOTION:
The @bannedas 's tip solved the problem for me. The SDL_JOYAXISMOTION and the SDL_CONTROLLERAXISMOTION where both trigged. That was the problem.
I added the following changes to SDL_Joysticks function::update()
Before:
...
case SDL_JOYAXISMOTION:
case SDL_CONTROLLERAXISMOTION:
emit axisEvent (getAxisEvent (&event));
break;
...
Now:
...
case SDL_JOYAXISMOTION:
if(!SDL_IsGameController(event.cdevice.which)){
emit axisEvent(getAxisEvent (&event));
}
break;
case SDL_CONTROLLERAXISMOTION:
if(SDL_IsGameController(event.cdevice.which)){
emit axisEvent(getAxisEvent (&event));
} break;
...
That way only one of the types of events is considered for axis events.
Thank you.
@Bollos00 Thanks for the PR! Should I close the issue?
@Bollos00 Thanks for the PR! Should I close the issue?
Yes, thank you.
I have been having some problems using the Qjoysticks library to receive commands from a game controller (in my case, PS4 Controller and XboxOne Controller).
When connecting the control to the PC and running JoystickList, the JoystickList interface indicates that the control has been connected and the button’s events and POV’s events work perfectly, but the axes don't seem to work properly.
The interface list shows 6 axes detected (as it should), and the expected events for each axes – I believe – are the following:
The LX (0), LY(1) and R2(5) axes work as they should work, but the others, when called, trigger more than one axis.
When I move the axis RX, I see in the interface that the axis 2 and 3 move together. When moving the RY axis, the 4 and 5 axes move. And when pressing L2 (or LT), the 2 and 4 axes move together. I do not understand the reason why axis 2, 3 and 4 are sending events from more than one axis. I have already tested it with a XboxOne control and a PS4 control and – in both situations – I have found the same issue.
I know very little about the subject and can be letting something pass, but I spent some time looking and I did not identify the problem.
Thanks in advance.