gauge: render unlit blocks as hollow wireframe outlines (only aristas in grey)

This commit is contained in:
Sebastián Nieto 2026-09-09 22:50:06 -03:00
parent ef3a24fd51
commit 259c4d6bbf

View file

@ -179,6 +179,18 @@ inline void drawBarBlock(uint8_t i, uint16_t color) {
if (d < min_d) min_d = d; if (d < min_d) min_d = d;
} }
if (min_d <= -0.5f) continue; 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) { if (min_d >= 0.5f) {
tft.drawPixel(x, y, color); tft.drawPixel(x, y, color);
} else { } else {
@ -187,6 +199,7 @@ inline void drawBarBlock(uint8_t i, uint16_t color) {
} }
} }
} }
}
tft.endWrite(); tft.endWrite();
} }
@ -294,6 +307,18 @@ inline void drawQuadBarBlock(uint8_t cell, uint8_t i, uint16_t color) {
} }
if (min_d <= -0.5f) continue; if (min_d <= -0.5f) continue;
int16_t sx = ox + x; 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) { if (min_d >= 0.5f) {
tft.drawPixel(sx, sy, color); tft.drawPixel(sx, sy, color);
} else { } else {
@ -302,6 +327,7 @@ inline void drawQuadBarBlock(uint8_t cell, uint8_t i, uint16_t color) {
} }
} }
} }
}
tft.endWrite(); tft.endWrite();
} }