Skip to content

Commit

Permalink
Fix ESP32 piezo ceramic buzzer
Browse files Browse the repository at this point in the history
Fix ESP32 piezo ceramic buzzer doesn't buzz (arendst#20118)
  • Loading branch information
arendst committed Dec 19, 2023
1 parent 87b5886 commit 9e2ae39
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file.
### Fixed
- Matter Contact sensor was not triggering any update (#20232)
- CVE-2021-36603 Cross Site Scripting (XSS) vulnerability (#12221)
- ESP32 piezo ceramic buzzer doesn't buzz (#20118)

### Removed

Expand Down
1 change: 1 addition & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm

### Fixed
- CVE-2021-36603 Cross Site Scripting (XSS) vulnerability [#12221](https://github.com/arendst/Tasmota/issues/12221)
- ESP32 piezo ceramic buzzer doesn't buzz [#20118](https://github.com/arendst/Tasmota/issues/20118)
- Matter Contact sensor was not triggering any update [#20232](https://github.com/arendst/Tasmota/issues/20232)

### Removed
7 changes: 7 additions & 0 deletions tasmota/tasmota_xdrv_driver/xdrv_24_buzzer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ void BuzzerSet(uint32_t state) {
if (last_state != state) {
// Set 50% duty cycle for frequency output
// Set 0% (or 100% for inverted PWM) duty cycle which turns off frequency output either way
#ifdef ESP8266
analogWrite(Pin(GPIO_BUZZER), (state) ? Settings->pwm_range / 2 : 0); // set duty cycle for frequency output
#else
int32_t pin = Pin(GPIO_BUZZER);
if (analogAttach(pin, Buzzer.inverted) >= 0) {
analogWritePhase(pin, (state) ? Settings->pwm_range / 2 : 0, 0);
}
#endif
last_state = state;
}
} else {
Expand Down

0 comments on commit 9e2ae39

Please sign in to comment.