if(bTimeReceived)
{
//NTP time has been received,ajusted and written to ESP32 RTC,so Obtain the time form the ESP32 RTC.
struct timeval tvTimeValue;
gettimeofday(& tvTimeValue,NULL);
//Obtain a pointer to local time.
struct tm * tmPointer = localtime(& tvTimeValue.tv_sec);
tft.fillRect(0,100,240,20,ST77XX_BLACK);
tft.setFont(&FreeSans12pt7b);
strftime(chBuffer, sizeof(chBuffer), "%Y.%B.%d", tmPointer);
tft.setCursor(0,20);
tft.println(chBuffer);
strftime(chBuffer, sizeof(chBuffer), "%A", tmPointer);
tft.setCursor(0,70);
tft.println(chBuffer);
strftime(chBuffer, sizeof(chBuffer), "%H:%M:%S", tmPointer);
tft.setCursor(0,120);
tft.print(chBuffer);
}
这样写字符不重叠,但是字符会闪烁 |