From f5000ad78f870ca8be30908fc52d66a0ec97a952 Mon Sep 17 00:00:00 2001 From: StanJ <53401742+Tech-TX@users.noreply.github.com> Date: Tue, 31 Mar 2020 20:23:51 -0500 Subject: [PATCH 1/5] add comments for tone max frequency limit --- cores/esp8266/Tone.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cores/esp8266/Tone.cpp b/cores/esp8266/Tone.cpp index 35a5a41515..f7e7945465 100644 --- a/cores/esp8266/Tone.cpp +++ b/cores/esp8266/Tone.cpp @@ -35,10 +35,12 @@ static void _startTone(uint8_t _pin, uint32_t high, uint32_t low, unsigned long pinMode(_pin, OUTPUT); - high = std::max(high, (uint32_t)100); - low = std::max(low, (uint32_t)100); + high = std::max(high, (uint32_t)100); // 5KHz maximum tone for Arduino compatibility + low = std::max(low, (uint32_t)100); // (100us high + 100us low period = 5KHz) - if (startWaveform(_pin, high, low, (uint32_t) duration * 1000)) { + duration *= 1000UL; + duration -= duration % (high + low); + if (startWaveform(_pin, high, low, duration)) { _toneMap |= 1 << _pin; } } From a5eb7eadfc86f632b085cf76011c08d0ec787f29 Mon Sep 17 00:00:00 2001 From: StanJ <53401742+Tech-TX@users.noreply.github.com> Date: Tue, 31 Mar 2020 20:28:54 -0500 Subject: [PATCH 2/5] add comments for tone max frequency limit --- cores/esp8266/Tone.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cores/esp8266/Tone.cpp b/cores/esp8266/Tone.cpp index f7e7945465..54693ca4f8 100644 --- a/cores/esp8266/Tone.cpp +++ b/cores/esp8266/Tone.cpp @@ -38,9 +38,7 @@ static void _startTone(uint8_t _pin, uint32_t high, uint32_t low, unsigned long high = std::max(high, (uint32_t)100); // 5KHz maximum tone for Arduino compatibility low = std::max(low, (uint32_t)100); // (100us high + 100us low period = 5KHz) - duration *= 1000UL; - duration -= duration % (high + low); - if (startWaveform(_pin, high, low, duration)) { + if (startWaveform(_pin, high, low, (uint32_t) duration * 1000)) { _toneMap |= 1 << _pin; } } From 30df0ae8de389f2ad60b514b0cf446c763acc362 Mon Sep 17 00:00:00 2001 From: StanJ <53401742+Tech-TX@users.noreply.github.com> Date: Wed, 1 Apr 2020 18:19:55 -0500 Subject: [PATCH 3/5] set Tone maximum frequency to 20KHz (was 5KHz) --- cores/esp8266/Tone.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cores/esp8266/Tone.cpp b/cores/esp8266/Tone.cpp index 54693ca4f8..0a156fe213 100644 --- a/cores/esp8266/Tone.cpp +++ b/cores/esp8266/Tone.cpp @@ -35,8 +35,8 @@ static void _startTone(uint8_t _pin, uint32_t high, uint32_t low, unsigned long pinMode(_pin, OUTPUT); - high = std::max(high, (uint32_t)100); // 5KHz maximum tone for Arduino compatibility - low = std::max(low, (uint32_t)100); // (100us high + 100us low period = 5KHz) + high = std::max(high, (uint32_t)25); // new 20KHz maximum tone frequency, + low = std::max(low, (uint32_t)25); // (25us high + 25us low period = 20KHz) if (startWaveform(_pin, high, low, (uint32_t) duration * 1000)) { _toneMap |= 1 << _pin; From 397d314d3ced235b56136b123a5b4ec7505efa19 Mon Sep 17 00:00:00 2001 From: StanJ <53401742+Tech-TX@users.noreply.github.com> Date: Sat, 4 Apr 2020 10:04:06 -0500 Subject: [PATCH 4/5] dummy commit to kick Travis off --- cores/esp8266/Tone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/esp8266/Tone.cpp b/cores/esp8266/Tone.cpp index 0a156fe213..fa93816788 100644 --- a/cores/esp8266/Tone.cpp +++ b/cores/esp8266/Tone.cpp @@ -35,7 +35,7 @@ static void _startTone(uint8_t _pin, uint32_t high, uint32_t low, unsigned long pinMode(_pin, OUTPUT); - high = std::max(high, (uint32_t)25); // new 20KHz maximum tone frequency, + high = std::max(high, (uint32_t)25); // 20KHz maximum tone frequency (new), low = std::max(low, (uint32_t)25); // (25us high + 25us low period = 20KHz) if (startWaveform(_pin, high, low, (uint32_t) duration * 1000)) { From d7bf500a3368a171b324f58ddada6c6ac0abc0e7 Mon Sep 17 00:00:00 2001 From: StanJ <53401742+Tech-TX@users.noreply.github.com> Date: Sat, 4 Apr 2020 10:45:40 -0500 Subject: [PATCH 5/5] dummy commit to kick Travis off --- cores/esp8266/Tone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/esp8266/Tone.cpp b/cores/esp8266/Tone.cpp index fa93816788..0a156fe213 100644 --- a/cores/esp8266/Tone.cpp +++ b/cores/esp8266/Tone.cpp @@ -35,7 +35,7 @@ static void _startTone(uint8_t _pin, uint32_t high, uint32_t low, unsigned long pinMode(_pin, OUTPUT); - high = std::max(high, (uint32_t)25); // 20KHz maximum tone frequency (new), + high = std::max(high, (uint32_t)25); // new 20KHz maximum tone frequency, low = std::max(low, (uint32_t)25); // (25us high + 25us low period = 20KHz) if (startWaveform(_pin, high, low, (uint32_t) duration * 1000)) {