mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
Don't raise exception for Joystick axis/POV out of active range. Shorten error message and change to Warning (filtered by DS by default)
Return 0.0 in this case (as it can be commonly caused by the joystick not being plugged in). Still raise exception (Java) / set error (C++) if the asked-for axis/POV is higher than kMaxJoystickAxes/kMaxJoystickPOVs. See artf3673. Change-Id: I4847c5badb358ed08f01170724ec1446af2e4ab9
This commit is contained in:
committed by
Kevin O'Connor
parent
5b2520c35f
commit
7f30b6bff4
@@ -194,7 +194,10 @@ float DriverStation::GetStickAxis(uint32_t stick, uint32_t axis)
|
||||
|
||||
if (axis >= m_joystickAxes[stick].count)
|
||||
{
|
||||
wpi_setWPIError(BadJoystickAxis);
|
||||
if (axis >= kMaxJoystickAxes)
|
||||
wpi_setWPIError(BadJoystickAxis);
|
||||
else
|
||||
ReportError("WARNING: Joystick Axis missing, check if all controllers are plugged in\n");
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@@ -224,7 +227,10 @@ int DriverStation::GetStickPOV(uint32_t stick, uint32_t pov) {
|
||||
|
||||
if (pov >= m_joystickPOVs[stick].count)
|
||||
{
|
||||
wpi_setWPIError(BadJoystickAxis);
|
||||
if (pov >= kMaxJoystickPOVs)
|
||||
wpi_setWPIError(BadJoystickAxis);
|
||||
else
|
||||
ReportError("WARNING: Joystick POV missing, check if all controllers are plugged in\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user