SleXx88 / ESP32-Waveshare-EPaper-Driver

This driver board controls e-paper displays from Waveshare. Thus it is easy to display visually beautiful dashboards.
https://martinteske-blog.de/e-paper-home-assistant-dashboard-teil-1/
GNU General Public License v3.0
29 stars 0 forks source link

How to compile this project #2

Closed JJYi1 closed 10 months ago

JJYi1 commented 10 months ago

Hi, I have changed the name of /src folder to FW_V1.0_EPAPER_DRIVER (same as FW_V1.0_EPAPER_DRIVER.ino) to compile the project in arduino IDE. But it returned following errors: C:\Users\user\Desktop\ESP32-Waveshare-EPaper-Driver-master\FW_V1.0_EPAPER_DRIVER\refresh_epaper.ino:5:21: note: the macro 'GxEPD_RED' had not yet been defined In file included from c:\Users\user\Documents\Arduino\libraries\GxEPD2\src/GxEPD2_EPD.h:18, from c:\Users\user\Documents\Arduino\libraries\GxEPD2\src/GxEPD2_3C.h:32, from C:\Users\user\Desktop\ESP32-Waveshare-EPaper-Driver-master\FW_V1.0_EPAPER_DRIVER\setup_epaper.ino:3: c:\Users\user\Documents\Arduino\libraries\GxEPD2\src/GxEPD2.h:25: note: it was later defined here

define GxEPD_RED 0xF800 // 255, 0, 0

C:\Users\user\Desktop\ESP32-Waveshare-EPaper-Driver-master\FW_V1.0_EPAPER_DRIVER\refresh_epaper.ino:7:3: error: 'display' was not declared in this scope display.firstPage(); ^~~

I can see all the things are defined in the setup_epaper.ino but somehow it doesn't work. Thanks a lot if you can help!

animevietsub commented 10 months ago

For some reason, the file refresh_epaper.ino was compile before file setup_epaper.ino so you need to move

#define ENABLE_GxEPD2_GFX 0

#include <GxEPD2_3C.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include <U8g2_for_Adafruit_GFX.h>

#define GxEPD2_DISPLAY_CLASS GxEPD2_3C
//#define GxEPD2_DRIVER_CLASS GxEPD2_420c_Z21 // GDEQ042Z21  400x300, UC8276
#define GxEPD2_DRIVER_CLASS GxEPD2_750c_Z08 // GDEW075Z08  800x480, GD7965
//#define GxEPD2_DRIVER_CLASS GxEPD2_750c_Z90 // GDEH075Z90  880x528, SSD1677

//#define GxEPD2_3C_IS_GxEPD2_3C true
#define GxEPD2_750c_Z08_IS_3C true
//#define GxEPD2_750c_Z90_IS_3C true

#define IS_GxEPD2_DRIVER(c, x) (c##x)
#define IS_GxEPD2_3C(x) IS_GxEPD(GxEPD2_3C_IS_, x)
#define MAX_DISPLAY_BUFFER_SIZE 65536ul
#define MAX_HEIGHT(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8))
GxEPD2_DISPLAY_CLASS<GxEPD2_DRIVER_CLASS, MAX_HEIGHT(GxEPD2_DRIVER_CLASS)> display(GxEPD2_DRIVER_CLASS(PIN_CS, PIN_DC, PIN_RST, PIN_BUSY));

//#define GxEPD2_420c_Z21_IS_3C true
#define GxEPD2_750c_Z08_IS_3C true
//#define GxEPD2_750c_Z90_IS_3C true

U8G2_FOR_ADAFRUIT_GFX u8g2Fonts;

from file setup_epaper.ino to file refresh_epaper.ino.

SleXx88 commented 10 months ago

Hello, thanks for the info. I have the same problem and will completely rework the script. Likewise, I'm working on a new interface at the moment, less code and more options for custom design.