diff --git a/library.json b/library.json index 1c9270c..2ff1fc2 100644 --- a/library.json +++ b/library.json @@ -10,7 +10,7 @@ "type": "git", "url": "https://github.com/pkerspe/ESP-FlexyStepper.git" }, - "version": "1.4.8", + "version": "1.4.9", "license": "MIT", "frameworks": "arduino", "platforms": [ diff --git a/library.properties b/library.properties index 9a5b615..5ebde25 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ESP-FlexyStepper -version=1.4.8 +version=1.4.9 author=Paul Kerspe maintainer=Paul Kerspe sentence=This library is used to control one or more stepper motors from an ESP32 device diff --git a/src/ESP_FlexyStepper.cpp b/src/ESP_FlexyStepper.cpp index bdbb0d6..5b0fb1d 100644 --- a/src/ESP_FlexyStepper.cpp +++ b/src/ESP_FlexyStepper.cpp @@ -799,6 +799,15 @@ void ESP_FlexyStepper::setCurrentPositionAsHomeAndStop() this->isCurrentlyHomed = true; } +/** + * set the current position counter to a defined value + * Can be used to resetting the position counter or setting it to a specific value for calibration etc. + * Use setCurrentPositionAsHomeAndStop instead if you want to set a real home position value +*/ +void setCurrentPositionInSteps(long currentPositionInSteps){ + this->currentPosition_InSteps = currentPositionInSteps; +} + /** * start jogging in the direction of home (use setDirectionToHome() to set the proper direction) until the limit switch is hit, then set the position as home * Warning: This function requires a limit switch to be configured otherwise the motor will never stop jogging. diff --git a/src/ESP_FlexyStepper.h b/src/ESP_FlexyStepper.h index ed507f7..53cffa0 100644 --- a/src/ESP_FlexyStepper.h +++ b/src/ESP_FlexyStepper.h @@ -122,6 +122,7 @@ class ESP_FlexyStepper void setCurrentPositionAsHomeAndStop(void); void setTargetPositionToStop(); long getDistanceToTargetSigned(void); + void setCurrentPositionInSteps(long currentPositionInSteps); void setTargetPositionInSteps(long absolutePositionToMoveToInSteps); void setTargetPositionInMillimeters(float absolutePositionToMoveToInMillimeters);