Closed IljaGrebel closed 4 years ago
I've got the same issue with a Thrustmaster T16000M joystick.
But using the debugger, I was able to understand that, for some reason, the 4th Axis on the controller has an e.axis index of 4. The List that stores the axis assignment only has a count of 4 which means that the 4th axis index falls outside of the range of the List. The list is 0,1,2,3 and the e.axis values for pitch (x), roll (y), throttle (z) and twist (Rz) are 0, 1, 2, and 4 respectively.
I couldn't see where these e.axis values are being drawn from or set to troubleshoot the problem further.
Same for me here....
0 down vote
I had the same problem.
However if you do not need the 4th axis and just basic 2D joystick movement just change the code to ignore the 4th axis:
void QJoysticks::onAxisEvent (const QJoystickAxisEvent& e) { if (!isBlacklisted (e.joystick->id)) { if (e.axis != 4) { getInputDevice (e.joystick->id)->axes [e.axis] = e.value; emit axisChanged (e.joystick->id, e.axis, e.value); } } }
I have a same problem with Thrustmaster T16000M too...
But after testing, I found out that problem is at SDL_Joysticks.cpp#L139。
That is, SDL_CONTROLLERAXISMOTION
is for gamecontrol, not for joysticks. And with T.16000M, sometimes SDL_PollEvent
will return an event with type = SDL_CONTROLLERAXISMOTION
, and also with wrong axes index. So the best way to slove this problem is removing case SDL_CONTROLLERAXISMOTION:
.
But it's strange that, When I use SDL along to test the T.16000M, this problem disappeared...
Ok I found the root...
SDL_GameControllerAddMapping
will raise event with type = SDL_CONTROLLERAXISMOTION
.
So comment that part or find a suitable mapping for T.16000M can also fix the problem.
Hi there,
I was trying to use your lib with my joystick which have 3 axis and every time, when I'm trying to change the 3rd axis, my app just crash with a debug message - QList::operator[]: "index out of range".
Do you have any idea, how I can fix that?