Stepper: fixed indentation

This commit is contained in:
Cristian Maglie 2015-05-28 10:53:56 +02:00
parent 1064554b87
commit f2a8f517f0
1 changed files with 12 additions and 8 deletions

View File

@ -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;
}