From 771e457427de1f7722763cdeb31f7167a289003a Mon Sep 17 00:00:00 2001 From: SQFMI Date: Thu, 21 Nov 2019 20:11:32 -0500 Subject: [PATCH] Optimized power usage with partial updates --- examples/Watchy_Button_Test/Watchy_Button_Test.ino | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/Watchy_Button_Test/Watchy_Button_Test.ino b/examples/Watchy_Button_Test/Watchy_Button_Test.ino index ce33590..635afd9 100644 --- a/examples/Watchy_Button_Test/Watchy_Button_Test.ino +++ b/examples/Watchy_Button_Test/Watchy_Button_Test.ino @@ -78,7 +78,7 @@ void handleButton() display.deepSleep(); } -void updateTime() +void updateTime(bool fullRefresh) { RTC.begin(); if(RTC.oscStopped(false)){ //check if RTC has been stopped @@ -106,7 +106,11 @@ void updateTime() display.print('0'); } display.print(currentTime.Minute); - display.update(); + if(fullRefresh){ + display.update(); + }else{ + display.updateWindow(0, 0 , GxEPD_WIDTH, GxEPD_HEIGHT, true); + } display.deepSleep(); } @@ -139,8 +143,8 @@ void detect_wakeup_reason(){ switch(wakeup_reason) { - case ESP_SLEEP_WAKEUP_EXT0: updateTime(); break; //RTC Alarm + case ESP_SLEEP_WAKEUP_EXT0: updateTime(false); break; //RTC Alarm case ESP_SLEEP_WAKEUP_EXT1: handleButton(); break; //Button Press - default: updateTime(); //Reset + default: updateTime(true); //Reset } -} \ No newline at end of file +}