Просмотр исходного кода

Version 1.1.4

- eliminated double refresh for "fast partial update"
- moved wavetables to the driver classes
- added one explicit drawImage(...) and writeImage(...) method (for removed default paramter values for 1.1.3)
- added init method with added parameter  initial, for re-init after processor deep sleep wakeup
- added init parameter pulldown_rst_mode, for special RST handling (not needed for waveshare shield)
ZinggJM 7 лет назад
Родитель
Сommit
d525f54a36

+ 25 - 1
README.md

@@ -38,7 +38,31 @@
 - Waveshare e-paper displays with SPI: http://forum.arduino.cc/index.php?topic=487007.0
 - Good Dispay ePaper for Arduino : https://forum.arduino.cc/index.php?topic=436411.0
 
-### Version 1.1.3
+### Supported SPI e-paper panels from Good Display:
+- GDEP015OC1      1.54" b/w
+- GDEW0154Z04   1.54" b/w/r 200x200
+- GDE0213B1         2.13" b/w
+- GDEW0213I5F    2.13" b/w flexible
+- GDEW0213Z16   2.13" b/w/r
+- GDEH029A1        2.9" b/w
+- GDEW029T5       2.9" b/w
+- GDEW029Z10     2.9" b/w/r
+- GDEW027C44     2.7" b/w/r
+- GDEW027W3      2.7" b/w
+- GDEW042T2        4.2" b/w
+- GDEW042Z15      4.2" b/w/r
+- GDEW0583T7      5.83" b/w
+- GDEW075T8        7.5" b/w
+- GDEW075Z09      7.5" b/w/r
+#### Supported SPI e-paper panels & boards from Waveshare: compare with Good Display, same panel
+
+### Version 1.1.4
+- eliminated double refresh for "fast partial update"
+- moved wavetables to the driver classes
+- added one explicit drawImage(...) and writeImage(...) method (for removed default paramter values for 1.1.3)
+- added init method with added parameter  initial, for re-init after processor deep sleep wakeup
+- added init parameter pulldown_rst_mode, for special RST handling (not needed for waveshare shield)
+#### Version 1.1.3
 - fixed wavetables for GDEW029T5 and GDEW0213I5F
 - fixed drawImage(...) overloaded methods signature matching ambiguity
 #### Version 1.1.2

+ 18 - 17
examples/GxEPD2_Example/GxEPD2_Example.ino

@@ -162,26 +162,27 @@
 //GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
 
 // ***** for mapping of Waveshare Universal e-Paper Raw Panel Driver Shield for Arduino / NUCLEO *****
-// CAUTION: the RST line is not connected through level converter! This may damage the display and/or cause malfunction. use -1 for RST parameter
+// the RST line is not connected through level converter, but has a pull up resistor and a pull down diode to the Arduino pin; this is safe for 5V Arduino
+// NOTE: the 11-pinholes for pin connectors are not through level converter, and the VCC pin is 5V, only FCP connector pins are through level converter
 // select one and adapt to your mapping
-//GxEPD2_BW<GxEPD2_154, MAX_HEIGHT(GxEPD2_154)> display(GxEPD2_154(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7));
-//GxEPD2_BW<GxEPD2_213, MAX_HEIGHT(GxEPD2_213)> display(GxEPD2_213(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7));
-//GxEPD2_BW<GxEPD2_213_flex, MAX_HEIGHT(GxEPD2_213_flex)> display(GxEPD2_213_flex(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7)); // GDEW0213I5F
-//GxEPD2_BW<GxEPD2_290, MAX_HEIGHT(GxEPD2_290)> display(GxEPD2_290(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7));
-//GxEPD2_BW<GxEPD2_290_T5, MAX_HEIGHT(GxEPD2_290_T5)> display(GxEPD2_290_T5(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7)); // GDEW029T5
-//GxEPD2_BW<GxEPD2_270, MAX_HEIGHT(GxEPD2_270)> display(GxEPD2_270(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7));
-//GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7));
-//GxEPD2_BW<GxEPD2_583, MAX_HEIGHT(GxEPD2_583)> display(GxEPD2_583(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7));
-//GxEPD2_BW<GxEPD2_750, MAX_HEIGHT(GxEPD2_750)> display(GxEPD2_750(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7));
+//GxEPD2_BW<GxEPD2_154, MAX_HEIGHT(GxEPD2_154)> display(GxEPD2_154(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
+//GxEPD2_BW<GxEPD2_213, MAX_HEIGHT(GxEPD2_213)> display(GxEPD2_213(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
+//GxEPD2_BW<GxEPD2_213_flex, MAX_HEIGHT(GxEPD2_213_flex)> display(GxEPD2_213_flex(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEW0213I5F
+//GxEPD2_BW<GxEPD2_290, MAX_HEIGHT(GxEPD2_290)> display(GxEPD2_290(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
+//GxEPD2_BW<GxEPD2_290_T5, MAX_HEIGHT(GxEPD2_290_T5)> display(GxEPD2_290_T5(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEW029T5
+//GxEPD2_BW<GxEPD2_270, MAX_HEIGHT(GxEPD2_270)> display(GxEPD2_270(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
+//GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
+//GxEPD2_BW<GxEPD2_583, MAX_HEIGHT(GxEPD2_583)> display(GxEPD2_583(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
+//GxEPD2_BW<GxEPD2_750, MAX_HEIGHT(GxEPD2_750)> display(GxEPD2_750(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
 // 3-color e-papers
 #define MAX_HEIGHT_3C(EPD) (EPD::HEIGHT <= (MAX_DISPAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8) ? EPD::HEIGHT : (MAX_DISPAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8))
-//GxEPD2_3C<GxEPD2_154c, MAX_HEIGHT_3C(GxEPD2_154c)> display(GxEPD2_154c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7));
-//GxEPD2_3C<GxEPD2_213c, MAX_HEIGHT_3C(GxEPD2_213c)> display(GxEPD2_213c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7));
-//GxEPD2_3C<GxEPD2_290c, MAX_HEIGHT_3C(GxEPD2_290c)> display(GxEPD2_290c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7));
-//GxEPD2_3C<GxEPD2_270c, MAX_HEIGHT_3C(GxEPD2_270c)> display(GxEPD2_270c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7));
-//GxEPD2_3C<GxEPD2_420c, MAX_HEIGHT_3C(GxEPD2_420c)> display(GxEPD2_420c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7));
-//GxEPD2_3C<GxEPD2_583c, MAX_HEIGHT_3C(GxEPD2_583c)> display(GxEPD2_583c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7));
-//GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ -1, /*BUSY=*/ 7));
+//GxEPD2_3C<GxEPD2_154c, MAX_HEIGHT_3C(GxEPD2_154c)> display(GxEPD2_154c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
+//GxEPD2_3C<GxEPD2_213c, MAX_HEIGHT_3C(GxEPD2_213c)> display(GxEPD2_213c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
+//GxEPD2_3C<GxEPD2_290c, MAX_HEIGHT_3C(GxEPD2_290c)> display(GxEPD2_290c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
+//GxEPD2_3C<GxEPD2_270c, MAX_HEIGHT_3C(GxEPD2_270c)> display(GxEPD2_270c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
+//GxEPD2_3C<GxEPD2_420c, MAX_HEIGHT_3C(GxEPD2_420c)> display(GxEPD2_420c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
+//GxEPD2_3C<GxEPD2_583c, MAX_HEIGHT_3C(GxEPD2_583c)> display(GxEPD2_583c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
+//GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
 #endif
 
 #include "GxEPD2_boards_added.h"

+ 1 - 1
library.properties

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

+ 20 - 0
src/GxEPD2_3C.h

@@ -114,6 +114,18 @@ class GxEPD2_3C : public Adafruit_GFX
       setFullWindow();
     }
 
+    // init method with additional parameters:
+    // initial true for re-init after processor deep sleep wake up, if display power supply was kept
+    // only relevant for b/w displays with fast partial update
+    // pulldown_rst_mode true for alternate RST handling to avoid feeding 5V through RST pin
+    void init(uint32_t serial_diag_bitrate, bool initial, bool pulldown_rst_mode = false)
+    {
+      epd2.init(serial_diag_bitrate, initial, pulldown_rst_mode);
+      _using_partial_mode = false;
+      _current_page = 0;
+      setFullWindow();
+    }
+
     void fillScreen(uint16_t color) // 0x0 black, >0x0 white, to buffer
     {
       uint8_t black = 0xFF;
@@ -328,6 +340,10 @@ class GxEPD2_3C : public Adafruit_GFX
     {
       epd2.writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
     }
+    void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h)
+    {
+      epd2.writeImage(black, color, x, y, w, h, false, false, false);
+    }
     // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8
     void writeNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
     {
@@ -342,6 +358,10 @@ class GxEPD2_3C : public Adafruit_GFX
     {
       epd2.drawImage(black, color, x, y, w, h, invert, mirror_y, pgm);
     }
+    void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h)
+    {
+      epd2.drawImage(black, color, x, y, w, h, false, false, false);
+    }
     // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
     void drawNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
     {

+ 53 - 4
src/GxEPD2_BW.h

@@ -117,6 +117,19 @@ class GxEPD2_BW : public Adafruit_GFX
       setFullWindow();
     }
 
+    // init method with additional parameters:
+    // initial true for re-init after processor deep sleep wake up, if display power supply was kept
+    // this can be used to avoid the repeated initial full refresh on displays with fast partial update
+    // NOTE: garbage will result on fast partial update displays, if initial full update is omitted after power loss
+    // pulldown_rst_mode true for alternate RST handling to avoid feeding 5V through RST pin
+    void init(uint32_t serial_diag_bitrate, bool initial, bool pulldown_rst_mode = false)
+    {
+      epd2.init(serial_diag_bitrate, initial, pulldown_rst_mode);
+      _using_partial_mode = false;
+      _current_page = 0;
+      setFullWindow();
+    }
+
     void fillScreen(uint16_t color) // 0x0 black, >0x0 white, to buffer
     {
       uint8_t data = (color == GxEPD_BLACK) ? 0x00 : 0xFF;
@@ -180,7 +193,7 @@ class GxEPD2_BW : public Adafruit_GFX
           if (epd2.hasFastPartialUpdate)
           {
             epd2.writeImageAgain(_buffer + offset, _pw_x, _pw_y, _pw_w, _pw_h);
-            epd2.refresh(_pw_x, _pw_y, _pw_w, _pw_h);
+            //epd2.refresh(_pw_x, _pw_y, _pw_w, _pw_h); // not needed
           }
         }
         else // full update
@@ -190,7 +203,7 @@ class GxEPD2_BW : public Adafruit_GFX
           if (epd2.hasFastPartialUpdate)
           {
             epd2.writeImageAgain(_buffer, 0, 0, WIDTH, HEIGHT);
-            epd2.refresh(true);
+            //epd2.refresh(true); // not needed
             epd2.powerOff();
           }
         }
@@ -254,7 +267,7 @@ class GxEPD2_BW : public Adafruit_GFX
               fillScreen(GxEPD_WHITE);
               return true;
             }
-            else epd2.refresh(true); // partial update after second phase
+            //else epd2.refresh(true); // partial update after second phase
           } else epd2.refresh(false); // full update after only phase
           epd2.powerOff();
           return false;
