ArduinoTroubleshooting

DFRobot_GDL refresh text without clearing screen

userHead Nick.Brett 2023-02-11 01:33:15 731 Views2 Replies

I have a Fermion: 1.8" 128x160 IPS TFT LCD Display that I am using for a temperature monitor.  I'm using the DFRobot_GDL library to interface with the screen from an Arduino Pro Micro.  Every few seconds a new sample is taken and I update the text on the screen.  How can I update the text without doing a fillScreen first?  The problem is this causes a noticeable flicker when fillScreen runs.  If I don't clear the screen the numbers just write over each other and it becomes unreadable.  

Here is the code I'm using:
 

screen.fillScreen(BackgroundColor);
screen.setCursor(0, 0);


screen.setTextColor(LabelColor);
screen.print("TC   ");


if (calculatedTransferCaseTemp <= transferCaseTempCool) {
  screen.setTextColor(TransferCaseFluidColdColor);
}
else if (calculatedTransferCaseTemp > transferCaseTempCool && calculatedTransferCaseTemp < transferCaseTempHot) {
  screen.setTextColor(TransferCaseFluidWarmColor);

}
else {
  screen.setTextColor(TransferCaseFluidHotColor);
}


screen.print(calculatedTransferCaseTemp);

screen.println("F");

2023-03-18 01:59:52

It turns out the setTextColor takes an optional second parameter which is the background color.  This allows in place update of text.  The downside is using a font other than the default breaks this.

userHeadPic Nick.Brett
2023-02-20 10:07:14

Hi

According to the library, you have to do a refresh (fillScreen) to clean the existing content on your screen. That is the underlying limitation of this screen, sorry for that.

However, if you wish just to update some parts of the screen, you can fill that parts of the screen with a black rectangle and update the content.

Hope it can help.

userHeadPic NeloKin