Skip to content

Commit

Permalink
Update HiGrowEsp32.ino
Browse files Browse the repository at this point in the history
Changed esp_sleep_enable_timer_wakeup to fix issue lucafabbri#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.
  • Loading branch information
VegasIOT authored Nov 2, 2017
1 parent 3c35538 commit aac562f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions HiGrowEsp32/HiGrowEsp32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

}
Expand Down

0 comments on commit aac562f

Please sign in to comment.