@@ -267,6 +280,34 @@ class GxEPD2_BW : public Adafruit_GFX
     // GxEPD style paged drawing; drawCallback() is called as many times as needed
     void drawPaged(void (*drawCallback)(const void*), const void* pv)
     {
+      if (1 == _pages)
+      {
+        fillScreen(GxEPD_WHITE);
+        drawCallback(pv);
+        if (_using_partial_mode)
+        {
+          uint32_t offset = _reverse ? (HEIGHT - _pw_h) * _pw_w / 8 : 0;
+          epd2.writeImage(_buffer + offset, _pw_x, _pw_y, _pw_w, _pw_h);
+          epd2.refresh(_pw_x, _pw_y, _pw_w, _pw_h);
+          if (epd2.hasFastPartialUpdate)
+          {
+            epd2.writeImageAgain(_buffer + offset, _pw_x, _pw_y, _pw_w, _pw_h);
+            //epd2.refresh(_pw_x, _pw_y, _pw_w, _pw_h); // not needed
+          }
+        }
+        else // full update
+        {
+          epd2.writeImage(_buffer, 0, 0, WIDTH, HEIGHT);
+          epd2.refresh(false);
+          if (epd2.hasFastPartialUpdate)
+          {
+            epd2.writeImageAgain(_buffer, 0, 0, WIDTH, HEIGHT);
+            //epd2.refresh(true); // not needed
+            epd2.powerOff();
+          }
+        }
+        return;
+      }
       if (_using_partial_mode)
       {
         for (uint16_t phase = 1; phase <= 2; phase++)
@@ -311,7 +352,7 @@ class GxEPD2_BW : public Adafruit_GFX
             drawCallback(pv);
             epd2.writeImageAgain(_buffer, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
           }
-          epd2.refresh(true); // partial update after second phase
+          //epd2.refresh(true); // partial update after second phase // not needed
         }
         epd2.powerOff();
       }
@@ -362,6 +403,10 @@ class GxEPD2_BW : public Adafruit_GFX
     {
       epd2.writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
     }
+    void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h)
+    {
+      epd2.writeImage(black, color, x, y, w, h, false, false, false);
+    }
     // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8
     void writeNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
     {
@@ -376,6 +421,10 @@ class GxEPD2_BW : public Adafruit_GFX
     {
       epd2.drawImage(black, color, x, y, w, h, invert, mirror_y, pgm);
     }
+    void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h)
+    {
+      epd2.drawImage(black, color, x, y, w, h, false, false, false);
+    }
     // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
     void drawNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
     {

+ 40 - 21
src/GxEPD2_EPD.cpp

@@ -23,10 +23,23 @@ GxEPD2_EPD::GxEPD2_EPD(int8_t cs, int8_t dc, int8_t rst, int8_t busy, int8_t bus
   _cs(cs), _dc(dc), _rst(rst), _busy(busy), _busy_level(busy_level), _busy_timeout(busy_timeout), _diag_enabled(false),
   _spi_settings(4000000, MSBFIRST, SPI_MODE0)
 {
+  _power_is_on = false;
+  _using_partial_mode = false;
+  _hibernating = false;
 }
 
 void GxEPD2_EPD::init(uint32_t serial_diag_bitrate)
 {
+  init(serial_diag_bitrate, true, false);
+}
+
+void GxEPD2_EPD::init(uint32_t serial_diag_bitrate, bool initial, bool pulldown_rst_mode)
+{
+  _initial = initial;
+  _pulldown_rst_mode = pulldown_rst_mode;
+  _power_is_on = false;
+  _using_partial_mode = false;
+  _hibernating = false;
   if (serial_diag_bitrate > 0)
   {
     Serial.begin(serial_diag_bitrate);
@@ -42,32 +55,38 @@ void GxEPD2_EPD::init(uint32_t serial_diag_bitrate)
     digitalWrite(_dc, HIGH);
     pinMode(_dc, OUTPUT);
   }
-  if (_rst >= 0)
-  {
-    digitalWrite(_rst, HIGH);
-    pinMode(_rst, OUTPUT);
-    delay(20);
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-  }
+  _reset();
   if (_busy >= 0)
   {
     pinMode(_busy, INPUT);
   }
   SPI.begin();
-  //  SPI.setDataMode(SPI_MODE0);
-  //  SPI.setBitOrder(MSBFIRST);
-  //#if defined(SPI_HAS_TRANSACTION)
-  //  // true also for STM32F1xx Boards
-  //  SPISettings settings(4000000, MSBFIRST, SPI_MODE0);
-  //  SPI.beginTransaction(settings);
-  //  SPI.endTransaction();
-  //  //Serial.println("SPI has Transaction");
-  //#elif defined(ESP8266) || defined(ESP32)
-  //  SPI.setFrequency(4000000);
-  //#endif
+}
+
+void GxEPD2_EPD::_reset()
+{
+  if (_rst >= 0)
+  {
+    if (_pulldown_rst_mode)
+    {
+      digitalWrite(_rst, LOW);
+      pinMode(_rst, OUTPUT);
+      delay(20);
+      pinMode(_rst, INPUT_PULLUP);
+      delay(200);
+    }
+    else
+    {
+      digitalWrite(_rst, HIGH);
+      pinMode(_rst, OUTPUT);
+      delay(20);
+      digitalWrite(_rst, LOW);
+      delay(20);
+      digitalWrite(_rst, HIGH);
+      delay(200);
+    }
+    _hibernating = false;
+  }
 }
 
 void GxEPD2_EPD::_waitWhileBusy(const char* comment, uint16_t busy_time)

+ 5 - 2
src/GxEPD2_EPD.h

@@ -30,7 +30,8 @@ class GxEPD2_EPD
     // constructor
     GxEPD2_EPD(int8_t cs, int8_t dc, int8_t rst, int8_t busy, int8_t busy_level, uint32_t busy_timeout,
                uint16_t w, uint16_t h, GxEPD2::Panel p, bool c, bool pu, bool fpu);
-    virtual void init(uint32_t serial_diag_bitrate = 0) = 0; // serial_diag_bitrate = 0 : disabled
+    virtual void init(uint32_t serial_diag_bitrate = 0); // serial_diag_bitrate = 0 : disabled
+    virtual void init(uint32_t serial_diag_bitrate, bool initial, bool pulldown_rst_mode = false);
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     virtual void clearScreen(uint8_t value) = 0; // init controller memory and screen (default white)
     virtual void writeScreenBuffer(uint8_t value) = 0; // init controller memory (default white)
@@ -60,6 +61,7 @@ class GxEPD2_EPD
       return (a > b ? a : b);
     };
   protected:
+    void _reset();
     void _waitWhileBusy(const char* comment = 0, uint16_t busy_time = 5000);
     void _writeCommand(uint8_t c);
     void _writeData(uint8_t d);
@@ -70,8 +72,9 @@ class GxEPD2_EPD
   protected:
     int8_t _cs, _dc, _rst, _busy, _busy_level;
     uint32_t _busy_timeout;
-    bool _diag_enabled;
+    bool _diag_enabled, _pulldown_rst_mode;
     SPISettings _spi_settings;
+    bool _initial, _power_is_on, _using_partial_mode, _hibernating;
 };
 
 #endif

+ 8 - 0
src/GxEPD2_GFX.h

@@ -22,6 +22,12 @@ class GxEPD2_GFX : public Adafruit_GFX
     virtual uint16_t pageHeight() = 0;
     virtual bool mirror(bool m) = 0;
     virtual void init(uint32_t serial_diag_bitrate = 0) = 0; // serial_diag_bitrate = 0 : disabled
+    // init method with additional parameters:
+    // initial true for re-init after processor deep sleep wake up, if display power supply was kept
+    // this can be used to avoid the repeated initial full refresh on displays with fast partial update
+    // NOTE: garbage will result on fast partial update displays, if initial full update is omitted after power loss
+    // pulldown_rst_mode true for alternate RST handling to avoid feeding 5V through RST pin
+    virtual void init(uint32_t serial_diag_bitrate, bool initial, bool pulldown_rst_mode = false) = 0;
     virtual void fillScreen(uint16_t color) = 0; // 0x0 black, >0x0 white, to buffer
     virtual void display(bool partial_update_mode = false) = 0;
     virtual void setFullWindow() = 0;
@@ -41,9 +47,11 @@ class GxEPD2_GFX : public Adafruit_GFX
     // 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* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) = 0;
+    virtual void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h) = 0; // default options false
     // write to controller memory, with screen refresh; x and w should be multiple of 8
     virtual void drawImage(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 drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) = 0;
+    virtual void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h) = 0; // default options false
     virtual void refresh(bool partial_update_mode = false) = 0; // screen refresh from controller memory to full screen
     virtual void refresh(int16_t x, int16_t y, int16_t w, int16_t h) = 0; // screen refresh from controller memory, partial screen
     virtual void powerOff() = 0; // turns off generation of panel driving voltages, avoids screen fading over time

+ 17 - 24
src/epd/GxEPD2_154.cpp

@@ -11,24 +11,10 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_154.h"
-#include "WaveTables.h"
 
 GxEPD2_154::GxEPD2_154(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
-}
-
-void GxEPD2_154::init(uint32_t serial_diag_bitrate)
-{
-  GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
 }
 
 void GxEPD2_154::clearScreen(uint8_t value)
@@ -245,14 +231,7 @@ void GxEPD2_154::_PowerOff()
 
 void GxEPD2_154::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   _writeCommand(0x01); // Panel configuration, Gate selection
   _writeData((HEIGHT - 1) % 256);
   _writeData((HEIGHT - 1) / 256);
@@ -270,10 +249,24 @@ void GxEPD2_154::_InitDisplay()
   _setPartialRamArea(0, 0, WIDTH, HEIGHT);
 }
 
