mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-19 13:54:23 +01:00
Stepper: fixed indentation
This commit is contained in:
parent
1064554b87
commit
f2a8f517f0
@ -189,26 +189,30 @@ void Stepper::step(int steps_to_move)
|
||||
int steps_left = abs(steps_to_move); // how many steps to take
|
||||
|
||||
// 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 = 0;}
|
||||
if (steps_to_move > 0) { this->direction = 1; }
|
||||
if (steps_to_move < 0) { this->direction = 0; }
|
||||
|
||||
|
||||
// decrement the number of steps, moving one step each time:
|
||||
while(steps_left > 0) {
|
||||
unsigned long now = micros();
|
||||
// move only if the appropriate delay has passed:
|
||||
if (now - this->last_step_time >= this->step_delay) {
|
||||
while (steps_left > 0)
|
||||
{
|
||||
unsigned long now = micros();
|
||||
// move only if the appropriate delay has passed:
|
||||
if (now - this->last_step_time >= this->step_delay)
|
||||
{
|
||||
// get the timeStamp of when you stepped:
|
||||
this->last_step_time = now;
|
||||
// increment or decrement the step number,
|
||||
// depending on direction:
|
||||
if (this->direction == 1) {
|
||||
if (this->direction == 1)
|
||||
{
|
||||
this->step_number++;
|
||||
if (this->step_number == this->number_of_steps) {
|
||||
this->step_number = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
if (this->step_number == 0) {
|
||||
this->step_number = this->number_of_steps;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user