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:
@@ -13,7 +13,7 @@ frc::GenericHID& CommandGenericHID::GetHID() {
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::Button(int button, frc::EventLoop* loop) const {
|
||||
return m_hid.Button(button, loop).CastTo<Trigger>();
|
||||
return Trigger(loop, [this, button] { return m_hid.GetRawButton(button); });
|
||||
}
|
||||
|
||||
Trigger CommandGenericHID::POV(int angle, frc::EventLoop* loop) const {
|
||||
|
||||
Reference in New Issue
Block a user