faster graphics with ILI9341 compatible

Hello,

Graphics seem super slow on my 320x240 ILI9341 display. Even when repainting the minimum area of the screen, I get like 1Hz refresh rate at the most. My project is only using lines.

so what I did so far:

  1. I use 1:4 interlacing. able to see meaningful information but still slow

2 I tried to optimize everything to use nothing more than drawFastHLine which I assumed was fastest. Not getting results I went inside Adafruit_Gfx.cpp library to see what's going on. It looks like it is calling writeLine and I noticed that it is changing pixels one by one:

void Adafruit_GFX::writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
                             uint16_t color) {
#if defined(ESP8266)
  yield();
#endif
  int16_t steep = abs(y1 - y0) > abs(x1 - x0);
  if (steep) {
    _swap_int16_t(x0, y0);
    _swap_int16_t(x1, y1);
  }

  if (x0 > x1) {
    _swap_int16_t(x0, x1);
    _swap_int16_t(y0, y1);
  }

  int16_t dx, dy;
  dx = x1 - x0;
  dy = abs(y1 - y0);

  int16_t err = dx / 2;
  int16_t ystep;

  if (y0 < y1) {
    ystep = 1;
  } else {
    ystep = -1;
  }

  for (; x0 <= x1; x0++) {
    if (steep) {
      writePixel(y0, x0, color);
    } else {
      writePixel(x0, y0, color);
    }
    err -= dy;
    if (err < 0) {
      y0 += ystep;
      err += dx;
    }
  }
}

Is there any way to use memSet() or memCpy() or equivalent functions so I can fill all those consecutive bytes with same color faster?

  1. is there any way do draw to a temporary buffer and then dump it to the video memory? I used to do that back in the day when programming for 80386 but I'm new to Arduino enviroment.

Thanks!

Use a teensy processor and their ILI9341_t3 version of the library.

-jim lee

It looks like it is calling writeLine and I noticed that it is changing pixels one by one:

Yep, a stupid and just plain lazy decision. But it does work.

You might check out the PDQ_GFX library, which is supposed to be about 10x faster than the Adafruit dinosaur.

I have not yet had the chance, so let us know.

Which arduino board and which specific display are you using?

david_2018:
Which arduino board and which specific display are you using?

Arduino UNO R3 and the HiLetgo 2.8 shield

jremington:
Yep, a stupid and just plain lazy decision. But it does work.

You might check out the PDQ_GFX library, which is supposed to be about 10x faster than the Adafruit dinosaur.

I have not yet had the chance, so let us know.

apparently this one is configured to be used with a breakout board only, not shield.
because in the config.h i see only:

// NOTE: These are typical hookups individual boards will vary, please check your documentation.
// CAUTION: While Adafruit boards generally always come with needed level-converters, I find many
//          other LCD displays advertised as supporting 5V only support 5V power (with a regulator).
//          They still only have 3.3V safe logic (CS, DC, RESET, MOSI, SCK marked with * below).
//          If this is the case you will need a voltage level-converter (e.g., HC4050, divider circuit etc.).
//
// LCD PIN	Uno (328)	Leo (32u4)  644/1284
// -------	---------	---------- --------
// 1  VCC	  3.3V/5V	 3.3V/5V	3.3V/5V	// +3.3V or 5V with on-board regulator
// 2  GND	    GND		   GND		  GND
// 3* CS	    10		   10		   4	// Could be any GPIO pin, but then need to make sure SS isn't a LOW input (or slave SPI mode)
// 4* RESET	  0/8/RESET	 0/8/RESET	0/RESET	// This relies on soft-reset. You can also use Arduino reset pin (if correct voltage).
// 5* DC/RS		9  		   9		   3	// Could be any GPIO pin
// 6* SDI/MOSI	11		  ICSP4		   5	// HW SPI pin (can't change)
// 7* SCK	    13		  ICSP3		   7	// HW SPI pin (can't change) NOTE: On Uno this causes on-board LED to flicker during SPI use
// 8* LED	 3.3V/5V	 3.3V/5V	3.3V/5V	// LCD screen blanked when LOW (could use GPIO for PWM dimming)
// 9  SDO/MISO      -		    -	   -	// (not used if present, LCD code is currently "write only")
//
//  * = Typically only 3.3V safe logic-line (unless board has level converter [ala Adafruit]). Be careful with 5V!

Why is that a problem?

The Adafruit display libraries are generally designed for flexibility not speed. For example, they make it easy to change the screen rotation orientation. It's difficult to do that without sticking to graphics primitives like a set pixel, when drawing a line for example.

jremington:
Why is that a problem?

i purchased shield display.
and i made a cute box for it
not expecting that i need to change format

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