mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-27 16:54:15 +01:00
gcs gamepad: teach GCS that an accel is not a gamepad
The gcscontrolgadget expects all gamepad devices to have at least 4 axes of control. The SDL layer (on Linux anyway) will detect the accelerometer that's built into some laptops as a gamepad with 3 axes. This change prevents the accel from being selected and subsequently flooding the console with errors from gcscontrolgadget every 10ms.
This commit is contained in:
parent
4edf78d1cd
commit
ed24d93ab1
@ -93,10 +93,20 @@ bool SDLGamepad::setGamepad(qint16 index)
|
|||||||
{
|
{
|
||||||
buttons = SDL_JoystickNumButtons(gamepad);
|
buttons = SDL_JoystickNumButtons(gamepad);
|
||||||
axes = SDL_JoystickNumAxes(gamepad);
|
axes = SDL_JoystickNumAxes(gamepad);
|
||||||
|
|
||||||
|
if (axes >= 4) {
|
||||||
this->index = index;
|
this->index = index;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
buttons = -1;
|
||||||
|
axes = -1;
|
||||||
|
this->index = -1;
|
||||||
|
qCritical("Gamepad has less than 4 axes");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
buttons = -1;
|
buttons = -1;
|
||||||
axes = -1;
|
axes = -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user