We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0546bf0 commit 1064554Copy full SHA for 1064554
libraries/Stepper/src/Stepper.cpp
@@ -195,10 +195,11 @@ void Stepper::step(int steps_to_move)
195
196
// decrement the number of steps, moving one step each time:
197
while(steps_left > 0) {
198
+ unsigned long now = micros();
199
// move only if the appropriate delay has passed:
- if (micros() - this->last_step_time >= this->step_delay || micros() < this->last_step_time) {
200
+ if (now - this->last_step_time >= this->step_delay) {
201
// get the timeStamp of when you stepped:
- this->last_step_time = micros();
202
+ this->last_step_time = now;
203
// increment or decrement the step number,
204
// depending on direction:
205
if (this->direction == 1) {
0 commit comments