updated to 1.57
This commit is contained in:
parent
56ab78ac23
commit
62a21398f6
@ -257,6 +257,8 @@ AccelStepper::AccelStepper(void (*forward)(), void (*backward)())
|
|||||||
|
|
||||||
void AccelStepper::setMaxSpeed(float speed)
|
void AccelStepper::setMaxSpeed(float speed)
|
||||||
{
|
{
|
||||||
|
if (speed < 0.0)
|
||||||
|
speed = -speed;
|
||||||
if (_maxSpeed != speed)
|
if (_maxSpeed != speed)
|
||||||
{
|
{
|
||||||
_maxSpeed = speed;
|
_maxSpeed = speed;
|
||||||
@ -279,6 +281,8 @@ void AccelStepper::setAcceleration(float acceleration)
|
|||||||
{
|
{
|
||||||
if (acceleration == 0.0)
|
if (acceleration == 0.0)
|
||||||
return;
|
return;
|
||||||
|
if (acceleration < 0.0)
|
||||||
|
acceleration = -acceleration;
|
||||||
if (_acceleration != acceleration)
|
if (_acceleration != acceleration)
|
||||||
{
|
{
|
||||||
// Recompute _n per Equation 17
|
// Recompute _n per Equation 17
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
/// The latest version of this documentation can be downloaded from
|
/// The latest version of this documentation can be downloaded from
|
||||||
/// http://www.airspayce.com/mikem/arduino/AccelStepper
|
/// http://www.airspayce.com/mikem/arduino/AccelStepper
|
||||||
/// The version of the package that this documentation refers to can be downloaded
|
/// The version of the package that this documentation refers to can be downloaded
|
||||||
/// from http://www.airspayce.com/mikem/arduino/AccelStepper/AccelStepper-1.56.zip
|
/// from http://www.airspayce.com/mikem/arduino/AccelStepper/AccelStepper-1.57.zip
|
||||||
///
|
///
|
||||||
/// Example Arduino programs are included to show the main modes of use.
|
/// Example Arduino programs are included to show the main modes of use.
|
||||||
///
|
///
|
||||||
@ -95,7 +95,7 @@
|
|||||||
/// \par Commercial Licensing
|
/// \par Commercial Licensing
|
||||||
/// This is the appropriate option if you are creating proprietary applications
|
/// This is the appropriate option if you are creating proprietary applications
|
||||||
/// and you are not prepared to distribute and share the source code of your
|
/// and you are not prepared to distribute and share the source code of your
|
||||||
/// application. Purchase commercial licenses at http://airspayce.binpress.com/product/accelstepper/3846
|
/// application. Purchase commercial licenses at http://airspayce.binpress.com/
|
||||||
///
|
///
|
||||||
/// \par Revision History
|
/// \par Revision History
|
||||||
/// \version 1.0 Initial release
|
/// \version 1.0 Initial release
|
||||||
@ -237,6 +237,9 @@
|
|||||||
/// \version 1.56 2017-02-03
|
/// \version 1.56 2017-02-03
|
||||||
/// Fixed minor documentation error with DIRECTION_CCW and DIRECTION_CW. Reported by David Mutterer.
|
/// Fixed minor documentation error with DIRECTION_CCW and DIRECTION_CW. Reported by David Mutterer.
|
||||||
/// Added link to Binpress commercial license purchasing.
|
/// Added link to Binpress commercial license purchasing.
|
||||||
|
/// \version 1.57 2017-03-28
|
||||||
|
/// _direction moved to protected at the request of Rudy Ercek.
|
||||||
|
/// setMaxSpeed() and setAcceleration() now correct negative values to be positive.
|
||||||
///
|
///
|
||||||
/// \author Mike McCauley (mikem@airspayce.com) DO NOT CONTACT THE AUTHOR DIRECTLY: USE THE LISTS
|
/// \author Mike McCauley (mikem@airspayce.com) DO NOT CONTACT THE AUTHOR DIRECTLY: USE THE LISTS
|
||||||
// Copyright (C) 2009-2013 Mike McCauley
|
// Copyright (C) 2009-2013 Mike McCauley
|
||||||
@ -590,6 +593,10 @@ protected:
|
|||||||
/// \param[in] step The current step phase number (0 to 7)
|
/// \param[in] step The current step phase number (0 to 7)
|
||||||
virtual void step8(long step);
|
virtual void step8(long step);
|
||||||
|
|
||||||
|
/// Current direction motor is spinning in
|
||||||
|
/// Protected because some peoples subclasses need it to be so
|
||||||
|
boolean _direction; // 1 == CW
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Number of pins on the stepper motor. Permits 2 or 4. 2 pins is a
|
/// Number of pins on the stepper motor. Permits 2 or 4. 2 pins is a
|
||||||
/// bipolar, and 4 pins is a unipolar.
|
/// bipolar, and 4 pins is a unipolar.
|
||||||
@ -662,9 +669,6 @@ private:
|
|||||||
/// Min step size in microseconds based on maxSpeed
|
/// Min step size in microseconds based on maxSpeed
|
||||||
float _cmin; // at max speed
|
float _cmin; // at max speed
|
||||||
|
|
||||||
/// Current direction motor is spinning in
|
|
||||||
boolean _direction; // 1 == CW
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @example Random.pde
|
/// @example Random.pde
|
||||||
|
Loading…
x
Reference in New Issue
Block a user