Hi all,
I am using the code below from https://www.instructables.com/E-Paper-Display-Partial-Refresh-With-Arduino/. Their code works really well.
They use a B/W 2.9" E-Paper display from Waveshare and an Arduino Nano.
I am using a B/W/R 2.9" E-Paper display from Waveshare and an ESP32
I have made some modifications for my color display, as seen in the code below.
In my case partial refresh is not working. The display does full refresh for every update.
I did raise a ticket with Waveshare asking for a dedicate driver for this display, but no answer from them.
I believe the problem in the driver.
Is there a more recent driver for this display?
Has anyone experienced same issue with this display?
I really appreciate any input.
Thank you very much.
#define ENABLE_GxEPD2_GFX 0
//#include <GxEPD2_BW.h> // ORIGINAL CODE
#include <U8g2_for_Adafruit_GFX.h>
// -------------- My modifications -------------------
#include <GxEPD2_3C.h>
//These work s but no partial refresh, only full refresh (copied from GxEPD2_display_selection.h)
GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW029Z10
//GxEPD2_3C<GxEPD2_290_Z13c, GxEPD2_290_Z13c::HEIGHT> display(GxEPD2_290_Z13c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH029Z13
//This one not working at all
//GxEPD2_3C<GxEPD2_290_C90c, GxEPD2_290_C90c::HEIGHT> display(GxEPD2_290_C90c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEM029C90
//--------------------------------------------------------
#if defined(__AVR)
#define MAX_DISPLAY_BUFFER_SIZE 800
#define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8))
GxEPD2_BW<GxEPD2_290, MAX_HEIGHT(GxEPD2_290)> display(GxEPD2_290(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
#endif
U8G2_FOR_ADAFRUIT_GFX u8g2Fonts;
void setup()
{
display.init();
u8g2Fonts.begin(display); // connect u8g2 procedures to Adafruit GFX
delay(1000);
}
void loop()
{
display.fillScreen(GxEPD_WHITE);
displayValues();
delay(1000);
}
void displayValues()
{
float number; //A0 Value
float number2; // A0 Value converted to voltage
number = analogRead(A0);
number2 = number/1023 * 5;
display.setRotation(1); // 0--> No rotation , 1--> rotate 90 deg
uint16_t bg = GxEPD_WHITE;
uint16_t fg = GxEPD_BLACK;
u8g2Fonts.setFontMode(1); // use u8g2 transparent mode (this is default)
u8g2Fonts.setFontDirection(0); // left to right (this is default)
u8g2Fonts.setForegroundColor(fg); // apply Adafruit GFX color
u8g2Fonts.setBackgroundColor(bg); // apply Adafruit GFX color
//u8g2Fonts.setFont(u8g2_font_helvR14_tf); // select u8g2 font from here: https://github.com/olikraus/u8g2/wiki/fntlistall
u8g2Fonts.setFont(u8g2_font_logisoso32_tr); //u8g2_font_logisoso32_tn--->numbers only to save memory ; u8g2_font_logisoso32_tr , u8g2_font_logisoso32_tf -->numbers&letters
uint16_t x = 150;
uint16_t y = 50;
display.setPartialWindow(0, 0, display.width(), 296); //this sets a window for the partial update, so the values can update without refreshing the entire screen.
display.firstPage();
do
{
display.fillScreen(bg);
// Display A0 value
u8g2Fonts.setCursor(90, y);
u8g2Fonts.print("A0:");
u8g2Fonts.setCursor(x, y);
u8g2Fonts.println(number,1);
// Display Voltage of A0
u8g2Fonts.setCursor(50, y +40);
u8g2Fonts.print("Volts:");
u8g2Fonts.setCursor(x, y + 40);
u8g2Fonts.println(number2,1);
}
while (display.nextPage());
}