GxEPD2: setPartialWindow does not work coming from reset

Using the GxEPD2 library and working on an ESP32S3:

I am working with a GDEY042T81 e-ink display from Good Display

I am trying to render a timestamp on an existing content on the display. This timestamp only takes a very tiny rectangle of space on the display. Therefore I am using the display.setPartialWindow(x, y, w, h) method for doing so.

My application requires that I am able to add this partial-content:

a) after some main content is shown on the entire e-ink display

b) after a reset (keeping whatever is shown on the e-ink display and only adding the partial-content to whatever is there on the display after coming from reset)

a) I achieved without issues. But b) does not work. I tried during 6 hours today to make b) work ! But unfortunately without success :frowning:

I had to realize that, for some unknown reason, the partial window render does only work if I do a setFullWindow() drawing in the first place.

Can anybody explain how I can add partial content coming from reset withtout having to execute a fullWindow-render before ??

Here is my partial-content adding code :

display.setRotation(0);            
display.setPartialWindow(EPD_WIDTH - 85, 0, 85, 22);         
display.firstPage();
do {             
    display.fillScreen(GxEPD_WHITE);
    u8g2Fonts.setCursor(EPD_WIDTH - 82, 20);
    u8g2Fonts.print(timeHoursStr + ":" + timeMinutesStr + ":" + timeSecondsStr);
} while(display.nextPage());    

There is no effect if I do this coming from Reset. Or even worse, in some cases the e-ink display eliminates whatever is there in the non-partial-regions ! I really don't understand this weird behaviour.

However the above code perfectly works if I do the following before :

If I render a display.setFullWindow() beforehand, then the parial-display render works !!!

Here is the code for this:

display.setRotation(0);
display.setFullWindow();
display.firstPage();
do {                                
    display.fillScreen(GxEPD_WHITE);
    u8g2Fonts.setCursor(EPD_WIDTH / 2 - 112, EPD_HEIGHT / 2);        
    u8g2Fonts.print("Test - Welcome");
} while (display.nextPage());

The main problem is that the fullWindow render overwrites what is on the display coming from Reset. And I don't want to do this.

What I need is to being able to partially render a region of interest on the display without having to first render the entire display after coming from reset.

How can I do this ?

See https://github.com/ZinggJM/GxEPD2/blob/master/src/GxEPD2_BW.h line 287ff:

    // init method with additional parameters:
    // initial false for re-init after processor deep sleep wake up, if display power supply was kept
    // this can be used to avoid the repeated initial full refresh on displays with fast partial update
    // NOTE: garbage will result on fast partial update displays, if initial full update is omitted after power loss
    // reset_duration = 10 is default; a value of 2 may help with "clever" reset circuit of newer boards from Waveshare
    // pulldown_rst_mode true for alternate RST handling to avoid feeding 5V through RST pin
    void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 10, bool pulldown_rst_mode = false)
2 Likes

Excellent, thank you very much. You have an incredible knowledge, impressive!

My partial-upadate now works.

The only thing that was missing is to...

...replace
display.init()

...with
display.init(115200, false, 10, false);

After that you can achieve partial window render coming from Reset.

As described: the only thing that is needed is to keep the power connected all the time (from USB-plug or battery).

Again, many thanks for your support.

1 Like

Thanks! It would be kind to mark my response as solution, and maybe click the like.
-jz-

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