From aa9f2a69043a8cdbc5b8e1cd9053495098212e2b Mon Sep 17 00:00:00 2001 From: Xiaonan Shen Date: Sat, 29 Feb 2020 19:54:34 -0800 Subject: [PATCH] Fix Arduino/epd4in2(bc) x_end calculation --- Arduino/epd4in2/epd4in2.cpp | 2 +- Arduino/epd4in2bc/epd4in2b.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Arduino/epd4in2/epd4in2.cpp b/Arduino/epd4in2/epd4in2.cpp index 8e13f55..fb8753b 100644 --- a/Arduino/epd4in2/epd4in2.cpp +++ b/Arduino/epd4in2/epd4in2.cpp @@ -159,7 +159,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 & 0xfff8) + w - 1) >> 8); SendData(((x & 0xf8) + w - 1) | 0x07); SendData(y >> 8); SendData(y & 0xff); diff --git a/Arduino/epd4in2bc/epd4in2b.cpp b/Arduino/epd4in2bc/epd4in2b.cpp index 353ab06..18d5e69 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 & 0xfff8) + 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 & 0xfff8) + 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 & 0xfff8) + w - 1) >> 8); SendData(((x & 0xf8) + w - 1) | 0x07); SendData(y >> 8); SendData(y & 0xff);