From 220fc5845c08b83c8dbac63e0cb83e1a774071ca Mon Sep 17 00:00:00 2001 From: ZinggJM Date: Mon, 15 Jan 2024 15:09:11 +0100 Subject: [PATCH] Version 1.5.5 - updated 7-color driver classes (design cleanup fixed) - note: Waveshare PhotoPainter doesn't work with MBED Pico package - note: use package https://github.com/earlephilhower/arduino-pico for PhotoPainter --- README.md | 6 +++++- examples/GxEPD2_Example/GxEPD2_Example.ino | 3 ++- library.properties | 2 +- src/epd7c/GxEPD2_565c.cpp | 10 +++------- src/epd7c/GxEPD2_730c_ACeP_730.cpp | 8 +------- src/epd7c/GxEPD2_730c_GDEY073D46.cpp | 10 ++-------- src/gdey/GxEPD2_750_GDEY075T7.cpp | 3 +-- 7 files changed, 15 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index de64a85..38752ec 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,11 @@ - promotion panels from suppliers are welcome, to add support to GxEPD2 - donation panels from users are welcome, to add support to GxEPD2 -### Version 1.5.4 +### Version 1.5.5 +- updated 7-color driver classes (design cleanup fixed) +- note: Waveshare PhotoPainter doesn't work with MBED Pico package +- note: use package https://github.com/earlephilhower/arduino-pico for PhotoPainter +#### Version 1.5.4 - added support for GDEQ031T10 3.1" b/w 240x320 - updated support for GDEY075T7 7.5" b/w 800x480 - renamed driver class GxEPD2_750_YT7 to GxEPD2_750_GDEY075T7 diff --git a/examples/GxEPD2_Example/GxEPD2_Example.ino b/examples/GxEPD2_Example/GxEPD2_Example.ino index 9f3813c..b4096a6 100644 --- a/examples/GxEPD2_Example/GxEPD2_Example.ino +++ b/examples/GxEPD2_Example/GxEPD2_Example.ino @@ -129,7 +129,8 @@ arduino::MbedSPI SPIn(4, 7, 6); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short // uncomment next line for use with my proto board. // MbedSPI(int miso, int mosi, int sck); //arduino::MbedSPI SPIn(4, 3, 2); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short -// uncomment next line for use with Waveshare Pico-ePaper-2.9 or PhotoPainter. // MbedSPI(int miso, int mosi, int sck); +// uncomment next line for use with Waveshare Pico-ePaper-2.9. // MbedSPI(int miso, int mosi, int sck); +// note: doesn't work with Waveshare PhotoPainter, conflict on pin 12. use philhower package instead. //arduino::MbedSPI SPIn(12, 11, 10); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short #else // package https://github.com/earlephilhower/arduino-pico // SPIClassRP2040(spi_inst_t *spi, pin_size_t rx, pin_size_t cs, pin_size_t sck, pin_size_t tx); diff --git a/library.properties b/library.properties index ccab73f..b6ddbb0 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=GxEPD2 -version=1.5.4 +version=1.5.5 author=Jean-Marc Zingg maintainer=Jean-Marc Zingg sentence=Arduino Display Library for SPI E-Paper displays from Dalian Good Display and Waveshare. diff --git a/src/epd7c/GxEPD2_565c.cpp b/src/epd7c/GxEPD2_565c.cpp index 9862f6a..53a12b8 100644 --- a/src/epd7c/GxEPD2_565c.cpp +++ b/src/epd7c/GxEPD2_565c.cpp @@ -47,7 +47,6 @@ void GxEPD2_565c::writeScreenBuffer(uint8_t black_value, uint8_t color_value) _transfer(0xFF == black_value ? 0x11 : black_value); } _endTransfer(); - _initial_write = false; // initial full screen buffer clean done } void GxEPD2_565c::writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) @@ -56,7 +55,6 @@ void GxEPD2_565c::writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16 //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")"); delay(1); // yield() to avoid WDT on ESP8266 and ESP32 if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT))) { //Serial.println("paged"); @@ -130,7 +128,6 @@ void GxEPD2_565c::writeImage(const uint8_t* black, const uint8_t* color, int16_t //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")"); delay(1); // yield() to avoid WDT on ESP8266 and ESP32 if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT))) { //Serial.println("paged"); @@ -241,7 +238,6 @@ void GxEPD2_565c::writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t h1 -= dy; if ((w1 <= 0) || (h1 <= 0)) return; if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); _writeCommand(0x10); _startTransfer(); for (int16_t i = 0; i < int16_t(HEIGHT); i++) @@ -308,7 +304,6 @@ void GxEPD2_565c::writeImagePart(const uint8_t* black, const uint8_t* color, int h1 -= dy; if ((w1 <= 0) || (h1 <= 0)) return; if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); _writeCommand(0x10); _startTransfer(); for (int16_t i = 0; i < int16_t(HEIGHT); i++) @@ -368,7 +363,6 @@ void GxEPD2_565c::writeNative(const uint8_t* data1, const uint8_t* data2, int16_ //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")"); delay(1); // yield() to avoid WDT on ESP8266 and ESP32 if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT))) { //Serial.println("paged"); @@ -456,7 +450,6 @@ void GxEPD2_565c::writeNativePart(const uint8_t* data1, const uint8_t* data2, in h1 -= dy; if ((w1 <= 0) || (h1 <= 0)) return; if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); _writeCommand(0x10); _startTransfer(); for (int16_t i = 0; i < int16_t(HEIGHT); i++) @@ -595,6 +588,7 @@ void GxEPD2_565c::_InitDisplay() digitalWrite(_rst, HIGH); delay(2); _waitWhileBusy("_InitDisplay reset", power_on_time); + _initial_write = false; // used for initial reset done _hibernating = false; _power_is_on = false; } @@ -630,4 +624,6 @@ void GxEPD2_565c::_InitDisplay() delay(100); _writeCommand(0x50); // VCOM and Data Interval Setting _writeData(0x37); // white border + _PowerOn(); + _init_display_done = true; } diff --git a/src/epd7c/GxEPD2_730c_ACeP_730.cpp b/src/epd7c/GxEPD2_730c_ACeP_730.cpp index 6ec8277..bd44617 100644 --- a/src/epd7c/GxEPD2_730c_ACeP_730.cpp +++ b/src/epd7c/GxEPD2_730c_ACeP_730.cpp @@ -46,7 +46,6 @@ void GxEPD2_730c_ACeP_730::writeScreenBuffer(uint8_t black_value, uint8_t color_ _transfer(0xFF == black_value ? 0x11 : black_value); } _endTransfer(); - _initial_write = false; // initial full screen buffer clean done } void GxEPD2_730c_ACeP_730::writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) @@ -55,7 +54,6 @@ void GxEPD2_730c_ACeP_730::writeImage(const uint8_t bitmap[], int16_t x, int16_t //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")"); delay(1); // yield() to avoid WDT on ESP8266 and ESP32 if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT))) { //Serial.println("paged"); @@ -129,7 +127,6 @@ void GxEPD2_730c_ACeP_730::writeImage(const uint8_t* black, const uint8_t* color //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")"); delay(1); // yield() to avoid WDT on ESP8266 and ESP32 if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT))) { //Serial.println("paged"); @@ -240,7 +237,6 @@ void GxEPD2_730c_ACeP_730::writeImagePart(const uint8_t bitmap[], int16_t x_part h1 -= dy; if ((w1 <= 0) || (h1 <= 0)) return; if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); _writeCommand(0x10); _startTransfer(); for (int16_t i = 0; i < int16_t(HEIGHT); i++) @@ -307,7 +303,6 @@ void GxEPD2_730c_ACeP_730::writeImagePart(const uint8_t* black, const uint8_t* c h1 -= dy; if ((w1 <= 0) || (h1 <= 0)) return; if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); _writeCommand(0x10); _startTransfer(); for (int16_t i = 0; i < int16_t(HEIGHT); i++) @@ -367,7 +362,6 @@ void GxEPD2_730c_ACeP_730::writeNative(const uint8_t* data1, const uint8_t* data //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")"); delay(1); // yield() to avoid WDT on ESP8266 and ESP32 if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT))) { //Serial.println("paged"); @@ -455,7 +449,6 @@ void GxEPD2_730c_ACeP_730::writeNativePart(const uint8_t* data1, const uint8_t* h1 -= dy; if ((w1 <= 0) || (h1 <= 0)) return; if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); _writeCommand(0x10); _startTransfer(); for (int16_t i = 0; i < int16_t(HEIGHT); i++) @@ -595,6 +588,7 @@ void GxEPD2_730c_ACeP_730::_InitDisplay() digitalWrite(_rst, HIGH); delay(2); _waitWhileBusy("_InitDisplay reset", power_on_time); + _initial_write = false; // used for initial reset done _hibernating = false; _power_is_on = false; } diff --git a/src/epd7c/GxEPD2_730c_GDEY073D46.cpp b/src/epd7c/GxEPD2_730c_GDEY073D46.cpp index a849d73..b069d44 100644 --- a/src/epd7c/GxEPD2_730c_GDEY073D46.cpp +++ b/src/epd7c/GxEPD2_730c_GDEY073D46.cpp @@ -46,7 +46,6 @@ void GxEPD2_730c_GDEY073D46::writeScreenBuffer(uint8_t black_value, uint8_t colo _transfer(0xFF == black_value ? 0x11 : black_value); } _endTransfer(); - _initial_write = false; // initial full screen buffer clean done } void GxEPD2_730c_GDEY073D46::writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) @@ -55,7 +54,6 @@ void GxEPD2_730c_GDEY073D46::writeImage(const uint8_t bitmap[], int16_t x, int16 //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")"); delay(1); // yield() to avoid WDT on ESP8266 and ESP32 if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT))) { //Serial.println("paged"); @@ -129,7 +127,6 @@ void GxEPD2_730c_GDEY073D46::writeImage(const uint8_t* black, const uint8_t* col //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")"); delay(1); // yield() to avoid WDT on ESP8266 and ESP32 if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT))) { //Serial.println("paged"); @@ -240,7 +237,6 @@ void GxEPD2_730c_GDEY073D46::writeImagePart(const uint8_t bitmap[], int16_t x_pa h1 -= dy; if ((w1 <= 0) || (h1 <= 0)) return; if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); _writeCommand(0x10); _startTransfer(); for (int16_t i = 0; i < int16_t(HEIGHT); i++) @@ -307,7 +303,6 @@ void GxEPD2_730c_GDEY073D46::writeImagePart(const uint8_t* black, const uint8_t* h1 -= dy; if ((w1 <= 0) || (h1 <= 0)) return; if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); _writeCommand(0x10); _startTransfer(); for (int16_t i = 0; i < int16_t(HEIGHT); i++) @@ -367,7 +362,6 @@ void GxEPD2_730c_GDEY073D46::writeNative(const uint8_t* data1, const uint8_t* da //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")"); delay(1); // yield() to avoid WDT on ESP8266 and ESP32 if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT))) { //Serial.println("paged"); @@ -455,7 +449,6 @@ void GxEPD2_730c_GDEY073D46::writeNativePart(const uint8_t* data1, const uint8_t h1 -= dy; if ((w1 <= 0) || (h1 <= 0)) return; if (!_init_display_done) _InitDisplay(); - if (_initial_write) writeScreenBuffer(); _writeCommand(0x10); _startTransfer(); for (int16_t i = 0; i < int16_t(HEIGHT); i++) @@ -589,12 +582,13 @@ void GxEPD2_730c_GDEY073D46::_InitDisplay() { pinMode(_rst, OUTPUT); // just in case digitalWrite(_rst, HIGH); - delay(20); + delay(50); // needs a little longer digitalWrite(_rst, LOW); delay(20); digitalWrite(_rst, HIGH); delay(2); _waitWhileBusy("_InitDisplay reset", power_on_time); + _initial_write = false; // used for initial reset done _hibernating = false; _power_is_on = false; } diff --git a/src/gdey/GxEPD2_750_GDEY075T7.cpp b/src/gdey/GxEPD2_750_GDEY075T7.cpp index 39f2357..623b140 100644 --- a/src/gdey/GxEPD2_750_GDEY075T7.cpp +++ b/src/gdey/GxEPD2_750_GDEY075T7.cpp @@ -285,8 +285,7 @@ void GxEPD2_750_GDEY075T7::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w _writeData(y % 256); _writeData(ye / 256); _writeData(ye % 256); - _writeData(0x01); // don't see any difference - //_writeData(0x00); // don't see any difference + _writeData(0x01); } void GxEPD2_750_GDEY075T7::_PowerOn()