diff --git a/platformio/src/main.cpp b/platformio/src/main.cpp index a09afc8d..50eb4b4c 100644 --- a/platformio/src/main.cpp +++ b/platformio/src/main.cpp @@ -77,7 +77,7 @@ void beginDeepSleep(unsigned long startTime, tm *timeInfo) // align wake time to nearest multiple of SLEEP_DURATION int sleepMinutes = SLEEP_DURATION - offsetMinutes; - if (offsetSeconds < 120 + if (desiredSleepSeconds - offsetSeconds < 120 || offsetSeconds / (float)desiredSleepSeconds > 0.95f) { // if we have a sleep time less than 2 minutes OR less 5% SLEEP_DURATION, // skip to next alignment @@ -101,7 +101,8 @@ void beginDeepSleep(unsigned long startTime, tm *timeInfo) } // add extra delay to compensate for esp32's with fast RTCs. - sleepDuration += 10ULL; + sleepDuration += 1ULL; + sleepDuration *= 1.0015f; #if DEBUG_LEVEL >= 1 printHeapUsage();