Modo 4 cuadrantes: eliminar carteles de encabezado, agrandar iconos a 32x32 y ajustar fuente numerica para evitar superposicion con vumetro

This commit is contained in:
Sebastián Nieto 2026-09-09 20:53:23 -03:00
parent 4bb5986ce7
commit 554423ec4e

View file

@ -44,16 +44,16 @@ const float factoryECUOff = 12.5; // default off voltage
float ecu_off_volt = factoryECUOff; // turn engine off if voltage lower float ecu_off_volt = factoryECUOff; // turn engine off if voltage lower
// than 12.4 // 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) { void drawPidIcon(int x, int y, const String &pidStr) {
if (pidStr == "0105") { 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") { } 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") { } 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") { } 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 h = 120;
int x = cell4_x[cell]; int x = cell4_x[cell];
int y = cell4_y[cell]; int y = cell4_y[cell];
String label = pidConfig[pid][0];
if (redrawHeader) { tft.fillRect(x, y, w, h, TFT_BLACK);
drawQuadHeaderGradient(cell); drawPidIcon(x + 5, y + 5, pidConfig[pid][2]);
drawPidIcon(x + 3, y + 1, pidConfig[pid][2]); tft.drawFastVLine(159, 0, 240, 0x2104);
tft.setTextColor(TFT_WHITE); tft.drawFastHLine(0, 119, 320, 0x2104);
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);
if (last_valid_data[cell] != -999) { if (last_valid_data[cell] != -999) {
old_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) { void arcMeter4(uint8_t cell, uint8_t pid, bool redrawHeader = true) {
int x = cell4_x[cell]; int x = cell4_x[cell];
int y = cell4_y[cell]; int y = cell4_y[cell];
String label = pidConfig[pid][0];
if (redrawHeader) { tft.fillRect(x, y, 160, 120, TFT_BLACK);
drawQuadHeaderGradient(cell); drawPidIcon(x + 5, y + 3, pidConfig[pid][2]);
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.drawFastVLine(159, 0, 240, 0x2104); tft.drawFastVLine(159, 0, 240, 0x2104);
tft.drawFastHLine(0, 119, 320, 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; old_data[cell] = -999;
plotArc4(cell, last_valid_data[cell], warn, min, max, digit, unit); plotArc4(cell, last_valid_data[cell], warn, min, max, digit, unit);
} else { } else {
// Value placeholder using DSEG7 Modern 44pt smooth font // Value placeholder using DSEG7 Modern 24pt smooth font
tft.loadFont(DSEG7_Modern_BoldItalic_44); tft.loadFont(DSEG7_Modern_BoldItalic_24);
tft.setTextColor(TFT_GREEN, TFT_BLACK); tft.setTextColor(TFT_GREEN, TFT_BLACK);
tft.setTextPadding(115); tft.setTextPadding(86);
tft.drawRightString("---", x + 152, y + 70, 1); tft.drawRightString("---", x + 150, y + 78, 1);
tft.setTextPadding(0); tft.setTextPadding(0);
tft.unloadFont(); tft.unloadFont();
old_data[cell] = -999; 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.setTextColor(col, TFT_BLACK);
tft.setTextPadding(115); tft.setTextPadding(86);
tft.drawRightString(numStr.c_str(), x + 152, y + 70, 1); tft.drawRightString(numStr.c_str(), x + 150, y + 78, 1);
tft.setTextPadding(0); tft.setTextPadding(0);
tft.unloadFont(); tft.unloadFont();
old_data[cell] = data; old_data[cell] = data;