Closed
Description
Board
ESP32DevModule
Device Description
%
Hardware Configuration
%
Version
v2.0.2
IDE Name
Arduino, Sloeber, Github Actions
Operating System
%
Flash frequency
%
PSRAM enabled
no
Upload speed
%
Description
Since 2.0.2, the compiler claims that the call tone(TONE_PIN, 1100) is ambiguous, which is totally nonsense 😞 . see sketch below.
Sketch
#include <Arduino.h>
void setup() {
// put your setup code here, to run once:
}
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
void tone(uint8_t aPinNumber, unsigned int aFrequency){
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
ledcWriteTone(TONE_LEDC_CHANNEL, aFrequency);
}
void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
ledcWriteTone(TONE_LEDC_CHANNEL, aFrequency);
delay(aDuration);
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
}
void noTone(uint8_t aPinNumber){
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
}
void loop() {
// put your main code here, to run repeatedly:
tone(TONE_PIN, 1100); // what is the compiler doing here???
delay(50);
tone(TONE_PIN, 1100, 10);
delay(50);
}
Debug Message
E:\WORKSPACE_ARDUINO\ArduinoSketches\ESP32Bug\ESP32Bug.ino: In function 'void loop()':
ESP32Bug:23:32: error: call of overloaded 'tone(int, int)' is ambiguous
tone(TONE_PIN, 1100);
^
E:\WORKSPACE_ARDUINO\ArduinoSketches\ESP32Bug\ESP32Bug.ino:12:6: note: candidate: 'void tone(uint8_t, unsigned int, long unsigned int)'
void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
^~~~
E:\WORKSPACE_ARDUINO\ArduinoSketches\ESP32Bug\ESP32Bug.ino:8:6: note: candidate: 'void tone(uint8_t, unsigned int)'
void tone(uint8_t aPinNumber, unsigned int aFrequency){
^~~~
exit status 1
call of overloaded 'tone(int, int)' is ambiguous
Other Steps to Reproduce
Just compile!
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.