Skip to content

Commit

Permalink
Optimized power usage with partial updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sqfmi authored Nov 22, 2019
1 parent bd8919e commit 771e457
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions examples/Watchy_Button_Test/Watchy_Button_Test.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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
}
}
}

0 comments on commit 771e457

Please sign in to comment.