TeamCode/src/main/java/org/commandftc/Trigger.java
public Trigger cancelWhenActive(final Command command) {
        Objects.requireNonNull(command);
        CommandScheduler.addButton(new Runnable() {
            private boolean lastPressed = get();

            @Override
            public void run() {
                boolean nowPressed = get();
                if (!lastPressed && nowPressed) {
                    CommandScheduler.unscheduleCommand(command);
                }
                lastPressed = nowPressed;
            }
        });
        return this;
    }
/**
     * When the trigger is active from unactive, unschedule a given command.
     * @param command
     * @return this trigger so it can be chained.
     */
When the trigger is active from unactive, unschedule a given command.
@param command
@return this trigger so it can be chained.
When the trigger is active from unactive unschedule a given command . @param command @return this trigger so it can be chained .
public Trigger cancelWhenActive(final Command command) {
        Objects.requireNonNull(command);
        CommandScheduler.addButton(new Runnable() {
            private boolean lastPressed = get();
            @Override
            public void run() {
                boolean nowPressed = get();
                if (!lastPressed && nowPressed) {
                    CommandScheduler.unscheduleCommand(command);
                }
                lastPressed = nowPressed;
            }
        });
        return this;
    }
public Trigger cancelWhenActive ( final Command command ) { Objects . requireNonNull ( command ) ; CommandScheduler . addButton ( new Runnable ( ) { private boolean lastPressed = get ( ) ; @ Override public void run ( ) { boolean nowPressed = get ( ) ; if ( ! lastPressed && nowPressed ) { CommandScheduler . unscheduleCommand ( command ) ; } lastPressed = nowPressed ; } } ) ; return this ; }
When the trigger is active from unactive, unschedule a given command.
When the trigger is active from unactive unschedule a given command .