mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Stepper: fixed indentation
This commit is contained in:
@ -189,26 +189,30 @@ void Stepper::step(int steps_to_move)
|
|||||||
int steps_left = abs(steps_to_move); // how many steps to take
|
int steps_left = abs(steps_to_move); // how many steps to take
|
||||||
|
|
||||||
// determine direction based on whether steps_to_mode is + or -:
|
// determine direction based on whether steps_to_mode is + or -:
|
||||||
if (steps_to_move > 0) {this->direction = 1;}
|
if (steps_to_move > 0) { this->direction = 1; }
|
||||||
if (steps_to_move < 0) {this->direction = 0;}
|
if (steps_to_move < 0) { this->direction = 0; }
|
||||||
|
|
||||||
|
|
||||||
// decrement the number of steps, moving one step each time:
|
// decrement the number of steps, moving one step each time:
|
||||||
while(steps_left > 0) {
|
while (steps_left > 0)
|
||||||
unsigned long now = micros();
|
{
|
||||||
// move only if the appropriate delay has passed:
|
unsigned long now = micros();
|
||||||
if (now - this->last_step_time >= this->step_delay) {
|
// move only if the appropriate delay has passed:
|
||||||
|
if (now - this->last_step_time >= this->step_delay)
|
||||||
|
{
|
||||||
// get the timeStamp of when you stepped:
|
// get the timeStamp of when you stepped:
|
||||||
this->last_step_time = now;
|
this->last_step_time = now;
|
||||||
// increment or decrement the step number,
|
// increment or decrement the step number,
|
||||||
// depending on direction:
|
// depending on direction:
|
||||||
if (this->direction == 1) {
|
if (this->direction == 1)
|
||||||
|
{
|
||||||
this->step_number++;
|
this->step_number++;
|
||||||
if (this->step_number == this->number_of_steps) {
|
if (this->step_number == this->number_of_steps) {
|
||||||
this->step_number = 0;
|
this->step_number = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
if (this->step_number == 0) {
|
if (this->step_number == 0) {
|
||||||
this->step_number = this->number_of_steps;
|
this->step_number = this->number_of_steps;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user