Skip to content

Possible softlock on millis() overflow #14

@GaiEquilibrium

Description

@GaiEquilibrium

Hello, looks like it's possible to softlock button in read() method.
If button changes at time:
millis_max_value - _delay - some_small_value
and doesn't change state back until millis() overflow, then _ignore_until will be almost always bigger then millis().

For an example: if button has been unpressed at millis_max_value - _delay, then state will be saved us unpressed, _ignore_until will be millis_max_value. And right after millis overflow, condition:
if (_ignore_until > millis()) { // ignore any changes during this period }
almost always will be true, and it will lock execution of next condition.
And the only possible exit, except reset, will be holding button down around overflow, hoping not to miss it =)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions