Merge branch 'master' into light_sleep_display

pull/116/head
SQFMI 2021-12-12 17:12:31 -05:00 committed by GitHub
commit afb2e23dea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 898 additions and 896 deletions

View File

@ -27,7 +27,6 @@ void Watchy::init(String datetime){
switch (wakeup_reason)
{
case ESP_SLEEP_WAKEUP_EXT0: //RTC Alarm
RTC.clearAlarm(); //resets the alarm flag in the RTC
if(guiState == WATCHFACE_STATE){
RTC.read(currentTime);
showWatchFace(true); //partial updates on tick
@ -55,6 +54,11 @@ void Watchy::displayBusyCallback(const void*){
void Watchy::deepSleep(){
display.hibernate();
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++) {
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();
@ -97,7 +101,6 @@ void Watchy::handleButtonPress(){
//Back Button
else if (wakeupBit & BACK_BTN_MASK){
if(guiState == MAIN_MENU_STATE){//exit to watch face if already in menu
RTC.clearAlarm(); //resets the alarm flag in the RTC
RTC.read(currentTime);
showWatchFace(false);
}else if(guiState == APP_STATE){
@ -176,7 +179,6 @@ void Watchy::handleButtonPress(){
}else if(digitalRead(BACK_BTN_PIN) == 1){
lastTimeout = millis();
if(guiState == MAIN_MENU_STATE){//exit to watch face if already in menu
RTC.clearAlarm(); //resets the alarm flag in the RTC
RTC.read(currentTime);
showWatchFace(false);
break; //leave loop