@@ -28,6 +28,11 @@ functions so HTML/JavaScript programmers will feel right at home.
28
28
For the unfamiliar with JavaScript there's a short example code included that
29
29
illustrates the whole API and its best usage.
30
30
31
+ ChangeLog
32
+ ---------
33
+ * version 1.1 adds clear example of DS18B20 handling
34
+ * version 1.2 adds optional priorities when defining tasks
35
+
31
36
How to use
32
37
----------
33
38
@@ -49,17 +54,17 @@ Tasker API
49
54
Tasker tasker (FALSE); // creates non-prioritizing tasker
50
55
```
51
56
52
- * <code>setTimeout(function_name, time_in_milliseconds [, optional_int])</code>
57
+ * <code>setTimeout(function_name, time_in_milliseconds [, optional_int [, optional_priority] ])</code>
53
58
Tasker will call the *function_name* in *time_in_milliseconds* from now.
54
59
It will run the function only once. May pass the *optional_int* parameter into the called function.
55
60
When the task finishes its Tasker slot is made available for new tasks (more about slots later).
56
61
57
- * <code>setInterval(function_name, time_in_milliseconds [, optional_int])</code>
62
+ * <code>setInterval(function_name, time_in_milliseconds [, optional_int [, optional_priority] ])</code>
58
63
Tasker will call the *function_name* repeatedly and forever, every
59
64
*time_in_milliseconds* from now on.
60
65
May pass the *optional_int* parameter into the called function.
61
66
62
- * <code>setRepeated(function_name, time, number_of_repeats [, optional_int])</code>
67
+ * <code>setRepeated(function_name, time, number_of_repeats [, optional_int [, optional_priority] ])</code>
63
68
Tasker will call the *function_name* repeatedly for *number_of_repeats*,
64
69
every *time* (in_milliseconds) from now on.
65
70
May pass the <code>optional_int</code> parameter into the called function.
@@ -99,22 +104,22 @@ Task priorities
99
104
---------------
100
105
If the Tasker constructor was not called with a FALSE flag then the internal
101
106
scheduler will prioritize the tasks in its queue. Tasks added later have lower
102
- priority than those added earlier. Thus you'll want to add your more
103
- important tasks first and the less important ones add afterwards .
107
+ priority than those added earlier, unless you specify their priority with
108
+ optional parameter: the lower its value the higher priority, 0 = highest priority .
104
109
105
110
```cpp
106
111
Tasker tasker;
107
112
tasker.setInterval(most_important_fn, ..);
108
113
tasker.setInterval(less_important_fn, ..);
109
- tasker.setInterval(least_important_fn , ..);
114
+ tasker.setInterval(highest_priority_fn , .., .., 0 );
110
115
```
111
116
112
117
Normally, when there is enough time for calling each of the scheduled task
113
118
at the right time the priorities don't play any role but when a previous task takes
114
119
longer time and the scheduler detects that certain tasks are delayed
115
120
(are behind their schedule) it needs to decide which task will get run of those
116
121
that should have been run already. And that's where the tasks' priorities step
117
- in: the task added earlier (= with a higher priority) will be chosen.
122
+ in: the task added earlier or with a higher priority will be chosen.
118
123
If the priorities were disabled then the scheduler would simply run the next task
119
124
in its queue. If all your tasks are equally important you might want to disable
120
125
the priorities by passing FALSE into the constructor:
@@ -158,8 +163,10 @@ as the first instruction in your task function:
158
163
I consider this library finished and stable for everyday use. Adding more features
159
164
is not expected, the library will stay short, simple and fast.
160
165
161
- Enjoy
162
-
166
+ Author
167
+ ------
163
168
Petr Stehlík
164
169
165
- http://joysfera.blogspot.com/ with link to my G+ profile and contact information.
170
+
171
+ http://joysfera.blogspot.com/
172
+ https://plus.google.com/+PetrStehl%C3%ADk
0 commit comments