delta Helper

template<size_t MaxDeps = 8, typename Source>
auto RxESP32::Helpers::Numerical::delta(Source &source, const typename Computed<decltype(source.get()), 1, MaxDeps>::Options &options = {})

Calculate change (delta) from previous value.

Creates a Computed that returns the difference between current and previous value.

Since

v0.1.0

Signal<int> counter(0);
auto delta_counter = delta(counter);

Note

Stateful helper. On first call, returns 0.

Warning

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

Template Parameters:
size_t MaxDeps = 8

Maximum number of dependents for the computed signal.

Parameters:
Source &source

Source (determines result type).

const typename Computed<decltype(source.get()), 1, MaxDeps>::Options &options = {}

Optional Computed configuration.

Returns:

Computed with delta values.

See Also