1

I've been having an odd issue with a new custom ESP board. I can't push deep-sleep time past 35 minutes no matter how I adjust the timing.

Below is my current pertinent code, but basically the device wakes up, reads several environmental sensors, sends them to the cloud and then turns off. I'm aiming to sleep for an hour between readings to preserve battery power.

 #include <esp_deep_sleep.h>

int SLEEP_TIME;

#define uS_TO_S_FACTOR 9e9  //Conversion factor for micro seconds to seconds
#define TIME_TO_SLEEP  9e8 //Time ESP32 will go to sleep (in seconds)

SLEEP_TIME = (uS_TO_S_FACTOR * TIME_TO_SLEEP);
esp_sleep_enable_timer_wakeup(SLEEP_TIME);

esp_deep_sleep_start();
2
  • 1
    use uint64_t instread of int. and prefix hex constants with 0x – Juraj Mar 18 at 5:50
  • @Juraj Thank you! This worked great. – Mulcch Mar 21 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.