You need to look at using sprites to avoid the flickering / flashing when you blank the screen. Take a look at the example sprite projects to see how it's done. The M5.Lcd functions can be called on a sprite object, so bitmap drawing, text drawing etc can be done the same way. Clearing, and drawing the sprite happens off screen, and then is copied quickly to the screen with pushSprite() which avoids visible flashing. The examples provided show you how to do it all, but here's the basic process :
-
create your sprite object
TFT_eSprite tftSprite = TFT_eSprite(&M5.Lcd); -
create a sprite and give it the size
tftSprite.createSprite(160, 80); -
clear the sprite
tftSprite.fillSprite(WHITE); -
draw into the sprite
tftSprite.drawBitmap(x, y, w, h,(uint16_t *)img, 0xffff); -
copy the sprite to the screen, and let it know where to draw it
tftSprite.pushSprite(0, 0);