Best refresh strategy with external display controller

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by giusloq on Sun May 03 10:55:25 MST 2015
I already post this on emWin forum, but I didn't receive any help after some days. I hope someone can help me here.

I'm using a TFT display with integrated ILI9341 controller. The connection between MCU and TFT is 16-bits parallel.

I'm confused about the best strategy to refresh the display when some parts change.

Suppose I have a black background with one image at the center. Every 1 second, a variable is checked and, depending on its value, the image at the center could change accordingly. The variable is updated in another task.

I can use the background window and call GUI_DrawBitmap() in WM_PAINT message. Every 1 second, I call WM_Invalidate() to force the refresh (maybe in a WM_TIMER message).
This works, but I suspect the GUI library is forced to redraw (i.e., re-write) every pixel of the display, not only the pixels of the image that could change. This approach wastes a lot of time and precious resources.

So what is a better approach? I'm thinking to create an IMAGE widget in WM_CREATE and change the image with IMAGE_SetBitmap() directly in WM_TIMER (raised every second) and not in WM_PAINT.

Unfortunately, I can't use a data cache to store the actual pixel values, because I don't have memory space.