@@ -18,7 +18,8 @@ _______________________________________________________________________________
1818
1919REVISION HISTORY
2020
21- version 1.0 Initial release
21+ version 1.0.0 initial release
22+ version 1.0.1 various cleanups / style fixes (thank you: Florian Uekermann)
2223
2324_______________________________________________________________________________
2425
@@ -50,7 +51,7 @@ class SmoothStepper {
5051 void setInvertDirection (bool invert);
5152
5253 // set the number of steps per revolution
53- void setStepsPerRev (unsigned long stepsPerRev);
54+ void setStepsPerRev (uint32_t stepsPerRev);
5455
5556 // set the acceleration (steps / s^2)
5657 void setAcceleration (float acceleration);
@@ -59,7 +60,7 @@ class SmoothStepper {
5960 void setMaxSpeed (float maxSpeed);
6061
6162 // set the duration of step pulses (µs)
62- void setPulseWidth (unsigned int pulseWidth);
63+ void setPulseWidth (uint16_t pulseWidth);
6364
6465 // enables the stepper motor driver (via _pinEnable)
6566 void enableDriver ();
@@ -68,24 +69,24 @@ class SmoothStepper {
6869 void disableDriver ();
6970
7071 // move by n steps
71- void moveSteps (long nSteps);
72+ void moveSteps (int32_t nSteps);
7273
7374 // move by n degrees
7475 void moveDegrees (float degrees);
7576
76-
77+
7778 private:
7879 void step (); // step function
79- uint8_t _pinStep; // pin number: step
80+ bool _invertDirection = false ; // invert the direction pin?
81+ bool _invertEnable = false ; // invert the enable pin?
8082 uint8_t _pinDirection; // pin number: direction
8183 uint8_t _pinEnable; // pin number: enable
84+ uint8_t _pinStep; // pin number: step
85+ uint16_t _pulseWidth = 1 ; // duration of step pulses (µs)
86+ uint32_t _stepsPerRev = 200 ; // steps per revolution
8287 float _a; // acceleration (steps / s^2)
8388 float _vMax; // maximum speed (steps / s)
8489 float _c0; // duration of first interval (µs)
85- unsigned int _pulseWidth = 1 ; // duration of step pulses (µs)
86- unsigned long _stepsPerRev = 200 ; // steps per revolution
87- bool _invertEnable = false ; // invert the enable pin?
88- bool _invertDirection = false ; // invert the direction pin?
8990};
9091
9192#endif
0 commit comments