I’ve been surfing the internet looking for information on putting the esp32 into automatic light sleep while maintaining a WiFi connection. I know this has been done using the ESP-IDF (esp-idf/power_save.c at master · espressif/esp-idf · GitHub), but my entire project has already been built in arduino framework.
I came across the esp_pm.h library and was hoping to use esp_pm_configure() with auto light sleep enabled.
Has anyone had some success with this or is it simply not supported yet?
The function is also available with Arduino-ESP32 since it’s a function included from the SDK.
However, I’m not sure if FreeRTOS is configured in tickless mode, as that is needed for the light-sleep.
This issue seems to indicate that it’s not enabled, but you should double-check it by writing a firmware which outputs whether CONFIG_FREERTOS_USE_TICKLESS_IDLE is defined to a value or not.
Then again, you can try and use Arduino as ESP-IDF component to still have a configurable ESP-IDF base (in which you can then e.g. reconfigure FreeRTOS) while still compiling the Arduino core and thereby enabling your code to run without any modifications to it.
thanks for the reply, and yes the library does exist in the arduino framework, it just never seems to be happy, either ill get ESP_ERR_NOT_SUPPORTED when calling config or ill get complaints about the idle time while compiling.
Adding the configuration flags in an Arduino-only build does not enable it, because the underlying SDK (ESP-IDF) was compiled once with a sdkconfig and is linked via binary libraries. And there it was, disabled
@maxgerhardt I have been trying to use the example project espidf-arduino-blink and yes i can now use arduino APIs, however im having an issue with #include <ESPAsyncWebServer.h>.
These are the includes i added to the example project:
I have gone and tweaked the ESP-IDF Arduino blink project and have tried to implement both modem sleep and auto light sleep. I get confirmation via serial that both have indeed been enabled…yet i see no difference in power consumption. In fact no matter what i do, I cant seem to get below 45mA current draw at 3.3V