From b074ca8a1ed6c7658049bff8bc4e47e862d50b09 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 15 Oct 2025 18:00:33 -1000 Subject: [PATCH] fix --- esphome/components/sensor/filter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/sensor/filter.cpp b/esphome/components/sensor/filter.cpp index a6819dd73c..0e52f9d94f 100644 --- a/esphome/components/sensor/filter.cpp +++ b/esphome/components/sensor/filter.cpp @@ -53,7 +53,7 @@ optional SlidingWindowFilter::new_value(float value) { // Buffer not yet full - just append this->window_.push_back(value); this->window_count_++; - this->window_head_ = this->window_count_; + this->window_head_ = this->window_count_ % this->window_size_; } else { // Buffer full - overwrite oldest value (ring buffer) this->window_[this->window_head_] = value; @@ -81,7 +81,7 @@ FixedVector SortedWindowFilter::get_sorted_values_() { sorted_values.push_back(v); } } - sort(sorted_values.begin(), sorted_values.end()); + std::sort(sorted_values.begin(), sorted_values.end()); return sorted_values; }