To reset or not to reset? millis rollover is the question

Yes, just perform a software reset (google resetfunc Arduino)

Why?

See post #7.

Bacause depending on what you are doing with millis(), and what board you have, you can make your arduino do weird things after it fills up the memory with millis(). A software reset resets millis(). I do this on principle every time I use millis() at my Uncles suggestion (he is extremely experienced with Arduino, to a level I have rarely seen even here on the forum)

That's absolute nonsense.

Argue with the professionals, not me:
image
And there is the watchdog:


1 Like

Happily... he is wrong. If you use the method shown above then even when millis() rolls over the comparison with the previous snapshot taken still produces the correct result. Go have a look at how unsigned subtraction arithmetic works.

1 Like

All that proves is the internet allows anyone to say any ridiculous thing they want, despite having no idea what they're talking about.

1 Like

My uncle knows what he is talking about. And he agrees with them. However, I don't wish to argue about it.

Why does this sound so familiar?

a7

1 Like

Not sure. Have I said that before?

Post 12

That's the post @alto777 was referencing...

Be concise, what do you perceive is the problem with millis( ) ?

My understanding is that the Arduino can not count an infinite amount of millis() due to storage limitations (a big number takes lots of bytes to remember!). If millis() overflow is not an issue, go ahead! But some needs accurate millis() for timing purposes - and an overflow can be detrimental in that case. But that is easily remedied by performing a reset in the software.

My understanding is that the Arduino can not count an infinite amount of millis() due to storage limitations (a big number takes lots of bytes to remember!). If millis() overflow is not an issue, go ahead! But some code needs accurate millis() for timing purposes - and an overflow can be detrimental in that case. But that is easily remedied by performing a reset in the software.

Yes, the internet is full of people who don't know what they're talking about.

You should do some research on this subject.

https://www.norwegiancreations.com/2018/10/arduino-tutorial-avoiding-the-overflow-issue-when-using-millis-and-micros/

This proves that there is an issue. Maybe not what I thought it was, and there are ways around it, but it can be an issue.

I'm well aware of that because I know what I'm talking about. So, it's not an issue.

So what was the problem then? Why were you arguing about it if we both agree there can be an issue with it?