fix(display): render authentic DSEG7 34pt font during transition for pixel-perfect match
This commit is contained in:
parent
3c18eb78ac
commit
100d19762e
1 changed files with 23 additions and 7 deletions
|
|
@ -1374,10 +1374,16 @@ inline void renderPage0ToSprite(TFT_eSprite &s, int x_offset, int y_slice, int s
|
||||||
drawQuadBarBlockToSprite(s, qx, qy, i, bCol, slice_h);
|
drawQuadBarBlockToSprite(s, qx, qy, i, bCol, slice_h);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Digital value string
|
// 4. Digital value string using authentic DSEG7 34pt font (pixel-perfect match with resting screen)
|
||||||
String numStr = (val <= -900.0f) ? "---" : String(val, digit);
|
String numStr = (val <= -900.0f) ? "---" : String(val, digit);
|
||||||
s.setTextColor(priCol);
|
int textY = qy + 74;
|
||||||
s.drawRightString(numStr.c_str(), qx + 152, qy + 74, 4);
|
if (textY < slice_h && textY + 40 > 0) {
|
||||||
|
s.fontLoaded = true;
|
||||||
|
s.setTextColor(priCol, TFT_BLACK);
|
||||||
|
s.setTextPadding(0);
|
||||||
|
s.drawRightString(numStr.c_str(), qx + 152, textY, 1);
|
||||||
|
s.fontLoaded = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. Eco Badge if active
|
// 5. Eco Badge if active
|
||||||
|
|
@ -1470,10 +1476,16 @@ 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 (clean built-in font 4: zero padding artifacts, zero distortion)
|
// Value text using authentic DSEG7 34pt font matching drawTriTempCard
|
||||||
String numStr = (val <= -900.0f) ? "---" : (isInt ? String((int)val) : String(val, 1));
|
String numStr = (val <= -900.0f) ? "---" : (isInt ? String((int)val) : String(val, 1));
|
||||||
|
int numY = cardY + 22;
|
||||||
|
if (numY < slice_h && numY + 40 > 0) {
|
||||||
|
s.fontLoaded = true;
|
||||||
s.setTextColor(accentCol, cardBg);
|
s.setTextColor(accentCol, cardBg);
|
||||||
s.drawRightString(numStr.c_str(), cardX + 262, cardY + 24, 4);
|
s.setTextPadding(0);
|
||||||
|
s.drawRightString(numStr.c_str(), cardX + 262, numY, 1);
|
||||||
|
s.fontLoaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
s.setTextColor(0xC618, cardBg);
|
s.setTextColor(0xC618, cardBg);
|
||||||
s.drawString("`C", cardX + 268, cardY + 32, 2);
|
s.drawString("`C", cardX + 268, cardY + 32, 2);
|
||||||
|
|
@ -1494,7 +1506,9 @@ inline void animateSlideTransition(bool swipeLeft) {
|
||||||
}
|
}
|
||||||
spr.setTextFont(1); // CRITICAL: initializes textfont=1 and clears uninitialized gfxFont=NULL
|
spr.setTextFont(1); // CRITICAL: initializes textfont=1 and clears uninitialized gfxFont=NULL
|
||||||
spr.setFreeFont(NULL); // CRITICAL: prevents crash in textWidth() when drawing Font 1 on stack sprite
|
spr.setFreeFont(NULL); // CRITICAL: prevents crash in textWidth() when drawing Font 1 on stack sprite
|
||||||
Serial.printf(">>> [DB] Sprite created OK. Heap: %u, MaxAlloc: %u\n", ESP.getFreeHeap(), ESP.getMaxAllocHeap());
|
spr.loadFont(DSEG7_Modern_BoldItalic_34);
|
||||||
|
spr.fontLoaded = false; // Default to standard fonts until DSEG7 digits are drawn
|
||||||
|
Serial.printf(">>> [DB] Sprite created OK with DSEG7. Heap: %u, MaxAlloc: %u\n", ESP.getFreeHeap(), ESP.getMaxAllocHeap());
|
||||||
|
|
||||||
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:
|
||||||
|
|
@ -1549,6 +1563,8 @@ inline void animateSlideTransition(bool swipeLeft) {
|
||||||
delay(7); // Ultra-smooth high density pacing (~330ms total)
|
delay(7); // Ultra-smooth high density pacing (~330ms total)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spr.fontLoaded = true;
|
||||||
|
spr.unloadFont();
|
||||||
spr.deleteSprite(); // Release the 25KB
|
spr.deleteSprite(); // Release the 25KB
|
||||||
Serial.printf(">>> [DB] animateSlideTransition LEAVE (heap: %u)\n", ESP.getFreeHeap());
|
Serial.printf(">>> [DB] animateSlideTransition LEAVE (heap: %u)\n", ESP.getFreeHeap());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue