Help with GxEPD library

Hello, I'm a university student from China, I like embedded development, I want to do a project with an ink screen recently, so I use your GxEPD library, but I don't know what functions are available in this library, and I don't know what functions are used for what, because in China, there is too little information about the GxEPD library, so I would like to ask where can you find the information about the built-in functions in the GxEPD library?

Hi @qinzhongle , welcome to the forum!

Please note that there are two libraries, GxEPD and GxEPD2.

GxEPD2 is the library I recommend for new users and new projects. It is the actual supported library.
GxEPD will be maintained, but not updated with support for new displays.

README.md of GxEPD2 should give you enough information to start.

But I should add a pointer to the example to start with: examples/GxEPD2_Example.

Please also note:

Note on documentation

  • GxEPD2 uses Adafruit_GFX for Graphics and Text support, which is well documented there
  • GxEPD2 uses meaningful method names, and has some comments in the header files
  • consult the header files GxEPD2_BW.h, GxEPD2_3C.h and GxEPD2_GFX.h
  • for the concept of paged drawing and picture loop see:
  • tpictureloop · olikraus/u8glib Wiki · GitHub

-jz-

1 Like

Thank you very much for your reply!I would also like to ask how to set the ink screen to be refreshed globally or locally

I feel more comfortable to answer questions if I know which display you use or want to use, with link please, and what processor or processor board.

If I understand your question correctly, then you could take a look at GxEPD2_BW.h line 363 and 377:

    void setFullWindow()
    // setPartialWindow, use parameters according to actual rotation.
    // x and w should be multiple of 8, for rotation 0 or 2,
    // y and h should be multiple of 8, for rotation 1 or 3,
    // else window is increased as needed,
    // this is an addressing limitation of the e-paper controllers
    void setPartialWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h)

Some few controllers don't support partial window addressing, especially the 7-color display controllers.

I used a Weixue 2.66-inch black and white ink screen

How do I set it to a local refresh?

"局部刷新"? The term for this is "Partial Refresh".

哈哈yeah

(I'm not sure how, sorry. Just wanted to try clarify)

There are two 2.66" b/w displays supported in GxEPD2:

//#define GxEPD2_DRIVER_CLASS GxEPD2_266_BN // DEPG0266BN   152x296, SSD1680, (FPC7510), TTGO T5 V2.66, TTGO T5 V2.4.1
//#define GxEPD2_DRIVER_CLASS GxEPD2_266_GDEY0266T90 // GDEY0266T90 152x296, SSD1680, (FPC-A003 HB)

GDEY0266T90 is this one: https://www.good-display.com/product/412.html.

I have no idea if your display is one of them.

This is "Waveshare", I believe.

you call setPartialWindow before the page loop.

Search for setPartialWindow in GxEPD2_Example.ino to see how.

1 Like

That's why I asked for a link.

But I take a rest now for digestion "Mittagsschlaf", as my wife suggests.

1 Like

2.66寸Pico电子墨水屏扩展板 e-paper 296×152分辨率 SPI通信 (waveshare.net) We Chinese call it “Weixue” 哈哈哈

okay i will try! thank your reply and your GxEPD very good!!

My bad, I hadnt actually realized that partial window and fast partial mode were both accessed through the same command. I wrongly assumed that there was a distinction to make by interpreting "local refresh". Have a nice afternoon!

1 Like

I have the 2.9" version. The panel seems to be from DKE. You may have the DEPG0266BN panel.

哈哈哈

Yes, I use this. I still don’t know how to set the screen to partial refresh. Can I just add setPartialWindow(); in front of the loop function?

void helloArduino()
{
  //Serial.println("helloArduino");
  display.setRotation(1);
  display.setFont(&FreeMonoBold9pt7b);
  if (display.epd2.WIDTH < 104) display.setFont(0);
  display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  int16_t tbx, tby; uint16_t tbw, tbh;
  // align with centered HelloWorld
  display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  uint16_t x = ((display.width() - tbw) / 2) - tbx;
  // height might be different
  display.getTextBounds(HelloArduino, 0, 0, &tbx, &tby, &tbw, &tbh);
  uint16_t y = ((display.height() / 4) - tbh / 2) - tby; // y is base line!
  // make the window big enough to cover (overwrite) descenders of previous text
  uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  uint16_t wy = (display.height() / 4) - wh / 2;
  display.setPartialWindow(0, wy, display.width(), wh);
  display.firstPage();
  do
  {
    display.fillScreen(GxEPD_WHITE);
    //display.drawRect(x, y - tbh, tbw, tbh, GxEPD_BLACK);
    display.setCursor(x, y);
    display.print(HelloArduino);
  }
  while (display.nextPage());
  delay(1000);
  //Serial.println("helloArduino done");
}

void helloEpaper()
{
  //Serial.println("helloEpaper");
  display.setRotation(1);
  display.setFont(&FreeMonoBold9pt7b);
  if (display.epd2.WIDTH < 104) display.setFont(0);
  display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  int16_t tbx, tby; uint16_t tbw, tbh;
  // align with centered HelloWorld
  display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  uint16_t x = ((display.width() - tbw) / 2) - tbx;
  // height might be different
  display.getTextBounds(HelloEpaper, 0, 0, &tbx, &tby, &tbw, &tbh);
  uint16_t y = ((display.height() * 3 / 4) - tbh / 2) - tby; // y is base line!
  // make the window big enough to cover (overwrite) descenders of previous text
  uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  uint16_t wy = (display.height() * 3 / 4) - wh / 2;
  display.setPartialWindow(0, wy, display.width(), wh);
  display.firstPage();
  do
  {
    display.fillScreen(GxEPD_WHITE);
    display.setCursor(x, y);
    display.print(HelloEpaper);
  }
  while (display.nextPage());
  //Serial.println("helloEpaper done");
}
  display.setPartialWindow(0, wy, display.width(), wh);
  display.firstPage();

setPartialWindow() is in effect until setFullWindow() is called. Initial state is full window.