theelims / StrokeEngine

A library to create a variety of stroking motions with a stepper or servo motor on an ESP32.
MIT License
30 stars 13 forks source link

Implement a way of setting up the depth live #1

Closed theelims closed 3 years ago

theelims commented 3 years ago

Right now the lib has no feature to set up the depth and get a live feedback. It can only go full in or full out. However, it would be desirable to have it follow the depth setting to find an optimal position before starting the stroking.

theelims commented 3 years ago

In a special setup mode it will always follow the Depth position. By envoking Stroker.setupDepth(); it will start to follow the depth position whenever Stroker.setDepth(float); is updated. Takes the speed in mm/s as an argument: e.g. Stroker.setupDepth(10.0); Speed defaults to 10 mm/s. With float Stroker.getDepth() one may obtain the current set depth to calculate incremental updates for Stroker.setDepth(float). Can be called from states SERVO_RUNNING and SERVO_READY and stops any current motion. Returns false if called in a wrong state.