TaskScheduler icon indicating copy to clipboard operation
TaskScheduler copied to clipboard

Using esp_light_sleep_start() can break WiFi, should be configurable to use delay()/xTaskNotifyWait() instead.

Open ranma opened this issue 1 year ago • 3 comments
trafficstars

With the default of esp_light_sleep_start() I see WiFi connection problems.

Using delay() can still noticeably reduce the SoC temperature. In my limited testing, the temperature reported by CpuTemperature.read() reduced from ~58 °C to ~52 °C after enabling -D_TASK_SLEEP_ON_IDLE_RUN=1 and hacking it to use delay() instead of esp_light_sleep_start().

ranma avatar Sep 29 '24 16:09 ranma

Hi, Which version of TaskSxheduler are you running. I believe I disabled light sleep in the latest version since yes, it causes WiFi issues. Simple delay(1) (or vTaskDelay(1) ) works better.

arkhipenko avatar Sep 29 '24 18:09 arkhipenko

Which version of TaskSxheduler are you running.

The master branch: https://github.com/arkhipenko/TaskScheduler/blob/master/src/TaskSchedulerSleepMethods.h#L61

ranma avatar Sep 29 '24 20:09 ranma

Simple delay(1) (or vTaskDelay(1) ) works better.

One problem with a simple delay is that when using StatusRequest to wake from an interrupt, the delay is not interrupted.

So for ESP32 even better is to use xTaskNotifyWait() to sleep and xTaskNotify()/xTaskNotifyFromISR() to interrupt the sleep.

ranma avatar Oct 06 '24 14:10 ranma

This would be very difficult to implement. I would try FreeRTOS tickless to do something like this in combination with the TASK_TICKLESS (example to follow) Please submit a PR if you figure out how to make it work reliably

arkhipenko avatar Sep 21 '25 23:09 arkhipenko