gin66 / FastAccelStepper

A high speed stepper library for Atmega 168/328p (nano), Atmega32u4, Atmega 2560, ESP32, ESP32S2, ESP32S3, ESP32C3, ESP32C6 and Atmel SAM Due
MIT License
311 stars 71 forks source link

Deceleration in applySpeedAcceleration() don't work. #23

Closed FP2K-Minske closed 3 years ago

FP2K-Minske commented 3 years ago

I'm working with a potentiometer, setSpeed and applySpeedAcceleration. While the acceleration works perfect (by adding speed), there isn't an existing deceleration when decreasing the speed. It's jerky and jumpy getting slower. With the methods "runForward" and "runBackward" it decelerates perfectly. Is it meant to be like that or isn't it implemented yet?

gin66 commented 3 years ago

speed changes are applied in a similar way to runForward()/runBackward() and move/moveTo(). So there should be no difference and jerky/jumpy getting slower should not happen.

Questions back:

Today evening I can check on my hw.

gin66 commented 3 years ago

btw: which values or range for v do you use ?

FP2K-Minske commented 3 years ago

I forgot something important to say: I'm using runForward(); and runBackward();, since I need continuous movement.

Like I said, the acceleration works flawlessly with that setup, but the deceleration isn't existing.

Thank you for the fast support.

gin66 commented 3 years ago

Have tried on my setup and can confirm this bug. After further investigation have found out, that this is related to the ramp generator and similarly impacting esp32.

The fix is implemented in 0.16.3

My test suite did not catch it, because only speed increase while running has been checked. => Now I have added a test case for speed deceleration while running.

My manual testing for release 0.16.1 and 0.16.2 has not identified the issue, because my build system is not reliable for changes in library code and used old, still working code. => Now the pio_dirs build system avoids use of symbolic links to refer to the library code. Similarly the tests build system with Makefile avoids symbolic links, too. Hope this way, pio run and make correctly build related object files on library file changes.

FP2K-Minske commented 3 years ago

Works perfect, thank you!