diff --git a/src/WatchFace.cpp b/src/WatchFace.cpp index c630e77..1c95345 100644 --- a/src/WatchFace.cpp +++ b/src/WatchFace.cpp @@ -29,6 +29,34 @@ void WatchFace::HandleButtonPress(uint64_t buttonMask) if (buttonMask & MENU_BTN_MASK) { m_inMenu = true; m_menu.Redraw(false); + + const std::vector buttons = {MENU_BTN_PIN, UP_BTN_PIN, DOWN_BTN_PIN, BACK_BTN_PIN}; + while (m_inMenu) { + for (int button : buttons) { + if (digitalRead(button) == HIGH) { + switch (button) { + case MENU_BTN_PIN: + m_menu.HandleButtonPress(MENU_BTN_MASK); + break; + case UP_BTN_PIN: + m_menu.HandleButtonPress(UP_BTN_MASK); + break; + case DOWN_BTN_PIN: + m_menu.HandleButtonPress(DOWN_BTN_MASK); + break; + case BACK_BTN_PIN: + m_menu.HandleButtonPress(BACK_BTN_MASK); + break; + } + + while (true) { + if (digitalRead(button) == LOW) { + break; + } + } + } + } + } } } } diff --git a/src/Watchy.h b/src/Watchy.h index 42bdbe7..065b219 100644 --- a/src/Watchy.h +++ b/src/Watchy.h @@ -24,9 +24,9 @@ public: virtual void Setup() = 0; virtual void HandleButtonPress(uint64_t buttonMask) = 0; virtual void DrawWatchFace(bool partialRefresh = false) = 0; + static void DisplayBusyCallback(const void *); protected: - static void DisplayBusyCallback(const void *); static WatchyDisplayBase m_displayBase; static WatchyDisplay m_display;