Skip to content

Commit 6c5e7ff

Browse files
only convert time to string when time changes
1 parent 20a866d commit 6c5e7ff

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

wordclock_esp8266.ino

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,9 +520,15 @@ void updateStateBehavior(uint8_t state){
520520
filterFactor = DEFAULT_SMOOTHING_FACTOR;
521521
behaviorUpdatePeriod = PERIOD_TIMEVISUUPDATE;
522522
}
523-
int hours = ntp.getHours24();
524-
int minutes = ntp.getMinutes();
525-
showStringOnClock(timeToString(hours, minutes), maincolor_clock);
523+
uint8_t hours = ntp.getHours24();
524+
uint8_t minutes = ntp.getMinutes();
525+
static uint8_t lastMinutes = 0;
526+
static String timeAsString = "";
527+
if(lastMinutes != minutes){
528+
timeAsString = timeToString(hours, minutes);
529+
lastMinutes = minutes;
530+
}
531+
showStringOnClock(timeAsString, maincolor_clock);
526532
drawMinuteIndicator(minutes, maincolor_clock);
527533
}
528534
break;

0 commit comments

Comments
 (0)