[hal,wpilib,cmd] Update POVs to use enums (#7978)

This commit is contained in:
Joseph Eng
2025-06-29 18:32:26 -07:00
committed by GitHub
parent e13d237390
commit f55564729b
30 changed files with 538 additions and 378 deletions

View File

@@ -315,14 +315,14 @@ double DriverStation::GetStickAxis(int stick, int axis) {
return axes.axes[axis];
}
int DriverStation::GetStickPOV(int stick, int pov) {
DriverStation::POVDirection DriverStation::GetStickPOV(int stick, int pov) {
if (stick < 0 || stick >= kJoystickPorts) {
FRC_ReportError(warn::BadJoystickIndex, "stick {} out of range", stick);
return -1;
return kCenter;
}
if (pov < 0 || pov >= HAL_kMaxJoystickPOVs) {
FRC_ReportError(warn::BadJoystickAxis, "POV {} out of range", pov);
return -1;
return kCenter;
}
HAL_JoystickPOVs povs;
@@ -333,10 +333,10 @@ int DriverStation::GetStickPOV(int stick, int pov) {
"Joystick POV {} missing (max {}), check if all controllers are "
"plugged in",
pov, povs.count);
return -1;
return kCenter;
}
return povs.povs[pov];
return static_cast<POVDirection>(povs.povs[pov]);
}
int DriverStation::GetStickButtons(int stick) {