updated to bool
This commit is contained in:
@@ -196,12 +196,12 @@
|
|||||||
<a name="l00181"></a>00181 <span class="comment"> /// fequently as possible, but at least once per minimum step interval,</span>
|
<a name="l00181"></a>00181 <span class="comment"> /// fequently as possible, but at least once per minimum step interval,</span>
|
||||||
<a name="l00182"></a>00182 <span class="comment"> /// preferably in your main loop.</span>
|
<a name="l00182"></a>00182 <span class="comment"> /// preferably in your main loop.</span>
|
||||||
<a name="l00183"></a>00183 <span class="comment"> /// \return true if the motor is at the target position.</span>
|
<a name="l00183"></a>00183 <span class="comment"> /// \return true if the motor is at the target position.</span>
|
||||||
<a name="l00184"></a>00184 <span class="comment"></span> <span class="keywordtype">boolean</span> <a class="code" href="classAccelStepper.html#608b2395b64ac15451d16d0371fe13ce">run</a>();
|
<a name="l00184"></a>00184 <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="classAccelStepper.html#608b2395b64ac15451d16d0371fe13ce">run</a>();
|
||||||
<a name="l00185"></a>00185 <span class="comment"></span>
|
<a name="l00185"></a>00185 <span class="comment"></span>
|
||||||
<a name="l00186"></a>00186 <span class="comment"> /// Poll the motor and step it if a step is due, implmenting a constant</span>
|
<a name="l00186"></a>00186 <span class="comment"> /// Poll the motor and step it if a step is due, implmenting a constant</span>
|
||||||
<a name="l00187"></a>00187 <span class="comment"> /// speed as set by the most recent call to setSpeed().</span>
|
<a name="l00187"></a>00187 <span class="comment"> /// speed as set by the most recent call to setSpeed().</span>
|
||||||
<a name="l00188"></a>00188 <span class="comment"> /// \return true if the motor was stepped.</span>
|
<a name="l00188"></a>00188 <span class="comment"> /// \return true if the motor was stepped.</span>
|
||||||
<a name="l00189"></a>00189 <span class="comment"></span> <span class="keywordtype">boolean</span> <a class="code" href="classAccelStepper.html#a4a6bdf99f698284faaeb5542b0b7514">runSpeed</a>();
|
<a name="l00189"></a>00189 <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="classAccelStepper.html#a4a6bdf99f698284faaeb5542b0b7514">runSpeed</a>();
|
||||||
<a name="l00190"></a>00190 <span class="comment"></span>
|
<a name="l00190"></a>00190 <span class="comment"></span>
|
||||||
<a name="l00191"></a>00191 <span class="comment"> /// Sets the maximum permitted speed. the run() function will accelerate</span>
|
<a name="l00191"></a>00191 <span class="comment"> /// Sets the maximum permitted speed. the run() function will accelerate</span>
|
||||||
<a name="l00192"></a>00192 <span class="comment"> /// up to the speed set by this function.</span>
|
<a name="l00192"></a>00192 <span class="comment"> /// up to the speed set by this function.</span>
|
||||||
@@ -257,7 +257,7 @@
|
|||||||
<a name="l00242"></a>00242 <span class="comment"></span>
|
<a name="l00242"></a>00242 <span class="comment"></span>
|
||||||
<a name="l00243"></a>00243 <span class="comment"> /// Runs at the currently selected speed until the target position is reached</span>
|
<a name="l00243"></a>00243 <span class="comment"> /// Runs at the currently selected speed until the target position is reached</span>
|
||||||
<a name="l00244"></a>00244 <span class="comment"> /// Does not implement accelerations.</span>
|
<a name="l00244"></a>00244 <span class="comment"> /// Does not implement accelerations.</span>
|
||||||
<a name="l00245"></a>00245 <span class="comment"></span> <span class="keywordtype">boolean</span> <a class="code" href="classAccelStepper.html#9270d20336e76ac1fd5bcd5b9c34f301">runSpeedToPosition</a>();
|
<a name="l00245"></a>00245 <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="classAccelStepper.html#9270d20336e76ac1fd5bcd5b9c34f301">runSpeedToPosition</a>();
|
||||||
<a name="l00246"></a>00246 <span class="comment"></span>
|
<a name="l00246"></a>00246 <span class="comment"></span>
|
||||||
<a name="l00247"></a>00247 <span class="comment"> /// Moves the motor to the new target position and blocks until it is at</span>
|
<a name="l00247"></a>00247 <span class="comment"> /// Moves the motor to the new target position and blocks until it is at</span>
|
||||||
<a name="l00248"></a>00248 <span class="comment"> /// position. Dont use this in event loops, since it blocks.</span>
|
<a name="l00248"></a>00248 <span class="comment"> /// position. Dont use this in event loops, since it blocks.</span>
|
||||||
|
|||||||
@@ -80,9 +80,9 @@ Public Member Functions</h2></td></tr>
|
|||||||
<tr class="separator:ace236ede35f87c63d18da25810ec9736"><td class="memSeparator" colspan="2"> </td></tr>
|
<tr class="separator:ace236ede35f87c63d18da25810ec9736"><td class="memSeparator" colspan="2"> </td></tr>
|
||||||
<tr class="memitem:a68942c66e78fb7f7b5f0cdade6eb7f06"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#a68942c66e78fb7f7b5f0cdade6eb7f06">move</a> (long relative)</td></tr>
|
<tr class="memitem:a68942c66e78fb7f7b5f0cdade6eb7f06"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#a68942c66e78fb7f7b5f0cdade6eb7f06">move</a> (long relative)</td></tr>
|
||||||
<tr class="separator:a68942c66e78fb7f7b5f0cdade6eb7f06"><td class="memSeparator" colspan="2"> </td></tr>
|
<tr class="separator:a68942c66e78fb7f7b5f0cdade6eb7f06"><td class="memSeparator" colspan="2"> </td></tr>
|
||||||
<tr class="memitem:a608b2395b64ac15451d16d0371fe13ce"><td class="memItemLeft" align="right" valign="top">boolean </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#a608b2395b64ac15451d16d0371fe13ce">run</a> ()</td></tr>
|
<tr class="memitem:a608b2395b64ac15451d16d0371fe13ce"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#a608b2395b64ac15451d16d0371fe13ce">run</a> ()</td></tr>
|
||||||
<tr class="separator:a608b2395b64ac15451d16d0371fe13ce"><td class="memSeparator" colspan="2"> </td></tr>
|
<tr class="separator:a608b2395b64ac15451d16d0371fe13ce"><td class="memSeparator" colspan="2"> </td></tr>
|
||||||
<tr class="memitem:aa4a6bdf99f698284faaeb5542b0b7514"><td class="memItemLeft" align="right" valign="top">boolean </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#aa4a6bdf99f698284faaeb5542b0b7514">runSpeed</a> ()</td></tr>
|
<tr class="memitem:aa4a6bdf99f698284faaeb5542b0b7514"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#aa4a6bdf99f698284faaeb5542b0b7514">runSpeed</a> ()</td></tr>
|
||||||
<tr class="separator:aa4a6bdf99f698284faaeb5542b0b7514"><td class="memSeparator" colspan="2"> </td></tr>
|
<tr class="separator:aa4a6bdf99f698284faaeb5542b0b7514"><td class="memSeparator" colspan="2"> </td></tr>
|
||||||
<tr class="memitem:abee8d466229b87accba33d6ec929c18f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#abee8d466229b87accba33d6ec929c18f">setMaxSpeed</a> (float <a class="el" href="classAccelStepper.html#a4f0989d0ae264e7eadfe1fa720769fb6">speed</a>)</td></tr>
|
<tr class="memitem:abee8d466229b87accba33d6ec929c18f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#abee8d466229b87accba33d6ec929c18f">setMaxSpeed</a> (float <a class="el" href="classAccelStepper.html#a4f0989d0ae264e7eadfe1fa720769fb6">speed</a>)</td></tr>
|
||||||
<tr class="separator:abee8d466229b87accba33d6ec929c18f"><td class="memSeparator" colspan="2"> </td></tr>
|
<tr class="separator:abee8d466229b87accba33d6ec929c18f"><td class="memSeparator" colspan="2"> </td></tr>
|
||||||
@@ -104,7 +104,7 @@ Public Member Functions</h2></td></tr>
|
|||||||
<tr class="separator:a9d917f014317fb9d3b5dc14e66f6c689"><td class="memSeparator" colspan="2"> </td></tr>
|
<tr class="separator:a9d917f014317fb9d3b5dc14e66f6c689"><td class="memSeparator" colspan="2"> </td></tr>
|
||||||
<tr class="memitem:a344f58fef8cc34ac5aa75ba4b665d21c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#a344f58fef8cc34ac5aa75ba4b665d21c">runToPosition</a> ()</td></tr>
|
<tr class="memitem:a344f58fef8cc34ac5aa75ba4b665d21c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#a344f58fef8cc34ac5aa75ba4b665d21c">runToPosition</a> ()</td></tr>
|
||||||
<tr class="separator:a344f58fef8cc34ac5aa75ba4b665d21c"><td class="memSeparator" colspan="2"> </td></tr>
|
<tr class="separator:a344f58fef8cc34ac5aa75ba4b665d21c"><td class="memSeparator" colspan="2"> </td></tr>
|
||||||
<tr class="memitem:a9270d20336e76ac1fd5bcd5b9c34f301"><td class="memItemLeft" align="right" valign="top">boolean </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#a9270d20336e76ac1fd5bcd5b9c34f301">runSpeedToPosition</a> ()</td></tr>
|
<tr class="memitem:a9270d20336e76ac1fd5bcd5b9c34f301"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#a9270d20336e76ac1fd5bcd5b9c34f301">runSpeedToPosition</a> ()</td></tr>
|
||||||
<tr class="separator:a9270d20336e76ac1fd5bcd5b9c34f301"><td class="memSeparator" colspan="2"> </td></tr>
|
<tr class="separator:a9270d20336e76ac1fd5bcd5b9c34f301"><td class="memSeparator" colspan="2"> </td></tr>
|
||||||
<tr class="memitem:a176c5d2e4c2f21e9e92b12e39a6f0e67"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#a176c5d2e4c2f21e9e92b12e39a6f0e67">runToNewPosition</a> (long position)</td></tr>
|
<tr class="memitem:a176c5d2e4c2f21e9e92b12e39a6f0e67"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#a176c5d2e4c2f21e9e92b12e39a6f0e67">runToNewPosition</a> (long position)</td></tr>
|
||||||
<tr class="separator:a176c5d2e4c2f21e9e92b12e39a6f0e67"><td class="memSeparator" colspan="2"> </td></tr>
|
<tr class="separator:a176c5d2e4c2f21e9e92b12e39a6f0e67"><td class="memSeparator" colspan="2"> </td></tr>
|
||||||
@@ -158,7 +158,7 @@ Protected Member Functions</h2></td></tr>
|
|||||||
</table><table class="memberdecls">
|
</table><table class="memberdecls">
|
||||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
|
||||||
Protected Attributes</h2></td></tr>
|
Protected Attributes</h2></td></tr>
|
||||||
<tr class="memitem:a35162cdf8ed9a98f98984c177d5ade58"><td class="memItemLeft" align="right" valign="top">boolean </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#a35162cdf8ed9a98f98984c177d5ade58">_direction</a></td></tr>
|
<tr class="memitem:a35162cdf8ed9a98f98984c177d5ade58"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#a35162cdf8ed9a98f98984c177d5ade58">_direction</a></td></tr>
|
||||||
<tr class="separator:a35162cdf8ed9a98f98984c177d5ade58"><td class="memSeparator" colspan="2"> </td></tr>
|
<tr class="separator:a35162cdf8ed9a98f98984c177d5ade58"><td class="memSeparator" colspan="2"> </td></tr>
|
||||||
</table>
|
</table>
|
||||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||||
@@ -570,7 +570,7 @@ Protected Attributes</h2></td></tr>
|
|||||||
<div class="memproto">
|
<div class="memproto">
|
||||||
<table class="memname">
|
<table class="memname">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="memname">boolean AccelStepper::run </td>
|
<td class="memname">bool AccelStepper::run </td>
|
||||||
<td>(</td>
|
<td>(</td>
|
||||||
<td class="paramname"></td><td>)</td>
|
<td class="paramname"></td><td>)</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
@@ -592,7 +592,7 @@ Protected Attributes</h2></td></tr>
|
|||||||
<div class="memproto">
|
<div class="memproto">
|
||||||
<table class="memname">
|
<table class="memname">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="memname">boolean AccelStepper::runSpeed </td>
|
<td class="memname">bool AccelStepper::runSpeed </td>
|
||||||
<td>(</td>
|
<td>(</td>
|
||||||
<td class="paramname"></td><td>)</td>
|
<td class="paramname"></td><td>)</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
@@ -614,7 +614,7 @@ Protected Attributes</h2></td></tr>
|
|||||||
<div class="memproto">
|
<div class="memproto">
|
||||||
<table class="memname">
|
<table class="memname">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="memname">boolean AccelStepper::runSpeedToPosition </td>
|
<td class="memname">bool AccelStepper::runSpeedToPosition </td>
|
||||||
<td>(</td>
|
<td>(</td>
|
||||||
<td class="paramname"></td><td>)</td>
|
<td class="paramname"></td><td>)</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
@@ -1316,7 +1316,7 @@ Protected Attributes</h2></td></tr>
|
|||||||
<td class="mlabels-left">
|
<td class="mlabels-left">
|
||||||
<table class="memname">
|
<table class="memname">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="memname">boolean AccelStepper::_direction</td>
|
<td class="memname">bool AccelStepper::_direction</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ void AccelStepper::move(long relative)
|
|||||||
// Implements steps according to the current step interval
|
// Implements steps according to the current step interval
|
||||||
// You must call this at least once per step
|
// You must call this at least once per step
|
||||||
// returns true if a step occurred
|
// returns true if a step occurred
|
||||||
boolean AccelStepper::runSpeed()
|
bool AccelStepper::runSpeed()
|
||||||
{
|
{
|
||||||
// Dont do anything unless we actually have a step interval
|
// Dont do anything unless we actually have a step interval
|
||||||
if (!_stepInterval)
|
if (!_stepInterval)
|
||||||
@@ -180,7 +180,7 @@ void AccelStepper::computeNewSpeed()
|
|||||||
// You must call this at least once per step, preferably in your main loop
|
// You must call this at least once per step, preferably in your main loop
|
||||||
// If the motor is in the desired position, the cost is very small
|
// If the motor is in the desired position, the cost is very small
|
||||||
// returns true if the motor is still running to the target position.
|
// returns true if the motor is still running to the target position.
|
||||||
boolean AccelStepper::run()
|
bool AccelStepper::run()
|
||||||
{
|
{
|
||||||
if (runSpeed())
|
if (runSpeed())
|
||||||
computeNewSpeed();
|
computeNewSpeed();
|
||||||
@@ -616,7 +616,7 @@ void AccelStepper::runToPosition()
|
|||||||
YIELD; // Let system housekeeping occur
|
YIELD; // Let system housekeeping occur
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean AccelStepper::runSpeedToPosition()
|
bool AccelStepper::runSpeedToPosition()
|
||||||
{
|
{
|
||||||
if (_targetPos == _currentPos)
|
if (_targetPos == _currentPos)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -401,13 +401,13 @@ public:
|
|||||||
/// 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,
|
/// 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.
|
/// based on the current speed and the time since the last step.
|
||||||
/// \return true if the motor is still running to the target position.
|
/// \return true if the motor is still running to the target position.
|
||||||
boolean run();
|
bool run();
|
||||||
|
|
||||||
/// Poll the motor and step it if a step is due, implementing a constant
|
/// Poll the motor and step it if a step is due, implementing a constant
|
||||||
/// speed as set by the most recent call to setSpeed(). You must call this as
|
/// speed as set by the most recent call to setSpeed(). You must call this as
|
||||||
/// frequently as possible, but at least once per step interval,
|
/// frequently as possible, but at least once per step interval,
|
||||||
/// \return true if the motor was stepped.
|
/// \return true if the motor was stepped.
|
||||||
boolean runSpeed();
|
bool runSpeed();
|
||||||
|
|
||||||
/// Sets the maximum permitted speed. The run() function will accelerate
|
/// Sets the maximum permitted speed. The run() function will accelerate
|
||||||
/// up to the speed set by this function.
|
/// up to the speed set by this function.
|
||||||
@@ -474,7 +474,7 @@ public:
|
|||||||
/// 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.
|
/// Does not implement accelerations.
|
||||||
/// \return true if it stepped
|
/// \return true if it stepped
|
||||||
boolean runSpeedToPosition();
|
bool runSpeedToPosition();
|
||||||
|
|
||||||
/// Moves the motor (with acceleration/deceleration)
|
/// Moves the motor (with acceleration/deceleration)
|
||||||
/// to the new target position and blocks until it is at
|
/// to the new target position and blocks until it is at
|
||||||
@@ -616,7 +616,7 @@ protected:
|
|||||||
|
|
||||||
/// Current direction motor is spinning in
|
/// Current direction motor is spinning in
|
||||||
/// Protected because some peoples subclasses need it to be so
|
/// Protected because some peoples subclasses need it to be so
|
||||||
boolean _direction; // 1 == CW
|
bool _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
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ MultiStepper::MultiStepper()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean MultiStepper::addStepper(AccelStepper& stepper)
|
bool MultiStepper::addStepper(AccelStepper& stepper)
|
||||||
{
|
{
|
||||||
if (_num_steppers >= MULTISTEPPER_MAX_STEPPERS)
|
if (_num_steppers >= MULTISTEPPER_MAX_STEPPERS)
|
||||||
return false; // No room for more
|
return false; // No room for more
|
||||||
@@ -49,10 +49,10 @@ void MultiStepper::moveTo(long absolute[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if any motor is still running to the target position.
|
// Returns true if any motor is still running to the target position.
|
||||||
boolean MultiStepper::run()
|
bool MultiStepper::run()
|
||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
boolean ret = false;
|
bool ret = false;
|
||||||
for (i = 0; i < _num_steppers; i++)
|
for (i = 0; i < _num_steppers; i++)
|
||||||
{
|
{
|
||||||
if ( _steppers[i]->distanceToGo() != 0)
|
if ( _steppers[i]->distanceToGo() != 0)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
/// There is an upper limit of MULTISTEPPER_MAX_STEPPERS = 10 to the number of steppers that can be managed
|
/// There is an upper limit of MULTISTEPPER_MAX_STEPPERS = 10 to the number of steppers that can be managed
|
||||||
/// \param[in] stepper Reference to a stepper to add to the managed list
|
/// \param[in] stepper Reference to a stepper to add to the managed list
|
||||||
/// \return true if successful. false if the number of managed steppers would exceed MULTISTEPPER_MAX_STEPPERS
|
/// \return true if successful. false if the number of managed steppers would exceed MULTISTEPPER_MAX_STEPPERS
|
||||||
boolean addStepper(AccelStepper& stepper);
|
bool addStepper(AccelStepper& stepper);
|
||||||
|
|
||||||
/// Set the target positions of all managed steppers
|
/// Set the target positions of all managed steppers
|
||||||
/// according to a coordinate array.
|
/// according to a coordinate array.
|
||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
/// Calls runSpeed() on all the managed steppers
|
/// Calls runSpeed() on all the managed steppers
|
||||||
/// that have not acheived their target position.
|
/// that have not acheived their target position.
|
||||||
/// \return true if any stepper is still in the process of running to its target position.
|
/// \return true if any stepper is still in the process of running to its target position.
|
||||||
boolean run();
|
bool run();
|
||||||
|
|
||||||
/// Runs all managed steppers until they acheived their target position.
|
/// Runs all managed steppers until they acheived their target position.
|
||||||
/// Blocks until all that position is acheived. If you dont
|
/// Blocks until all that position is acheived. If you dont
|
||||||
|
|||||||
Reference in New Issue
Block a user