-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Turn off IRQ on stopWaveform after Tone timeout #7232
Conversation
Fix esp8266#7230 (until 3.0 when this whole code will probably change). Before, a timed out pin would clear its bit in `waveformEnabled`. The logic in `stopWaveform`. If only one tone was running and timed out, `stopWaveform` would check the `enabled` bitmask and see nothing active and immediately return w/o cancelling the IRQ. So, the IRQ would be called every 1/100th of a second and return immediately when no work to be done was detected. Remove the check and always send in a `waveformToDisable` bit. It's save to disable an already disabled pin, so no logical consequences will occur, and the final IRQ disable will be executed when appropriate.
@earlephilhower Off the top of my head, your fix isn't right, if you'd just cherry-pick mine from PR#7022 it will be correct? |
@dok-net I'm looking at your commit bb3ee99 . I think we're both fine here. It's doing the same thing, but this small PR sends in the In your PR it's also possible to have a race condition where the bit is cleared in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok from my pov
Closing |
Fix #7230 (until 3.0 when this whole code will probably change).
Before, a timed out pin would clear its bit in
waveformEnabled
. Thelogic in
stopWaveform
. If only one tone was running and timed out,stopWaveform
would check theenabled
bitmask and see nothing activeand immediately return w/o cancelling the IRQ. So, the IRQ would be
called every 1/100th of a second and return immediately when no work to
be done was detected.
Remove the check and always send in a
waveformToDisable
bit. It'ssave to disable an already disabled pin, so no logical consequences will
occur, and the final IRQ disable will be executed when appropriate.