diff --git a/code/espurna/libs/MedianFilter.h b/code/espurna/libs/MedianFilter.h index de4aaaf6..be7239b2 100644 --- a/code/espurna/libs/MedianFilter.h +++ b/code/espurna/libs/MedianFilter.h @@ -38,7 +38,7 @@ class MedianFilter { return max; } - virtual double result(bool do_reset = false) { + virtual double result() { double sum = 0; @@ -66,8 +66,6 @@ class MedianFilter { } - if (do_reset) reset(); - return sum; } diff --git a/code/espurna/power.ino b/code/espurna/power.ino index 066018ed..f8ab8725 100644 --- a/code/espurna/power.ino +++ b/code/espurna/power.ino @@ -201,10 +201,10 @@ void _powerReport() { // Get the fitered values #if POWER_HAS_ACTIVE double max_power = _filter_active.max(); - _power_current = _filter_current.result(true); - _power_voltage = _filter_voltage.result(true); - _power_active = _filter_active.result(true); - _power_apparent = _filter_apparent.result(true); + _power_current = _filter_current.result(); + _power_voltage = _filter_voltage.result(); + _power_active = _filter_active.result(); + _power_apparent = _filter_apparent.result(); if (_power_active > _power_apparent) _power_apparent = _power_active; _power_reactive = (_power_apparent > _power_active) ? sqrt(_power_apparent * _power_apparent - _power_active * _power_active) : 0; _power_factor = (_power_apparent > 0) ? _power_active / _power_apparent : 1; @@ -212,7 +212,7 @@ void _powerReport() { double power = _power_active; #else double max_power = _filter_current.max() * _power_voltage; - _power_current = _filter_current.result(true); + _power_current = _filter_current.result(); _power_apparent = _power_current * _power_voltage; double power = _power_apparent; #endif @@ -283,6 +283,8 @@ void _powerReport() { } #endif + _powerReset(); + } void _powerConfigure() {