Sorry for the delay in answering. No idea so far what rises the problem...
Just a suggestion to try :
- Remove the lines that handle the display from loop()
- Add the following function and the modification to HandleModelClock() to your sketch
// Copy this function to your sketch; maybe just before HandleModelClock();
// so that it is close to where it is used
void PrintModelClockToDisplay()
{
display.setBrightness(1,true);
display.showNumberDecEx(modelClock.minutes, 0, true, 2, 2);
display.showNumberDecEx(modelClock.hours, 0x40, true, 2, 0);
}
void HandleModelClock() {
if (currentTime - modelClock.stamp >= modelClock.duration) {
modelClock.stamp = currentTime;
modelClock.seconds++;
modelClock.seconds %= 60;
if (!modelClock.seconds) {
modelClock.minutes++;
modelClock.minutes %= 60;
if (!modelClock.minutes){
modelClock.hours++;
modelClock.hours %= 24;
}
}
PrintModelClockToSerial();
PrintModelClockToDisplay(); // Add the new function here !
HandleCountDown();
}
}
You might also add a static or global variable to HandleModelClock() that checks when the minutes have changed and call the display function only in that case ...