diff --git a/src/helpers/ui/ST7735Display.cpp b/src/helpers/ui/ST7735Display.cpp index 15d41407..bb3c6473 100644 --- a/src/helpers/ui/ST7735Display.cpp +++ b/src/helpers/ui/ST7735Display.cpp @@ -6,6 +6,8 @@ #define DISPLAY_ROTATION 2 #endif +#define SCALE_X 1.25f // 160 / 128 +#define SCALE_Y 1.25f // 80 / 64 bool ST7735Display::i2c_probe(TwoWire& wire, uint8_t addr) { return true; @@ -99,7 +101,7 @@ void ST7735Display::setColor(Color c) { } void ST7735Display::setCursor(int x, int y) { - display.setCursor(x, y); + display.setCursor(x*SCALE_X, y*SCALE_Y); } void ST7735Display::print(const char* str) { @@ -107,22 +109,22 @@ void ST7735Display::print(const char* str) { } void ST7735Display::fillRect(int x, int y, int w, int h) { - display.fillRect(x, y, w, h, _color); + display.fillRect(x*SCALE_X, y*SCALE_Y, w*SCALE_X, h*SCALE_Y, _color); } void ST7735Display::drawRect(int x, int y, int w, int h) { - display.drawRect(x, y, w, h, _color); + display.drawRect(x*SCALE_X, y*SCALE_Y, w*SCALE_X, h*SCALE_Y, _color); } void ST7735Display::drawXbm(int x, int y, const uint8_t* bits, int w, int h) { - display.drawBitmap(x, y, bits, w, h, _color); + display.drawBitmap(x*SCALE_X, y*SCALE_Y, bits, w, h, _color); } uint16_t ST7735Display::getTextWidth(const char* str) { int16_t x1, y1; uint16_t w, h; display.getTextBounds(str, 0, 0, &x1, &y1, &w, &h); - return w; + return w / SCALE_X; } void ST7735Display::endFrame() { diff --git a/src/helpers/ui/ST7735Display.h b/src/helpers/ui/ST7735Display.h index efde213d..8e9bd04c 100644 --- a/src/helpers/ui/ST7735Display.h +++ b/src/helpers/ui/ST7735Display.h @@ -14,9 +14,9 @@ class ST7735Display : public DisplayDriver { bool i2c_probe(TwoWire& wire, uint8_t addr); public: #ifdef USE_PIN_TFT - ST7735Display() : DisplayDriver(80, 160), display(PIN_TFT_CS, PIN_TFT_DC, PIN_TFT_SDA, PIN_TFT_SCL, PIN_TFT_RST) { _isOn = false; } + ST7735Display() : DisplayDriver(128, 64), display(PIN_TFT_CS, PIN_TFT_DC, PIN_TFT_SDA, PIN_TFT_SCL, PIN_TFT_RST) { _isOn = false; } #else - ST7735Display() : DisplayDriver(80, 160), display(&SPI1, PIN_TFT_CS, PIN_TFT_DC, PIN_TFT_RST) { _isOn = false; } + ST7735Display() : DisplayDriver(128, 64), display(&SPI1, PIN_TFT_CS, PIN_TFT_DC, PIN_TFT_RST) { _isOn = false; } #endif bool begin();