Skip to content

Commit 692ac22

Browse files
committed
changed signature of callback function for target position reached
1 parent 9509f4c commit 692ac22

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/ESP_FlexyStepper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ void ESP_FlexyStepper::registerLimitReachedCallback(callbackFunction limitSwitch
794794
/**
795795
* register a callback function to be called whenever a target position has been reached
796796
*/
797-
void ESP_FlexyStepper::registerTargetPositionReachedCallback(callbackFunction targetPositionReachedCallbackFunction)
797+
void ESP_FlexyStepper::registerTargetPositionReachedCallback(positionCallbackFunction targetPositionReachedCallbackFunction)
798798
{
799799
this->_targetPositionReachedCallback = targetPositionReachedCallbackFunction;
800800
}
@@ -1248,7 +1248,7 @@ bool ESP_FlexyStepper::processMovement(void)
12481248
firstProcessingAfterTargetReached = false;
12491249
if (this->_targetPositionReachedCallback)
12501250
{
1251-
this->_targetPositionReachedCallback();
1251+
this->_targetPositionReachedCallback(currentPosition_InSteps);
12521252
}
12531253
//activate brake since we reached the final position
12541254
if (this->_isBrakeConfigured && !this->_isBrakeActive)

src/ESP_FlexyStepper.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include <stdlib.h>
5050

5151
typedef void (*callbackFunction)(void);
52+
typedef void (*positionCallbackFunction)(long);
5253

5354
class ESP_FlexyStepper
5455
{
@@ -79,7 +80,7 @@ class ESP_FlexyStepper
7980
//register function for callbacks
8081
void registerHomeReachedCallback(callbackFunction homeReachedCallbackFunction);
8182
void registerLimitReachedCallback(callbackFunction limitSwitchTriggerdCallbackFunction);
82-
void registerTargetPositionReachedCallback(callbackFunction targetPositionReachedCallbackFunction);
83+
void registerTargetPositionReachedCallback(positionCallbackFunction targetPositionReachedCallbackFunction);
8384
void registerEmergencyStopTriggeredCallback(callbackFunction emergencyStopTriggerdCallbackFunction);
8485
void registerEmergencyStopReleasedCallback(callbackFunction emergencyStopReleasedCallbackFunction);
8586

@@ -154,7 +155,7 @@ class ESP_FlexyStepper
154155
callbackFunction _limitTriggeredCallback = NULL;
155156
callbackFunction _emergencyStopTriggeredCallback = NULL;
156157
callbackFunction _emergencyStopReleasedCallback = NULL;
157-
callbackFunction _targetPositionReachedCallback = NULL;
158+
positionCallbackFunction _targetPositionReachedCallback = NULL;
158159
callbackFunction _callbackFunctionForGoToLimit = NULL;
159160

160161
static void taskRunner(void *parameter);

0 commit comments

Comments
 (0)