Skip to content

Commit e4892fa

Browse files
committed
Remove _toneMap from Tone.cpp
1 parent 12a4c65 commit e4892fa

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

cores/esp8266/Tone.cpp

+2-11
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,20 @@
2525
#include "core_esp8266_waveform.h"
2626
#include "user_interface.h"
2727

28-
// Which pins have a tone running on them?
29-
static uint32_t _toneMap = 0;
30-
31-
3228
static void _startTone(uint8_t _pin, uint32_t high, uint32_t low, uint32_t duration) {
3329
if (_pin > 16) {
3430
return;
3531
}
3632

37-
if (!(_toneMap & 1UL << _pin)) {
38-
pinMode(_pin, OUTPUT);
39-
}
33+
pinMode(_pin, OUTPUT);
4034

4135
high = std::max(high, (uint32_t)microsecondsToClockCycles(25)); // new 20KHz maximum tone frequency,
4236
low = std::max(low, (uint32_t)microsecondsToClockCycles(25)); // (25us high + 25us low period = 20KHz)
4337

4438
duration = microsecondsToClockCycles(duration * 1000UL);
4539
duration += high + low - 1;
4640
duration -= duration % (high + low);
47-
if (startWaveformClockCycles(_pin, high, low, duration)) {
48-
_toneMap |= 1UL << _pin;
49-
}
41+
startWaveformClockCycles(_pin, high, low, duration);
5042
}
5143

5244

@@ -88,6 +80,5 @@ void noTone(uint8_t _pin) {
8880
return;
8981
}
9082
stopWaveform(_pin);
91-
_toneMap &= ~(1UL << _pin);
9283
digitalWrite(_pin, 0);
9384
}

0 commit comments

Comments
 (0)