Skip to content

Commit

Permalink
Update readme and remove duplicat functions
Browse files Browse the repository at this point in the history
  • Loading branch information
pkerspe committed Jun 30, 2023
1 parent 28dc01d commit 8472b9f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand All @@ -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() |
11 changes: 1 addition & 10 deletions src/ESP_FlexyStepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
{
Expand Down
1 change: 0 additions & 1 deletion src/ESP_FlexyStepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8472b9f

Please sign in to comment.