|
ESPHome 2026.5.3
|
Base class for filters that need a sorted window (Median, Quantile). More...
#include <filter.h>
Public Member Functions | |
| SlidingWindowFilter (uint16_t window_size, uint16_t send_every, uint16_t send_first_at) | |
Public Member Functions inherited from esphome::sensor::SlidingWindowFilter | |
| SlidingWindowFilter (uint16_t window_size, uint16_t send_every, uint16_t send_first_at) | |
| optional< float > | new_value (float value) final |
Public Member Functions inherited from esphome::sensor::Filter | |
| virtual void | initialize (Sensor *parent, Filter *next) |
| Initialize this filter, please note this can be called more than once. | |
| void | input (float value) |
| void | output (float value) |
Protected Member Functions | |
| FixedVector< float > | get_window_values_ () |
| Helper to get non-NaN values from the window (not sorted - caller will use nth_element) Returns empty FixedVector if all values are NaN. | |
Protected Member Functions inherited from esphome::sensor::SlidingWindowFilter | |
| virtual float | compute_result ()=0 |
| Called by new_value() to compute the filtered result from the current window. | |
Additional Inherited Members | |
Protected Attributes inherited from esphome::sensor::SlidingWindowFilter | |
| FixedRingBuffer< float > | window_ |
| Sliding window ring buffer - automatically overwrites oldest values when full. | |
| uint16_t | send_every_ |
| Send result every N values. | |
| uint16_t | send_at_ |
| Counter for send_every. | |
Protected Attributes inherited from esphome::sensor::Filter | |
| friend | Sensor |
| Filter * | next_ {nullptr} |
| Sensor * | parent_ {nullptr} |
Base class for filters that need a sorted window (Median, Quantile).
Extends SlidingWindowFilter to provide a helper that filters out NaN values. Derived classes use std::nth_element for efficient partial sorting.
|
protected |
Helper to get non-NaN values from the window (not sorted - caller will use nth_element) Returns empty FixedVector if all values are NaN.
Definition at line 59 of file filter.cpp.
| esphome::sensor::SlidingWindowFilter::SlidingWindowFilter | ( | uint16_t | window_size, |
| uint16_t | send_every, | ||
| uint16_t | send_first_at ) |
Definition at line 56 of file filter.cpp.