Use native display resolution and adaptive typography

This commit is contained in:
mikecarper committed 2026-09-08 16:02:16 -07:00
1 parent 0058f72192
commit 846282adf4
64 files changed
+5643 -533

No files matched your search

+6 -10
View File
@@ -409,8 +409,7 @@ static void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
writeCommand(ST77XX_RAMWR); // write to RAM
}
#define SCALE_X 1.25f // 160 / 128
#define SCALE_Y 1.25f // 80 / 64
// Compile-time 1:1 on T096; keep the legacy 1.25x coordinates on other boards.
static TFT_eSprite *sprite = NULL;
@@ -622,7 +621,7 @@ void ST7735Display::setColor(ColorVal c) {
void ST7735Display::setCursor(int x, int y) {
if (!spriteReady()) return;
sprite->setCursor(x*SCALE_X, y*SCALE_Y);
sprite->setCursor(x, y);
}
void ST7735Display::print(const char* str) {
@@ -632,25 +631,22 @@ void ST7735Display::print(const char* str) {
void ST7735Display::fillRect(int x, int y, int w, int h) {
if (!spriteReady()) return;
// Scale the edges, so adjacent 1px font cells meet at fractional scaling.
const int left = x*SCALE_X, top = y*SCALE_Y;
sprite->fillRect(left, top, int((x+w)*SCALE_X)-left,
int((y+h)*SCALE_Y)-top, curr_color);
sprite->fillRect(x, y, w, h, curr_color);
}
void ST7735Display::drawRect(int x, int y, int w, int h) {
if (!spriteReady()) return;
sprite->drawRect(x*SCALE_X, y*SCALE_Y, w*SCALE_X, h*SCALE_Y, curr_color);
sprite->drawRect(x, y, w, h, curr_color);
}
void ST7735Display::drawXbm(int x, int y, const uint8_t* bits, int w, int h) {
if (!spriteReady()) return;
sprite->drawBitmap(x*SCALE_X, y*SCALE_Y, bits, w, h, curr_color);
sprite->drawBitmap(x, y, bits, w, h, curr_color);
}
uint16_t ST7735Display::getTextWidth(const char* str) {
if (!spriteReady()) return 0;
return sprite->textWidth(str) / SCALE_X;
return sprite->textWidth(str);
}
void ST7735Display::endFrame() {