From 9edbe90155b19267bfb0cc4439ee5216f0569ba9 Mon Sep 17 00:00:00 2001
From: Anatoli Arkhipenko
cooperative multitasking for Arduino microcontrollers
-Version 1.8.4: 2015-11-17
+Version 1.8.5: 2015-11-23
OVERVIEW:
@@ -1120,18 +1120,40 @@ must return a value of true for task to be enabled. If regardless if task is already enabled or not. Alignment to current millis() is performed after OnEnable exits, so any changes to the interval inside OnEnable is taken into consideration. +TaskScheduler +allows tasks to be added to the a Scheduler and enabled at the time +of creation. Be very careful +with such tasks – the OnEnable method +will be executed immediately, while certain objects (i.e., other +Tasks, libraries) are not yet ready (e.g., Wire.begin() +was not yet called), or hardware not yet activated (pins not set to +INPUT or OUTPUT). +
+It +is very much recommended to to enable all tasks at the end of setup() +method after all initializations are done. +
+If +you require immediate execution of already enabled task, use +forceNextIteratoin() +method instead of enable(): +it achieves the result, but does not call OnEnable +method. +
NOTE: -in the event enable() method is called inside the OnEnable callback -method (thus basically creating indefinte loop), TaskScheduler will -only call OnEnable once (thus protecting the Task against OnEnable -infinite loop). +in the event enable() method is called inside the OnEnable +callback method (thus basically creating indefinte loop), +TaskScheduler will only call OnEnable once (thus protecting +the Task against OnEnable infinite loop).
bool enableIfNot();
-
+
+bool enableIfNot();
+
+
Enables the task only if it was previously disabled. Returns previous enable @@ -1164,6 +1186,9 @@ forceNextIteration();
Schedules the task for execution during immediate next scheduling pass.
+The +Task must be already enabled prior to this method. +
Note: @@ -1240,8 +1265,10 @@ dynamic control of task execution parameters in one method call.
Note: OnEnable and OnDisable parameters can be omitted. In that case -they will be assigned to NULL and respective methods will no longer -be called. +they will be assigned to NULL and respective methods will no +longer be called. Therefore it is advisable to use either all five +parameters explicitly, or employ individual “setter” methods +below instead.
Note: Next +
NOTE: Next execution time calculation takes place after the callback method is called, so new interval will be used immediately by the scheduler. For the situations when one task is changing the interval parameter for the other, setInterval method calls delay explicitly to guarantee schedule change, however it does not enable the task if task is disabled.
-Note: Tasks that +
NOTE: Tasks that ran through all their allocated iterations are disabled. SetIterations() method DOES NOT enable the task. Either enable explicitly, or use restart methods.
+Please note that as a +result execution of the taks is delayed +by the provided interval. If immediate invocation is required, call +forceNextIteration() +method after setting a new interval. +
STATUS REQUEST @@ -1569,8 +1602,36 @@ task being enabled or disabled. one scheduling pass, including end-of-pass sleep. This method is typically placed inside the loop() method of the sketch. Since execute exits after every pass, you can put additional -statements after execute inside the loop() +statements after execute inside the loop().
+Generally, +execute will perform the following steps:
+Ignore + task completely if it is disabled.
+Disable + task if it ran out of iterations (calling OnDesable, if necessary).
+Check + if task is waiting on a StatusRequest object, and make appropriate + scheduling arrangements
+Perform + necessary timing calculations (including millis() rollover fix, if + requested)
+Invoke + task's callback method, if it is time to do so, and one is provided. + +
+Put + microcontroller to sleep (if requested and supported) if none of the + tasks were invoked. +
+
Please +NOTE: schedule-related +calculations are performed prior to task's callback method +invocation. This allows tasks to manipulate their runtime parameters +(like execution interval) directly.
bool isOverrun()
@@ -2749,7 +2810,7 @@ time examples of TaskScheduler are available here: