CountUpDownTimer icon indicating copy to clipboard operation
CountUpDownTimer copied to clipboard

Countdown stops and how to repeat after a long period

Open evermore99 opened this issue 5 years ago • 8 comments

Dear Andrew, thanks for the great library!

Could you add days into the program or what is the limit to the amount of hours? And how do I make the code repeat after 36:00:00 ?

I’ll like to integrate this in the library. Is such a thing possible?

many thanks for taking your time reading this.

best regards

Bastiaan

evermore99 avatar Feb 03 '21 14:02 evermore99

I haven’t touched this library in years but I’ll see what I can do.

  • Andrew

Sent from my iPhone

On Feb 3, 2021, at 9:50 AM, evermore99 [email protected] wrote:

 Dear Andrew, thanks for the great library!

Could you add days into the program or what is the limit to the amount of hours? And how do I make the code repeat after 36:00:00 ?

I’ll like to integrate this in the library. Is such a thing possible?

many thanks for taking your time reading this.

best regards

Bastiaan

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

AndrewMascolo avatar Feb 03 '21 15:02 AndrewMascolo

Hi Andrew

I found about the repeat part and I just added it into my else statement of the timeischanged. I am using my reset button on my teensy as a reset.

I’ll try to make a reset button with the reset function with a longpress hold. To see if it makes a difference.

Best regards

Bastiaan

Op wo 3 feb. 2021 om 16:54 schreef AndrewMascolo [email protected]

I haven’t touched this library in years but I’ll see what I can do.

  • Andrew

Sent from my iPhone

On Feb 3, 2021, at 9:50 AM, evermore99 [email protected] wrote:

 Dear Andrew, thanks for the great library!

Could you add days into the program or what is the limit to the amount of hours? And how do I make the code repeat after 36:00:00 ?

I’ll like to integrate this in the library. Is such a thing possible?

many thanks for taking your time reading this.

best regards

Bastiaan

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AndrewMascolo/CountUpDownTimer/issues/30#issuecomment-772613631, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARH2AEHKILTMEONTNB5U7H3S5FWU3ANCNFSM4XA7QUNQ .

evermore99 avatar Feb 04 '21 04:02 evermore99

Hi, it’s definitely possible to add days to this library but that would require a rewrite of the logic. Right now you can only set the timer for about 18 hours as that is the largest value that can be stored in a 32bit unsigned integer. The hours minutes and seconds are all converted into seconds and then decremented. If I were to add days, this would need to be changed, which can also impact precision. Although if you need precision then I would advise getting a Real Time Clock module instead. This way you keep precision and keep the rest of your code running smoothly.

I will play around with the library over the weekend and add in days.

AndrewMascolo avatar Feb 04 '21 04:02 AndrewMascolo

Hi Andrew,

Thanks for pointing that out with the 32bit uint.

I have tested the library on 36:00:00 and it does the countdown perfectly. I don’t know however what will happen if the countdown is reaching 36:00:00 hours or before.

can you run down the countdown library faster to see if there is a unint overflow?

Best regards

Bastiaan

Op do 4 feb. 2021 om 05:49 schreef AndrewMascolo [email protected]

Hi, it’s definitely possible to add days to this library but that would require a rewrite of the logic. Right now you can only set the timer for about 18 hours as that is the largest value that can be stored in a 32bit unsigned integer. The hours minutes and seconds are all converted into seconds and then decremented. If I were to add days, this would need to be changed, which can also impact precision. Although if you need precision then I would advise getting a Real Time Clock module instead. This way you keep precision and keep the rest of your code running smoothly.

I will play around with the library over the weekend and add in days.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AndrewMascolo/CountUpDownTimer/issues/30#issuecomment-773025897, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARH2AEBNQ6OL4WCBBXXL22DS5IRNRANCNFSM4XA7QUNQ .

evermore99 avatar Feb 04 '21 05:02 evermore99

Added Days

AndrewMascolo avatar Feb 07 '21 02:02 AndrewMascolo

Cool many thanks!

I’ll test it:)

thanks for the update:), was it hard? uint overflow problem?

Best regards

Bastiaan

Op zo 7 feb. 2021 om 03:28 schreef AndrewMascolo [email protected]

Added Days

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AndrewMascolo/CountUpDownTimer/issues/30#issuecomment-774578621, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARH2AEFAUHF4J22SCJIWNLTS5X3GJANCNFSM4XA7QUNQ .

evermore99 avatar Feb 07 '21 07:02 evermore99

Ok i get an error saying that:

Unsigned int _S = (seconds/60), _M =minutes/60; expected unqualified is before numeric constant

And once _M was not declared in this scope

I think unsigned int is missing, at the _M, i think I have some conflicts with other libraries because they use the same syntax/macros for _S

Best regards

Thanks for the help!

Bastiaan

Op zo 7 feb. 2021 om 08:53 schreef BP [email protected]

Cool many thanks!

I’ll test it:)

thanks for the update:), was it hard? uint overflow problem?

Best regards

Bastiaan

Op zo 7 feb. 2021 om 03:28 schreef AndrewMascolo <[email protected]

Added Days

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AndrewMascolo/CountUpDownTimer/issues/30#issuecomment-774578621, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARH2AEFAUHF4J22SCJIWNLTS5X3GJANCNFSM4XA7QUNQ .

evermore99 avatar Feb 08 '21 21:02 evermore99

You are more than welcome to change the library to suite your needs.

  • Andrew

Sent from my iPhone

On Feb 8, 2021, at 4:07 PM, evermore99 [email protected] wrote:

 Ok i get an error saying that:

Unsigned int _S = (seconds/60), _M =minutes/60; expected unqualified is before numeric constant

And once _M was not declared in this scope

I think unsigned int is missing, at the _M, i think I have some conflicts with other libraries because they use the same syntax/macros for _S

Best regards

Thanks for the help!

Bastiaan

Op zo 7 feb. 2021 om 08:53 schreef BP [email protected]

Cool many thanks!

I’ll test it:)

thanks for the update:), was it hard? uint overflow problem?

Best regards

Bastiaan

Op zo 7 feb. 2021 om 03:28 schreef AndrewMascolo <[email protected]

Added Days

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AndrewMascolo/CountUpDownTimer/issues/30#issuecomment-774578621, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARH2AEFAUHF4J22SCJIWNLTS5X3GJANCNFSM4XA7QUNQ .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

AndrewMascolo avatar Feb 08 '21 21:02 AndrewMascolo