MistyGro API
C++ API for MistyGro's ESP32 controller based on the Arduino framework
|
A scheduler for running tasks on the controller, minimum time between events is 1 second based off the ntp timer. Also depends how slow is the loop function. More...
#include <scheduler.h>
Public Member Functions | |
Scheduler () | |
void | create_task (void(*task_func)(), unsigned long interval_sec) |
Create a task. More... | |
void | run () |
This needs to be run in the loop function continuously. Best practice is to have a loop function that only runs the run() method of this scheduler. More... | |
void | begin (long int timer_sync_interval_ms=600000) |
initialise timer More... | |
A scheduler for running tasks on the controller, minimum time between events is 1 second based off the ntp timer. Also depends how slow is the loop function.
Maximum 10 tasks can be added, increase in the header file (MAX_TASKS) if required but beware of exhausting the heap
Definition at line 33 of file scheduler.h.
Scheduler::Scheduler | ( | ) |
Definition at line 19 of file scheduler.cpp.
void Scheduler::begin | ( | long int | timer_sync_interval_ms = 600000 | ) |
initialise timer
timer_sync_interval_ms | time interval in milliseconds to sync the internal ntp clock |
Definition at line 45 of file scheduler.cpp.
void Scheduler::create_task | ( | void(*)() | task_func, |
unsigned long | interval_sec | ||
) |
Create a task.
task_func | a task function that takes no input and has void output |
interval_sec |
Definition at line 21 of file scheduler.cpp.
void Scheduler::run | ( | ) |
This needs to be run in the loop function continuously. Best practice is to have a loop function that only runs the run() method of this scheduler.
Definition at line 31 of file scheduler.cpp.