[wpilib, commands] Cache controller BooleanEvents/Triggers and directly construct Triggers (#6738)

This has been a common footgun for teams, due to calling the factory functions in periodic loops.
This commit is contained in:
Gold856
2024-07-29 10:58:23 -04:00
committed by GitHub
parent 073192d513
commit 3c2bdafd57
21 changed files with 235 additions and 187 deletions

View File

@@ -14,11 +14,11 @@ frc::Joystick& CommandJoystick::GetHID() {
}
Trigger CommandJoystick::Trigger(frc::EventLoop* loop) const {
return m_hid.Trigger(loop).CastTo<class Trigger>();
return Button(frc::Joystick::ButtonType::kTriggerButton, loop);
}
Trigger CommandJoystick::Top(frc::EventLoop* loop) const {
return m_hid.Top(loop).CastTo<class Trigger>();
return Button(frc::Joystick::ButtonType::kTopButton, loop);
}
double CommandJoystick::GetMagnitude() const {