From ec3a219448578ede38349872bcbd5cb4ec73080f Mon Sep 17 00:00:00 2001 From: Blue Fox Date: Sun, 21 Aug 2022 22:52:30 +0200 Subject: [PATCH] Fixed only sleeping for ~2 minutes because of 32bit architecture and byte truncation --- losungepaper.ino | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/losungepaper.ino b/losungepaper.ino index 96ec5e5..1b4eaf3 100755 --- a/losungepaper.ino +++ b/losungepaper.ino @@ -6,7 +6,8 @@ #define UNCOLORED 1 Epd epd; -int DEEP_SLEEP_TIME_uS = 6 * 60 * 60 * 1000 * 1000; // time to deep sleep in microseconds (not milliseconds!) +uint64_t us_s_conversion_factor = 1000*1000; // conversion factor for s to µs +uint64_t DEEP_SLEEP_TIME = 6*60*60; // time to deep sleep in microseconds (not milliseconds!) // WiFi char wiFiSSID[] = "SSID"; // SSID of your network @@ -22,7 +23,7 @@ sFONT TITLE_FONT = Font20; char TITLE_TEXT[] = "Losung heute"; sFONT TEXT_FONT = Font12; // for the daily text int TEXT_WIDTH = 168; // width of the box around the text; should be a multiple of the width of the font (eg. Font8 => multiple of 8) -int TEXT_PADDING_TOP = 40; +int TEXT_PADDING_TOP = 30; int TEXT_PADDING_BETWEEN_BLOCKS = 20; // pixels between the lines int TEXT_PADDING_BETWEEN_LINES = 1; // pixels between the lines sFONT SOURCE_FONT = Font8; // for the position in bible @@ -43,9 +44,9 @@ void setup() { showDailyText(getLosungFromHTML(html), getLehrtextFromHTML(html), getLosungSourceFromHTML(html), getLehrtextSourceFromHTML(html)); - // deep sleep for 6 hours - esp_sleep_enable_timer_wakeup(DEEP_SLEEP_TIME_uS); - Serial.printf("[ESP32] Going to deep sleep mode.\n"); + // deep sleep for DEEP_SLEEP_TIME seconds + esp_sleep_enable_timer_wakeup(DEEP_SLEEP_TIME*us_s_conversion_factor); + Serial.printf("[ESP32] Entering deep sleep mode for %ds\n", DEEP_SLEEP_TIME); esp_deep_sleep_start(); }