Skip to content

Commit 07125d9

Browse files
Turn off IRQ on stopWaveform after Tone timeout
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.
1 parent ea1fdb2 commit 07125d9

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

cores/esp8266/core_esp8266_waveform.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,6 @@ int ICACHE_RAM_ATTR stopWaveform(uint8_t pin) {
176176
if (!timerRunning) {
177177
return false;
178178
}
179-
// If user sends in a pin >16 but <32, this will always point to a 0 bit
180-
// If they send >=32, then the shift will result in 0 and it will also return false
181-
uint32_t mask = 1<<pin;
182-
if (!(waveformEnabled & mask)) {
183-
return false; // It's not running, nothing to do here
184-
}
185179
waveformToDisable |= mask;
186180
// Ensure timely service....
187181
if (T1L > microsecondsToClockCycles(10)) {

0 commit comments

Comments
 (0)