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:
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:
Is there any way to use memSet() or memCpy() or equivalent functions so I can fill all those consecutive bytes with same color faster?
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.
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!
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.