23 if (num_tasks_ < MAX_TASKS) {
24 tasks_[num_tasks_].task_func = task_func;
25 tasks_[num_tasks_].interval = interval_sec;
26 tasks_[num_tasks_].last_execution_time = 0;
35 for (
int i = 0; i < num_tasks_; i++) {
36 if (current_time - tasks_[i].last_execution_time >= tasks_[i].interval) {
37 tasks_[i].last_execution_time = current_time;
38 tasks_[i].task_func();
47 timer_.
begin(timer_sync_interval_ms);
void begin(long int timer_sync_interval_ms=600000)
initialise timer
void run()
This needs to be run in the loop function continuously. Best practice is to have a loop function that...
void create_task(void(*task_func)(), unsigned long interval_sec)
Create a task.
void begin(long int sync_interval_ms=600000)
initialise the timer, set a sync interval to sync with NTP server
time_t get_epoch_time()
Get the seconds since epoch now.