Skip to content

Commit f67b315

Browse files
Adjusted buzzer initialization logic to support ESP-IDF 5.1.1, added conditional compilation to be compatible with older versions
1 parent 750ef32 commit f67b315

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

esp3d/src/modules/buzzer/buzzer.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,15 @@ bool BuzzerDevice::begin() {
5454
end();
5555
}
5656
#if defined(ARDUINO_ARCH_ESP32)
57+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 1) {
58+
ledcAttachChannel(0, 12000, 8, 0);
59+
#else
5760
setToneChannel(0);
5861
ledcSetup(0, 12000, 8);
59-
#endif // defined(ARDUINO_ARCH_ESP32)
62+
}
63+
#endif // ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 1)
64+
#endif // defined(ARDUINO_ARCH_ESP32)
65+
6066
if (ESP3DSettings::readByte(ESP_BUZZER) == 1) {
6167
_started = true;
6268
playsound(5000, 240);

0 commit comments

Comments
 (0)