refactor(display): extract dashboard tile grid logic to DisplayManager
This commit is contained in:
@@ -96,6 +96,22 @@ int DisplayDriverGFX::dashboardTouch(int x, int y) {
|
||||
return row * cols + col;
|
||||
}
|
||||
|
||||
void DisplayDriverGFX::drawTileAt(int x, int y, int w, int h, const char* label, uint16_t bgColor) {
|
||||
// Tile background (use fillRect - LovyanGFX may not have fillRoundRect)
|
||||
_gfx->fillRect(x, y, w, h, bgColor);
|
||||
|
||||
// Tile border
|
||||
_gfx->drawRect(x, y, w, h, 0xFFFF);
|
||||
|
||||
// Tile label
|
||||
_gfx->setTextColor(0xFFFF);
|
||||
_gfx->setTextSize(2);
|
||||
int textLen = strlen(label);
|
||||
int textW = textLen * 12;
|
||||
_gfx->setCursor(x + w/2 - textW/2, y + h/2 - 10);
|
||||
_gfx->print(label);
|
||||
}
|
||||
|
||||
HoldState DisplayDriverGFX::updateHold(unsigned long holdMs) {
|
||||
HoldState state;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user