mirror of https://github.com/sqfmi/Watchy.git
Moved clear alarm function
parent
c6483eebe0
commit
b794d8ee79
|
@ -21,7 +21,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
|
||||
|
@ -41,13 +40,14 @@ void Watchy::init(String datetime){
|
|||
}
|
||||
|
||||
void Watchy::deepSleep(){
|
||||
// Set all pins to input to avoid power leaking out
|
||||
for(int i=0; i<48; 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();
|
||||
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();
|
||||
}
|
||||
|
||||
void Watchy::handleButtonPress(){
|
||||
|
@ -87,7 +87,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){
|
||||
|
@ -166,7 +165,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
|
||||
|
@ -910,4 +908,4 @@ void Watchy::updateFWBegin(){
|
|||
|
||||
// time_t t = makeTime(tm);
|
||||
// return t + FUDGE; //add fudge factor to allow for compile time
|
||||
// }
|
||||
// }
|
||||
|
|
Loading…
Reference in New Issue