You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My doubt is I need to controll it in my main code?
I'm a newbie, sorry.
Library code....
bool Thread::shouldRun(unsigned long time){
// If the "sign" bit is set the signed difference would be negative
bool time_remaining = (time - _cached_next_run) & 0x80000000;
// Exceeded the time limit, AND is enabled? Then should run...
return !time_remaining && enabled;
Activity
gregkrsak commentedon Feb 1, 2020
I found this, after a quick Google search:
https://www.norwegiancreations.com/2018/10/arduino-tutorial-avoiding-the-overflow-issue-when-using-millis-and-micros/
julioj4pa commentedon Feb 1, 2020
@gregkrsak thank you for reply.
My doubt is I need to controll it in my main code?
I'm a newbie, sorry.
Library code....
bool Thread::shouldRun(unsigned long time){
// If the "sign" bit is set the signed difference would be negative
bool time_remaining = (time - _cached_next_run) & 0x80000000;
}
julioj4pa commentedon Feb 1, 2020
I think it doesn't have any problem because.
_cached_next_run is unsigned long too.
So when
void Thread::runned(unsigned long time){
// Saves last_run
last_run = time;
}
_cached_next_run restarts too.