initial builds, standalone and ble twatch s3 plus

This commit is contained in:
pelgraine
2026-06-26 19:28:24 +10:00
parent 7005bd065e
commit b80184cf96
18 changed files with 1007 additions and 18 deletions
+14 -2
View File
@@ -56,16 +56,28 @@ void LGFXDisplay::setColor(Color c) {
_color = TFT_WHITE;
break;
case RED:
#if defined(LILYGO_TWATCH_S3_PLUS)
_color = 0x7BEF; // dark grey -- the watch UI uses a grey/white/black palette
#else
_color = TFT_RED;
#endif
break;
case GREEN:
#if defined(LILYGO_TWATCH_S3_PLUS)
_color = 0xC618; // light grey
#else
_color = TFT_GREEN;
#endif
break;
case BLUE:
_color = TFT_BLUE;
break;
case YELLOW:
#if defined(LILYGO_TWATCH_S3_PLUS)
_color = TFT_WHITE;
#else
_color = TFT_YELLOW;
#endif
break;
case ORANGE:
_color = TFT_ORANGE;
@@ -113,7 +125,7 @@ void LGFXDisplay::endFrame() {
bool LGFXDisplay::getTouch(int *x, int *y) {
lgfx::v1::touch_point_t point;
display->getTouch(&point);
if (!display->getTouch(&point)) return false;
if (UI_ZOOM != 1) {
*x = point.x / UI_ZOOM;
*y = point.y / UI_ZOOM;
@@ -121,5 +133,5 @@ bool LGFXDisplay::getTouch(int *x, int *y) {
*x = point.x;
*y = point.y;
}
return (*x >= 0) && (*y >= 0);
return true;
}
+21 -1
View File
@@ -28,6 +28,26 @@ public:
void startFrame(Color bkg = DARK) override;
void setTextSize(int sz) override;
void setColor(Color c) override;
#if defined(LILYGO_TWATCH_S3_PLUS)
// Set an exact RGB565 colour, bypassing the Color enum + watch grey remap.
// Used by the watch P4-style tile grid for per-tile border/fill colours.
void setRawColor(uint16_t c) { _color = c; }
// Rounded-rect helpers for the P4-style tile grid (LovyanGFX buffer).
void fillRoundRect(int x, int y, int w, int h, int r) { buffer.fillRoundRect(x, y, w, h, r, _color); }
void drawRoundRect(int x, int y, int w, int h, int r) { buffer.drawRoundRect(x, y, w, h, r, _color); }
// Render a string in a very small font at (x,y) so long node names fit
// beside the centred clock, then restore the default GLCD font + size so
// later text is unaffected. Uses the colour set via setColor()/setRawColor().
void printSmallFont(int x, int y, const char* str) {
buffer.setFont(&fonts::TomThumb);
buffer.setTextColor(_color);
buffer.setTextSize(1);
buffer.setCursor(x, y);
buffer.print(str);
buffer.setFont(&fonts::Font0); // restore default 6x8 GLCD font
buffer.setTextSize(1);
}
#endif
void setCursor(int x, int y) override;
void print(const char* str) override;
void fillRect(int x, int y, int w, int h) override;
@@ -36,4 +56,4 @@ public:
uint16_t getTextWidth(const char* str) override;
void endFrame() override;
virtual bool getTouch(int *x, int *y);
};
};