test just header

This commit is contained in:
richonguzman 2024-06-03 16:03:03 -04:00
parent 4355b19526
commit 127eadc785
3 changed files with 43 additions and 4 deletions

View File

@ -118,6 +118,7 @@ build_flags =
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1 -DELEGANTOTA_USE_ASYNC_WEBSERVER=1
lib_deps = lib_deps =
${common.lib_deps} ${common.lib_deps}
zinggjm/GxEPD2@^1.5.4
[env:heltec_ht-ct62] [env:heltec_ht-ct62]

View File

@ -183,6 +183,12 @@
#define VEXT_CTRL 45 #define VEXT_CTRL 45
#define BOARD_I2C_SDA 37 #define BOARD_I2C_SDA 37
#define BOARD_I2C_SCL 36 #define BOARD_I2C_SCL 36
#define EPAPER_BUSY 7
#define EPAPER_RST 6
#define EPAPER_DC 5
#define EPAPER_CS 4
#define EPAPER_SCL 3
#define EPAPER_SDA 2
#endif #endif
#ifdef ESP32_C3_DIY_LoRa #ifdef ESP32_C3_DIY_LoRa

View File

@ -17,7 +17,11 @@
#endif #endif
#else #else
#ifdef HAS_EPAPER #ifdef HAS_EPAPER
// #include <GxEPD2_BW.h>
#include <GxEPD2_3C.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#define ENABLE_GxEPD2_GFX 0 // enable or disable GxEPD2_GFX base class
GxEPD2_BW<GxEPD2_213_BN, GxEPD2_213_BN::HEIGHT> display(GxEPD2_213_BN(EPAPER_CS, EPAPER_DC, EPAPER_RST, EPAPER_BUSY)); // DEPG0213BN 122x250, SSD1680
#else #else
#include <Adafruit_GFX.h> #include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h> #include <Adafruit_SSD1306.h>
@ -54,7 +58,7 @@ void setup_display() {
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
#else #else
#ifdef HAS_EPAPER #ifdef HAS_EPAPER
// display.init(115200, true, 50, false);
#else #else
#ifdef OLED_DISPLAY_HAS_RST_PIN #ifdef OLED_DISPLAY_HAS_RST_PIN
pinMode(OLED_RST, OUTPUT); pinMode(OLED_RST, OUTPUT);
@ -156,7 +160,21 @@ void show_display(const String& header, const String& line1, const String& line2
tft.print(line3); tft.print(line3);
#else #else
#ifdef HAS_EPAPER #ifdef HAS_EPAPER
// display.setRotation(1);
display.setFont(&FreeMonoBold9pt7b);
display.setTextColor(GxEPD_BLACK);
int16_t tbx, tby; uint16_t tbw, tbh;
display.getTextBounds(header, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t x = ((display.width() - tbw) / 2) - tbx; // center bounding box by transposition of origin:
uint16_t y = ((display.height() - tbh) / 2) - tby;
display.setFullWindow();
display.firstPage();
do {
display.fillScreen(GxEPD_WHITE);
display.setCursor(x, y);
display.print(header);
}
while (display.nextPage());
#else #else
display.clearDisplay(); display.clearDisplay();
display.setTextColor(WHITE); display.setTextColor(WHITE);
@ -203,7 +221,21 @@ void show_display(const String& header, const String& line1, const String& line2
tft.print(line6); tft.print(line6);
#else #else
#ifdef HAS_EPAPER #ifdef HAS_EPAPER
// display.setRotation(1);
display.setFont(&FreeMonoBold9pt7b);
display.setTextColor(GxEPD_BLACK);
int16_t tbx, tby; uint16_t tbw, tbh;
display.getTextBounds(header, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t x = ((display.width() - tbw) / 2) - tbx; // center bounding box by transposition of origin:
uint16_t y = ((display.height() - tbh) / 2) - tby;
display.setFullWindow();
display.firstPage();
do {
display.fillScreen(GxEPD_WHITE);
display.setCursor(x, y);
display.print(header);
}
while (display.nextPage());
#else #else
display.clearDisplay(); display.clearDisplay();
display.setTextColor(WHITE); display.setTextColor(WHITE);