That looks to be reporting 26 all the time.
I am testing using the following bit of code:
#include <Adafruit_GFX_RK.h>
#include <GxEPD2.h>
#define ENABLE_GxEPD2_GFX 0
#include <Arduino.h>
#include <Adafruit_GFX.h>
#include <FreeSerifBold24pt7b.h>
#include <GxEPD2_BW.h>
#include <GxEPD2_3C.h>
#include "benji_image.h"
// Init the screen object
GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT> display(GxEPD2_420c(/*CS=A2*/ D8, /*DC=*/ D7, /*RST=*/ D6, /*BUSY=*/ D5));
// setup() runs once, when the device is first turned on.
void setup() {
// Put initialization like pinMode and begin functions here.
Serial.begin(115200);
char tmpStr[50]; // Used for debugging messages
Serial.println("GxEPD test starting");
// Wake up display
display.init(115200);
// first update should be full refresh
display.setRotation(1);
display.setFont(&FreeSerifBold24pt7b);
display.setTextColor(GxEPD_RED);
display.setFullWindow();
int16_t tbx, tby; uint16_t tbw, tbh; // boundary box window
display.getTextBounds("Benji!", 0, 0, &tbx, &tby, &tbw, &tbh); // it works for origin 0, 0, fortunately (negative tby!)
// center bounding box by transposition of origin:
uint16_t x = ((display.width() - tbw) / 2) - tbx;
uint16_t y = tbh;
display.firstPage();
do {
display.fillScreen(GxEPD_WHITE);
display.drawInvertedBitmap(0,tbh+2,benjiBW,310,300,GxEPD_BLACK);
display.setCursor(x,y);
display.print("Benji!");
} while (display.nextPage());
}
int x=0;
int basePos=30;
int addPos=0;
char tmpStr[80];
void loop() {
sprintf(tmpStr, "Loop num=%d, addPos=%d", x, addPos);
Serial.println(tmpStr);
if(display.epd2.hasPartialUpdate) {
Serial.println(" Has partial update");
} else {
Serial.println(" Does not have partial update");
}
// Move the cursor
display.setPartialWindow(basePos,380,40+80,16); // Width is 80+cursor width
display.firstPage();
do {
display.fillScreen(GxEPD_WHITE);
display.fillRect(basePos+(addPos*80), 380, 40, 16, GxEPD_BLACK);
} while (display.nextPage());
x++;
if(addPos==0) {
addPos=1;
} else {
addPos=0;
}
delay(20000);
}
That just displays an image and then every 20 seconds it should move a cursor (just a filled rectangle) left and right. I was hoping that with partialUpdate I could just refresh a small area of the screen and avoid the whole thing redrawing. Is that just not how the partial update works and if I want that smoothness then (cheap) epaper is not the answer? At the moment, it redraws the whole screen.
The console output from this is
Loop num=24, addPos=0
Has partial update
_Update_Part : 26
Loop num=25, addPos=1
Has partial update
_Update_Part : 26
Loop num=26, addPos=0
Has partial update
_Update_Part : 26
Loop num=27, addPos=1
Has partial update
_Update_Part : 26