Browse Source

* Heltec Wireless Tracker fixes: getTextWidth() missing, PIN_BOARD_SDA/SCL

pull/254/head
Scott Powell 1 year ago
parent
commit
7a7f436921
  1. 7
      src/helpers/ui/ST7735Display.cpp
  2. 1
      src/helpers/ui/ST7735Display.h
  3. 2
      variants/heltec_v3/platformio.ini

7
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();
}

1
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;
};

2
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

Loading…
Cancel
Save