diff --git a/libnymea/integrations/statevaluefilters/statevaluefilteradaptive.cpp b/libnymea/integrations/statevaluefilters/statevaluefilteradaptive.cpp index e24bd052..a1fdf3c3 100644 --- a/libnymea/integrations/statevaluefilters/statevaluefilteradaptive.cpp +++ b/libnymea/integrations/statevaluefilters/statevaluefilteradaptive.cpp @@ -124,11 +124,11 @@ void StateValueFilterAdaptive::update() m_outputValueCount++; } } - - // Poor mans solution to calculate standard deviation. Not as precise, but much faster than looping over history again - m_standardDeviation = ((m_standardDeviation * m_windowSize) + qAbs(changeRatioToAverage)) / (m_windowSize + 1); } + // Poor mans solution to calculate standard deviation. Not as precise, but much faster than looping over history again + m_standardDeviation = ((m_standardDeviation * m_windowSize) + qAbs(changeRatioToAverage)) / (m_windowSize + 1); + // reset stats on overflow of counters if (m_inputValueCount < m_outputValueCount) { m_outputValueCount = 0;