From 04126ce5f632ca4049f957c3651bf5394dfddd16 Mon Sep 17 00:00:00 2001 From: Daniel Ansorregui Date: Wed, 3 Aug 2022 18:20:44 +0100 Subject: [PATCH] Tentative fixes for 2.0.3+ * Found that the Resets were caused by the timer wakeup being set * Also, some pins will crash the device if we access them. Maybe they were protected in 2.0.2 and now they are not. --- src/Watchy.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Watchy.cpp b/src/Watchy.cpp index 98e94e3..f0f0e53 100644 --- a/src/Watchy.cpp +++ b/src/Watchy.cpp @@ -52,10 +52,16 @@ void Watchy::displayBusyCallback(const void *) { void Watchy::deepSleep() { display.hibernate(); + if (displayFullInit) // For some reason, seems to be enabled on first boot + esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER); displayFullInit = false; // Notify not to init it again RTC.clearAlarm(); // resets the alarm flag in the RTC - // Set pins 0-39 to input to avoid power leaking out - for (int i = 0; i < 40; i++) { + + // Set GPIOs 0-39 to input to avoid power leaking out + const uint64_t ignore = 0b11110001000000110000100111000010; // Ignore some GPIOs due to resets + for (int i = 0; i < GPIO_NUM_MAX; i++) { + if ((ignore >> i) & 0b1) + continue; pinMode(i, INPUT); } esp_sleep_enable_ext0_wakeup((gpio_num_t)RTC_INT_PIN,