Clock hangs after 25 days

More
11 months 9 minutes ago #7511 by Ian
I finally found the problem that caused the clock display to get stuck after 25 days or so.

It was caused by the internal millis() counter overflowing.

V46 of the software solves it!

Please Log in or Create an account to join the conversation.

More
10 months 4 weeks ago #7512 by Stackerlee
Splendid!
So around 25 days it was?
Seems to fit my observations.
I see you've done numerous changes in the code.
Will take a look in a while.

Please Log in or Create an account to join the conversation.

More
10 months 4 weeks ago - 10 months 4 weeks ago #7519 by Ian
A quick explanation of the failure mode.

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.

Changes:

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: 10 months 4 weeks ago by Ian. Reason: clarity

Please Log in or Create an account to join the conversation.

More
8 months 1 day ago - 8 months 1 day ago #7740 by Ian
A quick update. We're better, but not good.

Now it hangs after 50 days. Back to the drawing board...
Last Edit: 8 months 1 day ago by Ian.

Please Log in or Create an account to join the conversation.

More
4 months 3 weeks ago #7931 by konradp
Hi Ian,
Is this still a issue?, does it mean that all clocks will hang after 50 days, is there a fix in sight?

Please Log in or Create an account to join the conversation.

More
4 months 2 weeks ago #7945 by Ian
It should be solved in V48+

We used to set an "end time" of the date display by using millis() + displaytime * 1000, but now we just put the number of seconds to display for in a variable and count it down until it reaches 0.

Please Log in or Create an account to join the conversation.

More
1 week 1 day ago #8182 by Stackerlee
Hello
I have one clock (V49) which has frozen after around 50 days. Can't say the exact number of days but it's close to 50. It's done it twice now (in about 100 days), so there seems to be a pattern.
After a restart it's ok again.

Please Log in or Create an account to join the conversation.

Moderators: AccutronTy_EeberfestIan
Time to create page: 0.033 seconds

Search

Tube Suppliers

Go to top
JSN Boot template designed by JoomlaShine.com