mirror of https://github.com/sqfmi/Watchy.git
Merge pull request #190 from shtrom/feature/exit-inactive-menu
Exit menu after some inactive timepull/188/head^2
commit
6e41b9c982
|
@ -12,6 +12,7 @@ RTC_DATA_ATTR bool BLE_CONFIGURED;
|
||||||
RTC_DATA_ATTR weatherData currentWeather;
|
RTC_DATA_ATTR weatherData currentWeather;
|
||||||
RTC_DATA_ATTR int weatherIntervalCounter = -1;
|
RTC_DATA_ATTR int weatherIntervalCounter = -1;
|
||||||
RTC_DATA_ATTR bool displayFullInit = true;
|
RTC_DATA_ATTR bool displayFullInit = true;
|
||||||
|
RTC_DATA_ATTR bool alreadyInMenu = true;
|
||||||
|
|
||||||
void Watchy::init(String datetime) {
|
void Watchy::init(String datetime) {
|
||||||
esp_sleep_wakeup_cause_t wakeup_reason;
|
esp_sleep_wakeup_cause_t wakeup_reason;
|
||||||
|
@ -27,8 +28,9 @@ 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
|
||||||
if (guiState == WATCHFACE_STATE) {
|
|
||||||
RTC.read(currentTime);
|
RTC.read(currentTime);
|
||||||
|
switch (guiState) {
|
||||||
|
case WATCHFACE_STATE:
|
||||||
showWatchFace(true); // partial updates on tick
|
showWatchFace(true); // partial updates on tick
|
||||||
if (settings.vibrateOClock) {
|
if (settings.vibrateOClock) {
|
||||||
if (currentTime.Minute == 0) {
|
if (currentTime.Minute == 0) {
|
||||||
|
@ -36,6 +38,16 @@ void Watchy::init(String datetime) {
|
||||||
vibMotor(75, 4);
|
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;
|
break;
|
||||||
case ESP_SLEEP_WAKEUP_EXT1: // button Press
|
case ESP_SLEEP_WAKEUP_EXT1: // button Press
|
||||||
|
@ -264,6 +276,7 @@ void Watchy::showMenu(byte menuIndex, bool partialRefresh) {
|
||||||
display.display(partialRefresh);
|
display.display(partialRefresh);
|
||||||
|
|
||||||
guiState = MAIN_MENU_STATE;
|
guiState = MAIN_MENU_STATE;
|
||||||
|
alreadyInMenu = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Watchy::showFastMenu(byte menuIndex) {
|
void Watchy::showFastMenu(byte menuIndex) {
|
||||||
|
|
Loading…
Reference in New Issue