Browse Source

Remove reset flag from MedianFilter::result

fastled
Xose Pérez 7 years ago
parent
commit
38baf8599c
2 changed files with 8 additions and 8 deletions
  1. +1
    -3
      code/espurna/libs/MedianFilter.h
  2. +7
    -5
      code/espurna/power.ino

+ 1
- 3
code/espurna/libs/MedianFilter.h View File

@ -38,7 +38,7 @@ class MedianFilter {
return max; return max;
} }
virtual double result(bool do_reset = false) {
virtual double result() {
double sum = 0; double sum = 0;
@ -66,8 +66,6 @@ class MedianFilter {
} }
if (do_reset) reset();
return sum; return sum;
} }


+ 7
- 5
code/espurna/power.ino View File

@ -201,10 +201,10 @@ void _powerReport() {
// Get the fitered values // Get the fitered values
#if POWER_HAS_ACTIVE #if POWER_HAS_ACTIVE
double max_power = _filter_active.max(); 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; 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_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; _power_factor = (_power_apparent > 0) ? _power_active / _power_apparent : 1;
@ -212,7 +212,7 @@ void _powerReport() {
double power = _power_active; double power = _power_active;
#else #else
double max_power = _filter_current.max() * _power_voltage; 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; _power_apparent = _power_current * _power_voltage;
double power = _power_apparent; double power = _power_apparent;
#endif #endif
@ -283,6 +283,8 @@ void _powerReport() {
} }
#endif #endif
_powerReset();
} }
void _powerConfigure() { void _powerConfigure() {


Loading…
Cancel
Save