Moved clear alarm function

pull/120/head
SQFMI 2021-12-12 16:43:38 -05:00 committed by Andre LaFleur
parent 81ab3feb94
commit 768f681c7b
1 changed files with 9 additions and 12 deletions

View File

@ -27,7 +27,6 @@ void Watchy::init(String datetime){
switch (wakeup_reason) switch (wakeup_reason)
{ {
case ESP_SLEEP_WAKEUP_EXT0: //RTC Alarm case ESP_SLEEP_WAKEUP_EXT0: //RTC Alarm
RTC.clearAlarm(); //resets the alarm flag in the RTC
if(guiState == WATCHFACE_STATE){ if(guiState == WATCHFACE_STATE){
RTC.read(currentTime); RTC.read(currentTime);
showWatchFace(true); //partial updates on tick showWatchFace(true); //partial updates on tick
@ -53,14 +52,14 @@ void Watchy::displayBusyCallback(const void*){
} }
void Watchy::deepSleep(){ void Watchy::deepSleep(){
// Set all pins to input to avoid power leaking out RTC.clearAlarm(); //resets the alarm flag in the RTC
for(int i=0; i<48; i++) { // Set pins 0-39 to input to avoid power leaking out
pinMode(i, INPUT); 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_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_sleep_enable_ext1_wakeup(BTN_PIN_MASK, ESP_EXT1_WAKEUP_ANY_HIGH); //enable deep sleep wake on button press
esp_deep_sleep_start(); esp_deep_sleep_start();
} }
void Watchy::handleButtonPress(){ void Watchy::handleButtonPress(){
@ -100,7 +99,6 @@ void Watchy::handleButtonPress(){
//Back Button //Back Button
else if (wakeupBit & BACK_BTN_MASK){ else if (wakeupBit & BACK_BTN_MASK){
if(guiState == MAIN_MENU_STATE){//exit to watch face if already in menu 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); RTC.read(currentTime);
showWatchFace(false); showWatchFace(false);
}else if(guiState == APP_STATE){ }else if(guiState == APP_STATE){
@ -179,7 +177,6 @@ void Watchy::handleButtonPress(){
}else if(digitalRead(BACK_BTN_PIN) == 1){ }else if(digitalRead(BACK_BTN_PIN) == 1){
lastTimeout = millis(); lastTimeout = millis();
if(guiState == MAIN_MENU_STATE){//exit to watch face if already in menu 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); RTC.read(currentTime);
showWatchFace(false); showWatchFace(false);
break; //leave loop break; //leave loop
@ -896,4 +893,4 @@ void Watchy::updateFWBegin(){
// time_t t = makeTime(tm); // time_t t = makeTime(tm);
// return t + FUDGE; //add fudge factor to allow for compile time // return t + FUDGE; //add fudge factor to allow for compile time
// } // }