From e726f27202db090680c40642b9be231d393405c5 Mon Sep 17 00:00:00 2001 From: echoromeo Date: Wed, 23 Oct 2024 09:00:58 +0200 Subject: [PATCH 1/2] SetPartialWindow x > 248 fix (x & 0xf8) is only for low byte --- Arduino/epd4in2/epd4in2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Arduino/epd4in2/epd4in2.cpp b/Arduino/epd4in2/epd4in2.cpp index f9e10caa9..877cb2064 100644 --- a/Arduino/epd4in2/epd4in2.cpp +++ b/Arduino/epd4in2/epd4in2.cpp @@ -179,7 +179,7 @@ void Epd::SetPartialWindow(const unsigned char* buffer_black, int x, int y, int SendCommand(PARTIAL_WINDOW); SendData(x >> 8); SendData(x & 0xf8); // x should be the multiple of 8, the last 3 bit will always be ignored - SendData(((x & 0xf8) + w - 1) >> 8); + SendData((x + w - 1) >> 8); SendData(((x & 0xf8) + w - 1) | 0x07); SendData(y >> 8); SendData(y & 0xff); From 9b88c053e431929d7f05303f591b0724b691c607 Mon Sep 17 00:00:00 2001 From: echoromeo Date: Wed, 23 Oct 2024 09:26:21 +0200 Subject: [PATCH 2/2] Fixed x > 248 for 4in2b as well --- Arduino/epd4in2bc/epd4in2b.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Arduino/epd4in2bc/epd4in2b.cpp b/Arduino/epd4in2bc/epd4in2b.cpp index 353ab06f7..6766bc270 100644 --- a/Arduino/epd4in2bc/epd4in2b.cpp +++ b/Arduino/epd4in2bc/epd4in2b.cpp @@ -103,7 +103,7 @@ void Epd::SetPartialWindow(const unsigned char* buffer_black, const unsigned cha SendCommand(PARTIAL_WINDOW); SendData(x >> 8); SendData(x & 0xf8); // x should be the multiple of 8, the last 3 bit will always be ignored - SendData(((x & 0xf8) + w - 1) >> 8); + SendData((x + w - 1) >> 8); SendData(((x & 0xf8) + w - 1) | 0x07); SendData(y >> 8); SendData(y & 0xff); @@ -136,7 +136,7 @@ void Epd::SetPartialWindowBlack(const unsigned char* buffer_black, int x, int y, SendCommand(PARTIAL_WINDOW); SendData(x >> 8); SendData(x & 0xf8); // x should be the multiple of 8, the last 3 bit will always be ignored - SendData(((x & 0xf8) + w - 1) >> 8); + SendData((x + w - 1) >> 8); SendData(((x & 0xf8) + w - 1) | 0x07); SendData(y >> 8); SendData(y & 0xff); @@ -162,7 +162,7 @@ void Epd::SetPartialWindowRed(const unsigned char* buffer_red, int x, int y, int SendCommand(PARTIAL_WINDOW); SendData(x >> 8); SendData(x & 0xf8); // x should be the multiple of 8, the last 3 bit will always be ignored - SendData(((x & 0xf8) + w - 1) >> 8); + SendData((x + w - 1) >> 8); SendData(((x & 0xf8) + w - 1) | 0x07); SendData(y >> 8); SendData(y & 0xff);