RoundyFi icon indicating copy to clipboard operation
RoundyFi copied to clipboard

Digital clock in the middle of the round clock doesn't display minutes less than 10 correctly

Open dplassgit opened this issue 2 years ago • 1 comments

E.g., "15:09" is shown as "15:9"

dplassgit avatar May 28 '22 19:05 dplassgit

Add this and it will fix it:

String currentDate =  String(monthDay)+ "-" + String(currentMonth) + "-" + String(currentYear);
String dateString = String(months[currentMonth - 1])+ " " + String(monthDay) + ", " + String(currentYear);
String minStr = "";
if(mm < 10) {
   minStr = "0" + String(mm);
} else {
  minStr = String(mm);
}
String currenttime =  String(hh)+ ":" + minStr;

I also changed the display to be:

gfx->setCursor(100, 45);
gfx->setTextColor(ORANGE);
gfx->setTextSize(2);
gfx->println(currenttime);
gfx->setCursor(70, 100);
gfx->setTextColor(ORANGE);
gfx->setTextSize(2);
gfx->println(weekDay);
gfx->setCursor(45, 145);
gfx->println(dateString);

The Time is now more centered, and at the top, the Day string is just above center, and the data string is there.

HTH

davidgs avatar May 31 '23 12:05 davidgs