Buzzer bug fixed. (#1081)

* Adjusted buzzer initialization logic to support ESP-IDF 5.1.1, added conditional compilation to be compatible with older versions

* Update buzzer.cpp
This commit is contained in:
E2D
2025-03-14 23:17:13 +08:00
committed by GitHub
parent dc8e221d7d
commit 429007b349

View File

@@ -54,9 +54,8 @@ bool BuzzerDevice::begin() {
end();
}
#if defined(ARDUINO_ARCH_ESP32)
setToneChannel(0);
ledcSetup(0, 12000, 8);
#endif // defined(ARDUINO_ARCH_ESP32)
ledcAttachChannel(0, 12000, 8, 0);
#endif // defined(ARDUINO_ARCH_ESP32)
if (ESP3DSettings::readByte(ESP_BUZZER) == 1) {
_started = true;
playsound(5000, 240);