AndrewMascolo / CountUpDownTimer

MIT License
28 stars 20 forks source link

(T.TimeCheck() - not seting to true after reaching 0 remaining time. #31

Open WojciechowskiMarek opened 3 years ago

WojciechowskiMarek commented 3 years ago

My code https://github.com/WojciechowskiMarek/Timer-for-Ozone-generator/blob/main/main.cpp line 174, after counting down not setted T.TimeCheck().

Your sincerely Marek Wojciechowski

AndrewMascolo commented 3 years ago

Made a change to the library, please pull the library again.

WojciechowskiMarek commented 3 years ago

Andrew, all is working fine was problem local with my code. Your code works excelent. Why I'm choose Your library ? Because You have flag T.TimeChanged it was easy to use in my code. TAke a look at line 293 and 294. When timer is running and I want to stop it I'm using T.SetTimer(0,0,0,0); T.StopTimer();. Do You have in library some elegant function for this purpose ? Now I have to set up timer for 0 and then stop to get TimeCheck flag set to true ?

AndrewMascolo commented 3 years ago

Nothing elegant no, but if you want something added, let me know.

Sent from my iPhone

Sent from my iPhone

On Feb 13, 2021, at 12:01 PM, WojciechowskiMarek notifications@github.com wrote:  Andrew, all is working fine was problem local with my code. Your code works excelent. Why I'm choose Your library ? Because You have flag T.TimeChanged it was easy to use in my code. TAke a look at line 293 and 294. When timer is running and I want to stop it I'm using T.SetTimer(0,0,0,0); T.StopTimer();. Do You have in library some elegant function for this purpose ? Now I have to set up timer for 0 and then stop to get TimeCheck flag set to true ?

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

WojciechowskiMarek commented 3 years ago

Hello.

Should be good to handle situation that is interrupted working of timer. For example in my case operator can exit from timer screen into main menu. Now I have to initialize timer with 0 time to get proper state flag T.TimeCheck. And stop timer with T.StopTimer ??? flag.

AndrewMascolo commented 3 years ago

boolean TimeCheck() { // output true if timer equals requested time or has passed it. if(_type) return remainingSeconds >= stopTimeTotalTime; // Counting UP else
return remainingSeconds <= stopTimeTotalTime; // Counting DOWN }

When Counting Down, TimeCheck only returns true when the remaining seconds is less than or equal to the set stop time. So in your case, yes you would need setTimer(0) and stopTimer() together.