From a9bf2f93bffff950469485c8a91c6e8709bba444 Mon Sep 17 00:00:00 2001 From: waspinator Date: Tue, 25 Aug 2020 17:07:01 -0400 Subject: [PATCH] update to 1.61 2020-04-20 - Release under GPL V3 (1.60) - Added yield() call in runToPosition(), so that platforms like esp8266 dont hang/crash during long runs. --- LICENSE | 6 ++--- extras/doc/classAccelStepper.html | 16 +++++++----- extras/doc/index.html | 14 ++++++---- extras/doc/tabs.css | 2 +- library.properties | 2 +- src/AccelStepper.cpp | 4 +-- src/AccelStepper.h | 43 +++++++++++++++++++++---------- src/MultiStepper.cpp | 15 ++++++++++- 8 files changed, 68 insertions(+), 34 deletions(-) diff --git a/LICENSE b/LICENSE index da124e1..814fc7b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,13 +1,13 @@ This software is Copyright (C) 2008 Mike McCauley. Use is subject to license -conditions. The main licensing options available are GPL V2 or Commercial: +conditions. The main licensing options available are GPL V3 or Commercial: -Open Source Licensing GPL V2 +Open Source Licensing GPL V3 This is the appropriate option if you want to share the source code of your application with everyone you distribute it to, and you also want to give them the right to share who uses it. If you wish to use this software under Open Source Licensing, you must contribute all your source code to the open source -community in accordance with the GPL Version 2 when your application is +community in accordance with the GPL Version 3 when your application is distributed. See http://www.gnu.org/copyleft/gpl.html Commercial Licensing diff --git a/extras/doc/classAccelStepper.html b/extras/doc/classAccelStepper.html index 9333f00..a45161a 100644 --- a/extras/doc/classAccelStepper.html +++ b/extras/doc/classAccelStepper.html @@ -284,7 +284,7 @@

Constructor. You can have multiple simultaneous steppers, all moving at different speeds and accelerations, provided you call their run() functions at frequent enough intervals. Current Position is set to 0, target position is set to 0. MaxSpeed and Acceleration default to 1.0. The motor pins will be initialised to OUTPUT mode during the constructor by a call to enableOutputs().

Parameters
- + @@ -385,7 +385,7 @@

-

The currently motor position.

Returns
the current motor position in steps. Positive is clockwise from the 0 position.
+

The current motor position.

Returns
the current motor position in steps. Positive is clockwise from the 0 position.

Referenced by MultiStepper::moveTo().

@@ -501,7 +501,7 @@

-

returns the maximum speed configured for this stepper that was previously set by setMaxSpeed();

Returns
The currently configured maximum speed
+

Returns the maximum speed configured for this stepper that was previously set by setMaxSpeed();

Returns
The currently configured maximum speed

Referenced by MultiStepper::moveTo().

@@ -522,7 +522,7 @@

-

Set the target position relative to the current position

Parameters
+

Set the target position relative to the current position.

Parameters

[in]interfaceNumber of pins to interface to. Integer values are supported, but it is preferred to use the MotorInterfaceType symbolic names. AccelStepper::DRIVER (1) means a stepper driver (with Step and Direction pins). If an enable line is also needed, call setEnablePin() after construction. You may also invert the pins using setPinsInverted(). AccelStepper::FULL2WIRE (2) means a 2 wire stepper (2 pins required). AccelStepper::FULL3WIRE (3) means a 3 wire stepper, such as HDD spindle (3 pins required). AccelStepper::FULL4WIRE (4) means a 4 wire stepper (4 pins required). AccelStepper::HALF3WIRE (6) means a 3 wire half stepper, such as HDD spindle (3 pins required) AccelStepper::HALF4WIRE (8) means a 4 wire half stepper (4 pins required) Defaults to AccelStepper::FULL4WIRE (4) pins.
[in]interfaceNumber of pins to interface to. Integer values are supported, but it is preferred to use the MotorInterfaceType symbolic names. AccelStepper::DRIVER (1) means a stepper driver (with Step and Direction pins). If an enable line is also needed, call setEnablePin() after construction. You may also invert the pins using setPinsInverted(). Caution: DRIVER implements a blocking delay of minPulseWidth microseconds (default 1us) for each step. You can change this with setMinPulseWidth(). AccelStepper::FULL2WIRE (2) means a 2 wire stepper (2 pins required). AccelStepper::FULL3WIRE (3) means a 3 wire stepper, such as HDD spindle (3 pins required). AccelStepper::FULL4WIRE (4) means a 4 wire stepper (4 pins required). AccelStepper::HALF3WIRE (6) means a 3 wire half stepper, such as HDD spindle (3 pins required) AccelStepper::HALF4WIRE (8) means a 4 wire half stepper (4 pins required) Defaults to AccelStepper::FULL4WIRE (4) pins.
[in]pin1Arduino digital pin number for motor pin 1. Defaults to pin 2. For a AccelStepper::DRIVER (interface==1), this is the Step input to the driver. Low to high transition means to step)
[in]pin2Arduino digital pin number for motor pin 2. Defaults to pin 3. For a AccelStepper::DRIVER (interface==1), this is the Direction input the driver. High means forward.
[in]pin3Arduino digital pin number for motor pin 3. Defaults to pin 4.
[in]relativeThe desired position relative to the current position. Negative is anticlockwise from the current position.
@@ -577,7 +577,7 @@

