Understanding when to create tasks
Posted: Sat May 25, 2024 10:42 pm
I have an event handler attached to the IP_EVENT_STA_GOT_IP event. When it occurs, some data is exchanged over TCP and then I want the esp to run a task which periodically records and stores data from a sensor, until some other event occurs and it stops.
Should this event handler create a task which periodically records and stores data from the sensor, or should I create the task when the program starts, and then have it block itself until it's released by a task notification: Or an event group bit being raised: When the task should stop running, should I delete the task and recreate it again later when needed, or just block it somehow until it's needed again?
Out of curiosity, since Event Handlers are an esp-idf thing, what would you without them in vanilla FreeRTOS?
Should this event handler create a task which periodically records and stores data from the sensor, or should I create the task when the program starts, and then have it block itself until it's released by a task notification:
Code: Select all
ulTaskNotifyTake()
Code: Select all
xEventGroupWaitBits()
Out of curiosity, since Event Handlers are an esp-idf thing, what would you without them in vanilla FreeRTOS?