Fix formatting / temporarily disable busy callback
This commit is contained in:
parent
99878ffe60
commit
e4a7be7bfb
3 changed files with 45 additions and 28 deletions
|
@ -31,6 +31,8 @@ void WatchFace::HandleButtonPress(uint64_t buttonMask)
|
|||
m_menu.Redraw(false);
|
||||
|
||||
const std::vector<int> buttons = {MENU_BTN_PIN, UP_BTN_PIN, DOWN_BTN_PIN, BACK_BTN_PIN};
|
||||
ClearBusyCallback();
|
||||
|
||||
while (m_inMenu) {
|
||||
for (int button : buttons) {
|
||||
if (digitalRead(button) == HIGH) {
|
||||
|
@ -57,6 +59,8 @@ void WatchFace::HandleButtonPress(uint64_t buttonMask)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetBusyCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ void Watchy::Init()
|
|||
|
||||
m_display.epd2.selectSPI(SPI, SPISettings(20000000, MSBFIRST, SPI_MODE0));
|
||||
m_display.init(0, g_displayFullInit, 10, true);
|
||||
m_display.epd2.setBusyCallback(DisplayBusyCallback);
|
||||
SetBusyCallback();
|
||||
|
||||
Setup();
|
||||
|
||||
|
@ -141,3 +141,13 @@ void Watchy::ShowWatchFace(bool partialRefresh)
|
|||
{
|
||||
DrawWatchFace(partialRefresh);
|
||||
}
|
||||
|
||||
void Watchy::ClearBusyCallback()
|
||||
{
|
||||
m_display.epd2.setBusyCallback(nullptr);
|
||||
}
|
||||
|
||||
void Watchy::SetBusyCallback()
|
||||
{
|
||||
m_display.epd2.setBusyCallback(DisplayBusyCallback);
|
||||
}
|
|
@ -20,13 +20,16 @@ public:
|
|||
void DisconnectWiFi();
|
||||
void ShowWatchFace(bool partialRefresh = false);
|
||||
|
||||
void ClearBusyCallback();
|
||||
void SetBusyCallback();
|
||||
|
||||
// Called after hardware is setup
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue