Experimental turbo menu handling
This commit is contained in:
parent
854dea2dc2
commit
99878ffe60
2 changed files with 29 additions and 1 deletions
|
@ -29,6 +29,34 @@ void WatchFace::HandleButtonPress(uint64_t buttonMask)
|
||||||
if (buttonMask & MENU_BTN_MASK) {
|
if (buttonMask & MENU_BTN_MASK) {
|
||||||
m_inMenu = true;
|
m_inMenu = true;
|
||||||
m_menu.Redraw(false);
|
m_menu.Redraw(false);
|
||||||
|
|
||||||
|
const std::vector<int> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,9 @@ public:
|
||||||
virtual void Setup() = 0;
|
virtual void Setup() = 0;
|
||||||
virtual void HandleButtonPress(uint64_t buttonMask) = 0;
|
virtual void HandleButtonPress(uint64_t buttonMask) = 0;
|
||||||
virtual void DrawWatchFace(bool partialRefresh = false) = 0;
|
virtual void DrawWatchFace(bool partialRefresh = false) = 0;
|
||||||
|
static void DisplayBusyCallback(const void *);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void DisplayBusyCallback(const void *);
|
|
||||||
|
|
||||||
static WatchyDisplayBase m_displayBase;
|
static WatchyDisplayBase m_displayBase;
|
||||||
static WatchyDisplay m_display;
|
static WatchyDisplay m_display;
|
||||||
|
|
Loading…
Reference in a new issue