diff --git a/sketch/obd2_gauge/meter.h b/sketch/obd2_gauge/meter.h index 585b1b0..283c163 100644 --- a/sketch/obd2_gauge/meter.h +++ b/sketch/obd2_gauge/meter.h @@ -44,16 +44,16 @@ const float factoryECUOff = 12.5; // default off voltage float ecu_off_volt = factoryECUOff; // turn engine off if voltage lower // than 12.4 -// Draw parameter icon in header with transparent background (TFT_BLACK) +// Draw parameter icon (32x32 px) with transparent background (TFT_BLACK) void drawPidIcon(int x, int y, const String &pidStr) { if (pidStr == "0105") { - tft.pushImage(x, y, 24, 24, icon_temp, TFT_BLACK); + tft.pushImage(x, y, 32, 32, icon_temp_32, TFT_BLACK); } else if (pidStr == "010D") { - tft.pushImage(x, y, 24, 24, icon_speed, TFT_BLACK); + tft.pushImage(x, y, 32, 32, icon_speed_32, TFT_BLACK); } else if (pidStr == "010C") { - tft.pushImage(x, y, 24, 24, icon_rpm, TFT_BLACK); + tft.pushImage(x, y, 32, 32, icon_rpm_32, TFT_BLACK); } else if (pidStr == "0142" || pidStr == "ATRV") { - tft.pushImage(x, y, 24, 24, icon_battery, TFT_BLACK); + tft.pushImage(x, y, 32, 32, icon_battery_32, TFT_BLACK); } } @@ -684,16 +684,11 @@ void numericMeter4(uint8_t cell, uint8_t pid, bool redrawHeader = true) { int h = 120; int x = cell4_x[cell]; int y = cell4_y[cell]; - String label = pidConfig[pid][0]; - if (redrawHeader) { - drawQuadHeaderGradient(cell); - drawPidIcon(x + 3, y + 1, pidConfig[pid][2]); - tft.setTextColor(TFT_WHITE); - tft.drawCentreString(label.c_str(), x + w / 2, y + 4, 2); - } - // Clear only the body below the header to avoid any header flickering - tft.fillRect(x, y + 25, 160, 95, TFT_BLACK); + tft.fillRect(x, y, w, h, TFT_BLACK); + drawPidIcon(x + 5, y + 5, pidConfig[pid][2]); + tft.drawFastVLine(159, 0, 240, 0x2104); + tft.drawFastHLine(0, 119, 320, 0x2104); if (last_valid_data[cell] != -999) { old_data[cell] = -999; @@ -735,16 +730,9 @@ void plotNumeric4(uint8_t cell, float data, int warn, bool digit, String unit) { void arcMeter4(uint8_t cell, uint8_t pid, bool redrawHeader = true) { int x = cell4_x[cell]; int y = cell4_y[cell]; - String label = pidConfig[pid][0]; - if (redrawHeader) { - drawQuadHeaderGradient(cell); - drawPidIcon(x + 3, y + 1, pidConfig[pid][2]); - tft.setTextColor(TFT_WHITE); - tft.drawCentreString(label.c_str(), x + 80, y + 4, 2); - } - // Clear only the body below the header - tft.fillRect(x, y + 25, 160, 95, TFT_BLACK); + tft.fillRect(x, y, 160, 120, TFT_BLACK); + drawPidIcon(x + 5, y + 3, pidConfig[pid][2]); tft.drawFastVLine(159, 0, 240, 0x2104); tft.drawFastHLine(0, 119, 320, 0x2104); @@ -763,11 +751,11 @@ void arcMeter4(uint8_t cell, uint8_t pid, bool redrawHeader = true) { old_data[cell] = -999; plotArc4(cell, last_valid_data[cell], warn, min, max, digit, unit); } else { - // Value placeholder using DSEG7 Modern 44pt smooth font - tft.loadFont(DSEG7_Modern_BoldItalic_44); + // Value placeholder using DSEG7 Modern 24pt smooth font + tft.loadFont(DSEG7_Modern_BoldItalic_24); tft.setTextColor(TFT_GREEN, TFT_BLACK); - tft.setTextPadding(115); - tft.drawRightString("---", x + 152, y + 70, 1); + tft.setTextPadding(86); + tft.drawRightString("---", x + 150, y + 78, 1); tft.setTextPadding(0); tft.unloadFont(); old_data[cell] = -999; @@ -819,10 +807,10 @@ void plotArc4(uint8_t cell, float data, int warn, int min, int max, bool digit, } } - tft.loadFont(DSEG7_Modern_BoldItalic_44); + tft.loadFont(DSEG7_Modern_BoldItalic_24); tft.setTextColor(col, TFT_BLACK); - tft.setTextPadding(115); - tft.drawRightString(numStr.c_str(), x + 152, y + 70, 1); + tft.setTextPadding(86); + tft.drawRightString(numStr.c_str(), x + 150, y + 78, 1); tft.setTextPadding(0); tft.unloadFont(); old_data[cell] = data;