Skip to content

Commit

Permalink
updated to 1.57
Browse files Browse the repository at this point in the history
  • Loading branch information
waspinator committed Apr 11, 2017
1 parent 56ab78a commit 62a2139
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/AccelStepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ AccelStepper::AccelStepper(void (*forward)(), void (*backward)())

void AccelStepper::setMaxSpeed(float speed)
{
if (speed < 0.0)
speed = -speed;
if (_maxSpeed != speed)
{
_maxSpeed = speed;
Expand All @@ -279,6 +281,8 @@ void AccelStepper::setAcceleration(float acceleration)
{
if (acceleration == 0.0)
return;
if (acceleration < 0.0)
acceleration = -acceleration;
if (_acceleration != acceleration)
{
// Recompute _n per Equation 17
Expand Down
14 changes: 9 additions & 5 deletions src/AccelStepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/// The latest version of this documentation can be downloaded from
/// http://www.airspayce.com/mikem/arduino/AccelStepper
/// 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.
///
Expand Down Expand Up @@ -95,7 +95,7 @@
/// \par Commercial Licensing
/// 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
/// application. Purchase commercial licenses at http://airspayce.binpress.com/product/accelstepper/3846
/// application. Purchase commercial licenses at http://airspayce.binpress.com/
///
/// \par Revision History
/// \version 1.0 Initial release
Expand Down Expand Up @@ -237,6 +237,9 @@
/// \version 1.56 2017-02-03
/// Fixed minor documentation error with DIRECTION_CCW and DIRECTION_CW. Reported by David Mutterer.
/// 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 ([email protected]) DO NOT CONTACT THE AUTHOR DIRECTLY: USE THE LISTS
// Copyright (C) 2009-2013 Mike McCauley
Expand Down Expand Up @@ -590,6 +593,10 @@ class AccelStepper
/// \param[in] step The current step phase number (0 to 7)
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:
/// Number of pins on the stepper motor. Permits 2 or 4. 2 pins is a
/// bipolar, and 4 pins is a unipolar.
Expand Down Expand Up @@ -662,9 +669,6 @@ class AccelStepper
/// Min step size in microseconds based on maxSpeed
float _cmin; // at max speed

/// Current direction motor is spinning in
boolean _direction; // 1 == CW

};

/// @example Random.pde
Expand Down

0 comments on commit 62a2139

Please sign in to comment.