epaper slow data after partial refresh

ttnnttnn
Posts: 6
Joined: Thu Nov 23, 2023 12:00 pm

epaper slow data after partial refresh

Postby ttnnttnn » Sat Dec 02, 2023 11:22 am

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.

Code: Select all

    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);

}
Last edited by ttnnttnn on Tue Dec 12, 2023 4:30 pm, edited 1 time in total.

ttnnttnn
Posts: 6
Joined: Thu Nov 23, 2023 12:00 pm

Re: epaper slow data afrea partial refresh

Postby ttnnttnn » Tue Dec 12, 2023 4:30 pm

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.

Code: Select all

#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);

}

ESP_Sprite
Posts: 9577
Joined: Thu Nov 26, 2015 4:08 am

Re: epaper slow data after partial refresh

Postby ESP_Sprite » Wed Dec 13, 2023 2:21 am

Are you sure you're not just running against the limits of the epaper? They're not the fastest displays even at the best of times.

ttnnttnn
Posts: 6
Joined: Thu Nov 23, 2023 12:00 pm

Re: epaper slow data after partial refresh

Postby ttnnttnn » Wed Dec 13, 2023 5:34 am

The problem is not the refresh rate of the display, but that all the other data that I have to process for the project is slow, and the more lines I turn off from the display the faster they are, which does not happen if I use an OLED display.

Who is online

Users browsing this forum: No registered users and 338 guests