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.
This commit is contained in:
parent
d54e55a358
commit
a9bf2f93bf
6
LICENSE
6
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
|
||||
|
@ -284,7 +284,7 @@ Protected Attributes</h2></td></tr>
|
||||
</div><div class="memdoc">
|
||||
<p>Constructor. You can have multiple simultaneous steppers, all moving at different speeds and accelerations, provided you call their <a class="el" href="classAccelStepper.html#a608b2395b64ac15451d16d0371fe13ce">run()</a> 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 <a class="el" href="classAccelStepper.html#aa279a50d30d0413f570c692cff071643">enableOutputs()</a>. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir">[in]</td><td class="paramname">interface</td><td>Number of pins to interface to. Integer values are supported, but it is preferred to use the <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5">MotorInterfaceType</a> symbolic names. <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5ac3523e4cf6763ba518d16fec3708ef23" title="Stepper Driver, 2 driver pins required. ">AccelStepper::DRIVER</a> (1) means a stepper driver (with Step and Direction pins). If an enable line is also needed, call <a class="el" href="classAccelStepper.html#a56a81c5f00d02ca19646718e88e974c0">setEnablePin()</a> after construction. You may also invert the pins using <a class="el" href="classAccelStepper.html#ac62cae590c2f9c303519a3a1c4adc8ab">setPinsInverted()</a>. <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5a62a305b52f749ff8c89138273fbb012d" title="2 wire stepper, 2 motor pins required ">AccelStepper::FULL2WIRE</a> (2) means a 2 wire stepper (2 pins required). <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5a0b8eea5cf0f8ce70b1959d2977ccc996" title="3 wire stepper, such as HDD spindle, 3 motor pins required ">AccelStepper::FULL3WIRE</a> (3) means a 3 wire stepper, such as HDD spindle (3 pins required). <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5adedd394a375190a3df8d4519c0d4dc2f" title="4 wire full stepper, 4 motor pins required ">AccelStepper::FULL4WIRE</a> (4) means a 4 wire stepper (4 pins required). <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5a00c2387a5af43d8e97639699ab7a5c7f" title="3 wire half stepper, such as HDD spindle, 3 motor pins required ">AccelStepper::HALF3WIRE</a> (6) means a 3 wire half stepper, such as HDD spindle (3 pins required) <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5aecc0900c55b777d2e885581b8c434b07" title="4 wire half stepper, 4 motor pins required ">AccelStepper::HALF4WIRE</a> (8) means a 4 wire half stepper (4 pins required) Defaults to <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5adedd394a375190a3df8d4519c0d4dc2f" title="4 wire full stepper, 4 motor pins required ">AccelStepper::FULL4WIRE</a> (4) pins. </td></tr>
|
||||
<tr><td class="paramdir">[in]</td><td class="paramname">interface</td><td>Number of pins to interface to. Integer values are supported, but it is preferred to use the <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5">MotorInterfaceType</a> symbolic names. <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5ac3523e4cf6763ba518d16fec3708ef23" title="Stepper Driver, 2 driver pins required. ">AccelStepper::DRIVER</a> (1) means a stepper driver (with Step and Direction pins). If an enable line is also needed, call <a class="el" href="classAccelStepper.html#a56a81c5f00d02ca19646718e88e974c0">setEnablePin()</a> after construction. You may also invert the pins using <a class="el" href="classAccelStepper.html#ac62cae590c2f9c303519a3a1c4adc8ab">setPinsInverted()</a>. Caution: DRIVER implements a blocking delay of minPulseWidth microseconds (default 1us) for each step. You can change this with <a class="el" href="classAccelStepper.html#af4d3818e691dad5dc518308796ccf154">setMinPulseWidth()</a>. <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5a62a305b52f749ff8c89138273fbb012d" title="2 wire stepper, 2 motor pins required ">AccelStepper::FULL2WIRE</a> (2) means a 2 wire stepper (2 pins required). <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5a0b8eea5cf0f8ce70b1959d2977ccc996" title="3 wire stepper, such as HDD spindle, 3 motor pins required ">AccelStepper::FULL3WIRE</a> (3) means a 3 wire stepper, such as HDD spindle (3 pins required). <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5adedd394a375190a3df8d4519c0d4dc2f" title="4 wire full stepper, 4 motor pins required ">AccelStepper::FULL4WIRE</a> (4) means a 4 wire stepper (4 pins required). <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5a00c2387a5af43d8e97639699ab7a5c7f" title="3 wire half stepper, such as HDD spindle, 3 motor pins required ">AccelStepper::HALF3WIRE</a> (6) means a 3 wire half stepper, such as HDD spindle (3 pins required) <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5aecc0900c55b777d2e885581b8c434b07" title="4 wire half stepper, 4 motor pins required ">AccelStepper::HALF4WIRE</a> (8) means a 4 wire half stepper (4 pins required) Defaults to <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5adedd394a375190a3df8d4519c0d4dc2f" title="4 wire full stepper, 4 motor pins required ">AccelStepper::FULL4WIRE</a> (4) pins. </td></tr>
|
||||
<tr><td class="paramdir">[in]</td><td class="paramname">pin1</td><td>Arduino digital pin number for motor pin 1. Defaults to pin 2. For a <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5ac3523e4cf6763ba518d16fec3708ef23" title="Stepper Driver, 2 driver pins required. ">AccelStepper::DRIVER</a> (interface==1), this is the Step input to the driver. Low to high transition means to step) </td></tr>
|
||||
<tr><td class="paramdir">[in]</td><td class="paramname">pin2</td><td>Arduino digital pin number for motor pin 2. Defaults to pin 3. For a <a class="el" href="classAccelStepper.html#a73bdecf1273d98d8c5fbcb764cabeea5ac3523e4cf6763ba518d16fec3708ef23" title="Stepper Driver, 2 driver pins required. ">AccelStepper::DRIVER</a> (interface==1), this is the Direction input the driver. High means forward. </td></tr>
|
||||
<tr><td class="paramdir">[in]</td><td class="paramname">pin3</td><td>Arduino digital pin number for motor pin 3. Defaults to pin 4. </td></tr>
|
||||
@ -385,7 +385,7 @@ Protected Attributes</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>The currently motor position. </p><dl class="section return"><dt>Returns</dt><dd>the current motor position in steps. Positive is clockwise from the 0 position. </dd></dl>
|
||||
<p>The current motor position. </p><dl class="section return"><dt>Returns</dt><dd>the current motor position in steps. Positive is clockwise from the 0 position. </dd></dl>
|
||||
|
||||
<p class="reference">Referenced by <a class="el" href="classMultiStepper.html#a291fec32a79390b6eb00296cffac49ee">MultiStepper::moveTo()</a>.</p>
|
||||
|
||||
@ -501,7 +501,7 @@ Protected Attributes</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>returns the maximum speed configured for this stepper that was previously set by <a class="el" href="classAccelStepper.html#abee8d466229b87accba33d6ec929c18f">setMaxSpeed()</a>; </p><dl class="section return"><dt>Returns</dt><dd>The currently configured maximum speed </dd></dl>
|
||||
<p>Returns the maximum speed configured for this stepper that was previously set by <a class="el" href="classAccelStepper.html#abee8d466229b87accba33d6ec929c18f">setMaxSpeed()</a>; </p><dl class="section return"><dt>Returns</dt><dd>The currently configured maximum speed </dd></dl>
|
||||
|
||||
<p class="reference">Referenced by <a class="el" href="classMultiStepper.html#a291fec32a79390b6eb00296cffac49ee">MultiStepper::moveTo()</a>.</p>
|
||||
|
||||
@ -522,7 +522,7 @@ Protected Attributes</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Set the target position relative to the current position </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<p>Set the target position relative to the current position. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir">[in]</td><td class="paramname">relative</td><td>The desired position relative to the current position. Negative is anticlockwise from the current position. </td></tr>
|
||||
</table>
|
||||
@ -577,7 +577,7 @@ Protected Attributes</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>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 <a class="el" href="classAccelStepper.html#a608b2395b64ac15451d16d0371fe13ce">run()</a> 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. </p><dl class="section return"><dt>Returns</dt><dd>true if the motor is still running to the target position. </dd></dl>
|
||||
<p>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 <a class="el" href="classAccelStepper.html#a608b2395b64ac15451d16d0371fe13ce">run()</a> 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. </p><dl class="section return"><dt>Returns</dt><dd>true if the motor is still running to the target position. </dd></dl>
|
||||
|
||||
<p class="reference">References <a class="el" href="classAccelStepper.html#affbee789b5c19165846cf0409860ae79">computeNewSpeed()</a>, <a class="el" href="classAccelStepper.html#a748665c3962e66fbc0e9373eb14c69c1">distanceToGo()</a>, and <a class="el" href="classAccelStepper.html#aa4a6bdf99f698284faaeb5542b0b7514">runSpeed()</a>.</p>
|
||||
|
||||
@ -621,7 +621,7 @@ Protected Attributes</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Runs at the currently selected speed until the target position is reached Does not implement accelerations. </p><dl class="section return"><dt>Returns</dt><dd>true if it stepped </dd></dl>
|
||||
<p>Runs at the currently selected speed until the target position is reached. Does not implement accelerations. </p><dl class="section return"><dt>Returns</dt><dd>true if it stepped </dd></dl>
|
||||
|
||||
<p class="reference">References <a class="el" href="classAccelStepper.html#a35162cdf8ed9a98f98984c177d5ade58">_direction</a>, <a class="el" href="classAccelStepper.html#a7468f91a925c689c3ba250f8d074d228a6959a4549f734bd771d418f995ba4fb4">DIRECTION_CCW</a>, <a class="el" href="classAccelStepper.html#a7468f91a925c689c3ba250f8d074d228ad604e0047f7cb47662c5a1cf6999337c">DIRECTION_CW</a>, and <a class="el" href="classAccelStepper.html#aa4a6bdf99f698284faaeb5542b0b7514">runSpeed()</a>.</p>
|
||||
|
||||
@ -725,6 +725,8 @@ Protected Attributes</h2></td></tr>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<p class="reference">Referenced by <a class="el" href="classMultiStepper.html#a26c2f53b1e7ddf5d5dfb333f6fb7fb92">MultiStepper::run()</a>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a56a81c5f00d02ca19646718e88e974c0"></a>
|
||||
@ -973,7 +975,7 @@ Protected Attributes</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>The most recently set speed </p><dl class="section return"><dt>Returns</dt><dd>the most recent speed in steps per second </dd></dl>
|
||||
<p>The most recently set speed. </p><dl class="section return"><dt>Returns</dt><dd>the most recent speed in steps per second </dd></dl>
|
||||
|
||||
<p class="reference">Referenced by <a class="el" href="classAccelStepper.html#abee8d466229b87accba33d6ec929c18f">setMaxSpeed()</a>, and <a class="el" href="classAccelStepper.html#ae79c49ad69d5ccc9da0ee691fa4ca235">setSpeed()</a>.</p>
|
||||
|
||||
|
@ -46,7 +46,7 @@ $(function() {
|
||||
<p><a class="el" href="classAccelStepper.html" title="Support for stepper motors with acceleration etc. ">AccelStepper</a> significantly improves on the standard Arduino Stepper library in several ways: </p><ul>
|
||||
<li>Supports acceleration and deceleration </li>
|
||||
<li>Supports multiple simultaneous steppers, with independent concurrent stepping on each stepper </li>
|
||||
<li>API functions never delay() or block </li>
|
||||
<li>Most API functions never delay() or block (unless otherwise stated) </li>
|
||||
<li>Supports 2, 3 and 4 wire steppers, plus 3 and 4 wire half steppers. </li>
|
||||
<li>Supports alternate stepping functions to enable support of AFMotor (<a href="https://github.com/adafruit/Adafruit-Motor-Shield-library">https://github.com/adafruit/Adafruit-Motor-Shield-library</a>) </li>
|
||||
<li>Supports stepper drivers such as the Sparkfun EasyDriver (based on 3967 driver chip) </li>
|
||||
@ -54,7 +54,7 @@ $(function() {
|
||||
<li>Extensive API </li>
|
||||
<li>Subclass support</li>
|
||||
</ul>
|
||||
<p>The latest version of this documentation can be downloaded from <a href="http://www.airspayce.com/mikem/arduino/AccelStepper">http://www.airspayce.com/mikem/arduino/AccelStepper</a> The version of the package that this documentation refers to can be downloaded from <a href="http://www.airspayce.com/mikem/arduino/AccelStepper/AccelStepper-1.59.zip">http://www.airspayce.com/mikem/arduino/AccelStepper/AccelStepper-1.59.zip</a></p>
|
||||
<p>The latest version of this documentation can be downloaded from <a href="http://www.airspayce.com/mikem/arduino/AccelStepper">http://www.airspayce.com/mikem/arduino/AccelStepper</a> The version of the package that this documentation refers to can be downloaded from <a href="http://www.airspayce.com/mikem/arduino/AccelStepper/AccelStepper-1.61.zip">http://www.airspayce.com/mikem/arduino/AccelStepper/AccelStepper-1.61.zip</a></p>
|
||||
<p>Example Arduino programs are included to show the main modes of use.</p>
|
||||
<p>You can also find online help and discussion at <a href="http://groups.google.com/group/accelstepper">http://groups.google.com/group/accelstepper</a> 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</p><ul>
|
||||
<li><a href="http://en.wikipedia.org/wiki/Wikipedia:Reference_desk/How_to_ask_a_software_question">http://en.wikipedia.org/wiki/Wikipedia:Reference_desk/How_to_ask_a_software_question</a></li>
|
||||
@ -74,8 +74,8 @@ $(function() {
|
||||
<dl class="section user"><dt>Trademarks</dt><dd></dd></dl>
|
||||
<p><a class="el" href="classAccelStepper.html" title="Support for stepper motors with acceleration etc. ">AccelStepper</a> is a trademark of AirSpayce Pty Ltd. The <a class="el" href="classAccelStepper.html" title="Support for stepper motors with acceleration etc. ">AccelStepper</a> 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.</p>
|
||||
<dl class="section user"><dt>Copyright</dt><dd></dd></dl>
|
||||
<p>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:</p>
|
||||
<dl class="section user"><dt>Open Source Licensing GPL V2</dt><dd>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 <a href="https://www.gnu.org/licenses/gpl-2.0.html">https://www.gnu.org/licenses/gpl-2.0.html</a></dd></dl>
|
||||
<p>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:</p>
|
||||
<dl class="section user"><dt>Open Source Licensing GPL V3</dt><dd>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 <a href="https://www.gnu.org/licenses/gpl-3.0.html">https://www.gnu.org/licenses/gpl-3.0.html</a></dd></dl>
|
||||
<dl class="section user"><dt>Commercial Licensing</dt><dd>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 <a href="#" onclick="location.href='mai'+'lto:'+'inf'+'o@'+'air'+'sp'+'ayc'+'e.'+'com'; return false;">info@<span style="display: none;">.nosp@m.</span>airs<span style="display: none;">.nosp@m.</span>payce<span style="display: none;">.nosp@m.</span>.com</a></dd></dl>
|
||||
<dl class="section user"><dt>Revision History</dt><dd></dd></dl>
|
||||
<dl class="section version"><dt>Version</dt><dd>1.0 Initial release</dd>
|
||||
@ -209,7 +209,11 @@ $(function() {
|
||||
<dd>
|
||||
1.58 2018-04-13 Add initialisation for _enableInverted in constructor. </dd>
|
||||
<dd>
|
||||
1.59 2018-08-28 Update commercial licensing, remove binpress.</dd></dl>
|
||||
1.59 2018-08-28 Update commercial licensing, remove binpress. </dd>
|
||||
<dd>
|
||||
1.60 2020-03-07 Release under GPL V3 </dd>
|
||||
<dd>
|
||||
1.61 2020-04-20 Added yield() call in runToPosition(), so that platforms like esp8266 dont hang/crash during long runs.</dd></dl>
|
||||
<dl class="section author"><dt>Author</dt><dd>Mike McCauley (<a href="#" onclick="location.href='mai'+'lto:'+'mik'+'em'+'@ai'+'rs'+'pay'+'ce'+'.co'+'m'; return false;">mikem<span style="display: none;">.nosp@m.</span>@air<span style="display: none;">.nosp@m.</span>spayc<span style="display: none;">.nosp@m.</span>e.co<span style="display: none;">.nosp@m.</span>m</a>) DO NOT CONTACT THE AUTHOR DIRECTLY: USE THE LISTS </dd></dl>
|
||||
</div></div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
name=AccelStepper
|
||||
version=1.59
|
||||
version=1.61
|
||||
author=Mike McCauley <mikem@airspayce.com>
|
||||
maintainer=Patrick Wasp <patrickwasp@gmail.com>
|
||||
sentence=Allows Arduino boards to control a variety of stepper motors.
|
||||
|
@ -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()
|
||||
|
@ -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 <AccelStepper.h>
|
||||
/// \brief Support for stepper motors with acceleration etc.
|
||||
@ -337,6 +350,8 @@ public:
|
||||
/// 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 @@ public:
|
||||
/// 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 @@ public:
|
||||
/// 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 @@ public:
|
||||
/// 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 @@ public:
|
||||
/// 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 @@ public:
|
||||
/// 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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user