mirror of
https://github.com/Xinyuan-LilyGO/TTGO_TWatch_Library.git
synced 2026-02-20 01:21:25 +01:00
Update Epaper_Badge example
This commit is contained in:
@@ -515,6 +515,7 @@ void drawBitmap(const char *filename, int16_t x, int16_t y, bool with_color)
|
||||
}
|
||||
}
|
||||
|
||||
static bool page = false;
|
||||
|
||||
void setup()
|
||||
{
|
||||
@@ -536,8 +537,10 @@ void setup()
|
||||
|
||||
twatch->begin();
|
||||
|
||||
#ifdef LILYGO_WATCH_HAS_BACKLIGHT
|
||||
// Turn on the backlight
|
||||
twatch->openBL();
|
||||
#endif
|
||||
|
||||
rtc = twatch->rtc;
|
||||
|
||||
@@ -569,7 +572,6 @@ void setup()
|
||||
|
||||
btn->setPressedHandler([]() {
|
||||
|
||||
static bool page = false;
|
||||
if (!page) {
|
||||
showQrPage();
|
||||
} else {
|
||||
@@ -578,8 +580,10 @@ void setup()
|
||||
page = !page;
|
||||
});
|
||||
|
||||
#ifdef LILYGO_WATCH_HAS_BACKLIGHT
|
||||
// Adjust the backlight to reduce current consumption
|
||||
twatch->setBrightness(DEFAULT_BRIGHTNESS);
|
||||
#endif
|
||||
|
||||
if (!loadBadgeInfo(&info)) {
|
||||
loadDefaultInfo();
|
||||
@@ -594,12 +598,24 @@ void setup()
|
||||
|
||||
void loop()
|
||||
{
|
||||
#ifdef LILYGO_WATCH_HAS_TOUCH
|
||||
if (twatch->touched()) {
|
||||
if (!page) {
|
||||
showQrPage();
|
||||
} else {
|
||||
showMianPage();
|
||||
}
|
||||
page = !page;
|
||||
}
|
||||
#endif
|
||||
if (pwIRQ) {
|
||||
pwIRQ = false;
|
||||
// Get interrupt status
|
||||
power->readIRQ();
|
||||
if (power->isPEKShortPressIRQ()) {
|
||||
#ifdef LILYGO_WATCH_HAS_BACKLIGHT
|
||||
twatch->bl->isOn() ? twatch->bl->off() : twatch->bl->adjust(DEFAULT_BRIGHTNESS);
|
||||
#endif
|
||||
}
|
||||
// After the interruption, you need to manually clear the interruption status
|
||||
power->clearIRQ();
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
// => Function select
|
||||
#define LILYGO_EINK_GDEH0154D67_BL //It is electronic paper with backlight
|
||||
// #define LILYGO_EINK_GDEH0154D67_TP //It is electronic paper with touchscreen
|
||||
|
||||
// #define LILYGO_EINK_GDEP015OC1 //Single electronic paper, no backlight, no touch
|
||||
#include <LilyGoWatch.h>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user