Skip to content

Commit

Permalink
Avoid unnecessary waveform de-initialization which corrupts softwares…
Browse files Browse the repository at this point in the history
…erial (esp8266#4913)
  • Loading branch information
shimarin authored and earlephilhower committed Jul 10, 2018
1 parent ce33c2c commit e6af980
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cores/esp8266/core_esp8266_waveform.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ int startWaveform(uint8_t pin, uint32_t timeHighUS, uint32_t timeLowUS, uint32_t
// Stops a waveform on a pin
int stopWaveform(uint8_t pin) {
for (size_t i = 0; i < countof(waveform); i++) {
if (((pin == 16) && waveform[i].gpio16Mask) || ((pin != 16) && (waveform[i].gpioMask == 1<<pin))) {
if ((((pin == 16) && waveform[i].gpio16Mask) || ((pin != 16) && (waveform[i].gpioMask == 1<<pin))) && waveform[i].enabled) {
// Note that there is no interrupt unsafety here. The IRQ can only ever change .enabled from 1->0
// We're also doing that, so even if an IRQ occurred it would still stay as 0.
waveform[i].enabled = 0;
Expand Down

0 comments on commit e6af980

Please sign in to comment.