mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[cmd3] Add rising and falling edge trigger factories (#8366)
`Trigger.getAsBoolean()` behavior has been changed from passing through the underlying boolean supplier to returning the latest cached signal as determined by the most recent call to `poll()`. This allows rising and falling edge triggers to have a consistent return value over an entire polling cycle, rather than only being high for the _first_ check in a cycle. Closes #8309
This commit is contained in:
@@ -30,6 +30,19 @@ public final class EventLoop {
|
||||
m_bindings.add(action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind an action from running when the loop is polled. Has no effect if the given action is not
|
||||
* already bound.
|
||||
*
|
||||
* @param action the action to unbind.
|
||||
*/
|
||||
public void unbind(Runnable action) {
|
||||
if (m_running) {
|
||||
throw new ConcurrentModificationException("Cannot unbind EventLoop while it is running");
|
||||
}
|
||||
m_bindings.remove(action);
|
||||
}
|
||||
|
||||
/** Poll all bindings. */
|
||||
@SuppressWarnings("PMD.UnusedAssignment")
|
||||
public void poll() {
|
||||
|
||||
Reference in New Issue
Block a user