From 3ea2487d8d9016a6bc4e4c239602215c066d9433 Mon Sep 17 00:00:00 2001 From: Sebastian Nieto Date: Wed, 9 Sep 2026 22:57:33 -0300 Subject: [PATCH] Revert meter blocks to solid fill with subtle dark charcoal inactive color --- sketch/obd2_gauge/meter.h | 51 ++++++++++++++------------------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/sketch/obd2_gauge/meter.h b/sketch/obd2_gauge/meter.h index 8c67f20..4730c30 100644 --- a/sketch/obd2_gauge/meter.h +++ b/sketch/obd2_gauge/meter.h @@ -42,6 +42,9 @@ bool arcFlashVisible = true; uint32_t lastArcFlashTime = 0; bool wasInRedAlarm[4] = { false, false, false, false }; +// Color for inactive meter blocks (dark charcoal grey, subtle against black background) +const uint16_t METER_INACTIVE_COLOR = 0x2124; // RGB ~ (36, 36, 36) + // backlight variable average counter uint8_t low_count = 0; uint8_t high_count = 0; @@ -181,15 +184,6 @@ inline void drawBarBlock(uint8_t i, uint16_t color) { if (min_d <= -0.5f) continue; if (color == TFT_BLACK) { tft.drawPixel(x, y, TFT_BLACK); - } else if (color == TFT_DARKGREY) { // Outline only (solo las aristas) - if (min_d > 1.5f) { - tft.drawPixel(x, y, TFT_BLACK); - } else if (min_d >= 0.5f) { - tft.drawPixel(x, y, TFT_DARKGREY); - } else { - uint8_t alpha = (uint8_t)((min_d + 0.5f) * 255.0f); - tft.drawPixel(x, y, TFT_DARKGREY, alpha, TFT_BLACK); - } } else { if (min_d >= 0.5f) { tft.drawPixel(x, y, color); @@ -309,15 +303,6 @@ inline void drawQuadBarBlock(uint8_t cell, uint8_t i, uint16_t color) { int16_t sx = ox + x; if (color == TFT_BLACK) { tft.drawPixel(sx, sy, TFT_BLACK); - } else if (color == TFT_DARKGREY) { // Outline only (solo las aristas) - if (min_d > 1.3f) { - tft.drawPixel(sx, sy, TFT_BLACK); - } else if (min_d >= 0.5f) { - tft.drawPixel(sx, sy, TFT_DARKGREY); - } else { - uint8_t alpha = (uint8_t)((min_d + 0.5f) * 255.0f); - tft.drawPixel(sx, sy, TFT_DARKGREY, alpha, TFT_BLACK); - } } else { if (min_d >= 0.5f) { tft.drawPixel(sx, sy, color); @@ -829,9 +814,9 @@ void arcMeter4(uint8_t cell, uint8_t pid, bool redrawHeader = true) { drawPidIcon(x + 5, y + 3, pidConfig[pid][2]); drawQuadrantDividers(); - // Initialize all 20 blocks in DARKGREY + // Initialize all 20 blocks in METER_INACTIVE_COLOR for (uint8_t i = 0; i < NUM_BAR_BLOCKS; i++) { - drawQuadBarBlock(cell, i, TFT_DARKGREY); + drawQuadBarBlock(cell, i, METER_INACTIVE_COLOR); } int min = pidConfig[pid][4].toInt(); @@ -885,7 +870,7 @@ void plotArc4(uint8_t cell, float data, int warn, int min, int max, bool digit, drawQuadBarBlock(cell, i, TFT_RED); } for (uint8_t i = newBlocks; i < NUM_BAR_BLOCKS; i++) { - drawQuadBarBlock(cell, i, TFT_DARKGREY); + drawQuadBarBlock(cell, i, METER_INACTIVE_COLOR); } } else if (arcFlashVisible) { if (newBlocks > oldBlocks) { @@ -894,7 +879,7 @@ void plotArc4(uint8_t cell, float data, int warn, int min, int max, bool digit, } } else if (newBlocks < oldBlocks) { for (uint8_t i = newBlocks; i < oldBlocks; i++) { - drawQuadBarBlock(cell, i, TFT_DARKGREY); + drawQuadBarBlock(cell, i, METER_INACTIVE_COLOR); } } } @@ -905,7 +890,7 @@ void plotArc4(uint8_t cell, float data, int warn, int min, int max, bool digit, drawQuadBarBlock(cell, i, col); } for (uint8_t i = newBlocks; i < NUM_BAR_BLOCKS; i++) { - drawQuadBarBlock(cell, i, TFT_DARKGREY); + drawQuadBarBlock(cell, i, METER_INACTIVE_COLOR); } } else if (newBlocks > oldBlocks) { for (uint8_t i = oldBlocks; i < newBlocks; i++) { @@ -913,7 +898,7 @@ void plotArc4(uint8_t cell, float data, int warn, int min, int max, bool digit, } } else if (newBlocks < oldBlocks) { for (uint8_t i = newBlocks; i < oldBlocks; i++) { - drawQuadBarBlock(cell, i, TFT_DARKGREY); + drawQuadBarBlock(cell, i, METER_INACTIVE_COLOR); } } } @@ -995,7 +980,7 @@ void fullScreenMeter(uint8_t cell, uint8_t pid, bool redrawHeader = true) { if (!cellIsNumeric[cell]) { // Exponential segmented block mode full screen (18 discrete blocks, 3mm x 5mm, 1mm gap) for (uint8_t i = 0; i < NUM_BAR_BLOCKS; i++) { - drawBarBlock(i, TFT_DARKGREY); + drawBarBlock(i, METER_INACTIVE_COLOR); } tft.loadFont(DSEG7_Modern_BoldItalic_80); @@ -1045,7 +1030,7 @@ void plotFullScreen(uint8_t cell, float data, int warn, int min, int max, drawBarBlock(i, TFT_RED); } for (uint8_t i = newBlocks; i < NUM_BAR_BLOCKS; i++) { - drawBarBlock(i, TFT_DARKGREY); + drawBarBlock(i, METER_INACTIVE_COLOR); } } else if (arcFlashVisible) { if (newBlocks > oldBlocks) { @@ -1054,7 +1039,7 @@ void plotFullScreen(uint8_t cell, float data, int warn, int min, int max, } } else if (newBlocks < oldBlocks) { for (uint8_t i = newBlocks; i < oldBlocks; i++) { - drawBarBlock(i, TFT_DARKGREY); + drawBarBlock(i, METER_INACTIVE_COLOR); } } } @@ -1065,7 +1050,7 @@ void plotFullScreen(uint8_t cell, float data, int warn, int min, int max, drawBarBlock(i, col); } for (uint8_t i = newBlocks; i < NUM_BAR_BLOCKS; i++) { - drawBarBlock(i, TFT_DARKGREY); + drawBarBlock(i, METER_INACTIVE_COLOR); } } else if (newBlocks > oldBlocks) { for (uint8_t i = oldBlocks; i < newBlocks; i++) { @@ -1073,7 +1058,7 @@ void plotFullScreen(uint8_t cell, float data, int warn, int min, int max, } } else if (newBlocks < oldBlocks) { for (uint8_t i = newBlocks; i < oldBlocks; i++) { - drawBarBlock(i, TFT_DARKGREY); + drawBarBlock(i, METER_INACTIVE_COLOR); } } } @@ -1339,7 +1324,7 @@ void handleArcAlarmFlash() { drawBarBlock(i, col); } for (uint8_t i = newBlocks; i < NUM_BAR_BLOCKS; i++) { - drawBarBlock(i, TFT_DARKGREY); + drawBarBlock(i, METER_INACTIVE_COLOR); } tft.loadFont(DSEG7_Modern_BoldItalic_80); tft.setTextColor(col, TFT_BLACK); @@ -1369,7 +1354,7 @@ void handleArcAlarmFlash() { drawBarBlock(i, TFT_RED); } for (uint8_t i = newBlocks; i < NUM_BAR_BLOCKS; i++) { - drawBarBlock(i, TFT_DARKGREY); + drawBarBlock(i, METER_INACTIVE_COLOR); } } else { for (uint8_t i = 0; i < NUM_BAR_BLOCKS; i++) { @@ -1418,7 +1403,7 @@ void handleArcAlarmFlash() { drawQuadBarBlock(cell, i, col); } for (uint8_t i = newBlocks; i < NUM_BAR_BLOCKS; i++) { - drawQuadBarBlock(cell, i, TFT_DARKGREY); + drawQuadBarBlock(cell, i, METER_INACTIVE_COLOR); } tft.loadFont(DSEG7_Modern_BoldItalic_34); tft.setTextColor(col, TFT_BLACK); @@ -1448,7 +1433,7 @@ void handleArcAlarmFlash() { drawQuadBarBlock(cell, i, TFT_RED); } for (uint8_t i = newBlocks; i < NUM_BAR_BLOCKS; i++) { - drawQuadBarBlock(cell, i, TFT_DARKGREY); + drawQuadBarBlock(cell, i, METER_INACTIVE_COLOR); } } else { for (uint8_t i = 0; i < NUM_BAR_BLOCKS; i++) {