Browse Source

Issue #50. Fix type bug in window variable when calculating energy for HLW8012 devices (Sonoff POW)

fastled
Xose Pérez 7 years ago
parent
commit
ae11c5ea81
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      code/espurna/pow.ino

+ 1
- 1
code/espurna/pow.ino View File

@ -242,7 +242,7 @@ void powLoop() {
reactive = (apparent > power) ? sqrt(apparent * apparent - power * power) : 0; reactive = (apparent > power) ? sqrt(apparent * apparent - power * power) : 0;
factor = (apparent > 0) ? 100 * power / apparent : 100; factor = (apparent > 0) ? 100 * power / apparent : 100;
if (factor > 100) factor = 100; if (factor > 100) factor = 100;
unsigned long window = (double) POW_REPORT_EVERY * POW_UPDATE_INTERVAL / 1000.0 / 3600.0;
double window = (double) POW_REPORT_EVERY * POW_UPDATE_INTERVAL / 1000.0 / 3600.0;
_energy += power * window; _energy += power * window;
saveEnergy(); saveEnergy();


Loading…
Cancel
Save