Skip to content

Commit 1184cda

Browse files
author
Felix Queisler
committed
Updated Readme to explain Overflow compensation.
1 parent 9440e0c commit 1184cda

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
# arduino-timer
2-
Non-blocking abstracted timer library for use instead of the blocking delay() function.
2+
Non-blocking abstracted timer library for use instead of the blocking `delay()` function.
33

44
## How to use
55
...
6+
7+
8+
### Optional: Overflow Compensation
9+
By using `timer.start(0, true)` (only change from 0 if you want to set a custom
10+
starting point) you can activate overflow compensation which can recover over 2
11+
timer intervals to an expected rythm if some blocking code took longer than one
12+
timer interval.
13+
14+
**Rythm example with 1000ms Timers:**
15+
16+
``` NO COMPENSATION
17+
┌──┐ ┌───┐ ┌──┐ ┌───────────┐┌─┐ ┌─┐
18+
│ │ │ │ │ │ │ ││ │ │ │
19+
─┴──┴────┴───┴───┴──┴────┴───────────┴┴─┴─────┴─┴────▶
20+
0 1 2 3 4 5 6 Seconds
21+
┌─────┐ ┌─────┐ ┌─────┐ ┌──────────┐ ┌─────┐ ┌─────┐
22+
└─────┘ └─────┘ └─────┘ └──────────┘ └─────┘ └─────┘
23+
```
24+
25+
``` COMPENSATING (recovers to expected rythm)
26+
┌──┐ ┌───┐ ┌──┐ ┌──────────┐┌─┐ ┌───┐ ┌─┐
27+
│ │ │ │ │ │ │ ││ │ │ │ │ │
28+
─┴──┴────┴───┴───┴──┴────┴──────────┴┴─┴─┴───┴───┴─┴▶
29+
0 1 2 3 4 5 6 Seconds
30+
┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐
31+
└─────┘ └─────┘ └─────┘ └─────┘ └─────┘ └─────┘ └─────┘
32+
```

0 commit comments

Comments
 (0)