I was reading millis() as a signed long value, but really it is an unsigned value.
After 2^31 milliseconds (=24days 10.5 hours or so) it rolls over to -2^31, a large negative number.
There is a function which knows the end time of the "temporary display" mode (date, LDR reading etc) which is usually set for 5 seconds in the future when you press the button. This is initialised to 0 and then moves forward each time you use temporary display mode. When time moves on, the check "millis < tempdisplayend" becomes false and the display reverts to normal time mode.
When we roll over, millis suddenly becomes much smaller than tempdisplayend, so the display gets stuck in temp mode.
all refrerences to time variables are now unsigned long
When we finish temp display mode, we set the tempdisplayend time to 0
I also made some little changes to the backlight cycling code to make the cycles give stronger primary shades.
Last edit: 3 years 3 months ago by Ian. Reason: clarity