+const uint8_t GxEPD2_154::LUTDefault_full[] PROGMEM =
+{
+  0x32,  // command
+  0x50, 0xAA, 0x55, 0xAA, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+const uint8_t GxEPD2_154::LUTDefault_part[] PROGMEM =
+{
+  0x32,  // command
+  0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
 void GxEPD2_154::_Init_Full()
 {
   _InitDisplay();
-  _writeCommandDataPGM(GDEP015OC1_LUTDefault_full, sizeof(GDEP015OC1_LUTDefault_full));
+  _writeCommandDataPGM(LUTDefault_full, sizeof(LUTDefault_full));
   _PowerOn();
   _using_partial_mode = false;
 }
@@ -281,7 +274,7 @@ void GxEPD2_154::_Init_Full()
 void GxEPD2_154::_Init_Part()
 {
   _InitDisplay();
-  _writeCommandDataPGM(GDEP015OC1_LUTDefault_part, sizeof(GDEP015OC1_LUTDefault_part));
+  _writeCommandDataPGM(LUTDefault_part, sizeof(LUTDefault_part));
   _PowerOn();
   _using_partial_mode = true;
 }

+ 3 - 3
src/epd/GxEPD2_154.h

@@ -32,7 +32,6 @@ class GxEPD2_154 : public GxEPD2_EPD
     // constructor
     GxEPD2_154(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
-    void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
     void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
@@ -60,8 +59,9 @@ class GxEPD2_154 : public GxEPD2_EPD
     void _Init_Part();
     void _Update_Full();
     void _Update_Part();
-  protected:
-    bool _initial, _power_is_on, _using_partial_mode, _hibernating;
+  private:
+    static const uint8_t LUTDefault_part[];
+    static const uint8_t LUTDefault_full[];
 };
 
 #endif

+ 17 - 24
src/epd/GxEPD2_213.cpp

@@ -11,24 +11,10 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_213.h"
-#include "WaveTables.h"
 
 GxEPD2_213::GxEPD2_213(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
-}
-
-void GxEPD2_213::init(uint32_t serial_diag_bitrate)
-{
-  GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
 }
 
 void GxEPD2_213::clearScreen(uint8_t value)
@@ -245,14 +231,7 @@ void GxEPD2_213::_PowerOff()
 
 void GxEPD2_213::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   _writeCommand(0x01); // Panel configuration, Gate selection
   _writeData((HEIGHT - 1) % 256);
   _writeData((HEIGHT - 1) / 256);
@@ -270,10 +249,24 @@ void GxEPD2_213::_InitDisplay()
   _setPartialRamArea(0, 0, WIDTH, HEIGHT);
 }
 
+const uint8_t GxEPD2_213::LUTDefault_full[] PROGMEM =
+{
+  0x32,  // command
+  0x22, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x01, 0x00, 0x00, 0x00, 0x00
+};
+
+const uint8_t GxEPD2_213::LUTDefault_part[] PROGMEM =
+{
+  0x32,  // command
+  0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
 void GxEPD2_213::_Init_Full()
 {
   _InitDisplay();
-  _writeCommandDataPGM(GxGDE0213B1_LUTDefault_full, sizeof(GxGDE0213B1_LUTDefault_full));
+  _writeCommandDataPGM(LUTDefault_full, sizeof(LUTDefault_full));
   _PowerOn();
   _using_partial_mode = false;
 }
@@ -281,7 +274,7 @@ void GxEPD2_213::_Init_Full()
 void GxEPD2_213::_Init_Part()
 {
   _InitDisplay();
-  _writeCommandDataPGM(GxGDE0213B1_LUTDefault_part, sizeof(GxGDE0213B1_LUTDefault_part));
+  _writeCommandDataPGM(LUTDefault_part, sizeof(LUTDefault_part));
   _PowerOn();
   _using_partial_mode = true;
 }

+ 3 - 3
src/epd/GxEPD2_213.h

@@ -32,7 +32,6 @@ class GxEPD2_213 : public GxEPD2_EPD
     // constructor
     GxEPD2_213(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
-    void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
     void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
@@ -63,8 +62,9 @@ class GxEPD2_213 : public GxEPD2_EPD
     void _Init_Part();
     void _Update_Full();
     void _Update_Part();
-  protected:
-    bool _initial, _power_is_on, _using_partial_mode, _hibernating;
+  private:
+    static const uint8_t LUTDefault_part[];
+    static const uint8_t LUTDefault_full[];
 };
 
 #endif

+ 127 - 32
src/epd/GxEPD2_213_flex.cpp

@@ -11,24 +11,10 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_213_flex.h"
-#include "WaveTables.h"
 
 GxEPD2_213_flex::GxEPD2_213_flex(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
-}
-
-void GxEPD2_213_flex::init(uint32_t serial_diag_bitrate)
-{
-  GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
 }
 
 void GxEPD2_213_flex::clearScreen(uint8_t value)
@@ -249,14 +235,7 @@ void GxEPD2_213_flex::_PowerOff()
 
 void GxEPD2_213_flex::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   _writeCommand(0x01); //POWER SETTING
   _writeData (0x03);
   _writeData (0x00);
@@ -278,6 +257,122 @@ void GxEPD2_213_flex::_InitDisplay()
   _writeData (HEIGHT & 0xFF);
 }
 
+//full screen update LUT
+const unsigned char GxEPD2_213_flex::lut_20_vcomDC[] PROGMEM =
+{
+  0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00,
+};
+
+const unsigned char GxEPD2_213_flex::lut_21_ww[] PROGMEM =
+{
+  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_213_flex::lut_22_bw[] PROGMEM =
+{
+  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_213_flex::lut_23_wb[] PROGMEM =
+{
+  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_213_flex::lut_24_bb[] PROGMEM =
+{
+  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+//partial screen update LUT
+//#define Fx19 0x19 // original value is 25 (phase length)
+#define Fx19 0x28   // new value for test is 40 (phase length)
+const unsigned char GxEPD2_213_flex::lut_20_vcomDC_partial[] PROGMEM =
+{
+  0x00, Fx19, 0x01, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00,
+};
+
+const unsigned char GxEPD2_213_flex::lut_21_ww_partial[] PROGMEM =
+{
+  0x00, Fx19, 0x01, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_213_flex::lut_22_bw_partial[] PROGMEM =
+{
+  0x80, Fx19, 0x01, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_213_flex::lut_23_wb_partial[] PROGMEM =
+{
+  0x40, Fx19, 0x01, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_213_flex::lut_24_bb_partial[] PROGMEM =
+{
+  0x00, Fx19, 0x01, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
 void GxEPD2_213_flex::_Init_Full()
 {
   _InitDisplay();
@@ -286,15 +381,15 @@ void GxEPD2_213_flex::_Init_Full()
   _writeCommand(0X50); //VCOM AND DATA INTERVAL SETTING
   _writeData(0x97);    //WBmode:VBDF 17|D7 VBDW 97 VBDB 57   WBRmode:VBDF F7 VBDW 77 VBDB 37  VBDR B7
   _writeCommand(0x20);
-  _writeDataPGM(GxGDEW0213I5F_lut_20_vcomDC, sizeof(GxGDEW0213I5F_lut_20_vcomDC));
+  _writeDataPGM(lut_20_vcomDC, sizeof(lut_20_vcomDC));
   _writeCommand(0x21);
-  _writeDataPGM(GxGDEW0213I5F_lut_21_ww, sizeof(GxGDEW0213I5F_lut_21_ww));
+  _writeDataPGM(lut_21_ww, sizeof(lut_21_ww));
   _writeCommand(0x22);
-  _writeDataPGM(GxGDEW0213I5F_lut_22_bw, sizeof(GxGDEW0213I5F_lut_22_bw));
+  _writeDataPGM(lut_22_bw, sizeof(lut_22_bw));
   _writeCommand(0x23);
-  _writeDataPGM(GxGDEW0213I5F_lut_23_wb, sizeof(GxGDEW0213I5F_lut_23_wb));
+  _writeDataPGM(lut_23_wb, sizeof(lut_23_wb));
   _writeCommand(0x24);
-  _writeDataPGM(GxGDEW0213I5F_lut_24_bb, sizeof(GxGDEW0213I5F_lut_24_bb));
+  _writeDataPGM(lut_24_bb, sizeof(lut_24_bb));
   _PowerOn();
   _using_partial_mode = false;
 }
@@ -307,15 +402,15 @@ void GxEPD2_213_flex::_Init_Part()
   _writeCommand(0X50);
   _writeData(0x17);    //WBmode:VBDF 17|D7 VBDW 97 VBDB 57   WBRmode:VBDF F7 VBDW 77 VBDB 37  VBDR B7
   _writeCommand(0x20);
-  _writeDataPGM(GxGDEW0213I5F_lut_20_vcomDC_partial, sizeof(GxGDEW0213I5F_lut_20_vcomDC_partial));
+  _writeDataPGM(lut_20_vcomDC_partial, sizeof(lut_20_vcomDC_partial));
   _writeCommand(0x21);
-  _writeDataPGM(GxGDEW0213I5F_lut_21_ww_partial, sizeof(GxGDEW0213I5F_lut_21_ww_partial));
+  _writeDataPGM(lut_21_ww_partial, sizeof(lut_21_ww_partial));
   _writeCommand(0x22);
-  _writeDataPGM(GxGDEW0213I5F_lut_22_bw_partial, sizeof(GxGDEW0213I5F_lut_22_bw_partial));
+  _writeDataPGM(lut_22_bw_partial, sizeof(lut_22_bw_partial));
   _writeCommand(0x23);
-  _writeDataPGM(GxGDEW0213I5F_lut_23_wb_partial, sizeof(GxGDEW0213I5F_lut_23_wb_partial));
+  _writeDataPGM(lut_23_wb_partial, sizeof(lut_23_wb_partial));
   _writeCommand(0x24);
-  _writeDataPGM(GxGDEW0213I5F_lut_24_bb_partial, sizeof(GxGDEW0213I5F_lut_24_bb_partial));
+  _writeDataPGM(lut_24_bb_partial, sizeof(lut_24_bb_partial));
   _PowerOn();
   _using_partial_mode = true;
 }

+ 11 - 3
src/epd/GxEPD2_213_flex.h

@@ -32,7 +32,6 @@ class GxEPD2_213_flex : public GxEPD2_EPD
     // constructor
     GxEPD2_213_flex(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
-    void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
     void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
@@ -60,8 +59,17 @@ class GxEPD2_213_flex : public GxEPD2_EPD
     void _Init_Part();
     void _Update_Full();
     void _Update_Part();
-  protected:
-    bool _initial, _power_is_on, _using_partial_mode, _hibernating;
+  private:
+    static const unsigned char lut_20_vcomDC[];
+    static const unsigned char lut_21_ww[];
+    static const unsigned char lut_22_bw[];
+    static const unsigned char lut_23_wb[];
+    static const unsigned char lut_24_bb[];
+    static const unsigned char lut_20_vcomDC_partial[];
+    static const unsigned char lut_21_ww_partial[];
+    static const unsigned char lut_22_bw_partial[];
+    static const unsigned char lut_23_wb_partial[];
+    static const unsigned char lut_24_bb_partial[];
 };
 
 #endif

+ 125 - 32
src/epd/GxEPD2_270.cpp

@@ -11,24 +11,10 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_270.h"
-#include "WaveTables.h"
 
 GxEPD2_270::GxEPD2_270(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
-}
-
-void GxEPD2_270::init(uint32_t serial_diag_bitrate)
-{
-  GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
 }
 
 void GxEPD2_270::clearScreen(uint8_t value)
@@ -262,14 +248,7 @@ void GxEPD2_270::_PowerOff()
 
 void GxEPD2_270::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   _writeCommand(0x01); //POWER SETTING
   _writeData (0x03);
   _writeData (0x00);
@@ -296,21 +275,135 @@ void GxEPD2_270::_InitDisplay()
   _writeData (0x08);   //0x28:-2.0V,0x12:-0.9V
 }
 
+//full screen update LUT
+const uint8_t GxEPD2_270::lut_20_vcomDC[] PROGMEM =
+{
+  0x00, 0x00,
+  0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+const uint8_t GxEPD2_270::lut_21_ww[] PROGMEM =
+{
+  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+const uint8_t GxEPD2_270::lut_22_bw[] PROGMEM =
+{
+  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+const uint8_t GxEPD2_270::lut_23_wb[] PROGMEM =
+{
+  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+const uint8_t GxEPD2_270::lut_24_bb[] PROGMEM =
+{
+  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+//partial screen update LUT
+const uint8_t GxEPD2_270::lut_20_vcomDC_partial[] PROGMEM =
+{
+  0x00, 0x00,
+  0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+const uint8_t GxEPD2_270::lut_21_ww_partial[] PROGMEM =
+{
+  0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+const uint8_t GxEPD2_270::lut_22_bw_partial[] PROGMEM =
+{
+  0x80, 0x19, 0x01, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+const uint8_t GxEPD2_270::lut_23_wb_partial[] PROGMEM =
+{
+  0x40, 0x19, 0x01, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+const uint8_t GxEPD2_270::lut_24_bb_partial[] PROGMEM =
+{
+  0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
 void GxEPD2_270::_Init_Full()
 {
   _InitDisplay();
   _writeCommand(0x50); //VCOM AND DATA INTERVAL SETTING
   _writeData(0x97);    //WBmode:VBDF 17|D7 VBDW 97 VBDB 57   WBRmode:VBDF F7 VBDW 77 VBDB 37  VBDR B7
   _writeCommand(0x20);
-  _writeDataPGM(GxGDEW027W3_lut_20_vcomDC, sizeof(GxGDEW027W3_lut_20_vcomDC));
+  _writeDataPGM(lut_20_vcomDC, sizeof(lut_20_vcomDC));
   _writeCommand(0x21);
-  _writeDataPGM(GxGDEW027W3_lut_21_ww, sizeof(GxGDEW027W3_lut_21_ww));
+  _writeDataPGM(lut_21_ww, sizeof(lut_21_ww));
   _writeCommand(0x22);
-  _writeDataPGM(GxGDEW027W3_lut_22_bw, sizeof(GxGDEW027W3_lut_22_bw));
+  _writeDataPGM(lut_22_bw, sizeof(lut_22_bw));
   _writeCommand(0x23);
-  _writeDataPGM(GxGDEW027W3_lut_23_wb, sizeof(GxGDEW027W3_lut_23_wb));
+  _writeDataPGM(lut_23_wb, sizeof(lut_23_wb));
   _writeCommand(0x24);
-  _writeDataPGM(GxGDEW027W3_lut_24_bb, sizeof(GxGDEW027W3_lut_24_bb));
+  _writeDataPGM(lut_24_bb, sizeof(lut_24_bb));
   _PowerOn();
   _using_partial_mode = false;
 }
@@ -321,15 +414,15 @@ void GxEPD2_270::_Init_Part()
   _writeCommand(0x50); //VCOM AND DATA INTERVAL SETTING
   _writeData(0x17);    //WBmode:VBDF 17|D7 VBDW 97 VBDB 57   WBRmode:VBDF F7 VBDW 77 VBDB 37  VBDR B7
   _writeCommand(0x20);
-  _writeDataPGM(GxGDEW027W3_lut_20_vcomDC_partial, sizeof(GxGDEW027W3_lut_20_vcomDC_partial));
+  _writeDataPGM(lut_20_vcomDC_partial, sizeof(lut_20_vcomDC_partial));
   _writeCommand(0x21);
-  _writeDataPGM(GxGDEW027W3_lut_21_ww_partial, sizeof(GxGDEW027W3_lut_21_ww_partial));
+  _writeDataPGM(lut_21_ww_partial, sizeof(lut_21_ww_partial));
   _writeCommand(0x22);
-  _writeDataPGM(GxGDEW027W3_lut_22_bw_partial, sizeof(GxGDEW027W3_lut_22_bw_partial));
+  _writeDataPGM(lut_22_bw_partial, sizeof(lut_22_bw_partial));
   _writeCommand(0x23);
-  _writeDataPGM(GxGDEW027W3_lut_23_wb_partial, sizeof(GxGDEW027W3_lut_23_wb_partial));
+  _writeDataPGM(lut_23_wb_partial, sizeof(lut_23_wb_partial));
   _writeCommand(0x24);
-  _writeDataPGM(GxGDEW027W3_lut_24_bb_partial, sizeof(GxGDEW027W3_lut_24_bb_partial));
+  _writeDataPGM(lut_24_bb_partial, sizeof(lut_24_bb_partial));
   _PowerOn();
   _using_partial_mode = true;
 }

+ 11 - 3
src/epd/GxEPD2_270.h

@@ -32,7 +32,6 @@ class GxEPD2_270 : public GxEPD2_EPD
     // constructor
     GxEPD2_270(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
-    void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
     void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
@@ -65,8 +64,17 @@ class GxEPD2_270 : public GxEPD2_EPD
     void _Update_Full();
     void _Update_Part();
     void _writeDataPGM(const uint8_t* data, uint16_t n);
-  protected:
-    bool _initial, _power_is_on, _using_partial_mode, _hibernating;
+  private:
+    static const unsigned char lut_20_vcomDC[];
+    static const unsigned char lut_21_ww[];
+    static const unsigned char lut_22_bw[];
+    static const unsigned char lut_23_wb[];
+    static const unsigned char lut_24_bb[];
+    static const unsigned char lut_20_vcomDC_partial[];
+    static const unsigned char lut_21_ww_partial[];
+    static const unsigned char lut_22_bw_partial[];
+    static const unsigned char lut_23_wb_partial[];
+    static const unsigned char lut_24_bb_partial[];
 };
 
 #endif

+ 17 - 24
src/epd/GxEPD2_290.cpp

@@ -11,24 +11,10 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_290.h"
-#include "WaveTables.h"
 
 GxEPD2_290::GxEPD2_290(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
-}
-
-void GxEPD2_290::init(uint32_t serial_diag_bitrate)
-{
-  GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
 }
 
 void GxEPD2_290::clearScreen(uint8_t value)
@@ -245,14 +231,7 @@ void GxEPD2_290::_PowerOff()
 
 void GxEPD2_290::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   _writeCommand(0x01); // Panel configuration, Gate selection
   _writeData((HEIGHT - 1) % 256);
   _writeData((HEIGHT - 1) / 256);
@@ -270,10 +249,24 @@ void GxEPD2_290::_InitDisplay()
   _setPartialRamArea(0, 0, WIDTH, HEIGHT);
 }
 
+const uint8_t GxEPD2_290::LUTDefault_full[] PROGMEM =
+{
+  0x32,  // command
+  0x50, 0xAA, 0x55, 0xAA, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+const uint8_t GxEPD2_290::LUTDefault_part[] PROGMEM =
+{
+  0x32,  // command
+  0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
 void GxEPD2_290::_Init_Full()
 {
   _InitDisplay();
-  _writeCommandDataPGM(GxGDEH029A1_LUTDefault_full, sizeof(GxGDEH029A1_LUTDefault_full));
+  _writeCommandDataPGM(LUTDefault_full, sizeof(LUTDefault_full));
   _PowerOn();
   _using_partial_mode = false;
 }
@@ -281,7 +274,7 @@ void GxEPD2_290::_Init_Full()
 void GxEPD2_290::_Init_Part()
 {
   _InitDisplay();
-  _writeCommandDataPGM(GxGDEH029A1_LUTDefault_part, sizeof(GxGDEH029A1_LUTDefault_part));
+  _writeCommandDataPGM(LUTDefault_part, sizeof(LUTDefault_part));
   _PowerOn();
   _using_partial_mode = true;
 }

+ 3 - 3
src/epd/GxEPD2_290.h

@@ -32,7 +32,6 @@ class GxEPD2_290 : public GxEPD2_EPD
     // constructor
     GxEPD2_290(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
-    void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
     void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
@@ -60,8 +59,9 @@ class GxEPD2_290 : public GxEPD2_EPD
     void _Init_Part();
     void _Update_Full();
     void _Update_Part();
-  protected:
-    bool _initial, _power_is_on, _using_partial_mode, _hibernating;
+  private:
+    static const uint8_t LUTDefault_part[];
+    static const uint8_t LUTDefault_full[];
 };
 
 #endif

+ 127 - 32
src/epd/GxEPD2_290_T5.cpp

@@ -11,24 +11,10 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_290_T5.h"
-#include "WaveTables.h"
 
 GxEPD2_290_T5::GxEPD2_290_T5(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
-}
-
-void GxEPD2_290_T5::init(uint32_t serial_diag_bitrate)
-{
-  GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
 }
 
 void GxEPD2_290_T5::clearScreen(uint8_t value)
@@ -249,14 +235,7 @@ void GxEPD2_290_T5::_PowerOff()
 
 void GxEPD2_290_T5::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   _writeCommand(0x01); //POWER SETTING
   _writeData (0x03);
   _writeData (0x00);
@@ -280,6 +259,122 @@ void GxEPD2_290_T5::_InitDisplay()
   _writeData (HEIGHT & 0xFF);
 }
 
+//full screen update LUT
+const unsigned char GxEPD2_290_T5::lut_20_vcomDC[] PROGMEM =
+{
+  0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00,
+};
+
+const unsigned char GxEPD2_290_T5::lut_21_ww[] PROGMEM =
+{
+  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_290_T5::lut_22_bw[] PROGMEM =
+{
+  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_290_T5::lut_23_wb[] PROGMEM =
+{
+  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_290_T5::lut_24_bb[] PROGMEM =
+{
+  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+//partial screen update LUT
+//#define Tx19 0x19 // original value is 25 (phase length)
+#define Tx19 0x20   // new value for test is 32 (phase length)
+const unsigned char GxEPD2_290_T5::lut_20_vcomDC_partial[] PROGMEM =
+{
+  0x00, Tx19, 0x01, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00,
+};
+
+const unsigned char GxEPD2_290_T5::lut_21_ww_partial[] PROGMEM =
+{
+  0x00, Tx19, 0x01, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_290_T5::lut_22_bw_partial[] PROGMEM =
+{
+  0x80, Tx19, 0x01, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_290_T5::lut_23_wb_partial[] PROGMEM =
+{
+  0x40, Tx19, 0x01, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_290_T5::lut_24_bb_partial[] PROGMEM =
+{
+  0x00, Tx19, 0x01, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
 void GxEPD2_290_T5::_Init_Full()
 {
   _InitDisplay();
@@ -288,15 +383,15 @@ void GxEPD2_290_T5::_Init_Full()
   _writeCommand(0X50); //VCOM AND DATA INTERVAL SETTING
   _writeData(0x97);    //WBmode:VBDF 17|D7 VBDW 97 VBDB 57   WBRmode:VBDF F7 VBDW 77 VBDB 37  VBDR B7
   _writeCommand(0x20);
-  _writeDataPGM(GxGDEW029T5_lut_20_vcomDC, sizeof(GxGDEW029T5_lut_20_vcomDC));
+  _writeDataPGM(lut_20_vcomDC, sizeof(lut_20_vcomDC));
   _writeCommand(0x21);
-  _writeDataPGM(GxGDEW029T5_lut_21_ww, sizeof(GxGDEW029T5_lut_21_ww));
+  _writeDataPGM(lut_21_ww, sizeof(lut_21_ww));
   _writeCommand(0x22);
-  _writeDataPGM(GxGDEW029T5_lut_22_bw, sizeof(GxGDEW029T5_lut_22_bw));
+  _writeDataPGM(lut_22_bw, sizeof(lut_22_bw));
   _writeCommand(0x23);
-  _writeDataPGM(GxGDEW029T5_lut_23_wb, sizeof(GxGDEW029T5_lut_23_wb));
+  _writeDataPGM(lut_23_wb, sizeof(lut_23_wb));
   _writeCommand(0x24);
-  _writeDataPGM(GxGDEW029T5_lut_24_bb, sizeof(GxGDEW029T5_lut_24_bb));
+  _writeDataPGM(lut_24_bb, sizeof(lut_24_bb));
   _PowerOn();
   _using_partial_mode = false;
 }
@@ -309,15 +404,15 @@ void GxEPD2_290_T5::_Init_Part()
   _writeCommand(0X50);
   _writeData(0x17);    //WBmode:VBDF 17|D7 VBDW 97 VBDB 57   WBRmode:VBDF F7 VBDW 77 VBDB 37  VBDR B7
   _writeCommand(0x20);
-  _writeDataPGM(GxGDEW029T5_lut_20_vcomDC_partial, sizeof(GxGDEW029T5_lut_20_vcomDC_partial));
+  _writeDataPGM(lut_20_vcomDC_partial, sizeof(lut_20_vcomDC_partial));
   _writeCommand(0x21);
-  _writeDataPGM(GxGDEW029T5_lut_21_ww_partial, sizeof(GxGDEW029T5_lut_21_ww_partial));
+  _writeDataPGM(lut_21_ww_partial, sizeof(lut_21_ww_partial));
   _writeCommand(0x22);
-  _writeDataPGM(GxGDEW029T5_lut_22_bw_partial, sizeof(GxGDEW029T5_lut_22_bw_partial));
+  _writeDataPGM(lut_22_bw_partial, sizeof(lut_22_bw_partial));
   _writeCommand(0x23);
-  _writeDataPGM(GxGDEW029T5_lut_23_wb_partial, sizeof(GxGDEW029T5_lut_23_wb_partial));
+  _writeDataPGM(lut_23_wb_partial, sizeof(lut_23_wb_partial));
   _writeCommand(0x24);
-  _writeDataPGM(GxGDEW029T5_lut_24_bb_partial, sizeof(GxGDEW029T5_lut_24_bb_partial));
+  _writeDataPGM(lut_24_bb_partial, sizeof(lut_24_bb_partial));
   _PowerOn();
   _using_partial_mode = true;
 }

+ 11 - 3
src/epd/GxEPD2_290_T5.h

@@ -32,7 +32,6 @@ class GxEPD2_290_T5 : public GxEPD2_EPD
     // constructor
     GxEPD2_290_T5(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
-    void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
     void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
@@ -60,8 +59,17 @@ class GxEPD2_290_T5 : public GxEPD2_EPD
     void _Init_Part();
     void _Update_Full();
     void _Update_Part();
-  protected:
-    bool _initial, _power_is_on, _using_partial_mode, _hibernating;
+  private:
+    static const unsigned char lut_20_vcomDC[];
+    static const unsigned char lut_21_ww[];
+    static const unsigned char lut_22_bw[];
+    static const unsigned char lut_23_wb[];
+    static const unsigned char lut_24_bb[];
+    static const unsigned char lut_20_vcomDC_partial[];
+    static const unsigned char lut_21_ww_partial[];
+    static const unsigned char lut_22_bw_partial[];
+    static const unsigned char lut_23_wb_partial[];
+    static const unsigned char lut_24_bb_partial[];
 };
 
 #endif

+ 135 - 32
src/epd/GxEPD2_420.cpp

@@ -11,24 +11,10 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_420.h"
-#include "WaveTables.h"
 
 GxEPD2_420::GxEPD2_420(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
-}
-
-void GxEPD2_420::init(uint32_t serial_diag_bitrate)
-{
-  GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
 }
 
 void GxEPD2_420::clearScreen(uint8_t value)
@@ -244,14 +230,7 @@ void GxEPD2_420::_PowerOff()
 
 void GxEPD2_420::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   _writeCommand(0x06); // boost
   _writeData(0x17);
   _writeData(0x17);
@@ -261,19 +240,143 @@ void GxEPD2_420::_InitDisplay()
   _writeData(0x3F); //300x400 B/W mode, LUT set by register
 }
 
+const unsigned char GxEPD2_420::lut_20_vcom0_full[] PROGMEM =
+{
+  0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00
+};
+
+const unsigned char GxEPD2_420::lut_21_ww_full[] PROGMEM =
+{
+  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+const unsigned char GxEPD2_420::lut_22_bw_full[] PROGMEM =
+{
+  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+const unsigned char GxEPD2_420::lut_23_wb_full[] PROGMEM =
+{
+  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+const unsigned char GxEPD2_420::lut_24_bb_full[] PROGMEM =
+{
+  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
+  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
+  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
+  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+// original wavetable from GxEPD, optimized for the display I have (modified Ben Krasnow version)
+#define TP0A  2 // sustain phase for bb and ww, change phase for bw and wb
+#define TP0B 45 // change phase for bw and wb
+
+// same waveform as demo wavetable from Good Display:
+//#define TP0A  0   // sustain phase for bb and ww, change phase for bw and wb
+//#define TP0B 0x19 // change phase for bw and wb
+
+const unsigned char GxEPD2_420::lut_20_vcom0_partial[] PROGMEM =
+{
+  0x00,
+  TP0A, TP0B, 0x01, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_420::lut_21_ww_partial[] PROGMEM =
+{
+  0x80, // 10 00 00 00
+  TP0A, TP0B, 0x01, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_420::lut_22_bw_partial[] PROGMEM =
+{
+  0xA0, // 10 10 00 00
+  TP0A, TP0B, 0x01, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_420::lut_23_wb_partial[] PROGMEM =
+{
+  0x50, // 01 01 00 00
+  TP0A, TP0B, 0x01, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+const unsigned char GxEPD2_420::lut_24_bb_partial[] PROGMEM =
+{
+  0x40, // 01 00 00 00
+  TP0A, TP0B, 0x01, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
 void GxEPD2_420::_Init_Full()
 {
   _InitDisplay();
   _writeCommand(0x20);
-  _writeDataPGM(GxGDEW042T2_lut_20_vcom0_full, sizeof(GxGDEW042T2_lut_20_vcom0_full));
+  _writeDataPGM(lut_20_vcom0_full, sizeof(lut_20_vcom0_full));
   _writeCommand(0x21);
-  _writeDataPGM(GxGDEW042T2_lut_21_ww_full, sizeof(GxGDEW042T2_lut_21_ww_full));
+  _writeDataPGM(lut_21_ww_full, sizeof(lut_21_ww_full));
   _writeCommand(0x22);
-  _writeDataPGM(GxGDEW042T2_lut_22_bw_full, sizeof(GxGDEW042T2_lut_22_bw_full));
+  _writeDataPGM(lut_22_bw_full, sizeof(lut_22_bw_full));
   _writeCommand(0x23);
-  _writeDataPGM(GxGDEW042T2_lut_23_wb_full, sizeof(GxGDEW042T2_lut_23_wb_full));
+  _writeDataPGM(lut_23_wb_full, sizeof(lut_23_wb_full));
   _writeCommand(0x24);
-  _writeDataPGM(GxGDEW042T2_lut_24_bb_full, sizeof(GxGDEW042T2_lut_24_bb_full));
+  _writeDataPGM(lut_24_bb_full, sizeof(lut_24_bb_full));
   _PowerOn();
   _using_partial_mode = false;
 }
@@ -282,15 +385,15 @@ void GxEPD2_420::_Init_Part()
 {
   _InitDisplay();
   _writeCommand(0x20);
-  _writeDataPGM(GxGDEW042T2_lut_20_vcom0_partial, sizeof(GxGDEW042T2_lut_20_vcom0_partial));
+  _writeDataPGM(lut_20_vcom0_partial, sizeof(lut_20_vcom0_partial));
   _writeCommand(0x21);
-  _writeDataPGM(GxGDEW042T2_lut_21_ww_partial, sizeof(GxGDEW042T2_lut_21_ww_partial));
+  _writeDataPGM(lut_21_ww_partial, sizeof(lut_21_ww_partial));
   _writeCommand(0x22);
-  _writeDataPGM(GxGDEW042T2_lut_22_bw_partial, sizeof(GxGDEW042T2_lut_22_bw_partial));
+  _writeDataPGM(lut_22_bw_partial, sizeof(lut_22_bw_partial));
   _writeCommand(0x23);
-  _writeDataPGM(GxGDEW042T2_lut_23_wb_partial, sizeof(GxGDEW042T2_lut_23_wb_partial));
+  _writeDataPGM(lut_23_wb_partial, sizeof(lut_23_wb_partial));
   _writeCommand(0x24);
-  _writeDataPGM(GxGDEW042T2_lut_24_bb_partial, sizeof(GxGDEW042T2_lut_24_bb_partial));
+  _writeDataPGM(lut_24_bb_partial, sizeof(lut_24_bb_partial));
   _PowerOn();
   _using_partial_mode = true;
 }

+ 11 - 3
src/epd/GxEPD2_420.h

@@ -32,7 +32,6 @@ class GxEPD2_420 : public GxEPD2_EPD
     // constructor
     GxEPD2_420(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
-    void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
     void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
@@ -60,8 +59,17 @@ class GxEPD2_420 : public GxEPD2_EPD
     void _Init_Part();
     void _Update_Full();
     void _Update_Part();
-  protected:
-    bool _initial, _power_is_on, _using_partial_mode, _hibernating;
+  private:
+    static const unsigned char lut_20_vcom0_full[];
+    static const unsigned char lut_21_ww_full[];
+    static const unsigned char lut_22_bw_full[];
+    static const unsigned char lut_23_wb_full[];
+    static const unsigned char lut_24_bb_full[];
+    static const unsigned char lut_20_vcom0_partial[];
+    static const unsigned char lut_21_ww_partial[];
+    static const unsigned char lut_22_bw_partial[];
+    static const unsigned char lut_23_wb_partial[];
+    static const unsigned char lut_24_bb_partial[];
 };
 
 #endif

+ 1 - 22
src/epd/GxEPD2_583.cpp

@@ -11,24 +11,10 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_583.h"
-#include "WaveTables.h"
 
 GxEPD2_583::GxEPD2_583(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
-}
-
-void GxEPD2_583::init(uint32_t serial_diag_bitrate)
-{
-  GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
 }
 
 void GxEPD2_583::clearScreen(uint8_t value)
@@ -302,14 +288,7 @@ void GxEPD2_583::_PowerOff()
 
 void GxEPD2_583::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   _writeCommand(0x01);
   _writeData (0x37); // POWER SETTING
   _writeData (0x00);

+ 0 - 3
src/epd/GxEPD2_583.h

@@ -32,7 +32,6 @@ class GxEPD2_583 : public GxEPD2_EPD
     // constructor
     GxEPD2_583(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
-    void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0x33); // init controller memory and screen (default white)
     void writeScreenBuffer(uint8_t value = 0x33); // init controller memory (default white)
@@ -61,8 +60,6 @@ class GxEPD2_583 : public GxEPD2_EPD
     void _Init_Part();
     void _Update_Full();
     void _Update_Part();
-  protected:
-    bool _initial, _power_is_on, _using_partial_mode, _hibernating;
 };
 
 #endif

+ 1 - 22
src/epd/GxEPD2_750.cpp

@@ -11,24 +11,10 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_750.h"
-#include "WaveTables.h"
 
 GxEPD2_750::GxEPD2_750(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
-}
-
-void GxEPD2_750::init(uint32_t serial_diag_bitrate)
-{
-  GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
-  _using_partial_mode = false;
-  _hibernating = false;
 }
 
 void GxEPD2_750::clearScreen(uint8_t value)
@@ -302,14 +288,7 @@ void GxEPD2_750::_PowerOff()
 
 void GxEPD2_750::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   /**********************************release flash sleep**********************************/
   _writeCommand(0X65);     //FLASH CONTROL
   _writeData(0x01);

+ 0 - 3
src/epd/GxEPD2_750.h

@@ -32,7 +32,6 @@ class GxEPD2_750 : public GxEPD2_EPD
     // constructor
     GxEPD2_750(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
-    void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0x33); // init controller memory and screen (default white)
     void writeScreenBuffer(uint8_t value = 0x33); // init controller memory (default white)
@@ -61,8 +60,6 @@ class GxEPD2_750 : public GxEPD2_EPD
     void _Init_Part();
     void _Update_Full();
     void _Update_Part();
-  protected:
-    bool _initial, _power_is_on, _using_partial_mode, _hibernating;
 };
 
 #endif

+ 0 - 642
src/epd/WaveTables.h

@@ -1,642 +0,0 @@
-#ifndef _WaveTables_H_
-#define _WaveTables_H_
-
-#if defined(ESP8266) || defined(ESP32)
-#include <pgmspace.h>
-#else
-#include <avr/pgmspace.h>
-#endif
-
-const uint8_t GDEP015OC1_LUTDefault_full[] PROGMEM =
-{
-  0x32,  // command
-  0x50, 0xAA, 0x55, 0xAA, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const uint8_t GDEP015OC1_LUTDefault_part[] PROGMEM =
-{
-  0x32,  // command
-  0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const uint8_t GxGDE0213B1_LUTDefault_full[] PROGMEM =
-{
-  0x32,  // command
-  0x22, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x01, 0x00, 0x00, 0x00, 0x00
-};
-
-const uint8_t GxGDE0213B1_LUTDefault_part[] PROGMEM =
-{
-  0x32,  // command
-  0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const uint8_t GxGDEH029A1_LUTDefault_full[] PROGMEM =
-{
-  0x32,  // command
-  0x50, 0xAA, 0x55, 0xAA, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const uint8_t GxGDEH029A1_LUTDefault_part[] PROGMEM =
-{
-  0x32,  // command
-  0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-// GDEW0213I5F
-
-//full screen update LUT
-const unsigned char GxGDEW0213I5F_lut_20_vcomDC[] PROGMEM =
-{
-  0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00,
-};
-
-const unsigned char GxGDEW0213I5F_lut_21_ww[] PROGMEM =
-{
-  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW0213I5F_lut_22_bw[] PROGMEM =
-{
-  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW0213I5F_lut_23_wb[] PROGMEM =
-{
-  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW0213I5F_lut_24_bb[] PROGMEM =
-{
-  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-//partial screen update LUT
-//#define Fx19 0x19 // original value is 25 (phase length)
-#define Fx19 0x28   // new value for test is 40 (phase length)
-const unsigned char GxGDEW0213I5F_lut_20_vcomDC_partial[] PROGMEM =
-{
-  0x00, Fx19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00,
-};
-
-const unsigned char GxGDEW0213I5F_lut_21_ww_partial[] PROGMEM =
-{
-  0x00, Fx19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW0213I5F_lut_22_bw_partial[] PROGMEM =
-{
-  0x80, Fx19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW0213I5F_lut_23_wb_partial[] PROGMEM =
-{
-  0x40, Fx19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW0213I5F_lut_24_bb_partial[] PROGMEM =
-{
-  0x00, Fx19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-// GDEW029T5 originally same as GDEW0213I5F, changed for test
-
-//full screen update LUT
-const unsigned char GxGDEW029T5_lut_20_vcomDC[] PROGMEM =
-{
-  0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00,
-};
-
-const unsigned char GxGDEW029T5_lut_21_ww[] PROGMEM =
-{
-  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW029T5_lut_22_bw[] PROGMEM =
-{
-  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW029T5_lut_23_wb[] PROGMEM =
-{
-  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW029T5_lut_24_bb[] PROGMEM =
-{
-  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-//partial screen update LUT
-//#define Tx19 0x19 // original value is 25 (phase length)
-#define Tx19 0x20   // new value for test is 32 (phase length)
-const unsigned char GxGDEW029T5_lut_20_vcomDC_partial[] PROGMEM =
-{
-  0x00, Tx19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00,
-};
-
-const unsigned char GxGDEW029T5_lut_21_ww_partial[] PROGMEM =
-{
-  0x00, Tx19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW029T5_lut_22_bw_partial[] PROGMEM =
-{
-  0x80, Tx19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW029T5_lut_23_wb_partial[] PROGMEM =
-{
-  0x40, Tx19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW029T5_lut_24_bb_partial[] PROGMEM =
-{
-  0x00, Tx19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-//full screen update LUT
-const uint8_t GxGDEW027W3_lut_20_vcomDC[] PROGMEM =
-{
-  0x00, 0x00,
-  0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const uint8_t GxGDEW027W3_lut_21_ww[] PROGMEM =
-{
-  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const uint8_t GxGDEW027W3_lut_22_bw[] PROGMEM =
-{
-  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const uint8_t GxGDEW027W3_lut_23_wb[] PROGMEM =
-{
-  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const uint8_t GxGDEW027W3_lut_24_bb[] PROGMEM =
-{
-  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-//partial screen update LUT
-const uint8_t GxGDEW027W3_lut_20_vcomDC_partial[] PROGMEM =
-{
-  0x00, 0x00,
-  0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const uint8_t GxGDEW027W3_lut_21_ww_partial[] PROGMEM =
-{
-  0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const uint8_t GxGDEW027W3_lut_22_bw_partial[] PROGMEM =
-{
-  0x80, 0x19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const uint8_t GxGDEW027W3_lut_23_wb_partial[] PROGMEM =
-{
-  0x40, 0x19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const uint8_t GxGDEW027W3_lut_24_bb_partial[] PROGMEM =
-{
-  0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-// GDEW042T2
-
-//#define USE_GDEW042T2_DEMO_WAVETABLE
-
-#ifdef USE_GDEW042T2_DEMO_WAVETABLE
-
-const unsigned char GxGDEW042T2_lut_20_vcom0_full[] PROGMEM =
-{
-  0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00
-};
-
-const unsigned char GxGDEW042T2_lut_21_ww_full[] PROGMEM =
-{
-  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const unsigned char GxGDEW042T2_lut_22_bw_full[] PROGMEM =
-{
-  0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const unsigned char GxGDEW042T2_lut_23_wb_full[] PROGMEM =
-{
-  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const unsigned char GxGDEW042T2_lut_24_bb_full[] PROGMEM =
-{
-  0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
-  0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
-  0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-
-const unsigned char GxGDEW042T2_lut_20_vcom0_partial[] PROGMEM =
-{
-  0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const unsigned char GxGDEW042T2_lut_21_ww_partial[] PROGMEM =
-{
-  0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const unsigned char GxGDEW042T2_lut_22_bw_partial[] PROGMEM =
-{
-  0x80, 0x19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const unsigned char GxGDEW042T2_lut_23_wb_partial[] PROGMEM =
-{
-  0x40, 0x19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-const unsigned char GxGDEW042T2_lut_24_bb_partial[] PROGMEM =
-{
-  0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-#else
-
-const unsigned char GxGDEW042T2_lut_20_vcom0_full[] PROGMEM =
-{
-  0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
-  0x00, 0x17, 0x17, 0x00, 0x00, 0x02,
-  0x00, 0x0A, 0x01, 0x00, 0x00, 0x01,
-  0x00, 0x0E, 0x0E, 0x00, 0x00, 0x02,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW042T2_lut_21_ww_full[] PROGMEM =
-{
-  0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
-  0x40, 0x0A, 0x01, 0x00, 0x00, 0x01,
-  0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW042T2_lut_22_bw_full[] PROGMEM =
-{
-  0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
-  0x40, 0x0A, 0x01, 0x00, 0x00, 0x01,
-  0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW042T2_lut_23_wb_full[] PROGMEM =
-{
-  0x80, 0x17, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
-  0x80, 0x0A, 0x01, 0x00, 0x00, 0x01,
-  0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW042T2_lut_24_bb_full[] PROGMEM =
-{
-  0x80, 0x17, 0x00, 0x00, 0x00, 0x02,
-  0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
-  0x80, 0x0A, 0x01, 0x00, 0x00, 0x01,
-  0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-#define TP0A  2 // sustain phase for bb and ww, change phase for bw and wb
-#define TP0B 45 // change phase for bw and wb
-
-const unsigned char GxGDEW042T2_lut_20_vcom0_partial[] PROGMEM =
-{
-  0x00,
-  TP0A, TP0B, 0x01, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW042T2_lut_21_ww_partial[] PROGMEM =
-{
-  0x80, // 10 00 00 00
-  TP0A, TP0B, 0x01, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW042T2_lut_22_bw_partial[] PROGMEM =
-{
-  0xA0, // 10 10 00 00
-  TP0A, TP0B, 0x01, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW042T2_lut_23_wb_partial[] PROGMEM =
-{
-  0x50, // 01 01 00 00
-  TP0A, TP0B, 0x01, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const unsigned char GxGDEW042T2_lut_24_bb_partial[] PROGMEM =
-{
-  0x40, // 01 00 00 00
-  TP0A, TP0B, 0x01, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-#endif
-
-#endif

+ 25 - 23
src/epd3c/GxEPD2_154c.cpp

@@ -11,7 +11,6 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_154c.h"
-#include "WaveTables3c.h"
 
 const uint8_t GxEPD2_154c::bw2grey[] =
 {
@@ -24,21 +23,22 @@ const uint8_t GxEPD2_154c::bw2grey[] =
 GxEPD2_154c::GxEPD2_154c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
-  _initial = true;
-  _power_is_on = false;
   _paged = false;
   _second_phase = false;
-  _hibernating = false;
 }
 
 void GxEPD2_154c::init(uint32_t serial_diag_bitrate)
 {
   GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
   _paged = false;
   _second_phase = false;
-  _hibernating = false;
+}
+
+void GxEPD2_154c::init(uint32_t serial_diag_bitrate, bool initial, bool pulldown_rst_mode)
+{
+  GxEPD2_EPD::init(serial_diag_bitrate, initial, pulldown_rst_mode);
+  _paged = false;
+  _second_phase = false;
 }
 
 void GxEPD2_154c::clearScreen(uint8_t value)
@@ -293,14 +293,7 @@ void GxEPD2_154c::setPaged()
 
 void GxEPD2_154c::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   _writeCommand(0x01);
   _writeData(0x07);
   _writeData(0x00);
@@ -325,25 +318,34 @@ void GxEPD2_154c::_InitDisplay()
   _writeData(0x0E);
 }
 
+const uint8_t GxEPD2_154c::lut_20_vcom0[] PROGMEM = {  0x0E  , 0x14 , 0x01 , 0x0A , 0x06 , 0x04 , 0x0A , 0x0A , 0x0F , 0x03 , 0x03 , 0x0C , 0x06 , 0x0A , 0x00 };
+const uint8_t GxEPD2_154c::lut_21_w[] PROGMEM = {  0x0E  , 0x14 , 0x01 , 0x0A , 0x46 , 0x04 , 0x8A , 0x4A , 0x0F , 0x83 , 0x43 , 0x0C , 0x86 , 0x0A , 0x04 };
+const uint8_t GxEPD2_154c::lut_22_b[] PROGMEM = {  0x0E  , 0x14 , 0x01 , 0x8A , 0x06 , 0x04 , 0x8A , 0x4A , 0x0F , 0x83 , 0x43 , 0x0C , 0x06 , 0x4A , 0x04 };
+const uint8_t GxEPD2_154c::lut_23_g1[] PROGMEM = { 0x8E  , 0x94 , 0x01 , 0x8A , 0x06 , 0x04 , 0x8A , 0x4A , 0x0F , 0x83 , 0x43 , 0x0C , 0x06 , 0x0A , 0x04 };
+const uint8_t GxEPD2_154c::lut_24_g2[] PROGMEM = { 0x8E  , 0x94 , 0x01 , 0x8A , 0x06 , 0x04 , 0x8A , 0x4A , 0x0F , 0x83 , 0x43 , 0x0C , 0x06 , 0x0A , 0x04 };
+const uint8_t GxEPD2_154c::lut_25_vcom1[] PROGMEM = {  0x03  , 0x1D , 0x01 , 0x01 , 0x08 , 0x23 , 0x37 , 0x37 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 };
+const uint8_t GxEPD2_154c::lut_26_red0[] PROGMEM = { 0x83  , 0x5D , 0x01 , 0x81 , 0x48 , 0x23 , 0x77 , 0x77 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 };
+const uint8_t GxEPD2_154c::lut_27_red1[] PROGMEM = { 0x03  , 0x1D , 0x01 , 0x01 , 0x08 , 0x23 , 0x37 , 0x37 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 };
+
 void GxEPD2_154c::_Init_Full()
 {
   _InitDisplay();
   _writeCommand(0x20);
-  _writeDataPGM(GxGDEW0154Z04_lut_20_vcom0, sizeof(GxGDEW0154Z04_lut_20_vcom0));
+  _writeDataPGM(lut_20_vcom0, sizeof(lut_20_vcom0));
   _writeCommand(0x21);
-  _writeDataPGM(GxGDEW0154Z04_lut_21_w, sizeof(GxGDEW0154Z04_lut_21_w));
+  _writeDataPGM(lut_21_w, sizeof(lut_21_w));
   _writeCommand(0x22);
-  _writeDataPGM(GxGDEW0154Z04_lut_22_b, sizeof(GxGDEW0154Z04_lut_22_b));
+  _writeDataPGM(lut_22_b, sizeof(lut_22_b));
   _writeCommand(0x23);
-  _writeDataPGM(GxGDEW0154Z04_lut_23_g1, sizeof(GxGDEW0154Z04_lut_23_g1));
+  _writeDataPGM(lut_23_g1, sizeof(lut_23_g1));
   _writeCommand(0x24);
-  _writeDataPGM(GxGDEW0154Z04_lut_24_g2, sizeof(GxGDEW0154Z04_lut_24_g2));
+  _writeDataPGM(lut_24_g2, sizeof(lut_24_g2));
   _writeCommand(0x25);
-  _writeDataPGM(GxGDEW0154Z04_lut_25_vcom1, sizeof(GxGDEW0154Z04_lut_25_vcom1));
+  _writeDataPGM(lut_25_vcom1, sizeof(lut_25_vcom1));
   _writeCommand(0x26);
-  _writeDataPGM(GxGDEW0154Z04_lut_26_red0, sizeof(GxGDEW0154Z04_lut_26_red0));
+  _writeDataPGM(lut_26_red0, sizeof(lut_26_red0));
   _writeCommand(0x27);
-  _writeDataPGM(GxGDEW0154Z04_lut_27_red1, sizeof(GxGDEW0154Z04_lut_27_red1));
+  _writeDataPGM(lut_27_red1, sizeof(lut_27_red1));
   _PowerOn();
 }
 

+ 10 - 2
src/epd3c/GxEPD2_154c.h

@@ -33,6 +33,7 @@ class GxEPD2_154c : public GxEPD2_EPD
     GxEPD2_154c(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
     void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
+    void init(uint32_t serial_diag_bitrate, bool initial, bool pulldown_rst_mode = false);
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
     void clearScreen(uint8_t black_value, uint8_t color_value); // init controller memory and screen
@@ -63,10 +64,17 @@ class GxEPD2_154c : public GxEPD2_EPD
     void _Init_Part();
     void _Update_Full();
     void _Update_Part();
-  protected:
-    bool _initial, _power_is_on, _hibernating;
+  private:
     bool _paged, _second_phase;
     static const uint8_t bw2grey[];
+    static const uint8_t lut_20_vcom0[];
+    static const uint8_t lut_21_w[];
+    static const uint8_t lut_22_b[];
+    static const uint8_t lut_23_g1[];
+    static const uint8_t lut_24_g2[];
+    static const uint8_t lut_25_vcom1[];
+    static const uint8_t lut_26_red0[];
+    static const uint8_t lut_27_red1[];
 };
 
 #endif

+ 1 - 17
src/epd3c/GxEPD2_213c.cpp

@@ -11,7 +11,6 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_213c.h"
-//#include "WaveTables3c.h"
 
 GxEPD2_213c::GxEPD2_213c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
@@ -21,14 +20,6 @@ GxEPD2_213c::GxEPD2_213c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   _hibernating = false;
 }
 
-void GxEPD2_213c::init(uint32_t serial_diag_bitrate)
-{
-  GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
-  _hibernating = false;
-}
-
 void GxEPD2_213c::clearScreen(uint8_t value)
 {
   clearScreen(value, 0xFF);
@@ -258,14 +249,7 @@ void GxEPD2_213c::_PowerOff()
 
 void GxEPD2_213c::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   _writeCommand(0x06);
   _writeData (0x17);
   _writeData (0x17);

+ 0 - 3
src/epd3c/GxEPD2_213c.h

@@ -32,7 +32,6 @@ class GxEPD2_213c : public GxEPD2_EPD
     // constructor
     GxEPD2_213c(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
-    void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
     void clearScreen(uint8_t black_value, uint8_t color_value); // init controller memory and screen
@@ -62,8 +61,6 @@ class GxEPD2_213c : public GxEPD2_EPD
     void _Init_Part();
     void _Update_Full();
     void _Update_Part();
-  protected:
-    bool _initial, _power_is_on, _hibernating;
 };
 
 #endif

+ 63 - 30
src/epd3c/GxEPD2_270c.cpp

@@ -11,22 +11,10 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_270c.h"
-#include "WaveTables3c.h"
 
 GxEPD2_270c::GxEPD2_270c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
-  _initial = true;
-  _power_is_on = false;
-  _hibernating = false;
-}
-
-void GxEPD2_270c::init(uint32_t serial_diag_bitrate)
-{
-  GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
-  _hibernating = false;
 }
 
 void GxEPD2_270c::clearScreen(uint8_t value)
@@ -266,14 +254,7 @@ void GxEPD2_270c::_PowerOff()
 
 void GxEPD2_270c::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   _writeCommand(0x01);
   _writeData (0x03);
   _writeData (0x00);
@@ -318,19 +299,71 @@ void GxEPD2_270c::_InitDisplay()
   _writeData(0x87);
 }
 
+const uint8_t GxEPD2_270c::lut_20_vcomDC[] PROGMEM =
+{
+  0x00  , 0x00,
+  0x00  , 0x1A  , 0x1A  , 0x00  , 0x00  , 0x01,
+  0x00  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
+  0x00  , 0x0E  , 0x01  , 0x0E  , 0x01  , 0x10,
+  0x00  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
+  0x00  , 0x04  , 0x10  , 0x00  , 0x00  , 0x05,
+  0x00  , 0x03  , 0x0E  , 0x00  , 0x00  , 0x0A,
+  0x00  , 0x23  , 0x00  , 0x00  , 0x00  , 0x01
+};
+//R21H
+const uint8_t GxEPD2_270c::lut_21[] PROGMEM = {
+  0x90  , 0x1A  , 0x1A  , 0x00  , 0x00  , 0x01,
+  0x40  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
+  0x84  , 0x0E  , 0x01  , 0x0E  , 0x01  , 0x10,
+  0x80  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
+  0x00  , 0x04  , 0x10  , 0x00  , 0x00  , 0x05,
+  0x00  , 0x03  , 0x0E  , 0x00  , 0x00  , 0x0A,
+  0x00  , 0x23  , 0x00  , 0x00  , 0x00  , 0x01
+};
+//R22H  r
+const uint8_t GxEPD2_270c::lut_22_red[] PROGMEM = {
+  0xA0  , 0x1A  , 0x1A  , 0x00  , 0x00  , 0x01,
+  0x00  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
+  0x84  , 0x0E  , 0x01  , 0x0E  , 0x01  , 0x10,
+  0x90  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
+  0xB0  , 0x04  , 0x10  , 0x00  , 0x00  , 0x05,
+  0xB0  , 0x03  , 0x0E  , 0x00  , 0x00  , 0x0A,
+  0xC0  , 0x23  , 0x00  , 0x00  , 0x00  , 0x01
+};
+//R23H  w
+const uint8_t GxEPD2_270c::lut_23_white[] PROGMEM = {
+  0x90  , 0x1A  , 0x1A  , 0x00  , 0x00  , 0x01,
+  0x40  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
+  0x84  , 0x0E  , 0x01  , 0x0E  , 0x01  , 0x10,
+  0x80  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
+  0x00  , 0x04  , 0x10  , 0x00  , 0x00  , 0x05,
+  0x00  , 0x03  , 0x0E  , 0x00  , 0x00  , 0x0A,
+  0x00  , 0x23  , 0x00  , 0x00  , 0x00  , 0x01
+};
+//R24H  b
+const uint8_t GxEPD2_270c::lut_24_black[] PROGMEM = {
+  0x90  , 0x1A  , 0x1A  , 0x00  , 0x00  , 0x01,
+  0x20  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
+  0x84  , 0x0E  , 0x01  , 0x0E  , 0x01  , 0x10,
+  0x10  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
+  0x00  , 0x04  , 0x10  , 0x00  , 0x00  , 0x05,
+  0x00  , 0x03  , 0x0E  , 0x00  , 0x00  , 0x0A,
+  0x00  , 0x23  , 0x00  , 0x00  , 0x00  , 0x01
+};
+
 void GxEPD2_270c::_Init_Full()
 {
   _InitDisplay();
   _writeCommand(0x20); //vcom
-  _writeData_nCS(GxGDEW027C44_lut_20_vcomDC, sizeof(GxGDEW027C44_lut_20_vcomDC));
+  _writeData_nCS(lut_20_vcomDC, sizeof(lut_20_vcomDC));
   _writeCommand(0x21); //ww --
-  _writeData_nCS(GxGDEW027C44_lut_21, sizeof(GxGDEW027C44_lut_21));
+  _writeData_nCS(lut_21, sizeof(lut_21));
   _writeCommand(0x22); //bw r
-  _writeData_nCS(GxGDEW027C44_lut_22_red, sizeof(GxGDEW027C44_lut_22_red));
+  _writeData_nCS(lut_22_red, sizeof(lut_22_red));
   _writeCommand(0x23); //wb w
-  _writeData_nCS(GxGDEW027C44_lut_23_white, sizeof(GxGDEW027C44_lut_23_white));
+  _writeData_nCS(lut_23_white, sizeof(lut_23_white));
   _writeCommand(0x24); //bb b
-  _writeData_nCS(GxGDEW027C44_lut_24_black, sizeof(GxGDEW027C44_lut_24_black));
+  _writeData_nCS(lut_24_black, sizeof(lut_24_black));
   _PowerOn();
 }
 
@@ -338,15 +371,15 @@ void GxEPD2_270c::_Init_Part()
 {
   _InitDisplay();
   _writeCommand(0x20); //vcom
-  _writeData_nCS(GxGDEW027C44_lut_20_vcomDC, sizeof(GxGDEW027C44_lut_20_vcomDC));
+  _writeData_nCS(lut_20_vcomDC, sizeof(lut_20_vcomDC));
   _writeCommand(0x21); //ww --
-  _writeData_nCS(GxGDEW027C44_lut_21, sizeof(GxGDEW027C44_lut_21));
+  _writeData_nCS(lut_21, sizeof(lut_21));
   _writeCommand(0x22); //bw r
-  _writeData_nCS(GxGDEW027C44_lut_22_red, sizeof(GxGDEW027C44_lut_22_red));
+  _writeData_nCS(lut_22_red, sizeof(lut_22_red));
   _writeCommand(0x23); //wb w
-  _writeData_nCS(GxGDEW027C44_lut_23_white, sizeof(GxGDEW027C44_lut_23_white));
+  _writeData_nCS(lut_23_white, sizeof(lut_23_white));
   _writeCommand(0x24); //bb b
-  _writeData_nCS(GxGDEW027C44_lut_24_black, sizeof(GxGDEW027C44_lut_24_black));
+  _writeData_nCS(lut_24_black, sizeof(lut_24_black));
   _PowerOn();
 }
 

+ 6 - 3
src/epd3c/GxEPD2_270c.h

@@ -32,7 +32,6 @@ class GxEPD2_270c : public GxEPD2_EPD
     // constructor
     GxEPD2_270c(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
-    void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
     void clearScreen(uint8_t black_value, uint8_t color_value); // init controller memory and screen
@@ -63,8 +62,12 @@ class GxEPD2_270c : public GxEPD2_EPD
     void _Init_Part();
     void _Update_Full();
     void _Update_Part();
-  protected:
-    bool _initial, _power_is_on, _hibernating;
+  private:
+    static const uint8_t lut_20_vcomDC[];
+    static const uint8_t lut_21[];
+    static const uint8_t lut_22_red[];
+    static const uint8_t lut_23_white[];
+    static const uint8_t lut_24_black[];
 };
 
 #endif

+ 1 - 20
src/epd3c/GxEPD2_290c.cpp

@@ -11,22 +11,10 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_290c.h"
-//#include "WaveTables3c.h"
 
 GxEPD2_290c::GxEPD2_290c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
-  _initial = true;
-  _power_is_on = false;
-  _hibernating = false;
-}
-
-void GxEPD2_290c::init(uint32_t serial_diag_bitrate)
-{
-  GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
-  _hibernating = false;
 }
 
 void GxEPD2_290c::clearScreen(uint8_t value)
@@ -258,14 +246,7 @@ void GxEPD2_290c::_PowerOff()
 
 void GxEPD2_290c::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   _writeCommand(0x06);
   _writeData (0x17);
   _writeData (0x17);

+ 0 - 3
src/epd3c/GxEPD2_290c.h

@@ -32,7 +32,6 @@ class GxEPD2_290c : public GxEPD2_EPD
     // constructor
     GxEPD2_290c(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
-    void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
     void clearScreen(uint8_t black_value, uint8_t color_value); // init controller memory and screen
@@ -62,8 +61,6 @@ class GxEPD2_290c : public GxEPD2_EPD
     void _Init_Part();
     void _Update_Full();
     void _Update_Part();
-  protected:
-    bool _initial, _power_is_on, _hibernating;
 };
 
 #endif

+ 1 - 20
src/epd3c/GxEPD2_420c.cpp

@@ -11,22 +11,10 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_420c.h"
-//#include "WaveTables3c.h"
 
 GxEPD2_420c::GxEPD2_420c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
-  _initial = true;
-  _power_is_on = false;
-  _hibernating = false;
-}
-
-void GxEPD2_420c::init(uint32_t serial_diag_bitrate)
-{
-  GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
-  _hibernating = false;
 }
 
 void GxEPD2_420c::clearScreen(uint8_t value)
@@ -259,14 +247,7 @@ void GxEPD2_420c::_PowerOff()
 
 void GxEPD2_420c::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   _writeCommand(0x06); //boost
   _writeData(0x17);
   _writeData(0x17);

+ 0 - 3
src/epd3c/GxEPD2_420c.h

@@ -32,7 +32,6 @@ class GxEPD2_420c : public GxEPD2_EPD
     // constructor
     GxEPD2_420c(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
-    void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
     void clearScreen(uint8_t black_value, uint8_t color_value); // init controller memory and screen
@@ -62,8 +61,6 @@ class GxEPD2_420c : public GxEPD2_EPD
     void _Init_Part();
     void _Update_Full();
     void _Update_Part();
-  protected:
-    bool _initial, _power_is_on, _hibernating;
 };
 
 #endif

+ 1 - 20
src/epd3c/GxEPD2_583c.cpp

@@ -11,22 +11,10 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_583c.h"
-//#include "WaveTables3c.h"
 
 GxEPD2_583c::GxEPD2_583c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, LOW, 40000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
-  _initial = true;
-  _power_is_on = false;
-  _hibernating = false;
-}
-
-void GxEPD2_583c::init(uint32_t serial_diag_bitrate)
-{
-  GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
-  _hibernating = false;
 }
 
 void GxEPD2_583c::clearScreen(uint8_t value)
@@ -325,14 +313,7 @@ void GxEPD2_583c::_PowerOff()
 
 void GxEPD2_583c::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   _writeCommand(0x01);
   _writeData (0x37); //POWER SETTING
   _writeData (0x00);

+ 0 - 3
src/epd3c/GxEPD2_583c.h

@@ -32,7 +32,6 @@ class GxEPD2_583c : public GxEPD2_EPD
     // constructor
     GxEPD2_583c(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
-    void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0x33); // init controller memory and screen (default white)
     void clearScreen(uint8_t black_value, uint8_t red_value); // init controller memory and screen
@@ -63,8 +62,6 @@ class GxEPD2_583c : public GxEPD2_EPD
     void _Init_Part();
     void _Update_Full();
     void _Update_Part();
-  protected:
-    bool _initial, _power_is_on, _hibernating;
 };
 
 #endif

+ 1 - 20
src/epd3c/GxEPD2_750c.cpp

@@ -11,22 +11,10 @@
 // Library: https://github.com/ZinggJM/GxEPD2
 
 #include "GxEPD2_750c.h"
-//#include "WaveTables3c.h"
 
 GxEPD2_750c::GxEPD2_750c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
   GxEPD2_EPD(cs, dc, rst, busy, LOW, 40000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
-  _initial = true;
-  _power_is_on = false;
-  _hibernating = false;
-}
-
-void GxEPD2_750c::init(uint32_t serial_diag_bitrate)
-{
-  GxEPD2_EPD::init(serial_diag_bitrate);
-  _initial = true;
-  _power_is_on = false;
-  _hibernating = false;
 }
 
 void GxEPD2_750c::clearScreen(uint8_t value)
@@ -322,14 +310,7 @@ void GxEPD2_750c::_PowerOff()
 
 void GxEPD2_750c::_InitDisplay()
 {
-  if (_hibernating && (_rst >= 0))
-  {
-    digitalWrite(_rst, LOW);
-    delay(20);
-    digitalWrite(_rst, HIGH);
-    delay(200);
-    _hibernating = false;
-  }
+  if (_hibernating) _reset();
   /**********************************release flash sleep**********************************/
   _writeCommand(0X65);     //FLASH CONTROL
   _writeData(0x01);

+ 0 - 3
src/epd3c/GxEPD2_750c.h

@@ -32,7 +32,6 @@ class GxEPD2_750c : public GxEPD2_EPD
     // constructor
     GxEPD2_750c(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
     // methods (virtual)
-    void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     void clearScreen(uint8_t value = 0x33); // init controller memory and screen (default white)
     void clearScreen(uint8_t black_value, uint8_t red_value); // init controller memory and screen
@@ -63,8 +62,6 @@ class GxEPD2_750c : public GxEPD2_EPD
     void _Init_Part();
     void _Update_Full();
     void _Update_Part();
-  protected:
-    bool _initial, _power_is_on, _hibernating;
 };
 
 #endif

+ 0 - 71
src/epd3c/WaveTables3c.h

@@ -1,71 +0,0 @@
-#ifndef _WaveTables3c_H_
-#define _WaveTables3c_H_
-
-#if defined(ESP8266) || defined(ESP32)
-#include <pgmspace.h>
-#else
-#include <avr/pgmspace.h>
-#endif
-
-const uint8_t GxGDEW0154Z04_lut_20_vcom0[] PROGMEM = {  0x0E  , 0x14 , 0x01 , 0x0A , 0x06 , 0x04 , 0x0A , 0x0A , 0x0F , 0x03 , 0x03 , 0x0C , 0x06 , 0x0A , 0x00 };
-const uint8_t GxGDEW0154Z04_lut_21_w[] PROGMEM = {  0x0E  , 0x14 , 0x01 , 0x0A , 0x46 , 0x04 , 0x8A , 0x4A , 0x0F , 0x83 , 0x43 , 0x0C , 0x86 , 0x0A , 0x04 };
-const uint8_t GxGDEW0154Z04_lut_22_b[] PROGMEM = {  0x0E  , 0x14 , 0x01 , 0x8A , 0x06 , 0x04 , 0x8A , 0x4A , 0x0F , 0x83 , 0x43 , 0x0C , 0x06 , 0x4A , 0x04 };
-const uint8_t GxGDEW0154Z04_lut_23_g1[] PROGMEM = { 0x8E  , 0x94 , 0x01 , 0x8A , 0x06 , 0x04 , 0x8A , 0x4A , 0x0F , 0x83 , 0x43 , 0x0C , 0x06 , 0x0A , 0x04 };
-const uint8_t GxGDEW0154Z04_lut_24_g2[] PROGMEM = { 0x8E  , 0x94 , 0x01 , 0x8A , 0x06 , 0x04 , 0x8A , 0x4A , 0x0F , 0x83 , 0x43 , 0x0C , 0x06 , 0x0A , 0x04 };
-const uint8_t GxGDEW0154Z04_lut_25_vcom1[] PROGMEM = {  0x03  , 0x1D , 0x01 , 0x01 , 0x08 , 0x23 , 0x37 , 0x37 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 };
-const uint8_t GxGDEW0154Z04_lut_26_red0[] PROGMEM = { 0x83  , 0x5D , 0x01 , 0x81 , 0x48 , 0x23 , 0x77 , 0x77 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 };
-const uint8_t GxGDEW0154Z04_lut_27_red1[] PROGMEM = { 0x03  , 0x1D , 0x01 , 0x01 , 0x08 , 0x23 , 0x37 , 0x37 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 };
-
-const uint8_t GxGDEW027C44_lut_20_vcomDC[] PROGMEM =
-{
-  0x00  , 0x00,
-  0x00  , 0x1A  , 0x1A  , 0x00  , 0x00  , 0x01,
-  0x00  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
-  0x00  , 0x0E  , 0x01  , 0x0E  , 0x01  , 0x10,
-  0x00  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
-  0x00  , 0x04  , 0x10  , 0x00  , 0x00  , 0x05,
-  0x00  , 0x03  , 0x0E  , 0x00  , 0x00  , 0x0A,
-  0x00  , 0x23  , 0x00  , 0x00  , 0x00  , 0x01
-};
-//R21H
-const uint8_t GxGDEW027C44_lut_21[] PROGMEM = {
-  0x90  , 0x1A  , 0x1A  , 0x00  , 0x00  , 0x01,
-  0x40  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
-  0x84  , 0x0E  , 0x01  , 0x0E  , 0x01  , 0x10,
-  0x80  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
-  0x00  , 0x04  , 0x10  , 0x00  , 0x00  , 0x05,
-  0x00  , 0x03  , 0x0E  , 0x00  , 0x00  , 0x0A,
-  0x00  , 0x23  , 0x00  , 0x00  , 0x00  , 0x01
-};
-//R22H  r
-const uint8_t GxGDEW027C44_lut_22_red[] PROGMEM = {
-  0xA0  , 0x1A  , 0x1A  , 0x00  , 0x00  , 0x01,
-  0x00  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
-  0x84  , 0x0E  , 0x01  , 0x0E  , 0x01  , 0x10,
-  0x90  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
-  0xB0  , 0x04  , 0x10  , 0x00  , 0x00  , 0x05,
-  0xB0  , 0x03  , 0x0E  , 0x00  , 0x00  , 0x0A,
-  0xC0  , 0x23  , 0x00  , 0x00  , 0x00  , 0x01
-};
-//R23H  w
-const uint8_t GxGDEW027C44_lut_23_white[] PROGMEM = {
-  0x90  , 0x1A  , 0x1A  , 0x00  , 0x00  , 0x01,
-  0x40  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
-  0x84  , 0x0E  , 0x01  , 0x0E  , 0x01  , 0x10,
-  0x80  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
-  0x00  , 0x04  , 0x10  , 0x00  , 0x00  , 0x05,
-  0x00  , 0x03  , 0x0E  , 0x00  , 0x00  , 0x0A,
-  0x00  , 0x23  , 0x00  , 0x00  , 0x00  , 0x01
-};
-//R24H  b
-const uint8_t GxGDEW027C44_lut_24_black[] PROGMEM = {
-  0x90  , 0x1A  , 0x1A  , 0x00  , 0x00  , 0x01,
-  0x20  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
-  0x84  , 0x0E  , 0x01  , 0x0E  , 0x01  , 0x10,
-  0x10  , 0x0A  , 0x0A  , 0x00  , 0x00  , 0x08,
-  0x00  , 0x04  , 0x10  , 0x00  , 0x00  , 0x05,
-  0x00  , 0x03  , 0x0E  , 0x00  , 0x00  , 0x0A,
-  0x00  , 0x23  , 0x00  , 0x00  , 0x00  , 0x01
-};
-
-#endif