From 8472b9f7d7a9e5bc1ca23a330240e930681f7265 Mon Sep 17 00:00:00 2001 From: Paul Kerspe Date: Fri, 30 Jun 2023 13:30:28 +0200 Subject: [PATCH] Update readme and remove duplicat functions --- README.md | 3 ++- src/ESP_FlexyStepper.cpp | 11 +---------- src/ESP_FlexyStepper.h | 1 - 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index e9eace6..8ce09d7 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,6 @@ void loop() | `float getCurrentVelocityInMillimetersPerSecond(void)` | return the current velocity as floating point number in millimeters/Second. *Note: make sure you configured the stepper correctly using the `setStepsPerMillimeter` function before calling this function, otherwise the result might be incorrect!* | | `void setCurrentPositionInSteps(long currentPositionInSteps)` | set the register for the current position to a specific value e.g. to mark the home position. NOTE: if you called one of the move functions before (and by that setting a target position internally) you might experience that the motor starts to move after calling setCurrentPositionInSteps(currentPositionInSteps) in the case that the value of currentPositionInSteps is different from the target position of the stepper. If this is not intended, you should call setTargetPositionInSteps() with the same value as the setCurrentPositionInSteps() function directly before or after calling setCurrentPositionInSteps | | `void setCurrentPositionAsHomeAndStop(void)` | set the current position of the stepper as the home position. This also sets the current position to 0. After performing this step you can always return to the home position by calling `setTargetPoisitionInSteps(0)`(or for blocking calls `moveToPositionInSteps(0)`) | -| `void setCurrentPositionInSteps(long currentPositionInSteps)` | 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 | | `long getCurrentPositionInSteps()` | return the current position of the stepper in steps (absolute value, could also be negative if no proper homing has been performed before) | | `bool moveToHomeInSteps(signed char directionTowardHome, float speedInStepsPerSecond, long maxDistanceToMoveInSteps, int homeSwitchPin)` | *Blocking call:* start movement in the given direction with a maximum number of steps or until the IO Pin defined by homeSwitchPin is going low (active low switch is required, since the library will configure this pin as input with internal pull-up in the current version). This is a blocking function, it will not return before the final position has been reached.| | `void moveRelativeInSteps(long distanceToMoveInSteps)` | *Blocking call:* start movement to the given relative position from current position. This is a blocking function, it will not return before the final position has been reached. | @@ -156,3 +155,5 @@ void loop() | `bool isMovingTowardsHome(void)` | true if the stepper is still on the way to the home position | | `static void taskRunner(void *parameter)` | this is the function that is used as the service, you do not need to call this manually ever | | `getTaskStackHighWaterMark(void)` | this is used for debugging to see if the allocated stack trace of the task / service function is large enough. You can ignore this function | +| `void startJogging(signed char direction)` | start jogging (continuous movement without a fixed target position). Uses the currently set speed and acceleration settings. To stop the motion call the stopJogging function. Will also stop when the external limit switch has been triggered using setLimitSwitchActive() or when the emergencyStop function is triggered. Warning: This function requires either a limit switch to be configured or manual trigger of the stopJogging/etTargetPositionToStop or emergencyStop function, otherwise the motor will never stop jogging (which could of course also be an intended behavior) | +| `void stopJogging()` | Stop jogging, basically an alias function for setTargetPositionToStop() | \ No newline at end of file diff --git a/src/ESP_FlexyStepper.cpp b/src/ESP_FlexyStepper.cpp index 5b0fb1d..05504cb 100644 --- a/src/ESP_FlexyStepper.cpp +++ b/src/ESP_FlexyStepper.cpp @@ -799,15 +799,6 @@ 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. @@ -886,7 +877,7 @@ void ESP_FlexyStepper::registerEmergencyStopReleasedCallback(callbackFunction em * uses the currently set speed and acceleration settings * to stop the motion call the stopJogging function. * Will also stop when the external limit switch has been triggered using setLimitSwitchActive() or when the emergencyStop function is triggered - * Warning: This function requires either a limit switch to be configured otherwise or manual trigger of the stopJogging/setTargetPositionToStop or emergencyStop function, the motor will never stop jogging + * Warning: This function requires either a limit switch to be configured or manual trigger of the stopJogging/setTargetPositionToStop or emergencyStop function, otherwise the motor will never stop jogging (which could of course also be an intended behavior) */ void ESP_FlexyStepper::startJogging(signed char direction) { diff --git a/src/ESP_FlexyStepper.h b/src/ESP_FlexyStepper.h index 53cffa0..ed507f7 100644 --- a/src/ESP_FlexyStepper.h +++ b/src/ESP_FlexyStepper.h @@ -122,7 +122,6 @@ class ESP_FlexyStepper void setCurrentPositionAsHomeAndStop(void); void setTargetPositionToStop(); long getDistanceToTargetSigned(void); - void setCurrentPositionInSteps(long currentPositionInSteps); void setTargetPositionInSteps(long absolutePositionToMoveToInSteps); void setTargetPositionInMillimeters(float absolutePositionToMoveToInMillimeters);