refactor(AGENTS.md): update docs for simplified build commands and board config

This commit is contained in:
2026-02-22 03:19:05 -08:00
parent 72636f9ecf
commit 4030048401
5 changed files with 230 additions and 409 deletions

View File

@@ -194,6 +194,15 @@ TouchEvent DisplayDriverGFX::readTouch() {
int32_t x, y;
bool pressed = _gfx->getTouch(&x, &y);
// Filter out invalid coordinates (touch panel can return garbage on release)
// Ignore both press and release transitions when coordinates are out of bounds
bool validCoords = !(x < 0 || x > DISP_W || y < 0 || y > DISP_H);
if(!validCoords) {
pressed = false;
// Don't update _lastTouch.pressed - keep previous state to avoid false release
return evt;
}
// Debounce: ignore repeated press events within debounce window after release
unsigned long now = millis();
if(pressed && _touchBounced) {
@@ -330,6 +339,13 @@ void DisplayDriverGFX::render(const ScreenState& state) {
_needsRedraw = false;
}
break;
case ScreenID::STATUS:
if(_needsRedraw) {
drawStatus(state);
_needsRedraw = false;
}
break;
}
}
@@ -429,11 +445,13 @@ void DisplayDriverGFX::drawDashboard(const ScreenState& state) {
// Get tile layouts from library helper
int tileCount = display.calculateDashboardLayouts(STYLE_HEADER_HEIGHT, STYLE_TILE_GAP);
display.setHeaderHeight(STYLE_HEADER_HEIGHT);
const TileLayout* layouts = display.getTileLayouts();
const char* tileLabels[] = { "1", "2", "3", "4", "5", "6", "7", "8" };
const char* tileLabels[] = { "Alert", "Silent", "Status", "Reboot" };
const uint16_t tileColors[] = { 0x0280, 0x0400, 0x0440, 0x0100 };
for(int i = 0; i < tileCount && i < 8; i++) {
for(int i = 0; i < tileCount && i < 4; i++) {
const TileLayout& lay = layouts[i];
int x = lay.x;
int y = lay.y;
@@ -441,7 +459,7 @@ void DisplayDriverGFX::drawDashboard(const ScreenState& state) {
int h = lay.h;
// Tile background
_gfx->fillRoundRect(x, y, w, h, STYLE_TILE_RADIUS, 0x0220);
_gfx->fillRoundRect(x, y, w, h, STYLE_TILE_RADIUS, tileColors[i]);
// Tile border
_gfx->drawRoundRect(x, y, w, h, STYLE_TILE_RADIUS, STYLE_COLOR_FG);
@@ -449,11 +467,114 @@ void DisplayDriverGFX::drawDashboard(const ScreenState& state) {
// Tile label
_gfx->setTextColor(STYLE_COLOR_FG);
setBodyFont();
_gfx->setCursor(x + w / 2 - 30, y + h / 2 - 10);
int textLen = strlen(tileLabels[i]);
int textW = textLen * 14;
_gfx->setCursor(x + w / 2 - textW / 2, y + h / 2 - 10);
_gfx->print(tileLabels[i]);
}
}
void DisplayDriverGFX::drawStatus(const ScreenState& st) {
_gfx->fillScreen(STYLE_COLOR_BG);
// Header with title and back button
_gfx->fillRect(0, 0, DISP_W, STYLE_HEADER_HEIGHT, STYLE_COLOR_HEADER);
Layout header = Layout::header(DISP_W, STYLE_HEADER_HEIGHT);
Layout safeText = header.padded(STYLE_SPACING_X);
setTitleFont();
_gfx->setTextColor(STYLE_COLOR_FG);
_gfx->setCursor(safeText.x, safeText.y + 4);
_gfx->print("STATUS");
// Back button in lower-right
setLabelFont();
_gfx->setCursor(DISP_W - 60, DISP_H - 20);
_gfx->print("[BACK]");
// Status items in 2-column layout
setBodyFont();
int colWidth = DISP_W / 2;
int startY = STYLE_HEADER_HEIGHT + 30;
int rowHeight = 35;
int labelX = STYLE_SPACING_X + 10;
int valueX = STYLE_SPACING_X + 120;
// Column 1
int y = startY;
// WiFi SSID
_gfx->setTextColor(0x8888);
_gfx->setCursor(labelX, y);
_gfx->print("WiFi:");
_gfx->setTextColor(STYLE_COLOR_FG);
_gfx->setCursor(valueX, y);
_gfx->print(st.wifiSsid.length() > 0 ? st.wifiSsid.c_str() : "N/A");
// RSSI
y += rowHeight;
_gfx->setTextColor(0x8888);
_gfx->setCursor(labelX, y);
_gfx->print("Signal:");
_gfx->setTextColor(STYLE_COLOR_FG);
_gfx->setCursor(valueX, y);
_gfx->printf("%d dBm", st.wifiRssi);
// IP Address
y += rowHeight;
_gfx->setTextColor(0x8888);
_gfx->setCursor(labelX, y);
_gfx->print("IP:");
_gfx->setTextColor(STYLE_COLOR_FG);
_gfx->setCursor(valueX, y);
_gfx->print(st.ipAddr.length() > 0 ? st.ipAddr.c_str() : "N/A");
// Column 2
y = startY;
// Uptime
uint32_t upSec = st.uptimeMs / 1000;
uint32_t upMin = upSec / 60;
uint32_t upHr = upMin / 60;
upSec = upSec % 60;
upMin = upMin % 60;
_gfx->setTextColor(0x8888);
_gfx->setCursor(colWidth + labelX, y);
_gfx->print("Uptime:");
_gfx->setTextColor(STYLE_COLOR_FG);
_gfx->setCursor(colWidth + valueX, y);
_gfx->printf("%02lu:%02lu:%02lu", upHr, upMin, upSec);
// Heap
y += rowHeight;
_gfx->setTextColor(0x8888);
_gfx->setCursor(colWidth + labelX, y);
_gfx->print("Heap:");
_gfx->setTextColor(STYLE_COLOR_FG);
_gfx->setCursor(colWidth + valueX, y);
_gfx->printf("%d KB", ESP.getFreeHeap() / 1024);
// Last Poll
y += rowHeight;
_gfx->setTextColor(0x8888);
_gfx->setCursor(colWidth + labelX, y);
_gfx->print("Last Poll:");
_gfx->setTextColor(STYLE_COLOR_FG);
_gfx->setCursor(colWidth + valueX, y);
uint32_t pollAgo = (millis() - st.lastPollMs) / 1000;
if(pollAgo < 60) {
_gfx->printf("%lu sec", pollAgo);
} else {
_gfx->printf("%lu min", pollAgo / 60);
}
// Footer with firmware version
setLabelFont();
_gfx->setTextColor(0x6666);
_gfx->setCursor(STYLE_SPACING_X, DISP_H - STYLE_SPACING_Y);
_gfx->print("v" FW_VERSION);
}
void DisplayDriverGFX::drawDebugTouch(int x, int y) {
if(!_gfx)
return;