Skip to content

Commit 3fe9042

Browse files
committed
update docs
1 parent c3b908b commit 3fe9042

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ In the setup method, add an function callback that gets fired once in the future
2828

2929
```
3030
// Create a task scheduled once every 100 miliis
31-
taskid_t taskId = taskManager.scheduleOnce(100, [] {
31+
taskid_t taskId = taskManager.schedule(repeatMillis(100), [] {
3232
// some work to be done.
3333
});
3434
3535
// Create a task that's scheduled every second
36-
taskid_t taskId = taskManager.scheduleFixedRate(1, [] {
36+
taskid_t taskId = taskManager.schedule(repeatSeconds(1), [] {
3737
// work to be done.
38-
}, TIME_SECONDS);
38+
});
3939
```
4040

4141
From 1.2 onwards: On ESP8266, ESP32, all mbed boards, and most 32 bit Arduino boards you can also *enable* argument capture in lambda expressions. By default, the feature is off because it is quite a heavy feature that many may never use.
@@ -46,9 +46,9 @@ An example of this usage follows:
4646

4747
```
4848
int capturedValue = 42;
49-
taskManager.scheduleFixedRate(2, [capturedValue]() {
49+
taskManager.schedule(repeatSeconds(2), [capturedValue]() {
5050
log("Execution with captured value = ", capturedValue);
51-
}, TIME_SECONDS);
51+
});
5252
5353
```
5454

@@ -68,9 +68,18 @@ You can also create a class that extends from `Executable` and schedule that ins
6868
MyClassToSchedule myClass;
6969
7070
// Register with taskManager for once a second execution
71-
taskManager.scheduleFixedRate(1, &myClass, TIME_SECONDS);
71+
taskManager.schedule(repeatSeconds(1), &myClass);
7272
```
7373

74+
The helper time functions that can be passed as the first time parameter are:
75+
76+
* `onceMicros(N)` run once in N microseconds
77+
* `onceMillis(N)` run once in N milliseconds
78+
* `onceSeconds(N)` run once in N seconds
79+
* `repeatMicros(N)` repeatedly run in N microseconds
80+
* `repeatMillis(N)` repeatedly run in N milliseconds
81+
* `repeatSeconds(N)` repeatedly run in N seconds
82+
7483
Then in the loop method you need to call:
7584

7685
```

0 commit comments

Comments
 (0)