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

Issue with millis() overflowing #127

Open
audiostrom opened this issue Sep 25, 2024 · 1 comment
Open

Issue with millis() overflowing #127

audiostrom opened this issue Sep 25, 2024 · 1 comment

Comments

@audiostrom
Copy link

audiostrom commented Sep 25, 2024

I think I have spotted an issue in ArtnetSender.h
What happens if millis(); overflow and now is 0 and this->last_send_times.find(dest) = 4,294,967,000 ?

void streamArtDmxTo(const String& ip, uint8_t net, uint8_t subnet, uint8_t universe, uint8_t physical)
    {
        Destination dest {ip, net, subnet, universe};
        uint32_t now = millis();
        if (this->last_send_times.find(dest) == this->last_send_times.end()) {
            this->last_send_times.insert(std::make_pair(dest, uint32_t(0)));
        }
        if (now >= this->last_send_times[dest] + DEFAULT_INTERVAL_MS) {
            this->sendArxDmxInternal(dest, physical);
            this->last_send_times[dest] = now;
        }
    }

How about (not tested)
if ((now - this->last_send_times[dest]) >= DEFAULT_INTERVAL_MS)

@hideakitai
Copy link
Owner

hideakitai commented Oct 22, 2024

@audiostrom Sorry for not getting back to you sooner. This issue is one of several known problems. I have not had time to address it and have not yet been able to fix it, but I will try to do so later.

For example, in my other library, I'm using PollingTImer library like this.

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