mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
Avoid unnecessary waveform de-initialization which corrupts softwareserial (#4913)
This commit is contained in:
parent
ce33c2cffe
commit
e6af980b85
@ -205,7 +205,7 @@ int startWaveform(uint8_t pin, uint32_t timeHighUS, uint32_t timeLowUS, uint32_t
|
|||||||
// Stops a waveform on a pin
|
// Stops a waveform on a pin
|
||||||
int stopWaveform(uint8_t pin) {
|
int stopWaveform(uint8_t pin) {
|
||||||
for (size_t i = 0; i < countof(waveform); i++) {
|
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
|
// 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.
|
// We're also doing that, so even if an IRQ occurred it would still stay as 0.
|
||||||
waveform[i].enabled = 0;
|
waveform[i].enabled = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user