From e4daf02c37f423047d412ab5e5577e45ff792b64 Mon Sep 17 00:00:00 2001 From: Sebastian Nieto Date: Mon, 7 Sep 2026 21:14:50 -0300 Subject: [PATCH] Right-justify all meter values across all display modes --- sketch/obd2_gauge/meter.h | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/sketch/obd2_gauge/meter.h b/sketch/obd2_gauge/meter.h index a75f5ea..bacfd01 100644 --- a/sketch/obd2_gauge/meter.h +++ b/sketch/obd2_gauge/meter.h @@ -153,7 +153,9 @@ void arcMeter(uint8_t cell, uint8_t pid) { tft.drawCentreString(label.c_str(), x + 80, y + 58, 2); // Comment out to avoid font 4 tft.setTextColor(TFT_GREEN); - tft.drawString("---", x + 10, y + 60, 2); // data + tft.setTextPadding(65); + tft.drawRightString("---", x + 75, y + 60, 2); // data + tft.setTextPadding(0); // draw arc animation for (int angle = 135; angle < 225; angle++) { tft.drawSmoothArc(x + 80, y + 90, 80, 60, 134, angle, TFT_GREEN, @@ -174,17 +176,6 @@ void plotArc(uint8_t cell, String label, float data, int warn, int min, int max, int y = cell1_y[cell - 1]; String result = String(data, digit); - switch (result.length()) { - case 2: - result = result + " "; - break; - case 3: - result = result + " "; - break; - case 4: - result = result + " "; - break; - } if (data < min) data = min; @@ -198,7 +189,9 @@ void plotArc(uint8_t cell, String label, float data, int warn, int min, int max, else // no warn arcColor = TFT_GREEN; // gren font green arc tft.setTextColor(arcColor, TFT_BLACK); - tft.drawString(result.c_str(), x + 10, y + 60, 2); // data + tft.setTextPadding(65); + tft.drawRightString(result.c_str(), x + 75, y + 60, 2); // data + tft.setTextPadding(0); int angle = map(data, min, max, 135, 225); if (data >= old_data[pidIndex]) // new data > old data -> draw only green // arc @@ -524,8 +517,8 @@ void fullScreenMeter(uint8_t cell, uint8_t pid, bool redrawHeader = true) { tft.loadFont(DSEG7_Modern_BoldItalic_80); tft.setTextColor(TFT_GREEN, TFT_BLACK); - tft.setTextPadding(280); - tft.drawCentreString("---", 160, 155, 1); + tft.setTextPadding(265); + tft.drawRightString("---", 260, 155, 1); tft.setTextPadding(0); tft.unloadFont(); } else { @@ -565,8 +558,8 @@ void plotFullScreen(uint8_t cell, float data, int warn, int min, int max, // Value below the arc using DSEG7 Modern smooth font tft.loadFont(DSEG7_Modern_BoldItalic_80); tft.setTextColor(col, TFT_BLACK); - tft.setTextPadding(280); - tft.drawCentreString(numStr.c_str(), 160, 155, 1); + tft.setTextPadding(265); + tft.drawRightString(numStr.c_str(), 260, 155, 1); tft.setTextPadding(0); tft.unloadFont(); } else {