Merge pull request #190 from shtrom/feature/exit-inactive-menu

Exit menu after some inactive time
pull/188/head^2
SQFMI 2022-12-26 12:07:11 -05:00 committed by GitHub
commit 6e41b9c982
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 2 deletions

View File

@ -12,6 +12,7 @@ RTC_DATA_ATTR bool BLE_CONFIGURED;
RTC_DATA_ATTR weatherData currentWeather;
RTC_DATA_ATTR int weatherIntervalCounter = -1;
RTC_DATA_ATTR bool displayFullInit = true;
RTC_DATA_ATTR bool alreadyInMenu = true;
void Watchy::init(String datetime) {
esp_sleep_wakeup_cause_t wakeup_reason;
@ -27,8 +28,9 @@ void Watchy::init(String datetime) {
switch (wakeup_reason) {
case ESP_SLEEP_WAKEUP_EXT0: // RTC Alarm
if (guiState == WATCHFACE_STATE) {
RTC.read(currentTime);
RTC.read(currentTime);
switch (guiState) {
case WATCHFACE_STATE:
showWatchFace(true); // partial updates on tick
if (settings.vibrateOClock) {
if (currentTime.Minute == 0) {
@ -36,6 +38,16 @@ void Watchy::init(String datetime) {
vibMotor(75, 4);
}
}
break;
case MAIN_MENU_STATE:
// Return to watchface if in menu for more than one tick
if (alreadyInMenu) {
guiState = WATCHFACE_STATE;
showWatchFace(false);
} else {
alreadyInMenu = true;
}
break;
}
break;
case ESP_SLEEP_WAKEUP_EXT1: // button Press
@ -264,6 +276,7 @@ void Watchy::showMenu(byte menuIndex, bool partialRefresh) {
display.display(partialRefresh);
guiState = MAIN_MENU_STATE;
alreadyInMenu = false;
}
void Watchy::showFastMenu(byte menuIndex) {