src/main/java/frc/team5431/titan/core/misc/Toggle.java
public void update(boolean pressed) {
        // "^=true" will toggle bool, "^=false" will not.
        // "pressed && !prev_state" checks whether state needs to be changed.
        // Using this over if/else logic allows the JVM to better optimize the logic to
        // CPU instructions.
        toggleState ^= pressed && !prevButtonState;

        this.prevButtonState = pressed;
    }
/**
     * Updates internal state for if toggle has changed
     * 
     * @param pressed raw button data
     */
Updates internal state for if toggle has changed

@param pressed raw button data
Updates internal state for if toggle has changed @param pressed raw button data
public void update(boolean pressed) {
        toggleState ^= pressed && !prevButtonState;
        this.prevButtonState = pressed;
    }
public void update ( boolean pressed ) { toggleState ^= pressed && ! prevButtonState ; this . prevButtonState = pressed ; }
Updates internal state for if toggle has changed
Updates internal state for if toggle has changed
// "^=true" will toggle bool, "^=false" will not. // "pressed && !prev_state" checks whether state needs to be changed. // Using this over if/else logic allows the JVM to better optimize the logic to // CPU instructions.