fix(ui): eliminar artefactos rectangulares en fuentes quitando setTextPadding y usando fuente 4 con recorte perfecto por pixel en sprite

This commit is contained in:
Sebastián Nieto 2026-09-22 00:03:33 -03:00
parent e211d4ad76
commit 9b7249b321

View file

@ -1277,9 +1277,7 @@ inline void renderPage0ToSprite(TFT_eSprite &s, int x_offset, int y_slice, int s
String numStr = (val <= -900.0f) ? "---" : String(val, digit); String numStr = (val <= -900.0f) ? "---" : String(val, digit);
s.setTextColor(priCol, bgCol); s.setTextColor(priCol, bgCol);
s.setTextPadding(114); s.drawRightString(numStr.c_str(), qx + 152, qy + 74, 4);
s.drawRightString(numStr.c_str(), qx + 152, qy + 70, 1);
s.setTextPadding(0);
} }
// Crosshair dividers // Crosshair dividers
@ -1352,12 +1350,10 @@ inline void renderPage1ToSprite(TFT_eSprite &s, int x_offset, int y_slice, int s
if (fillW < 4) fillW = 4; if (fillW < 4) fillW = 4;
s.fillRoundRect(barX, barY, fillW, 8, 3, accentCol); s.fillRoundRect(barX, barY, fillW, 8, 3, accentCol);
// Value text // Value text (clean built-in font 4: zero padding artifacts, zero distortion)
String numStr = (val <= -900.0f) ? "---" : (isInt ? String((int)val) : String(val, 1)); String numStr = (val <= -900.0f) ? "---" : (isInt ? String((int)val) : String(val, 1));
s.setTextColor(accentCol, cardBg); s.setTextColor(accentCol, cardBg);
s.setTextPadding(100); s.drawRightString(numStr.c_str(), cardX + 262, cardY + 24, 4);
s.drawRightString(numStr.c_str(), cardX + 262, cardY + 22, 1);
s.setTextPadding(0);
s.setTextColor(0xC618, cardBg); s.setTextColor(0xC618, cardBg);
s.drawString("`C", cardX + 268, cardY + 32, 2); s.drawString("`C", cardX + 268, cardY + 32, 2);
@ -1365,7 +1361,7 @@ inline void renderPage1ToSprite(TFT_eSprite &s, int x_offset, int y_slice, int s
} }
// 100% Flicker-Free Double-Buffered Mobile Slide Transition // 100% Flicker-Free Double-Buffered Mobile Slide Transition
// Safe 25KB sprite with single font load and smooth ease-out pacing // Safe 25KB sprite with pixel-perfect clipping and smooth ease-out pacing
inline void animateSlideTransition(bool swipeLeft) { inline void animateSlideTransition(bool swipeLeft) {
const int slice_h = 40; // 320x40 = only 25KB (100% safe, leaves 70KB+ free for Bluetooth) const int slice_h = 40; // 320x40 = only 25KB (100% safe, leaves 70KB+ free for Bluetooth)
const uint8_t numSlices = 240 / slice_h; // exactly 6 slices const uint8_t numSlices = 240 / slice_h; // exactly 6 slices
@ -1375,8 +1371,6 @@ inline void animateSlideTransition(bool swipeLeft) {
return; // Safety fallback return; // Safety fallback
} }
spr.loadFont(DSEG7_Modern_BoldItalic_34); // Loaded ONCE before animation loop!
const uint8_t FRAMES = 28; const uint8_t FRAMES = 28;
// High-density sine ease-out deceleration over 28 frames: // High-density sine ease-out deceleration over 28 frames:
// Ultra-fine 10-18px initial steps smoothly tapering to 1-3px for zero visible refresh chop // Ultra-fine 10-18px initial steps smoothly tapering to 1-3px for zero visible refresh chop
@ -1427,7 +1421,6 @@ inline void animateSlideTransition(bool swipeLeft) {
delay(7); // Ultra-smooth high density pacing (~330ms total) delay(7); // Ultra-smooth high density pacing (~330ms total)
} }
spr.unloadFont(); // Unload font once at the end
spr.deleteSprite(); // Release the 25KB spr.deleteSprite(); // Release the 25KB
} }