setcurrentposition

ivanmason/accelstepper/setcurrentposition

Resets the current position of the motor, so that wherever the motor happens to be right now is considered to be the new 0 position. Useful for setting a zero position on a stepper after an initial hardware positioning move. Has the side effect of setting the current motor speed to 0.
setcurrentposition
@/setcurrentposition
Resets the current position of the motor, so that wherever the motor happens to be right now is considered to be the new 0 position. Useful for setting a zero position on a stepper after an initial hardware positioning move. Has the side effect of setting the current motor speed to 0.
DEV@/accelstepper-device
Positionnumber
The position in steps of wherever the motor happens to be right now.
UPDpulse
setcurrentposition
DEV
Position
UPD
DONE
DONEpulse
To use the node in your project you should have the ivanmason/accelstepper 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

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
     if (!isInputDirty<input_UPD>(ctx))
        return;

    auto stepper = getValue<input_DEV>(ctx);
    long position = getValue<input_position>(ctx);
    stepper->setCurrentPosition(position);

    emitValue<output_DONE>(ctx, 1);
}