The redraw time causes the numbers to look like they are flashing which is very annoying. The mistake I made was blanking out the entire screen with tft.fillScreen(ILI9340_BLACK). It takes quite a while to redraw the entire screen with black.
Next I tried drawing a black rectangle just on the area of the screen where I was drawing numbers. Here is the result:
Huge improvement. Only blanking out that small area greatly sped up the redraw time.
In this next video I have highlighted the redraw area in red to make it easier to see what I am talking about:
What I am realizing at this point is you should only redraw information that has changed. If you watch the last video again, once the number goes past single digits the left digit looks like it is flashing. This is because it is being blanked out and redrawn every time the number changes. When you redraw something that hasn't changed it looks like flashing. Well that's it for now. I am going to continue to work on this more and figure out how to selectively redraw only digits that change. Once I figure that out I'll write up another blog post.
[UPDATE] - Here is part two:
http://matthewcmcmillan.blogspot.com/2014/08/arduino-tft-lcd-display-refresh-rate-part2.html
Here is the code I was using to do my testing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "SPI.h" | |
#include "Adafruit_GFX.h" | |
#include "Adafruit_ILI9340.h" | |
#if defined(__SAM3X8E__) | |
#undef __FlashStringHelper::F(string_literal) | |
#define F(string_literal) string_literal | |
#endif | |
// These are the pins used for the Mega | |
// for Due/Uno/Leonardo use the hardware SPI pins (which are different) | |
#define _sclk 52 | |
#define _miso 50 | |
#define _mosi 51 | |
#define _cs 53 | |
#define _rst 9 | |
#define _dc 8 | |
Adafruit_ILI9340 tft = Adafruit_ILI9340(_cs, _dc, _rst); | |
void setup() { | |
tft.begin(); | |
tft.setRotation(1); | |
tft.fillScreen(ILI9340_BLACK); | |
tft.fillRect(120, 70, 115, 70, ILI9340_RED); | |
tft.setTextColor(ILI9340_WHITE); | |
} | |
void loop(void) { | |
tft.setCursor(120, 70); | |
tft.setTextSize(10); | |
tft.print(millis()/1000); | |
delay(999); | |
tft.fillRect(120, 70, 115, 70, ILI9340_RED); | |
//tft.fillScreen(ILI9340_BLACK); //This is very slow | |
} |
[Updated 2014-08-08 - Added link to part 2 of this topic]