diff options
author | Ladyada <limor@ladyada.net> | 2011-01-03 22:52:51 +0300 |
---|---|---|
committer | Ladyada <limor@ladyada.net> | 2011-01-03 22:52:51 +0300 |
commit | 33d0c38f450ad8b6390a5bda4a027eb42a37fefe (patch) | |
tree | a7a9326621c9942b22b9e3b7fd21c430c9c6573a | |
parent | c81be81b85f8e3c2519fbfa88152a9045f98b5b5 (diff) |
fixed DOUBLE backwards steps and took out microstepping comment
-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 } |