summaryrefslogtreecommitdiff
path: root/TaskScheduler.cpp
diff options
context:
space:
mode:
authorAnatoli Arkhipenko <arkhipenko@hotmail.com>2015-09-22 21:34:41 -0400
committerAnatoli Arkhipenko <arkhipenko@hotmail.com>2015-09-22 21:34:41 -0400
commit82bd27b8924523e40fcf4383437303a814784da2 (patch)
treef18c9c65f120075b28ddfe3646b2db5fe9afa31d /TaskScheduler.cpp
parent5d6cb5f626bd2b692071f4fe13a281fb15a45cd0 (diff)
parent85887bbafa7f9494d4f736cc4f1ec065062c6dd0 (diff)
Merge pull request #2 from arkhipenko/disable-on-last-iteration
Adding "Always disable on last iteration" to master
Diffstat (limited to 'TaskScheduler.cpp')
-rw-r--r--TaskScheduler.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/TaskScheduler.cpp b/TaskScheduler.cpp
index 317b70c..924b40e 100644
--- a/TaskScheduler.cpp
+++ b/TaskScheduler.cpp
@@ -1,4 +1,4 @@
-// Cooperative multitasking library for Arduino version 1.51
+// Cooperative multitasking library for Arduino version 1.6
// Copyright (c) 2015 Anatoli Arkhipenko
//
@@ -50,7 +50,6 @@ void Task::reset() {
iPrev = NULL;
iNext = NULL;
iScheduler = NULL;
- iDisableOnLastIteration = false;
#ifdef _TASK_TIMECRITICAL
iOverrun = 0;
#endif
@@ -63,7 +62,6 @@ void Task::reset() {
*/
void Task::set(unsigned long aInterval, long aIterations, void (*aCallback)()) {
iInterval = aInterval;
- if (iEnabled && iIterations == 0) enable();
iSetIterations = iIterations = aIterations;
iCallback = aCallback;
}
@@ -73,7 +71,6 @@ void Task::set(unsigned long aInterval, long aIterations, void (*aCallback)()) {
* @param aIterations - number of iterations, use -1 for no limit
*/
void Task::setIterations(long aIterations) {
- if (iEnabled && iIterations == 0) enable();
iSetIterations = iIterations = aIterations;
}
@@ -240,7 +237,7 @@ void Scheduler::execute() {
do {
if (iCurrent->iEnabled) {
if (iCurrent->iIterations == 0) {
- if (iCurrent->iDisableOnLastIteration) iCurrent->disable();
+ iCurrent->disable();
break;
}
if (iCurrent->iInterval > 0) {