-

Poll the motor and step it if a step is due, implementing accelerations and decelerations to acheive the target position. You must call this as frequently as possible, but at least once per minimum step time interval, preferably in your main loop. Note that each call to run() will make at most one step, and then only when a step is due, based on the current speed and the time since the last step.

Returns
true if the motor is still running to the target position.
+

Poll the motor and step it if a step is due, implementing accelerations and decelerations to achieve the target position. You must call this as frequently as possible, but at least once per minimum step time interval, preferably in your main loop. Note that each call to run() will make at most one step, and then only when a step is due, based on the current speed and the time since the last step.

Returns
true if the motor is still running to the target position.

References computeNewSpeed(), distanceToGo(), and runSpeed().

@@ -621,7 +621,7 @@

-

Runs at the currently selected speed until the target position is reached Does not implement accelerations.

Returns
true if it stepped
+

Runs at the currently selected speed until the target position is reached. Does not implement accelerations.

Returns
true if it stepped

References _direction, DIRECTION_CCW, DIRECTION_CW, and runSpeed().

@@ -725,6 +725,8 @@

Referenced by MultiStepper::run().

+ @@ -973,7 +975,7 @@

-

The most recently set speed

Returns
the most recent speed in steps per second
+

The most recently set speed.

Returns
the most recent speed in steps per second

Referenced by setMaxSpeed(), and setSpeed().

diff --git a/extras/doc/index.html b/extras/doc/index.html index 7a606ac..f795f01 100644 --- a/extras/doc/index.html +++ b/extras/doc/index.html @@ -46,7 +46,7 @@

