mirror of https://github.com/sqfmi/Watchy.git
Optimized power usage with partial updates
parent
bd8919e2c0
commit
771e457427
|
@ -78,7 +78,7 @@ void handleButton()
|
||||||
display.deepSleep();
|
display.deepSleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateTime()
|
void updateTime(bool fullRefresh)
|
||||||
{
|
{
|
||||||
RTC.begin();
|
RTC.begin();
|
||||||
if(RTC.oscStopped(false)){ //check if RTC has been stopped
|
if(RTC.oscStopped(false)){ //check if RTC has been stopped
|
||||||
|
@ -106,7 +106,11 @@ void updateTime()
|
||||||
display.print('0');
|
display.print('0');
|
||||||
}
|
}
|
||||||
display.print(currentTime.Minute);
|
display.print(currentTime.Minute);
|
||||||
display.update();
|
if(fullRefresh){
|
||||||
|
display.update();
|
||||||
|
}else{
|
||||||
|
display.updateWindow(0, 0 , GxEPD_WIDTH, GxEPD_HEIGHT, true);
|
||||||
|
}
|
||||||
display.deepSleep();
|
display.deepSleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,8 +143,8 @@ void detect_wakeup_reason(){
|
||||||
|
|
||||||
switch(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
|
case ESP_SLEEP_WAKEUP_EXT1: handleButton(); break; //Button Press
|
||||||
default: updateTime(); //Reset
|
default: updateTime(true); //Reset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue