Skip to content

Commit 2776d16

Browse files
committed
Can't image stopWaveform is called but PWM shall not stop.
startWaveform already implied stopping PWM before.
1 parent b89932c commit 2776d16

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

cores/esp8266/Tone.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ static void _startTone(uint8_t _pin, uint32_t high, uint32_t low, uint32_t durat
3030
return;
3131
}
3232

33-
// Stop any analogWrites (PWM) because they are a different generator
34-
_stopPWM(_pin);
35-
// If there's another Tone or startWaveform on this pin
36-
// it will be changed on-the-fly (no need to stop it)
37-
3833
pinMode(_pin, OUTPUT);
3934

4035
high = std::max(high, (uint32_t)microsecondsToClockCycles(25)); // new 20KHz maximum tone frequency,

cores/esp8266/core_esp8266_waveform_pwm.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,9 @@ IRAM_ATTR int stopWaveform_weak(uint8_t pin) {
435435
if (!timerRunning) {
436436
return false;
437437
}
438+
439+
_stopPWM(pin); // Make sure there's no PWM live here
440+
438441
// If user sends in a pin >16 but <32, this will always point to a 0 bit
439442
// If they send >=32, then the shift will result in 0 and it will also return false
440443
uint32_t mask = 1<<pin;

cores/esp8266/core_esp8266_wiring_digital.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ extern void __pinMode(uint8_t pin, uint8_t mode) {
8383

8484
extern void IRAM_ATTR __digitalWrite(uint8_t pin, uint8_t val) {
8585
stopWaveform(pin); // Disable any Tone or startWaveform on this pin
86-
_stopPWM(pin); // and any analogWrites (PWM)
8786
if(pin < 16){
8887
if(val) GPOS = (1 << pin);
8988
else GPOC = (1 << pin);

0 commit comments

Comments
 (0)