mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user