mirror of
https://github.com/esphome/esphome.git
synced 2026-02-24 02:08:23 -07:00
[pulse_counter] Fix PCNT glitch filter calculation off by 1000x (#14132)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -117,7 +117,7 @@ bool HwPulseCounterStorage::pulse_counter_setup(InternalGPIOPin *pin) {
|
||||
}
|
||||
|
||||
if (this->filter_us != 0) {
|
||||
uint32_t max_glitch_ns = PCNT_LL_MAX_GLITCH_WIDTH * 1000000u / (uint32_t) esp_clk_apb_freq();
|
||||
uint32_t max_glitch_ns = PCNT_LL_MAX_GLITCH_WIDTH * 1000u / ((uint32_t) esp_clk_apb_freq() / 1000000u);
|
||||
pcnt_glitch_filter_config_t filter_config = {
|
||||
.max_glitch_ns = std::min(this->filter_us * 1000u, max_glitch_ns),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user