diff --git a/src/helpers/ui/ST7735Display.cpp b/src/helpers/ui/ST7735Display.cpp index 45fd2a39..15d41407 100644 --- a/src/helpers/ui/ST7735Display.cpp +++ b/src/helpers/ui/ST7735Display.cpp @@ -118,6 +118,13 @@ void ST7735Display::drawXbm(int x, int y, const uint8_t* bits, int w, int h) { display.drawBitmap(x, 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; +} + void ST7735Display::endFrame() { // display.display(); } diff --git a/src/helpers/ui/ST7735Display.h b/src/helpers/ui/ST7735Display.h index d456b477..efde213d 100644 --- a/src/helpers/ui/ST7735Display.h +++ b/src/helpers/ui/ST7735Display.h @@ -32,5 +32,6 @@ public: void fillRect(int x, int y, int w, int h) override; void drawRect(int x, int y, int w, int h) override; void drawXbm(int x, int y, const uint8_t* bits, int w, int h) override; + uint16_t getTextWidth(const char* str) override; void endFrame() override; }; diff --git a/variants/heltec_v3/platformio.ini b/variants/heltec_v3/platformio.ini index 82645b4a..47a23754 100644 --- a/variants/heltec_v3/platformio.ini +++ b/variants/heltec_v3/platformio.ini @@ -196,6 +196,8 @@ build_flags = ; -D ARDUINO_USB_CDC_ON_BOOT=1 ; need for debugging -D ST7735 -D PIN_ADC_CTRL=2 ; redefines the V3 pin + -D PIN_BOARD_SDA=45 + -D PIN_BOARD_SCL=46 -D DISPLAY_ROTATION=1 -D DISPLAY_CLASS=ST7735Display -D USE_PIN_TFT=1