|
1 | 1 | # ArduinoProcessScheduler |
2 | 2 | An Cooperative Arduino Object Oriented Cooperative Process Scheduler to Replace Them All |
3 | 3 |
|
| 4 | +## What is this? |
| 5 | +As your arduino projects get more complicated, you will begin to see the need for multitasking, or at least appear to multitask. Perhaps you want to check if a button was pressed as often as you can, but you only want to update a display once every second. Trying to do this on your own can quickly turn into overwhelming spagetti code involving `millis()`. `ArduinoProcessScheduler` seeks to simplify this. Simply create your custom Process that needs to be serviced at certain times, and let the scheduler handle the rest. |
| 6 | + |
| 7 | +## Why this one? |
| 8 | + |
| 9 | +Here are some similar popular libraries that inspired this one: |
| 10 | +- [TaskScheduler](https://github.com/arkhipenko/TaskScheduler) |
| 11 | +- [Scheduler](https://github.com/arduino-libraries/Scheduler) |
| 12 | +- [Arduino-Scheduler](https://github.com/mikaelpatel/Arduino-Scheduler) |
| 13 | + |
| 14 | +### What is wrong with them? |
| 15 | + |
| 16 | +1. They all treat processes/tasks as just callback functions. |
| 17 | + 1. Forces you to use ugly global and/or static function variables to track process state. |
| 18 | + 2. Limits you to one instance of a process, or lots of copy & paste. |
| 19 | + 3. Impossible to truly dynamically create new processes, you are really just enabling/disabling a callback function. |
| 20 | +2. Preemptive schedulers must split stack between all processes |
| 21 | + 1. With 2K or RAM and 8 processes, preemptive scheduler could at most equally give each Process 2k/8 = 256 Bytes of RAM. |
| 22 | +3. No concurrency protection (not interrupt safe) |
| 23 | + 1. What if an interrupt fires an tries to disable a process while it is running? |
| 24 | + |
| 25 | + |
4 | 26 | ## Features |
5 | | -- Fine Grained Control Over How Often a Process Runs (Periodically, Iterations, or as Often as Possible) |
| 27 | +- Control Over How Often a Process Runs (Periodically, Iterations, or as Often as Possible) |
6 | 28 | - Process Priority Levels (Easily make custom levels as well) |
7 | 29 | - Interrupt safe (add, disable, destroy, etc.. processes from interrupt routines) |
8 | | -- Process concurrency protection (Guarantees your process to be in a valid state when performing actions on it) |
| 30 | +- Process concurrency protection (Process will always be in a valid state) |
9 | 31 | - Dynamically Add/Remove and Enable/Disable Processes |
10 | | -- Easily spawn new processes from within running processes |
11 | | -- Automatic Process Monitoring Statistics (Automatically calculates % CPU time for process) |
12 | | -- Truly object oriented (a Process is no longer just a callback function like other libraries, but its own object) |
| 32 | +- Spawn new processes from within running processes |
| 33 | +- Automatic Process Monitoring Statistics (calculates % CPU time for process) |
| 34 | +- Truly object oriented (a Process is its own object) |
13 | 35 | - Exception Handling (wait what?!) |
14 | 36 | - Scheduler can automatically interrupt stuck processes |
15 | 37 |
|
16 | | -## Important Notes |
17 | | -- This is not a preemptive scheduler! However by not being one, processes get to use the entire stack when they run. |
18 | | -- This library was inspired from this [TaskScheduler](https://github.com/arkhipenko/TaskScheduler) library. |
19 | | - |
20 | 38 | ## Supported Platfroms |
21 | 39 | - AVR |
22 | 40 | - ESP8266 (No exception handling or process timeouts) |
|
0 commit comments