AccelStepper significantly improves on the standard Arduino Stepper library in several ways:

  • Supports acceleration and deceleration
  • Supports multiple simultaneous steppers, with independent concurrent stepping on each stepper
  • -
  • API functions never delay() or block
  • +
  • Most API functions never delay() or block (unless otherwise stated)
  • Supports 2, 3 and 4 wire steppers, plus 3 and 4 wire half steppers.
  • Supports alternate stepping functions to enable support of AFMotor (https://github.com/adafruit/Adafruit-Motor-Shield-library)
  • Supports stepper drivers such as the Sparkfun EasyDriver (based on 3967 driver chip)
  • @@ -54,7 +54,7 @@
  • Extensive API
  • Subclass support
-

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.59.zip

+

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.61.zip

Example Arduino programs are included to show the main modes of use.

You can also find online help and discussion at http://groups.google.com/group/accelstepper Please use that group for all questions and discussions on this topic. Do not contact the author directly, unless it is to discuss commercial licensing. Before asking a question or reporting a bug, please read

  • http://en.wikipedia.org/wiki/Wikipedia:Reference_desk/How_to_ask_a_software_question
  • @@ -74,8 +74,8 @@
    Trademarks

    AccelStepper is a trademark of AirSpayce Pty Ltd. The AccelStepper mark was first used on April 26 2010 for international trade, and is used only in relation to motor control hardware and software. It is not to be confused with any other similar marks covering other goods and services.

    Copyright
    -

    This software is Copyright (C) 2010-2018 Mike McCauley. Use is subject to license conditions. The main licensing options available are GPL V2 or Commercial:

    -
    Open Source Licensing GPL V2
    This is the appropriate option if you want to share the source code of your application with everyone you distribute it to, and you also want to give them the right to share who uses it. If you wish to use this software under Open Source Licensing, you must contribute all your source code to the open source community in accordance with the GPL Version 2 when your application is distributed. See https://www.gnu.org/licenses/gpl-2.0.html
    +

    This software is Copyright (C) 2010-2018 Mike McCauley. Use is subject to license conditions. The main licensing options available are GPL V3 or Commercial:

    +
    Open Source Licensing GPL V3
    This is the appropriate option if you want to share the source code of your application with everyone you distribute it to, and you also want to give them the right to share who uses it. If you wish to use this software under Open Source Licensing, you must contribute all your source code to the open source community in accordance with the GPL Version 23 when your application is distributed. See https://www.gnu.org/licenses/gpl-3.0.html
    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. To purchase a commercial license, contact info@.nosp@m.airs.nosp@m.payce.nosp@m..com
    Revision History
    Version
    1.0 Initial release
    @@ -209,7 +209,11 @@
    1.58 2018-04-13 Add initialisation for _enableInverted in constructor.
    -1.59 2018-08-28 Update commercial licensing, remove binpress.
    +1.59 2018-08-28 Update commercial licensing, remove binpress.

+
+1.60 2020-03-07 Release under GPL V3
+
+1.61 2020-04-20 Added yield() call in runToPosition(), so that platforms like esp8266 dont hang/crash during long runs.
Author
Mike McCauley (mikem.nosp@m.@air.nosp@m.spayc.nosp@m.e.co.nosp@m.m) DO NOT CONTACT THE AUTHOR DIRECTLY: USE THE LISTS
diff --git a/extras/doc/tabs.css b/extras/doc/tabs.css index bbde11e..7d45d36 100644 --- a/extras/doc/tabs.css +++ b/extras/doc/tabs.css @@ -1 +1 @@ -.sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:transparent}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0px/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.sm-dox{background-image:url("tab_b.png")}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0px 12px;padding-right:43px;font-family:"Lucida Grande","Geneva","Helvetica",Arial,sans-serif;font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:0px 1px 1px rgba(255,255,255,0.9);color:#283A5D;outline:none}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox a.current{color:#D23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace !important;text-align:center;text-shadow:none;background:rgba(255,255,255,0.5);border-radius:5px}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{border-radius:0}.sm-dox ul{background:rgba(162,162,162,0.1)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:white;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media (min-width: 768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:url("tab_b.png");line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:#283A5D transparent transparent transparent;background:transparent;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0px 12px;background-image:url("tab_s.png");background-repeat:no-repeat;background-position:right;border-radius:0 !important}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox a:hover span.sub-arrow{border-color:#fff transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent #fff transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:#fff;border-radius:5px !important;box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent #555;border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:#555;background-image:none;border:0 !important;color:#555;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent #fff}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:#fff;height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #D23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#D23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent #555 transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:#555 transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px !important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:url("tab_b.png")}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:#fff}} +.sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0)}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0px/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.sm-dox{background-image:url("tab_b.png")}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0px 12px;padding-right:43px;font-family:"Lucida Grande","Geneva","Helvetica",Arial,sans-serif;font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:0px 1px 1px rgba(255,255,255,0.9);color:#283A5D;outline:none}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox a.current{color:#D23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace !important;text-align:center;text-shadow:none;background:rgba(255,255,255,0.5);border-radius:5px}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{border-radius:0}.sm-dox ul{background:rgba(162,162,162,0.1)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:white;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media (min-width: 768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:url("tab_b.png");line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:#283A5D transparent transparent transparent;background:transparent;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0px 12px;background-image:url("tab_s.png");background-repeat:no-repeat;background-position:right;border-radius:0 !important}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox a:hover span.sub-arrow{border-color:#fff transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent #fff transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:#fff;border-radius:5px !important;box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent #555;border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:#555;background-image:none;border:0 !important;color:#555;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent #fff}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:#fff;height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #D23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#D23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent #555 transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:#555 transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px !important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:url("tab_b.png")}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:#fff}} diff --git a/library.properties b/library.properties index a026942..359401d 100755 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=AccelStepper -version=1.59 +version=1.61 author=Mike McCauley maintainer=Patrick Wasp sentence=Allows Arduino boards to control a variety of stepper motors. diff --git a/src/AccelStepper.cpp b/src/AccelStepper.cpp index 981d046..093d56d 100644 --- a/src/AccelStepper.cpp +++ b/src/AccelStepper.cpp @@ -1,7 +1,7 @@ // AccelStepper.cpp // // Copyright (C) 2009-2013 Mike McCauley -// $Id: AccelStepper.cpp,v 1.23 2016/08/09 00:39:10 mikem Exp $ +// $Id: AccelStepper.cpp,v 1.24 2020/04/20 00:15:03 mikem Exp mikem $ #include "AccelStepper.h" @@ -613,7 +613,7 @@ void AccelStepper::setPinsInverted(bool pin1Invert, bool pin2Invert, bool pin3In void AccelStepper::runToPosition() { while (run()) - ; + YIELD; // Let system housekeeping occur } boolean AccelStepper::runSpeedToPosition() diff --git a/src/AccelStepper.h b/src/AccelStepper.h index fa7cbe1..5ab5aba 100644 --- a/src/AccelStepper.h +++ b/src/AccelStepper.h @@ -12,7 +12,7 @@ /// AccelStepper significantly improves on the standard Arduino Stepper library in several ways: /// \li Supports acceleration and deceleration /// \li Supports multiple simultaneous steppers, with independent concurrent stepping on each stepper -/// \li API functions never delay() or block +/// \li Most API functions never delay() or block (unless otherwise stated) /// \li Supports 2, 3 and 4 wire steppers, plus 3 and 4 wire half steppers. /// \li Supports alternate stepping functions to enable support of AFMotor (https://github.com/adafruit/Adafruit-Motor-Shield-library) /// \li Supports stepper drivers such as the Sparkfun EasyDriver (based on 3967 driver chip) @@ -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.59.zip +/// from http://www.airspayce.com/mikem/arduino/AccelStepper/AccelStepper-1.61.zip /// /// Example Arduino programs are included to show the main modes of use. /// @@ -82,15 +82,15 @@ /// \par Copyright /// /// This software is Copyright (C) 2010-2018 Mike McCauley. Use is subject to license -/// conditions. The main licensing options available are GPL V2 or Commercial: +/// conditions. The main licensing options available are GPL V3 or Commercial: /// -/// \par Open Source Licensing GPL V2 +/// \par Open Source Licensing GPL V3 /// This is the appropriate option if you want to share the source code of your /// application with everyone you distribute it to, and you also want to give them /// the right to share who uses it. If you wish to use this software under Open /// Source Licensing, you must contribute all your source code to the open source -/// community in accordance with the GPL Version 2 when your application is -/// distributed. See https://www.gnu.org/licenses/gpl-2.0.html +/// community in accordance with the GPL Version 23 when your application is +/// distributed. See https://www.gnu.org/licenses/gpl-3.0.html /// /// \par Commercial Licensing /// This is the appropriate option if you are creating proprietary applications @@ -244,10 +244,15 @@ /// Add initialisation for _enableInverted in constructor. /// \version 1.59 2018-08-28 /// Update commercial licensing, remove binpress. +/// \version 1.60 2020-03-07 +/// Release under GPL V3 +/// \version 1.61 2020-04-20 +/// Added yield() call in runToPosition(), so that platforms like esp8266 dont hang/crash +/// during long runs. /// /// \author Mike McCauley (mikem@airspayce.com) DO NOT CONTACT THE AUTHOR DIRECTLY: USE THE LISTS // Copyright (C) 2009-2013 Mike McCauley -// $Id: AccelStepper.h,v 1.27 2016/08/14 10:26:54 mikem Exp mikem $ +// $Id: AccelStepper.h,v 1.28 2020/04/20 00:15:03 mikem Exp mikem $ #ifndef AccelStepper_h #define AccelStepper_h @@ -263,6 +268,14 @@ // These defs cause trouble on some versions of Arduino #undef round +// Use the system yield() whenever possoible, since some platforms require it for housekeeping, especially +// ESP8266 +#if (defined(ARDUINO) && ARDUINO >= 155) || defined(ESP8266) + #define YIELD yield(); +#else + #define YIELD +#endif + ///////////////////////////////////////////////////////////////////// /// \class AccelStepper AccelStepper.h /// \brief Support for stepper motors with acceleration etc. @@ -337,6 +350,8 @@ class AccelStepper /// AccelStepper::DRIVER (1) means a stepper driver (with Step and Direction pins). /// If an enable line is also needed, call setEnablePin() after construction. /// You may also invert the pins using setPinsInverted(). + /// Caution: DRIVER implements a blocking delay of minPulseWidth microseconds (default 1us) for each step. + /// You can change this with setMinPulseWidth(). /// AccelStepper::FULL2WIRE (2) means a 2 wire stepper (2 pins required). /// AccelStepper::FULL3WIRE (3) means a 3 wire stepper, such as HDD spindle (3 pins required). /// AccelStepper::FULL4WIRE (4) means a 4 wire stepper (4 pins required). @@ -375,13 +390,13 @@ class AccelStepper /// anticlockwise from the 0 position. void moveTo(long absolute); - /// Set the target position relative to the current position + /// Set the target position relative to the current position. /// \param[in] relative The desired position relative to the current position. Negative is /// anticlockwise from the current position. void move(long relative); /// Poll the motor and step it if a step is due, implementing - /// accelerations and decelerations to acheive the target position. You must call this as + /// accelerations and decelerations to achieve the target position. You must call this as /// frequently as possible, but at least once per minimum step time interval, /// preferably in your main loop. Note that each call to run() will make at most one step, and then only when a step is due, /// based on the current speed and the time since the last step. @@ -403,7 +418,7 @@ class AccelStepper /// Result in non-linear accelerations and decelerations. void setMaxSpeed(float speed); - /// returns the maximum speed configured for this stepper + /// Returns the maximum speed configured for this stepper /// that was previously set by setMaxSpeed(); /// \return The currently configured maximum speed float maxSpeed(); @@ -423,7 +438,7 @@ class AccelStepper /// The speed will be limited by the current value of setMaxSpeed() void setSpeed(float speed); - /// The most recently set speed + /// The most recently set speed. /// \return the most recent speed in steps per second float speed(); @@ -437,7 +452,7 @@ class AccelStepper /// in steps. Positive is clockwise from the 0 position. long targetPosition(); - /// The currently motor position. + /// The current motor position. /// \return the current motor position /// in steps. Positive is clockwise from the 0 position. long currentPosition(); @@ -451,12 +466,12 @@ class AccelStepper /// happens to be right now. void setCurrentPosition(long position); - /// Moves the motor (with acceleration/deceleration) + /// Moves the motor (with acceleration/deceleration) /// to the target position and blocks until it is at /// position. Dont use this in event loops, since it blocks. void runToPosition(); - /// Runs at the currently selected speed until the target position is reached + /// Runs at the currently selected speed until the target position is reached. /// Does not implement accelerations. /// \return true if it stepped boolean runSpeedToPosition(); diff --git a/src/MultiStepper.cpp b/src/MultiStepper.cpp index de0ec94..6a22e11 100644 --- a/src/MultiStepper.cpp +++ b/src/MultiStepper.cpp @@ -1,7 +1,7 @@ // MultiStepper.cpp // // Copyright (C) 2015 Mike McCauley -// $Id: MultiStepper.cpp,v 1.2 2015/10/04 05:16:38 mikem Exp $ +// $Id: MultiStepper.cpp,v 1.3 2020/04/20 00:15:03 mikem Exp mikem $ #include "MultiStepper.h" #include "AccelStepper.h" @@ -60,6 +60,19 @@ boolean MultiStepper::run() _steppers[i]->runSpeed(); ret = true; } + // Caution: it has een reported that if any motor is used with acceleration outside of + // MultiStepper, this code is necessary, you get + // strange results where it moves in the wrong direction for a while then + // slams back the correct way. +#if 0 + else + { + // Need to call this to clear _stepInterval, _speed and _n + otherwise future calls will fail. + _steppers[i]->setCurrentPosition(_steppers[i]->currentPosition()); + } +#endif + } return ret; }