Keep created Tasks even after DeepSleep

Kazuya91
Posts: 27
Joined: Wed Aug 23, 2017 11:33 am

Keep created Tasks even after DeepSleep

Postby Kazuya91 » Thu Jan 04, 2018 2:24 pm

I was wondering if there is a possible way to keep the created Tasks (with xTaskCreate) even after DeepSleep.

I have a routine of functions which are always doing the same in the exact same order. In my current code, the ESP32 creates the Tasks, starts with the first one, uses xTaskNotfiy to start the second one and so on... and after the last task is finished my ESP32 deletes all Tasks with vTaskDelete("Handle of the Task") and goes into the deep sleep mode. After DeepSleep, when he is awake again, he creates the tasks again which he created before. In my opinion this is not efficient.

So my question is: Is there a way to create the Tasks just once at a cold start, then keep it even after deepsleep so I dont need to create them again?

Is there also a difference between vTaskDelete(NULL) and vTaskDelete("Handle of the Task")? Is vTaskDelete(NULL) just exiting the calling task or does it really delete the calling Task?

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Keep created Tasks even after DeepSleep

Postby WiFive » Thu Jan 04, 2018 7:26 pm

No because deepsleep will power off the ram and the information will be lost. A hibernate mode is interesting to consider but not sure it would be worthwhile to implement.

Kazuya91
Posts: 27
Joined: Wed Aug 23, 2017 11:33 am

Re: Keep created Tasks even after DeepSleep

Postby Kazuya91 » Fri Jan 05, 2018 3:21 pm

Too bad, thought it is possible since it is possible to save Attributes even after DeepSleep with RTC_DATA_ATTR. Thanks for the reply.

Who is online

Users browsing this forum: No registered users and 123 guests