mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-29 05:36:39 +00:00
Fix ESP32 piezo ceramic buzzer
Fix ESP32 piezo ceramic buzzer doesn't buzz (#20118)
This commit is contained in:
parent
87b5886ea7
commit
9e2ae391fc
@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
### Fixed
|
### Fixed
|
||||||
- Matter Contact sensor was not triggering any update (#20232)
|
- Matter Contact sensor was not triggering any update (#20232)
|
||||||
- CVE-2021-36603 Cross Site Scripting (XSS) vulnerability (#12221)
|
- CVE-2021-36603 Cross Site Scripting (XSS) vulnerability (#12221)
|
||||||
|
- ESP32 piezo ceramic buzzer doesn't buzz (#20118)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -130,6 +130,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- CVE-2021-36603 Cross Site Scripting (XSS) vulnerability [#12221](https://github.com/arendst/Tasmota/issues/12221)
|
- 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)
|
- Matter Contact sensor was not triggering any update [#20232](https://github.com/arendst/Tasmota/issues/20232)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
@ -52,7 +52,14 @@ void BuzzerSet(uint32_t state) {
|
|||||||
if (last_state != state) {
|
if (last_state != state) {
|
||||||
// Set 50% duty cycle for frequency output
|
// Set 50% duty cycle for frequency output
|
||||||
// Set 0% (or 100% for inverted PWM) duty cycle which turns off frequency output either way
|
// 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
|
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;
|
last_state = state;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user