I'm currently drawing black boxes over old content before displaying constantly refreshing content on my display, so for instance to display temperature:
if (sensorTemp != nowTemp){
nowTemp = sensorTemp;
tft.fillRect(0,52,88,21,ILI9341_BLACK);
return nowTemp;
}
If I don't do this the display will just overlay content until it becomes a white blob.
However, this solution leaves me with a black flickering on the display and I can't control exactly what is refreshed where. So for instance when I want to display the current time or date it has to refresh the date all the time, even though nothing changed.
void loop() {
tft.setTextSize(2);
tft.setCursor(0,0);
tft.print(rtc.getDateStr());
tft.fillRect(144,0,199,15,ILI9341_BLACK); //Black box drawn over 'old' time data
tft.setCursor(144,0);
tft.print(rtc.getTimeStr()); //Draw new time
tft.setCursor(0,52);
tft.print(tempCall()); //call function to check on temperature and draw new data if necessary
}
Is there a more elegant solution to this problem?