GxEPD2 esp32 partial refresh

Hi everyone, I have a problem, with an esp32 wroom in which the code works perfectly with an oled, when I switch to a 2.9" epaper screen and I refresh the parts where I have the data fields that change continuously, I find myself with the data is very slow, if I leave only one string (any) everything resumes normal speed.
Can everything be compacted for speed?
Thank you.

T.

 display.setPartialWindow(100, 4, 110, 28); //(X, Y, width, eight)
    display.firstPage();
    do {
      display.fillScreen(GxEPD_WHITE);
      u8g2Fonts.setCursor( 100, 32);  
      if (vario > 0)
        u8g2Fonts.print(F("+"));
           u8g2Fonts.print(vario, 1);  //vario
    } while (display.nextPage());

    display.setPartialWindow(100, 75, 110, 28);  //(X, Y, width, eight)
    display.firstPage();
    do {
      display.fillScreen(GxEPD_WHITE);
      u8g2Fonts.setCursor(100, 101); 
      u8g2Fonts.print(gps.altitude.meters(), 0);  //altitude
    } while (display.nextPage());

    display.setPartialWindow(4, 4, 82, 28);  //(X, Y, width, eight)
    display.firstPage();
    do {
      display.fillScreen(GxEPD_WHITE);
      u8g2Fonts.setFont(u8g2_font_luBIS19_tr);
      u8g2Fonts.setCursor(4, 32); 
      u8g2Fonts.print(gps.speed.kmph(), 0);  //speed
    } while (display.nextPage());

    display.setPartialWindow(4, 55, 78, 25);  //(X, Y, width, eight)
    display.firstPage();
    do {
      display.fillScreen(GxEPD_WHITE);
      u8g2Fonts.setFont(u8g2_font_luBIS19_tr);
      u8g2Fonts.setCursor(4, 78);  
      u8g2Fonts.print(gps.course.deg(), 0);  
    } while (display.nextPage());
    u8g2Fonts.setFont(u8g2_font_luIS08_tf);

    display.setPartialWindow(108, 50, 90, 10);  //(X, Y, width, eight)
    display.firstPage();
    do {
      display.fillScreen(GxEPD_WHITE);
      u8g2Fonts.setCursor(108, 60);
      u8g2Fonts.print("TIME  ");
      u8g2Fonts.print(gps.time.hour());
      u8g2Fonts.print(" : ");
      u8g2Fonts.print(gps.time.minute());
    } while (display.nextPage());

    display.setPartialWindow(2, 95, 90, 8);  //(X, Y, width, eight)
    display.firstPage();
    do {
      display.fillScreen(GxEPD_WHITE);
      u8g2Fonts.setCursor(4, 101); 
      u8g2Fonts.print(volts, 1);  //volts
       u8g2Fonts.print("   #  3.1 = low");
    } while (display.nextPage());
    u8g2Fonts.setFont(u8g2_font_luBIS24_tr);

}

Hi everyone, I tried to redo the code, but I just can't make the output on the serial line faster, can you please help me.


#include <Adafruit_GFX.h>
#include <U8g2_for_Adafruit_GFX.h>
#include <GxEPD2_BW.h>
#define SCREEN_WIDTH 122
#define SCREEN_HEIGHT 250
GxEPD2_BW<GxEPD2_213_BN, GxEPD2_213_BN::HEIGHT> display(GxEPD2_213_BN(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // DEPG0213BN 122x250, SSD1680, TTGO T5 V2.4.1, V2.3.1

U8G2_FOR_ADAFRUIT_GFX u8g2Fonts;

// BATTERY LEVEL  //
const int potPin = 34;
int potValue = 0;
float volts;

void setup()
{
  Serial.begin(9600);
  delay(100);

  display.init();
  display.setTextColor(GxEPD_BLACK);
  display.firstPage();
  display.setRotation(1);
  u8g2Fonts.begin(display); // connect u8g2 procedures to Adafruit GFX
  delay(500);
  uint16_t bg = GxEPD_WHITE;
  uint16_t fg = GxEPD_BLACK;
  u8g2Fonts.setForegroundColor(fg);         // apply Adafruit GFX color
  u8g2Fonts.setBackgroundColor(bg);
  do {
    display.fillScreen(GxEPD_WHITE);
    u8g2Fonts.setFont(u8g2_font_luBIS18_tr);   //font is set
    display.drawLine ( 212, 0, 212, 104, GxEPD_BLACK); //(x0, y0, x1, y1, color); //vert
    display.drawLine ( 0, 104, 212, 104, GxEPD_BLACK); //(x0, y0, x1, y1, color); //orizz
    display.drawLine ( 95, 0, 95, 104, GxEPD_BLACK); //(x0, y0, x1, y1, color);  //vert
    display.drawLine ( 0, 86, 95, 86, GxEPD_BLACK); //(x0, y0, x1, y1, color);  //orizz
    display.drawLine ( 0, 46, 212, 46, GxEPD_BLACK); //(x0, y0, x1, y1, color);  //orizz speed
    display.drawLine ( 95, 64, 212, 64, GxEPD_BLACK); //(x0, y0, x1, y1, color);  //orizz  bassa
    display.drawLine ( 88, 0, 88, 46, GxEPD_BLACK); //(x0, y0, x1, y1, color);  //orizz
    display.drawLine ( 0, 86, 95, 86, GxEPD_BLACK); //(x0, y0, x1, y1, color);  //orizz

  } while (display.nextPage());
}


void displayPartialInfo(int x, int y, int width, int height, int cursorX, int cursorY, String text) {

  display.setPartialWindow(x, y, width, height);
  display.firstPage();
  do {
    display.fillScreen(GxEPD_WHITE);
    u8g2Fonts.setCursor(cursorX, cursorY);
    u8g2Fonts.print(text);
  } while (display.nextPage());



}


void loop()
{
  {
    // Reading potentiometer value
    potValue = analogRead(potPin);
    volts = potValue * 3.3 / 4096;
  }

  displayPartialInfo(100, 4, 110, 28, 100, 32, (volts, 1 > 0) ? String(F("+")) + String(volts, 1) : String(volts, 1));
  displayPartialInfo(100, 75, 110, 28, 100, 101, String(volts, 0));
  displayPartialInfo(4, 4, 82, 28, 4, 32, String(volts, 0));
  displayPartialInfo(4, 55, 78, 25, 4, 78, String(volts, 0));
  u8g2Fonts.setFont(u8g2_font_luIS08_tf);
  displayPartialInfo(108, 50, 90, 10, 108, 60, String(F("TIME  ")) + String(volts) + String(F(" : ")) + String(volts));
  displayPartialInfo(2, 95, 90, 8, 4, 101, String(volts, 1) + String(F("   #  3.1 = low")));
  u8g2Fonts.setFont(u8g2_font_luBIS24_tr);

  Serial.println(volts, 1);

}

Hi everyone, I'm still looking for a solution to the slowness in the data flow caused by the various data present and subject to partial updates, I also changed the card and tried with a lyligo t5 but the situation doesn't change.
Let's say that with just one piece of data on the screen everything works at a normal speed, but the more fields I add the more everything slows down, now I have a data refresh every 5 seconds, a very long time.

Could someone please give me some advice (e.g. ZinggJ)
Thank you

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.