From 81ab3feb94b02fabc731f26fcac23ef6057f99ab Mon Sep 17 00:00:00 2001 From: Daniel Ansorregui Date: Sat, 11 Dec 2021 16:14:38 +0000 Subject: [PATCH] Set all pins to INPUT before deep sleep * Some pins otherwise are left as output And their value is kept in deep sleep This can cause power usage in deep sleep * From my measurements 0.13mA Or, 3mAh / day extra usage --- src/Watchy.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Watchy.cpp b/src/Watchy.cpp index 05ab5f8..78d1484 100644 --- a/src/Watchy.cpp +++ b/src/Watchy.cpp @@ -53,8 +53,11 @@ void Watchy::displayBusyCallback(const void*){ } void Watchy::deepSleep(){ - display.hibernate(); - displayFullInit = false; // Notify not to init it again + // Set all pins to input to avoid power leaking out + for(int i=0; i<48; i++) { + pinMode(i, INPUT); + } + esp_sleep_enable_ext0_wakeup(RTC_PIN, 0); //enable deep sleep wake on RTC interrupt esp_sleep_enable_ext1_wakeup(BTN_PIN_MASK, ESP_EXT1_WAKEUP_ANY_HIGH); //enable deep sleep wake on button press esp_deep_sleep_start();