|
How to change command associated with button
We're doing some night-of-regionals programming changes, and one idea we were investigating was swapping the command associated with a button by calling WhenPressed() to replace the command bound to the button. (Our goal was to make one button that advances through a couple different states).
Looking at the WPILib code, it looks like WhenPressed() calls are additive, and it's not possible to replace the command associated with a button. Is that correct?
Our alternate approach is to maintain a state variable and vary the behavior of the associated command based on the state, but it seems less clean than replacing the command.
__________________
2016-17 events: 10000 Lakes Regional, Northern Lights Regional, FTC Burnsville Qualifying Tournament
2011 - present · FRC 3081 Kennedy RoboEagles mentor
2013 - present · event volunteer at 10000 Lakes Regional, Northern Lights Regional, North Star Regional, Lake Superior Regional, Minnesota State Tournament, PNW District 4 Glacier Peak, MN FTC, CMP
http://twitter.com/MrRoboSteve · www.linkedin.com/in/speterson
|