From aac562fce664ef1c951b2ea9673358189671c310 Mon Sep 17 00:00:00 2001 From: knutella Date: Thu, 2 Nov 2017 08:40:54 -0700 Subject: [PATCH] Update HiGrowEsp32.ino Changed esp_sleep_enable_timer_wakeup to fix issue #1 and also added LL (long long) to uS_TO_S_FACTOR to fix an issues where times longer than 30 minutes (like 3600 seconds) would overflow the counter. --- HiGrowEsp32/HiGrowEsp32.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HiGrowEsp32/HiGrowEsp32.ino b/HiGrowEsp32/HiGrowEsp32.ino index 5df3e07..53f2301 100644 --- a/HiGrowEsp32/HiGrowEsp32.ino +++ b/HiGrowEsp32/HiGrowEsp32.ino @@ -6,7 +6,7 @@ //#define DHTTYPE DHT11 // DHT 11 //#define DHTTYPE DHT21 // DHT 21 (AM2301) #define DHTTYPE DHT11 // DHT 22 (AM2302), AM2321 -#define uS_TO_S_FACTOR 1000000 +#define uS_TO_S_FACTOR 1000000LL unsigned long now; int DEEPSLEEP_SECONDS = 1800; @@ -72,7 +72,7 @@ void loop() { http.addHeader("Content-Type", "application/json"); int httpResponseCode = http.POST(body); Serial.println(httpResponseCode); - esp_deep_sleep_enable_timer_wakeup(DEEPSLEEP_SECONDS * uS_TO_S_FACTOR); + esp_sleep_enable_timer_wakeup(DEEPSLEEP_SECONDS * uS_TO_S_FACTOR); esp_deep_sleep_start(); }