RateOfChange Filter

template<typename T, T MaxRatePerSecond>
struct RateOfChange

Filter that limits the rate of change per second.

This stateful filter tracks the rate of change over time and propagates only when the rate of change is within the specified limit, preventing rapid fluctuations.

Since

v0.1.0

// Example: Limit temperature change to 5 degrees per second
Signal<float, 10, RateOfChange<float, 5>> temp(20.0);

Note

Stateful filter. Uses millis() for timing.

Warning

  • Only accepts arithmetic types (integral and floating-point).

  • MaxRatePerSecond must be positive.

Template Parameters:
typename T

Arithmetic type.

T MaxRatePerSecond

Maximum allowed rate of change per second.

Public Functions

inline bool operator()(const T &old_value, const T &new_value) const

Public Members

mutable uint32_t last_time = 0

See Also