Fix joystick issues [artf3707]

Make axes and POVs 0-based like they are on the DS

Correct default joystick axis numbers to be 0-based

Fix array dimensions for joystick axis values

Increase the number of joystick ports to the maximum 6 that the DS supports

Change-Id: I16d0e6e636188cbdd9cd7bfa0453a62466a55093
This commit is contained in:
Thomas Clark
2014-10-22 11:16:39 -04:00
parent be30d3ab1d
commit a56c0eb4af
7 changed files with 24 additions and 24 deletions

View File

@@ -192,13 +192,13 @@ float DriverStation::GetStickAxis(uint32_t stick, uint32_t axis)
return 0;
}
if (axis < 1 || axis > m_joystickAxes[stick].count)
if (axis >= m_joystickAxes[stick].count)
{
wpi_setWPIError(BadJoystickAxis);
return 0.0f;
}
int8_t value = m_joystickAxes[stick].axes[axis - 1];
int8_t value = m_joystickAxes[stick].axes[axis];
if(value < 0)
{
@@ -222,13 +222,13 @@ int DriverStation::GetStickPOV(uint32_t stick, uint32_t pov) {
return 0;
}
if (pov < 1 || pov > m_joystickPOVs[stick].count)
if (pov >= m_joystickPOVs[stick].count)
{
wpi_setWPIError(BadJoystickAxis);
return 0;
}
return m_joystickPOVs[stick].povs[pov - 1];
return m_joystickPOVs[stick].povs[pov];
}
/**