Skip to content

Commit

Permalink
Stepper: fixed indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Jun 5, 2015
1 parent 1064554 commit f2a8f51
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions libraries/Stepper/src/Stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f2a8f51

Please sign in to comment.