diff --git a/src/graphics/draw/DebugRenderer.cpp b/src/graphics/draw/DebugRenderer.cpp index 36f8a9186..02a1a0bdb 100644 --- a/src/graphics/draw/DebugRenderer.cpp +++ b/src/graphics/draw/DebugRenderer.cpp @@ -399,26 +399,11 @@ void drawLoRaFocused(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, display->setTextAlignment(TEXT_ALIGN_LEFT); display->setFont(FONT_SMALL); - // === Header === - graphics::drawCommonHeader(display, x, y); - - // === Draw title (aligned with header baseline) === - const int highlightHeight = FONT_HEIGHT_SMALL - 1; - const int textY = y + 1 + (highlightHeight - FONT_HEIGHT_SMALL) / 2; + // === Set Title const char *titleStr = (SCREEN_WIDTH > 128) ? "LoRa Info" : "LoRa"; - const int centerX = x + SCREEN_WIDTH / 2; - if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) { - display->setColor(BLACK); - } - - display->setTextAlignment(TEXT_ALIGN_CENTER); - display->drawString(centerX, textY, titleStr); - if (config.display.heading_bold) { - display->drawString(centerX + 1, textY, titleStr); - } - display->setColor(WHITE); - display->setTextAlignment(TEXT_ALIGN_LEFT); + // === Header === + graphics::drawCommonHeader(display, x, y, titleStr); // === First Row: Region / BLE Name === graphics::UIRenderer::drawNodes(display, x, compactFirstLine + 3, nodeStatus, 0, true, ""); @@ -527,25 +512,11 @@ void drawMemoryUsage(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, display->setFont(FONT_SMALL); display->setTextAlignment(TEXT_ALIGN_LEFT); - // === Header === - graphics::drawCommonHeader(display, x, y); - - // === Draw title === - const int highlightHeight = FONT_HEIGHT_SMALL - 1; - const int textY = y + 1 + (highlightHeight - FONT_HEIGHT_SMALL) / 2; + // === Set Title const char *titleStr = (SCREEN_WIDTH > 128) ? "System" : "Sys"; - const int centerX = x + SCREEN_WIDTH / 2; - if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) { - display->setColor(BLACK); - } - - display->setTextAlignment(TEXT_ALIGN_CENTER); - display->drawString(centerX, textY, titleStr); - if (config.display.heading_bold) { - display->drawString(centerX + 1, textY, titleStr); - } - display->setColor(WHITE); + // === Header === + graphics::drawCommonHeader(display, x, y, titleStr); // === Layout === const int yPositions[6] = {moreCompactFirstLine, moreCompactSecondLine, moreCompactThirdLine, diff --git a/src/graphics/draw/NodeListRenderer.cpp b/src/graphics/draw/NodeListRenderer.cpp index 522e8171b..2d465fffa 100644 --- a/src/graphics/draw/NodeListRenderer.cpp +++ b/src/graphics/draw/NodeListRenderer.cpp @@ -604,27 +604,12 @@ void drawNodeInfo(OLEDDisplay *display, const OLEDDisplayUiState *state, int16_t display->clear(); - // Draw battery/time/mail header (common across screens) - graphics::drawCommonHeader(display, x, y); - - // Draw the short node name centered at the top, with bold shadow if set - const int highlightHeight = FONT_HEIGHT_SMALL - 1; - const int textY = y + 1 + (highlightHeight - FONT_HEIGHT_SMALL) / 2; - const int centerX = x + SCREEN_WIDTH / 2; + // === Set Title const char *shortName = (node->has_user && graphics::UIRenderer::haveGlyphs(node->user.short_name)) ? node->user.short_name : "Node"; - if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) - display->setColor(BLACK); - display->setTextAlignment(TEXT_ALIGN_CENTER); - display->setFont(FONT_SMALL); - display->drawString(centerX, textY, shortName); - if (config.display.heading_bold) - display->drawString(centerX + 1, textY, shortName); - - display->setColor(WHITE); - display->setTextAlignment(TEXT_ALIGN_LEFT); - display->setFont(FONT_SMALL); + // === Header === + graphics::drawCommonHeader(display, x, y, shortName); // Dynamic row stacking with predefined Y positions const int yPositions[5] = {moreCompactFirstLine, moreCompactSecondLine, moreCompactThirdLine, moreCompactFourthLine, diff --git a/src/graphics/draw/UIRenderer.cpp b/src/graphics/draw/UIRenderer.cpp index 021191f4e..c16f7c41e 100644 --- a/src/graphics/draw/UIRenderer.cpp +++ b/src/graphics/draw/UIRenderer.cpp @@ -306,25 +306,11 @@ void drawNodeInfo(OLEDDisplay *display, const OLEDDisplayUiState *state, int16_t display->clear(); - // === Draw battery/time/mail header (common across screens) === - graphics::drawCommonHeader(display, x, y); - // === Draw the short node name centered at the top, with bold shadow if set === - const int highlightHeight = FONT_HEIGHT_SMALL - 1; - const int textY = y + 1 + (highlightHeight - FONT_HEIGHT_SMALL) / 2; - const int centerX = x + SCREEN_WIDTH / 2; const char *shortName = (node->has_user && haveGlyphs(node->user.short_name)) ? node->user.short_name : "Node"; - if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) - display->setColor(BLACK); - display->setTextAlignment(TEXT_ALIGN_CENTER); - display->setFont(FONT_SMALL); - display->drawString(centerX, textY, shortName); - if (config.display.heading_bold) - display->drawString(centerX + 1, textY, shortName); - display->setColor(WHITE); - display->setTextAlignment(TEXT_ALIGN_LEFT); - display->setFont(FONT_SMALL); + // === Draw battery/time/mail header (common across screens) === + graphics::drawCommonHeader(display, x, y, shortName); // ===== DYNAMIC ROW STACKING WITH YOUR MACROS ===== // 1. Each potential info row has a macro-defined Y position (not regular increments!). @@ -569,7 +555,7 @@ void drawDeviceFocused(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t display->setFont(FONT_SMALL); // === Header === - graphics::drawCommonHeader(display, x, y); + graphics::drawCommonHeader(display, x, y, ""); // === Content below header === @@ -949,26 +935,11 @@ void drawCompassAndLocationScreen(OLEDDisplay *display, OLEDDisplayUiState *stat display->setTextAlignment(TEXT_ALIGN_LEFT); display->setFont(FONT_SMALL); - // === Header === - graphics::drawCommonHeader(display, x, y); - - // === Draw title === - const int highlightHeight = FONT_HEIGHT_SMALL - 1; - const int textY = y + 1 + (highlightHeight - FONT_HEIGHT_SMALL) / 2; + // === Set Title const char *titleStr = "GPS"; - const int centerX = x + SCREEN_WIDTH / 2; - if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) { - display->setColor(BLACK); - } - - display->setTextAlignment(TEXT_ALIGN_CENTER); - display->drawString(centerX, textY, titleStr); - if (config.display.heading_bold) { - display->drawString(centerX + 1, textY, titleStr); - } - display->setColor(WHITE); - display->setTextAlignment(TEXT_ALIGN_LEFT); + // === Header === + graphics::drawCommonHeader(display, x, y, titleStr); // === First Row: My Location === #if HAS_GPS diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index d88fc0bed..37eeb049a 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -344,28 +344,11 @@ void EnvironmentTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiSt display->setFont(FONT_SMALL); display->setTextAlignment(TEXT_ALIGN_LEFT); - // Draw shared header bar (battery, time, etc.) - graphics::drawCommonHeader(display, x, y); - - // === Draw Title (Centered under header) === - const int highlightHeight = FONT_HEIGHT_SMALL - 1; - const int titleY = y + 1 + (highlightHeight - FONT_HEIGHT_SMALL) / 2; + // === Set Title const char *titleStr = (SCREEN_WIDTH > 128) ? "Environment" : "Env."; - const int centerX = x + SCREEN_WIDTH / 2; - - // Use black text on white background if in inverted mode - if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) - display->setColor(BLACK); - - display->setTextAlignment(TEXT_ALIGN_CENTER); - display->drawString(centerX, titleY, titleStr); // Centered title - if (config.display.heading_bold) - display->drawString(centerX + 1, titleY, titleStr); // Bold effect via 1px offset - - // Restore text color & alignment - display->setColor(WHITE); - display->setTextAlignment(TEXT_ALIGN_LEFT); + // === Header === + graphics::drawCommonHeader(display, x, y, titleStr); // === Row spacing setup === const int rowHeight = FONT_HEIGHT_SMALL - 4; diff --git a/src/modules/Telemetry/PowerTelemetry.cpp b/src/modules/Telemetry/PowerTelemetry.cpp index 66cf1e901..4de886de6 100644 --- a/src/modules/Telemetry/PowerTelemetry.cpp +++ b/src/modules/Telemetry/PowerTelemetry.cpp @@ -113,25 +113,11 @@ void PowerTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *s display->setTextAlignment(TEXT_ALIGN_LEFT); display->setFont(FONT_SMALL); - graphics::drawCommonHeader(display, x, y); // Shared UI header - - // === Draw title (aligned with header baseline) === - const int highlightHeight = FONT_HEIGHT_SMALL - 1; - const int textY = y + 1 + (highlightHeight - FONT_HEIGHT_SMALL) / 2; + // === Set Title const char *titleStr = (SCREEN_WIDTH > 128) ? "Power Telem." : "Power"; - const int centerX = x + SCREEN_WIDTH / 2; - if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) { - display->setColor(BLACK); - } - - display->setTextAlignment(TEXT_ALIGN_CENTER); - display->drawString(centerX, textY, titleStr); - if (config.display.heading_bold) { - display->drawString(centerX + 1, textY, titleStr); - } - display->setColor(WHITE); - display->setTextAlignment(TEXT_ALIGN_LEFT); + // === Header === + graphics::drawCommonHeader(display, x, y, titleStr); if (lastMeasurementPacket == nullptr) { // In case of no valid packet, display "Power Telemetry", "No measurement"