diff options
-rw-r--r-- | AFMotor.cpp | 8 | ||||
-rw-r--r-- | examples/StepperTest/StepperTest.pde | 2 |
2 files changed, 3 insertions, 7 deletions
diff --git a/AFMotor.cpp b/AFMotor.cpp index a9fb96f..89c0dc8 100644 --- a/AFMotor.cpp +++ b/AFMotor.cpp @@ -446,16 +446,14 @@ uint8_t AF_Stepper::onestep(uint8_t dir, uint8_t style) { if (! (currentstep/(MICROSTEPS/2) % 2)) { // we're at an even step, weird if (dir == FORWARD) { currentstep += MICROSTEPS/2; - } - else { + } else { currentstep -= MICROSTEPS/2; } } else { // go to the next odd step if (dir == FORWARD) { currentstep += MICROSTEPS; - } - else { - currentstep += MICROSTEPS; + } else { + currentstep -= MICROSTEPS; } } } else if (style == INTERLEAVE) { diff --git a/examples/StepperTest/StepperTest.pde b/examples/StepperTest/StepperTest.pde index 1ed94c5..57d7fd4 100644 --- a/examples/StepperTest/StepperTest.pde +++ b/examples/StepperTest/StepperTest.pde @@ -28,9 +28,7 @@ void loop() { motor.step(100, FORWARD, INTERLEAVE); motor.step(100, BACKWARD, INTERLEAVE); -#ifdef MICROSTEPPING Serial.println("Micrsostep steps"); motor.step(100, FORWARD, MICROSTEP); motor.step(100, BACKWARD, MICROSTEP); -#endif } |