Skip to content

Commit

Permalink
add function to reset internal position counter to extend jogging dur…
Browse files Browse the repository at this point in the history
…ation #16
  • Loading branch information
pkerspe committed Jun 30, 2023
1 parent 940316a commit 612c2a7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 9 additions & 0 deletions src/ESP_FlexyStepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/ESP_FlexyStepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 612c2a7

Please sign in to comment.