laurb9 / StepperDriver

Arduino library for A4988, DRV8825, DRV8834, DRV8880 and generic two-pin (DIR/STEP) stepper motor drivers
MIT License
557 stars 228 forks source link

Type Casting issue... #87

Closed trlafleur closed 4 years ago

trlafleur commented 4 years ago

This was discovered when we tried to use an RPM of less than zero... In DRV8880.x RPM it's a short, but in BasicStepperDriver.x it's a float...

Changing casting on DRV8880.x from short to float fixes this issue... This bug may be in other drivers.... (looks like other drivers do not re-define begin(), also the prototypes are most likely not needed in the driver as they are defined in: BasicStepperDriver.h)

In DRV8880.h

53    void begin(short rpm=60, short microsteps=1);

In DRV8800.cpp

42   void DRV8880::begin(short rpm, short microsteps){
      BasicStepperDriver::begin(rpm, microsteps);
      setCurrent(100);
     }

In BasicStepperDriver.h

118     void begin(float rpm=60, short microsteps=1);

In BasicStepperDriver.cpp

41      void BasicStepperDriver::begin(float rpm, short microsteps){
laurb9 commented 4 years ago

Thank you for the report. It looks like #40 missed a few places.