mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
Changed joystick port numbers to be zero-based for C++ and Java.
Change-Id: Ifd55e8654be3b15abbe7460d2e9e6fff8acd9977
This commit is contained in:
@@ -179,7 +179,7 @@ float DriverStation::GetBatteryVoltage()
|
||||
*/
|
||||
float DriverStation::GetStickAxis(uint32_t stick, uint32_t axis)
|
||||
{
|
||||
if (stick < 1 || stick > kJoystickPorts)
|
||||
if (stick >= kJoystickPorts)
|
||||
{
|
||||
wpi_setWPIError(BadJoystickIndex);
|
||||
return 0;
|
||||
@@ -191,7 +191,7 @@ float DriverStation::GetStickAxis(uint32_t stick, uint32_t axis)
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
int8_t value = m_joystickAxes[stick - 1].axes[axis - 1];
|
||||
int8_t value = m_joystickAxes[stick].axes[axis - 1];
|
||||
|
||||
if(value < 0)
|
||||
{
|
||||
@@ -212,13 +212,13 @@ float DriverStation::GetStickAxis(uint32_t stick, uint32_t axis)
|
||||
*/
|
||||
short DriverStation::GetStickButtons(uint32_t stick)
|
||||
{
|
||||
if (stick < 1 || stick > kJoystickPorts)
|
||||
if (stick >= kJoystickPorts)
|
||||
{
|
||||
wpi_setWPIError(BadJoystickIndex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return m_joystickButtons[stick - 1];
|
||||
return m_joystickButtons[stick];
|
||||
}
|
||||
|
||||
bool DriverStation::IsEnabled()
|
||||
|
||||
Reference in New Issue
Block a user