[HAL] Added check for defined ESP version macro (#860)

This commit is contained in:
jgromes 2023-10-28 21:54:31 +02:00
parent 039fa0fc59
commit 912333c408

View file

@ -145,12 +145,12 @@ void inline ArduinoHal::tone(uint32_t pin, unsigned int frequency, unsigned long
// ESP32 tone() emulation
(void)duration;
if(prev == -1) {
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0)
#if !defined(ESP_IDF_VERSION) || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0))
ledcAttachPin(pin, RADIOLIB_TONE_ESP32_CHANNEL);
#endif
}
if(prev != frequency) {
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0)
#if !defined(ESP_IDF_VERSION) || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0))
ledcWriteTone(RADIOLIB_TONE_ESP32_CHANNEL, frequency);
#else
ledcWriteTone(pin, frequency);
@ -184,7 +184,7 @@ void inline ArduinoHal::noTone(uint32_t pin) {
return;
}
// ESP32 tone() emulation
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0)
#if !defined(ESP_IDF_VERSION) || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0))
ledcDetachPin(pin);
ledcWrite(RADIOLIB_TONE_ESP32_CHANNEL, 0);
#else