Add blank page for weather for now
All checks were successful
Compile / Compile (push) Successful in 1m21s

This commit is contained in:
Lewis Jackson 2023-06-01 04:24:49 +03:00
parent 52478ec602
commit 3e7ddb805c
4 changed files with 80 additions and 2 deletions

View file

@ -70,6 +70,30 @@ void WatchFace::HandleButtonPress(uint64_t buttonMask)
}
}
delay(10);
}
} else if (buttonMask & UP_BTN_MASK) {
m_watchFacePage = (m_watchFacePage + 1) % m_pages.size();
ShowWatchFace(true);
while (true) {
// Wait for button release
if (digitalRead(UP_BTN_PIN) == LOW){
break;
}
delay(10);
}
} else if (buttonMask & DOWN_BTN_MASK) {
m_watchFacePage = (m_watchFacePage + m_pages.size() - 1) % m_pages.size();
ShowWatchFace(true);
while (true) {
// Wait for button release
if (digitalRead(DOWN_BTN_PIN) == LOW){
break;
}
delay(10);
}
}
@ -92,7 +116,7 @@ void WatchFace::DrawWatchFace(bool partialRefresh)
return;
}
m_pages[0]->DrawPage(partialRefresh);
m_pages[m_watchFacePage]->DrawPage(partialRefresh);
}
void WatchFace::SetupVolatileMenuStuff()

View file

@ -3,6 +3,7 @@
#include "Watchy.h"
#include "Menu.h"
#include "WatchFacePages/Clock.h"
#include "WatchFacePages/Weather.h"
#include <memory>
class WatchFace : public Watchy
@ -20,7 +21,8 @@ private:
RTC_DATA_ATTR static Menu m_menu;
RTC_DATA_ATTR static uint8_t m_watchFacePage;
std::vector<std::shared_ptr<WatchFacePages::Page>> m_pages = {
std::make_shared<WatchFacePages::Clock>(m_display, m_features)
std::make_shared<WatchFacePages::Clock>(m_display, m_features),
std::make_shared<WatchFacePages::Weather>(m_display, m_features)
};
void SetupVolatileMenuStuff();

View file

@ -0,0 +1,26 @@
#include "Weather.h"
#include "../SevenSegment.h"
#include "../Icons.h"
#include <Fonts/FreeSans9pt7b.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>
WatchFacePages::Weather::Weather(WatchyDisplay & display, WatchFeatures::WatchFeatures & features)
: m_display(display), m_features(features)
{
}
void WatchFacePages::Weather::InitBoot()
{
}
void WatchFacePages::Weather::InitWake()
{
}
void WatchFacePages::Weather::DrawPage(bool partialRefresh)
{
m_display.setFullWindow();
m_display.fillScreen(GxEPD_WHITE);
m_display.display(partialRefresh);
}

View file

@ -0,0 +1,26 @@
#pragma once
#pragma once
#include "Page.h"
#include "../WatchyDisplay.h"
#include "../WatchFeatures/WatchFeatures.h"
namespace WatchFacePages
{
class Weather;
}
class WatchFacePages::Weather : public WatchFacePages::Page
{
public:
Weather(WatchyDisplay & display, WatchFeatures::WatchFeatures & features);
void InitBoot() override;
void InitWake() override;
void DrawPage(bool partialRefresh = false) override;
private:
WatchyDisplay & m_display;
WatchFeatures::WatchFeatures & m_features;
};