Jelajahi Sumber

### Version 1.2.16

- fix for GDEH0154D67, to work independent of OTP version (ping-pong issue)
ZinggJM 5 tahun lalu
induk
melakukan
20a416c18b
7 mengubah file dengan 31 tambahan dan 26 penghapusan
  1. 3 1
      README.md
  2. 1 1
      library.properties
  3. 1 0
      src/GxEPD2.h
  4. 6 5
      src/GxEPD2_BW.h
  5. 5 0
      src/GxEPD2_EPD.h
  6. 14 19
      src/epd/GxEPD2_154_D67.cpp
  7. 1 0
      src/epd/GxEPD2_154_D67.h

+ 3 - 1
README.md

@@ -93,7 +93,9 @@
 - promotion panels from suppliers are welcome, to add support to GxEPD2
 - donation panels from users are welcome, to add support to GxEPD2
 
-### Version 1.2.15
+### Version 1.2.16
+- fix for GDEH0154D67, to work independent of OTP version (ping-pong issue)
+#### Version 1.2.15
 - added support for GDEW0213M21 2.13" 104x212 b/w new DES e-paper panel
 - added support for GDEW029M06 2.9" 128x296 b/w new DES e-paper panel
 - added support for GDEW042M01 4.2" 400x300 b/w new DES e-paper panel

+ 1 - 1
library.properties

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

+ 1 - 0
src/GxEPD2.h

@@ -49,6 +49,7 @@ class GxEPD2
       GDEH029A1,  Waveshare_2_9_bw = GDEH029A1,
       GDEW029T5,  Waveshare_2_9_bw_T5 = GDEW029T5,
       GDEW029M06,
+      GDEM029T94,
       GDEW027W3,  Waveshare_2_7_bw = GDEW027W3,
       GDEW0371W7, Waveshare_3_7_bw = GDEW0371W7,
       GDEW042T2,  Waveshare_4_2_bw = GDEW042T2,

+ 6 - 5
src/GxEPD2_BW.h

@@ -45,6 +45,7 @@
 #include "epd/GxEPD2_290.h"
 #include "epd/GxEPD2_290_T5.h"
 #include "epd/GxEPD2_290_M06.h"
+//#include "epd/GxEPD2_290_T94.h"
 #include "epd/GxEPD2_270.h"
 #include "epd/GxEPD2_371.h"
 #include "epd/GxEPD2_420.h"
