diff --git a/src/BasicStepperDriver.cpp b/src/BasicStepperDriver.cpp index 1380528..e437484 100644 --- a/src/BasicStepperDriver.cpp +++ b/src/BasicStepperDriver.cpp @@ -82,7 +82,7 @@ void BasicStepperDriver::setDirection(int direction){ * Move the motor a given number of steps. * positive to move forward, negative to reverse */ -int BasicStepperDriver::move(long steps){ +void BasicStepperDriver::move(long steps){ if (steps >= 0){ setDirection(1); } else { @@ -106,18 +106,18 @@ int BasicStepperDriver::move(long steps){ /* * Move the motor a given number of degrees (1-360) */ -int BasicStepperDriver::rotate(long deg){ +void BasicStepperDriver::rotate(long deg){ long steps = deg * motor_steps * (long)microsteps / 360; - return move(steps); + move(steps); } /* * Move the motor with sub-degree precision. * Note that using this function even once will add 1K to your program size * due to inclusion of float support. */ -int BasicStepperDriver::rotate(double deg){ +void BasicStepperDriver::rotate(double deg){ long steps = deg * motor_steps * microsteps / 360; - return move(steps); + move(steps); } /* diff --git a/src/BasicStepperDriver.h b/src/BasicStepperDriver.h index a2b1aa9..8f9c6bd 100644 --- a/src/BasicStepperDriver.h +++ b/src/BasicStepperDriver.h @@ -79,15 +79,18 @@ class BasicStepperDriver { * Move the motor a given number of steps. * positive to move forward, negative to reverse */ - int move(long steps); + void move(long steps); /* * Rotate the motor a given number of degrees (1-360) */ - int rotate(long deg); + void rotate(long deg); + inline void rotate(int deg){ + rotate((long)deg); + }; /* * Rotate using a float or double for increased movement precision. */ - int rotate(double deg); + void rotate(double deg); /* * Set target motor RPM (1-200 is a reasonable range) */