FlexyStepper: set current position leads to reach the old target I'm using the FlexyStepper library.Unfortunately there's no way to write an issue to the author so I'm going to ask my question here.

The documentation says about the setCurrentPosition*() functions:


  set current position of the motor in millimeter, this does not move the motor


But I see a different behavior.
Looking at the code, it seems it just update the current position, leaving unchanged the target position. This leads to an expected movement of the motor. Example:


set the target position to, say: 1000
the motor reach that position
set the current position to, say: 1500
now the motor come back to 1000


Instead, I want the current position from now is 1500, but because it has already reached the target, it shouldn't move further.

Of course a workaround is to set both current position and target to the same value.

I wonder if I'm wrong about the documentation or this might be considered a bug.
The point of setCurrentPosition() is to calibrate the stepper. It would normally be used in association with a limit switch of some form.

If you set the motor to go to 1000 and then tell it that the motor is actually at 1500 then of course it will then try and go back to 1000 - you have told it that is where you want it, but you also told it that's not where it is.

The normal usage would be:


Step the motor constantly in one direction until it hits a limit switch or similar
Set the current position to whatever that actual position is
Start going to actual positions that are relative to that reference point.


For example


Move the motor anti-clockwise
Motor triggers limit switch
Stop moving the motor
Set the current position to 0
Start using the motor normally