Skip to content

gdew042t2 400x300

Martin F edited this page Mar 18, 2023 · 1 revision
  • Size: 400 * 300 4.2"
  • Controller: IL0398
  • Status: Working correctly
  • New class: gdew042t2Grays.h supports 4 Gray mode at the cost of 30Kb more DRAM.
  • Tested on ESP32 / ESP32S2

logo-Goodisplay Buy this 4.2 epaper here

GDEW042T2

Stats

This time in milliseconds was tested in a S2, and it's v1.0 without optimization, sending a byte at time with SPI and toggling the Chip Select (SS) state. v1 original version GxEPD style

3210 _wakeUp settings+send Buffer
2006 _powerOn
5217 total time in millis

gdew042t2 v2 using SPI optimization

2569 _wakeUp settings+send Buffer
2007 _powerOn
4577 total time in ms (640 milliseconds optimized)

gdew042t2Grays.h class

90 ms _wakeUp settings+send Buffer

4 Grays class demo

About the gdew042t2Grays class you need to be aware that it keeps 3 buffers:

_buffer (monochrome) _buffer1 is SPI1 buffer (0x10 command) _buffer2 is SPI2 buffer (0x13 command)

Each of them 15 K that is the result of doing 400/8*300 (1-bit per pixel) summing 45Kb of DRAM in total (about 30Kb more than the monochrome version).

Be aware that you cannot use updateWindow partial update method if you are in 4 Grays mode. Or you can, but it will show the contents of _buffer (monochrome) since the controller does not support partial upgrade in 4 gray mode. In order to achieve both modes in the same class it has a new method called: setMonoMode(bool mode) on true it use monochrome mode and _buffer. In setMonoMode(false) you can draw using the 3 levels of gray plus white. There are 4 constants defined for that:

// The only 4 grays supported by Good display/Waveshare
#define EPD_BLACK     0
#define EPD_DARKGREY  64
#define EPD_LIGHTGREY 128
#define EPD_WHITE     255

Implementation demo

#include <gdew042t2Grays.h>
EpdSpi io;
Gdew042t2Grays display(io);

void app_main() {
   // Test Epd class. true to enable debug
   display.init(false);
   // Note that is in 4 Gray mode as default this is just to make it more explicit:
   display.setMonoMode(false); // 4 gray mode.

   // Draw something
   display.setTextColor(EPD_DARKGREY);
   display.setCursor(20,40);
   display.print("Hello world");
   display.fillCircle(60 , 200, 40, EPD_LIGHTGREY);
   display.fillCircle(160, 200, 40, EPD_DARKGREY);
   display.fillCircle(260, 200, 40, EPD_BLACK);
   display.drawCircle(360, 200, 40, EPD_BLACK);
   display.update();
   // Wait some seconds with some delay()

   display.setMonoMode(true); // Now it's in MONO mode
   // Draw something in the _buffer
   display.update();
}

For the record this is the first iteration of the monochrome mode Class

Gdew042t2 400x300

Clone this wiki locally