mirror of https://github.com/sqfmi/Watchy.git
Exit menu after some inactive time
Signed-off-by: Olivier Mehani <shtrom@ssji.net>pull/190/head
parent
c5344d9d42
commit
dd3797f2d5
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue