[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:
Sam Carlberg
2026-05-07 19:32:34 -04:00
committed by GitHub
parent 5964443038
commit 62e0bc515c
6 changed files with 546 additions and 28 deletions

View File

@@ -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() {