Преглед изворни кода

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
ZinggJM пре 2 година
родитељ
комит
220fc5845c

+ 5 - 1
README.md

@@ -144,7 +144,11 @@
 - promotion panels from suppliers are welcome, to add support to GxEPD2
 - promotion panels from suppliers are welcome, to add support to GxEPD2
 - donation panels from users 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
 - added support for GDEQ031T10 3.1" b/w 240x320
 - updated support for GDEY075T7 7.5" b/w 800x480
 - updated support for GDEY075T7 7.5" b/w 800x480
 - renamed driver class GxEPD2_750_YT7 to GxEPD2_750_GDEY075T7
 - renamed driver class GxEPD2_750_YT7 to GxEPD2_750_GDEY075T7

+ 2 - 1
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
 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);
 // 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
 //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
 //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
 #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);
 // SPIClassRP2040(spi_inst_t *spi, pin_size_t rx, pin_size_t cs, pin_size_t sck, pin_size_t tx);

+ 1 - 1
library.properties

@@ -1,5 +1,5 @@
 name=GxEPD2
 name=GxEPD2
-version=1.5.4
+version=1.5.5
 author=Jean-Marc Zingg
 author=Jean-Marc Zingg
 maintainer=Jean-Marc Zingg
 maintainer=Jean-Marc Zingg
 sentence=Arduino Display Library for SPI E-Paper displays from Dalian Good Display and Waveshare. 
 sentence=Arduino Display Library for SPI E-Paper displays from Dalian Good Display and Waveshare. 

+ 3 - 7
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);
     _transfer(0xFF == black_value ? 0x11 : black_value);
   }
   }
   _endTransfer();
   _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)
 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(")");
   //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
   delay(1); // yield() to avoid WDT on ESP8266 and ESP32
   delay(1); // yield() to avoid WDT on ESP8266 and ESP32
   if (!_init_display_done) _InitDisplay();
   if (!_init_display_done) _InitDisplay();
-  if (_initial_write) writeScreenBuffer();
   if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
   if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
   {
   {
     //Serial.println("paged");
     //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(")");
   //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
   delay(1); // yield() to avoid WDT on ESP8266 and ESP32
   delay(1); // yield() to avoid WDT on ESP8266 and ESP32
   if (!_init_display_done) _InitDisplay();
   if (!_init_display_done) _InitDisplay();
-  if (_initial_write) writeScreenBuffer();
   if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
   if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
   {
   {
     //Serial.println("paged");
     //Serial.println("paged");
@@ -241,7 +238,6 @@ void GxEPD2_565c::writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t
   h1 -= dy;
   h1 -= dy;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if (!_init_display_done) _InitDisplay();
   if (!_init_display_done) _InitDisplay();
-  if (_initial_write) writeScreenBuffer();
   _writeCommand(0x10);
   _writeCommand(0x10);
   _startTransfer();
   _startTransfer();
   for (int16_t i = 0; i < int16_t(HEIGHT); i++)
   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;
   h1 -= dy;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if (!_init_display_done) _InitDisplay();
   if (!_init_display_done) _InitDisplay();
-  if (_initial_write) writeScreenBuffer();
   _writeCommand(0x10);
   _writeCommand(0x10);
   _startTransfer();
   _startTransfer();
   for (int16_t i = 0; i < int16_t(HEIGHT); i++)
   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(")");
     //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
     delay(1); // yield() to avoid WDT on ESP8266 and ESP32
     delay(1); // yield() to avoid WDT on ESP8266 and ESP32
     if (!_init_display_done) _InitDisplay();
     if (!_init_display_done) _InitDisplay();
-    if (_initial_write) writeScreenBuffer();
     if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
     if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
     {
     {
       //Serial.println("paged");
       //Serial.println("paged");
@@ -456,7 +450,6 @@ void GxEPD2_565c::writeNativePart(const uint8_t* data1, const uint8_t* data2, in
   h1 -= dy;
   h1 -= dy;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if (!_init_display_done) _InitDisplay();
   if (!_init_display_done) _InitDisplay();
-  if (_initial_write) writeScreenBuffer();
   _writeCommand(0x10);
   _writeCommand(0x10);
   _startTransfer();
   _startTransfer();
   for (int16_t i = 0; i < int16_t(HEIGHT); i++)
   for (int16_t i = 0; i < int16_t(HEIGHT); i++)
@@ -595,6 +588,7 @@ void GxEPD2_565c::_InitDisplay()
     digitalWrite(_rst, HIGH);
     digitalWrite(_rst, HIGH);
     delay(2);
     delay(2);
     _waitWhileBusy("_InitDisplay reset", power_on_time);
     _waitWhileBusy("_InitDisplay reset", power_on_time);
+    _initial_write = false; // used for initial reset done
     _hibernating = false;
     _hibernating = false;
     _power_is_on = false;
     _power_is_on = false;
   }
   }
@@ -630,4 +624,6 @@ void GxEPD2_565c::_InitDisplay()
   delay(100);
   delay(100);
   _writeCommand(0x50); // VCOM and Data Interval Setting
   _writeCommand(0x50); // VCOM and Data Interval Setting
   _writeData(0x37);    // white border
   _writeData(0x37);    // white border
+  _PowerOn();
+  _init_display_done = true;
 }
 }

+ 1 - 7
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);
     _transfer(0xFF == black_value ? 0x11 : black_value);
   }
   }
   _endTransfer();
   _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)
 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(")");
   //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
   delay(1); // yield() to avoid WDT on ESP8266 and ESP32
   delay(1); // yield() to avoid WDT on ESP8266 and ESP32
   if (!_init_display_done) _InitDisplay();
   if (!_init_display_done) _InitDisplay();
