Skip to content

Commit e6af980

Browse files
shimarinearlephilhower
authored andcommitted
Avoid unnecessary waveform de-initialization which corrupts softwareserial (#4913)
1 parent ce33c2c commit e6af980

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cores/esp8266/core_esp8266_waveform.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ int startWaveform(uint8_t pin, uint32_t timeHighUS, uint32_t timeLowUS, uint32_t
205205
// Stops a waveform on a pin
206206
int stopWaveform(uint8_t pin) {
207207
for (size_t i = 0; i < countof(waveform); i++) {
208-
if (((pin == 16) && waveform[i].gpio16Mask) || ((pin != 16) && (waveform[i].gpioMask == 1<<pin))) {
208+
if ((((pin == 16) && waveform[i].gpio16Mask) || ((pin != 16) && (waveform[i].gpioMask == 1<<pin))) && waveform[i].enabled) {
209209
// Note that there is no interrupt unsafety here. The IRQ can only ever change .enabled from 1->0
210210
// We're also doing that, so even if an IRQ occurred it would still stay as 0.
211211
waveform[i].enabled = 0;

0 commit comments

Comments
 (0)