force-stop

jdavis-nodes/fastaccelstepper/force-stop

No description
force-stop
@/force-stop
DEV@/fastaccelstepper-device
DOpulse
force-stop
DEV
DO
DEV'
ACK
ACKpulse
DEV'@/fastaccelstepper-device
To use the node in your project you should have the jdavis-nodes/fastaccelstepper library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD evaluate_on_pin disable
#pragma XOD evaluate_on_pin enable input_DO

node {
    void evaluate(Context ctx) {
        // Only proceed if the DO input is dirty (pulsed)
        if (!isInputDirty<input_DO>(ctx))
            return;
        
        // Get the stepper instance
        auto stepper = getValue<input_DEV>(ctx);

        if (isSettingUp()) {
            // Short-circuit DEV and DEV'
            emitValue<output_DEVU0027>(ctx, stepper);
        }

        // Stop the stepper
        stepper->forceStop();

        // Emit a pulse to indicate the action was successful
        emitValue<output_ACK>(ctx, 1);
    }
}