-  if (_initial_write) writeScreenBuffer();
   if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
   if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
   {
   {
     //Serial.println("paged");
     //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(")");
   //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
   delay(1); // yield() to avoid WDT on ESP8266 and ESP32
   delay(1); // yield() to avoid WDT on ESP8266 and ESP32
   if (!_init_display_done) _InitDisplay();
   if (!_init_display_done) _InitDisplay();
-  if (_initial_write) writeScreenBuffer();
   if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
   if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
   {
   {
     //Serial.println("paged");
     //Serial.println("paged");
@@ -240,7 +237,6 @@ void GxEPD2_730c_ACeP_730::writeImagePart(const uint8_t bitmap[], int16_t x_part
   h1 -= dy;
   h1 -= dy;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if (!_init_display_done) _InitDisplay();
   if (!_init_display_done) _InitDisplay();
-  if (_initial_write) writeScreenBuffer();
   _writeCommand(0x10);
   _writeCommand(0x10);
   _startTransfer();
   _startTransfer();
   for (int16_t i = 0; i < int16_t(HEIGHT); i++)
   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;
   h1 -= dy;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if (!_init_display_done) _InitDisplay();
   if (!_init_display_done) _InitDisplay();
-  if (_initial_write) writeScreenBuffer();
   _writeCommand(0x10);
   _writeCommand(0x10);
   _startTransfer();
   _startTransfer();
   for (int16_t i = 0; i < int16_t(HEIGHT); i++)
   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(")");
     //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
     delay(1); // yield() to avoid WDT on ESP8266 and ESP32
     delay(1); // yield() to avoid WDT on ESP8266 and ESP32
     if (!_init_display_done) _InitDisplay();
     if (!_init_display_done) _InitDisplay();
-    if (_initial_write) writeScreenBuffer();
     if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
     if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
     {
     {
       //Serial.println("paged");
       //Serial.println("paged");
@@ -455,7 +449,6 @@ void GxEPD2_730c_ACeP_730::writeNativePart(const uint8_t* data1, const uint8_t*
   h1 -= dy;
   h1 -= dy;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if (!_init_display_done) _InitDisplay();
   if (!_init_display_done) _InitDisplay();
-  if (_initial_write) writeScreenBuffer();
   _writeCommand(0x10);
   _writeCommand(0x10);
   _startTransfer();
   _startTransfer();
   for (int16_t i = 0; i < int16_t(HEIGHT); i++)
   for (int16_t i = 0; i < int16_t(HEIGHT); i++)
@@ -595,6 +588,7 @@ void GxEPD2_730c_ACeP_730::_InitDisplay()
     digitalWrite(_rst, HIGH);
     digitalWrite(_rst, HIGH);
     delay(2);
     delay(2);
     _waitWhileBusy("_InitDisplay reset", power_on_time);
     _waitWhileBusy("_InitDisplay reset", power_on_time);
+    _initial_write = false; // used for initial reset done
     _hibernating = false;
     _hibernating = false;
     _power_is_on = false;
     _power_is_on = false;
   }
   }

+ 2 - 8
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);
     _transfer(0xFF == black_value ? 0x11 : black_value);
   }
   }
   _endTransfer();
   _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)
 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(")");
   //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
   delay(1); // yield() to avoid WDT on ESP8266 and ESP32
   delay(1); // yield() to avoid WDT on ESP8266 and ESP32
   if (!_init_display_done) _InitDisplay();
   if (!_init_display_done) _InitDisplay();
-  if (_initial_write) writeScreenBuffer();
   if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
   if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
   {
   {
     //Serial.println("paged");
     //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(")");
   //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
   delay(1); // yield() to avoid WDT on ESP8266 and ESP32
   delay(1); // yield() to avoid WDT on ESP8266 and ESP32
   if (!_init_display_done) _InitDisplay();
   if (!_init_display_done) _InitDisplay();
-  if (_initial_write) writeScreenBuffer();
   if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
   if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
   {
   {
     //Serial.println("paged");
     //Serial.println("paged");
@@ -240,7 +237,6 @@ void GxEPD2_730c_GDEY073D46::writeImagePart(const uint8_t bitmap[], int16_t x_pa
   h1 -= dy;
   h1 -= dy;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if (!_init_display_done) _InitDisplay();
   if (!_init_display_done) _InitDisplay();
-  if (_initial_write) writeScreenBuffer();
   _writeCommand(0x10);
   _writeCommand(0x10);
   _startTransfer();
   _startTransfer();
   for (int16_t i = 0; i < int16_t(HEIGHT); i++)
   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;
   h1 -= dy;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if (!_init_display_done) _InitDisplay();
   if (!_init_display_done) _InitDisplay();
-  if (_initial_write) writeScreenBuffer();
   _writeCommand(0x10);
   _writeCommand(0x10);
   _startTransfer();
   _startTransfer();
   for (int16_t i = 0; i < int16_t(HEIGHT); i++)
   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(")");
     //Serial.print(w); Serial.print(", "); Serial.print(h); Serial.println(")");
     delay(1); // yield() to avoid WDT on ESP8266 and ESP32
     delay(1); // yield() to avoid WDT on ESP8266 and ESP32
     if (!_init_display_done) _InitDisplay();
     if (!_init_display_done) _InitDisplay();
-    if (_initial_write) writeScreenBuffer();
     if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
     if (_paged && (x == 0) && (w == int16_t(WIDTH)) && (h < int16_t(HEIGHT)))
     {
     {
       //Serial.println("paged");
       //Serial.println("paged");
@@ -455,7 +449,6 @@ void GxEPD2_730c_GDEY073D46::writeNativePart(const uint8_t* data1, const uint8_t
   h1 -= dy;
   h1 -= dy;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if ((w1 <= 0) || (h1 <= 0)) return;
   if (!_init_display_done) _InitDisplay();
   if (!_init_display_done) _InitDisplay();
-  if (_initial_write) writeScreenBuffer();
   _writeCommand(0x10);
   _writeCommand(0x10);
   _startTransfer();
   _startTransfer();
   for (int16_t i = 0; i < int16_t(HEIGHT); i++)
   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
     pinMode(_rst, OUTPUT); // just in case
     digitalWrite(_rst, HIGH);
     digitalWrite(_rst, HIGH);
-    delay(20);
+    delay(50); // needs a little longer
     digitalWrite(_rst, LOW);
     digitalWrite(_rst, LOW);
     delay(20);
     delay(20);
     digitalWrite(_rst, HIGH);
     digitalWrite(_rst, HIGH);
     delay(2);
     delay(2);
     _waitWhileBusy("_InitDisplay reset", power_on_time);
     _waitWhileBusy("_InitDisplay reset", power_on_time);
+    _initial_write = false; // used for initial reset done
     _hibernating = false;
     _hibernating = false;
     _power_is_on = false;
     _power_is_on = false;
   }
   }

+ 1 - 2
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(y % 256);
   _writeData(ye / 256);
   _writeData(ye / 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()
 void GxEPD2_750_GDEY075T7::_PowerOn()