Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Probably millis() integer overflow problem #7

Open
DanielAndrascik opened this issue Jun 2, 2022 · 4 comments
Open

Probably millis() integer overflow problem #7

DanielAndrascik opened this issue Jun 2, 2022 · 4 comments

Comments

@DanielAndrascik
Copy link

Hi. After 49 days, all tasks will stop working. I only use a few "every" tasks but after 49 days all are dead. My UDP server in a separate thread is still running, that means ESP32 is alive. I guess it is millis() integer overflow problem.

@HamzaHajeir
Copy link

I don't think so, even that overflows, the difference is back to zero since it's unsigned.

@HamzaHajeir
Copy link

Hi @DanielAndrascik, you're correct, and I've just proposed a solution, you can take a look here:
HamzaHajeir@093b019

@HamzaHajeir
Copy link

To validate the issue, here's a MCVE:

#include <H4.h>
H4 h4(115200);

void testTimer(){
    Serial.printf("T=%lu testTimer()\n", millis());
    h4.once(UINT32_MAX, testTimer);
}
void h4setup(){
    delay(1); // ensure at least one millisecond pass
    testTimer();
}

@HamzaHajeir
Copy link

Solved in my fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants