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

stopWaveform() doesn't deinit the timer if waveform had limited runtime #7230

Closed
dok-net opened this issue Apr 19, 2020 · 0 comments
Closed
Assignees
Milestone

Comments

@dok-net
Copy link
Contributor

dok-net commented Apr 19, 2020

[...]
startWaveform(GPIO, 100, 100, 200);
delay(200);
stopWaveform();
[…]

Due to code in master branch, core_esp8266_waveform.cpp, stopWaveform(uint8_t pin):

  uint32_t mask = 1<<pin;
  if (!(waveformEnabled & mask)) {
    return false; // It's not running, nothing to do here
  }

the timer keeps running even when there isn't any other waveform or the callback attached.

Fixed in #7022

earlephilhower added a commit to earlephilhower/Arduino that referenced this issue Apr 20, 2020
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.
dok-net added a commit to dok-net/arduino-esp8266 that referenced this issue Apr 21, 2020
…t stopWaveform refuses to do anything if the waveform was stopped by runtime, either. Fixes esp8266#7230.
@devyte devyte added this to the 2.7.0 milestone Apr 23, 2020
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

Successfully merging a pull request may close this issue.

3 participants