Lilygo T5 V2: Lib GxEPD: The graphic display of x=0 y=0 (top left and right) is wrong with Platform IO, but correct with the Arduino IDE. What can do?
Please list the Arduino-ESP32 core version used in the Arduino IDE (Tools->Board->Board Manger → esp32), the version of the used GxEPD library in the Arduino IDE and a screenshot of the Tools menu.
So not GxEPD2 like shown in I can't load lib GxEPD2 and test examples - #3 by stoni99?
lib_deps =
zinggjm/GxEPD2 @ ^1.5.0
The GxEPD2 makes the same mistake under Platformio.
Well let’s equaliz the environments though or we’re comparing apples to oranges.
Set
lib_deps =
https://github.com/ZinggJM/GxEPD/archive/refs/tags/3.1.1.zip
and try to GxEPD/examples/GxEPD_Example at 3.1.1 · ZinggJM/GxEPD · GitHub running. Does it show the same error?
Version 3.1.1:
Archiving .pio\build\esp32dev\libb6b\libSPI.a
src/main.cpp:11:10: fatal error: GxDEPG0213BN/GxDEPG0213BN.h: No such file or directory
#include <GxDEPG0213BN/GxDEPG0213BN.h> // 2.13" b/w form DKE GROUP
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\esp32dev\src\main.cpp.o] Error 1
sketch:
#include <Arduino.h>
// According to the board, cancel the corresponding macro definition
#define LILYGO_T5_V213 //ist 250, 122 px (soll 212 x 104)
//#include <boards.h>
#include <GxEPD.h>
#include <SD.h>
#include <FS.h>
#include <GxDEPG0213BN/GxDEPG0213BN.h> // 2.13" b/w form DKE GROUP
// FreeFonts from Adafruit_GFX
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#include <Fonts/FreeMonoBold18pt7b.h>
#include <Fonts/FreeMonoBold24pt7b.h>
#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <GxIO/GxIO.h>
GxIO_Class io(SPI, 5, 17, 16);
GxEPD_Class display(io, /*RST=*/ 16, /*BUSY=*/ 4); // default selection of (9), 7
uint16_t box_x = 126;
uint16_t box_y = 62;
uint16_t box_w = 23;
uint16_t box_h = 28;
uint16_t cursor_y = box_y + 24;
void drawHelloWorld();
void showPartialUpdate();
void setup()
{
display.init();
display.eraseDisplay();
display.setTextColor(GxEPD_BLACK);
display.setRotation(1);
display.setFont(&FreeMonoBold9pt7b);
drawHelloWorld(); // UP
//display.drawPaged(drawHelloWorld); // version for AVR using paged drawing, works also on other processors
display.setFont(&FreeMonoBold18pt7b);
//display.drawRect(box_x, box_y, box_w, box_h, GxEPD_BLACK); //w= von x nach lks / h= von y nach unten
display.drawLine(125, 61, 0, 0, GxEPD_BLACK);
display.drawLine(125, 61, 250, 0, GxEPD_BLACK);
display.drawLine(125, 61, 0, 122, GxEPD_BLACK);
display.drawRect(0, 0, 250, 122, GxEPD_BLACK); // x y w h / w=von x nach re / h=von y nach unten
display.drawRect(125, 61, 25, 30, GxEPD_BLACK); // x y w h / w=von x nach re / h=von y nach unten
display.update();
delay(1000);
}
void drawHelloWorld()
{
display.eraseDisplay();
display.setCursor(20, 20);
display.print("Hello World! 9pt");
display.setFont(&FreeMonoBold12pt7b);
display.setCursor(30, 40);
display.print("Bold12pt");
display.setFont(&FreeMonoBold18pt7b);
display.setCursor(3, 75);
display.print("18pt");
display.update();
display.setFont(&FreeMonoBold12pt7b);
display.drawCircle(180, 61, 15, GxEPD_BLACK); // x,y,r,color
display.drawTriangle(100, 90, 90, 100, 110, 100, GxEPD_BLACK); // x1,y1,x2,y2,x3,y3,color
display.fillTriangle(150, 90, 140, 100, 160, 100, GxEPD_BLACK); // x1,y1,x2,y2,x3,y3,color
delay(1000);
}
void showPartialUpdate()
{
// es verhindert unerwünschte Hintergrund-Anzeigen:
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false);
for (int i=0;i<10;i++)
{
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
display.setCursor(box_x, cursor_y);
display.print(i);
display.updateWindow(box_x, box_y, box_w, box_h, true);
//display.powerDown();
delay(1000);
}
}
void loop() {
for (int a=1;a<10;a++)
{
showPartialUpdate(); // UP
delay(5000);
}
delay(5000);
}
I don’t see that a available header in GxEPD/examples/GxEPD_Example/GxEPD_Example.ino at 3.1.1 · ZinggJM/GxEPD · GitHub
That is 3.1.3 though. Can you update to
lib_deps =
https://github.com/ZinggJM/GxEPD/archive/refs/tags/3.1.3.zip
Done…
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
;https://github.com/ZinggJM/GxEPD/archive/refs/tags/3.1.1.zip
zinggjm/GxEPD@^3.1.3
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [= ] 8.0% (used 26328 bytes from 327680 bytes)
Flash: [== ] 22.2% (used 291141 bytes from 1310720 bytes)
Building .pio\build\esp32dev\firmware.bin
esptool.py v4.4
Creating esp32 image...
Merged 2 ELF sections
Successfully created esp32 image.
=================================================================== [SUCCESS] Took 170.70 seconds ===================================================================
This?:
I found something:
It has something to do with ‘display.setRotation(1);’ .
If I ‘display.setRotation(3);’ the display is correct.
With the Arduino IDE, however, both settings are correct.