@@ -164,7 +165,7 @@ class GxEPD2_BW : public GxEPD2_GFX_BASE_CLASS
     // display buffer content to screen, useful for full screen buffer
     void display(bool partial_update_mode = false)
     {
-      epd2.writeImage(_buffer, 0, 0, WIDTH, _page_height);
+      epd2.writeImage(_buffer, 0, 0, WIDTH, _page_height, false, false, false, !partial_update_mode);
       epd2.refresh(partial_update_mode);
       if (epd2.hasFastPartialUpdate)
       {
@@ -247,7 +248,7 @@ class GxEPD2_BW : public GxEPD2_GFX_BASE_CLASS
         }
         else // full update
         {
-          epd2.writeImage(_buffer, 0, 0, WIDTH, HEIGHT);
+          epd2.writeImage(_buffer, 0, 0, WIDTH, HEIGHT, false, false, false, true);
           epd2.refresh(false);
           if (epd2.hasFastPartialUpdate)
           {
@@ -301,7 +302,7 @@ class GxEPD2_BW : public GxEPD2_GFX_BASE_CLASS
       }
       else // full update
       {
-        if (!_second_phase) epd2.writeImage(_buffer, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
+        if (!_second_phase) epd2.writeImage(_buffer, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys), false, false, false, true);
         else epd2.writeImageAgain(_buffer, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
         _current_page++;
         if (_current_page == _pages)
@@ -346,7 +347,7 @@ class GxEPD2_BW : public GxEPD2_GFX_BASE_CLASS
         }
         else // full update
         {
-          epd2.writeImage(_buffer, 0, 0, WIDTH, HEIGHT);
+          epd2.writeImage(_buffer, 0, 0, WIDTH, HEIGHT, false, false, false, true);
           epd2.refresh(false);
           if (epd2.hasFastPartialUpdate)
           {
@@ -388,7 +389,7 @@ class GxEPD2_BW : public GxEPD2_GFX_BASE_CLASS
           uint16_t page_ys = _current_page * _page_height;
           fillScreen(GxEPD_WHITE);
           drawCallback(pv);
-          epd2.writeImage(_buffer, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
+          epd2.writeImage(_buffer, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys), false, false, false, true);
         }
         epd2.refresh(false); // full update after first phase
         if (epd2.hasFastPartialUpdate)

+ 5 - 0
src/GxEPD2_EPD.h

@@ -39,6 +39,11 @@ class GxEPD2_EPD
     virtual void writeScreenBuffer(uint8_t value) = 0; // init controller memory (default white)
     // write to controller memory, without screen refresh; x and w should be multiple of 8
     virtual void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0;
+    virtual void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm, bool for_full_refresh)
+    {
+      // writeImage is independent from refresh mode for most controllers, exception e.g. SSD1681
+      writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
+    }
     virtual void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
                                 int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0;
     //    virtual void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0;

+ 14 - 19
src/epd/GxEPD2_154_D67.cpp

@@ -27,16 +27,16 @@ void GxEPD2_154_D67::clearScreen(uint8_t value)
 
 void GxEPD2_154_D67::writeScreenBuffer(uint8_t value)
 {
-  _initial_write = false; // initial full screen buffer clean done
   if (!_using_partial_mode) _Init_Part();
+  if (_initial_write) _writeScreenBuffer(0x26, value); // set previous
   _writeScreenBuffer(0x24, value); // set current
-  if (_initial_refresh) _writeScreenBuffer(0x26, value); // set previous
+  _initial_write = false; // initial full screen buffer clean done
 }
 
 void GxEPD2_154_D67::writeScreenBufferAgain(uint8_t value)
 {
   if (!_using_partial_mode) _Init_Part();
-  _writeScreenBuffer(0x26, value); // set previous
+  _writeScreenBuffer(0x24, value); // set current
 }
 
 void GxEPD2_154_D67::_writeScreenBuffer(uint8_t command, uint8_t value)
@@ -53,9 +53,18 @@ void GxEPD2_154_D67::writeImage(const uint8_t bitmap[], int16_t x, int16_t y, in
   _writeImage(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
 }
 
+void GxEPD2_154_D67::writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm, bool for_full_refresh)
+{
+  if (for_full_refresh)
+  {
+    _writeImage(0x26, bitmap, x, y, w, h, invert, mirror_y, pgm);
+  }
+  _writeImage(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
+}
+
 void GxEPD2_154_D67::writeImageAgain(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
 {
-  _writeImage(0x26, bitmap, x, y, w, h, invert, mirror_y, pgm);
+  _writeImage(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
 }
 
 void GxEPD2_154_D67::_writeImage(uint8_t command, const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
@@ -112,7 +121,7 @@ void GxEPD2_154_D67::writeImagePart(const uint8_t bitmap[], int16_t x_part, int1
 void GxEPD2_154_D67::writeImagePartAgain(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
     int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
 {
-  _writeImagePart(0x26, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
+  _writeImagePart(0x24, bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
 }
 
 void GxEPD2_154_D67::_writeImagePart(uint8_t command, const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
@@ -333,20 +342,6 @@ void GxEPD2_154_D67::_InitDisplay()
   _writeData(0x05);
   _writeCommand(0x18); // Read built-in temperature sensor
   _writeData(0x80);
-  // PingPong for mode 2 doesn't work with GxEPD2
-  // not available for mode 1, and has some "quirks"
-  // values as read from OTP (0x2d) 2.1.2020, except F[6]
-  _writeCommand(0x37); //Write Register for Display Option
-  _writeData(0x00); // A
-  _writeData(0x00); // B
-  _writeData(0x00); // C
-  _writeData(0x00); // D
-  _writeData(0xff); // E
-  _writeData(0x00); // F F[6]=0 : disable PingPong
-  _writeData(0x00); // G
-  _writeData(0x00); // H
-  _writeData(0x00); // I
-  _writeData(0x01); // J
   _setPartialRamArea(0, 0, WIDTH, HEIGHT);
 }
 

+ 1 - 0
src/epd/GxEPD2_154_D67.h

@@ -39,6 +39,7 @@ class GxEPD2_154_D67 : public GxEPD2_EPD
     void writeScreenBufferAgain(uint8_t value = 0xFF); // init previous buffer controller memory (default white)
     // write to controller memory, without screen refresh; x and w should be multiple of 8
     void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
+    void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm, bool for_full_refresh);
     void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
                         int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
     void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);