Partial update of several several isolated areas on an e-paper display - What is the best way?

I've connected a Waveshare 1.54 e-paper display to an ESP32 and operate it via GxEPD2. To save time (and therefore energy), I'd like to do partial updates of only the relevant parts. For this purpose, GxEPD2 features the method setPartialWindow which takes a bounding box of an area to be updated.
Now, my display contains several small and isolated areas that need to be updated regularly. They only make up a small part of the display, but due to their distribution all over the screen, the setPartialUpdate method would need to encompass the whole screen every time.

What is the intended modus operandi in this case? Should I perform a separate partial update for each isolated area or simply perform a partial update of the whole screen every time something updates (is there even any disadvantage if your partial update area is bigger)? Or does GxEPD2 have functionality for this case I'm not aware of?

@janis_blank , hi, welcome to the forum!

You would use partial update to full screen for this use case.

See also GxEPD2_Example.ino line 292: void helloFullScreenPartialMode()
there is no disadvantage, it takes the same time and energy as for a smaller partial window.
-jz-

Added: there is a disadvantage: you loose the background with this method.
The whole background would be white. Even if you remove display.fillScreen(GxEPD_WHITE);.
You would need to redraw the background as well.

For full buffered graphics, as possible with your ESP32 and your display, you could just draw over your several areas and then call display.display(true);

Added2: for the full buffered case it works if you remove display.fillScreen(GxEPD_WHITE);.
(because of an optimization that leaves the buffer content intact).
Hope I got it correct, now. Simple question with complex answer.

Thanks a lot, a partial update without losing the background works as per your second addendum. I had already accepted that I prolably have to redraw everything each time, but this makes things a lot more comfortable.
Here is a short example sketch in case anybody else comes by:

#include <Arduino.h>

#include <GxEPD2_BW.h>
/*
Select the display using the new style header file available in most example sketches, 
e.g. here: https://github.com/ZinggJM/GxEPD2/blob/master/examples/GxEPD2_Example/GxEPD2_display_selection_new_style.h
*/
#include "GxEPD_display_selection_new_style.h"
#include <U8g2_for_Adafruit_GFX.h> // https://github.com/olikraus/u8g2/wiki/fntlist99#18-pixel-height


U8G2_FOR_ADAFRUIT_GFX u8g2Fonts;

void setup()
{
  Serial.begin(115200);

  display.init(115200, true, 2, false); // USE THIS for Waveshare boards with "clever" reset circuit, 2ms reset pulse
  
  u8g2Fonts.begin(display); // connect u8g2 procedures to Adafruit GFX
  delay(1000);
  uint16_t bg = GxEPD_WHITE;
  uint16_t fg = GxEPD_BLACK;
  u8g2Fonts.setForegroundColor(fg);         // apply Adafruit GFX color
  u8g2Fonts.setBackgroundColor(bg);

  do{
    display.fillScreen(GxEPD_WHITE);

    u8g2Fonts.setFont(u8g2_font_ncenB18_te);   //font is set
    u8g2Fonts.setCursor(10, 40);
    u8g2Fonts.print("T:  "); 
  }while (display.nextPage());

  display.hibernate();
}

void loop() {

    u8g2Fonts.setCursor(40, 40);
    u8g2Fonts.print(millis);

    display.display(true); // partial update

    display.hibernate();

    delay(10000);

};

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.