MistyGro API
C++ API for MistyGro's ESP32 controller based on the Arduino framework
Classes | Public Member Functions | List of all members
Scheduler Class Reference

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Scheduler()

Scheduler::Scheduler ( )

Definition at line 19 of file scheduler.cpp.

Member Function Documentation

◆ begin()

void Scheduler::begin ( long int  timer_sync_interval_ms = 600000)

initialise timer

Parameters
timer_sync_interval_mstime interval in milliseconds to sync the internal ntp clock

Definition at line 45 of file scheduler.cpp.

◆ create_task()

void Scheduler::create_task ( void(*)()  task_func,
unsigned long  interval_sec 
)

Create a task.

Parameters
task_funca task function that takes no input and has void output
interval_sec

Definition at line 21 of file scheduler.cpp.

◆ run()

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.


The documentation for this class was generated from the following files: