From ae11c5ea815fce60279476340a3757ee516f670f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Fri, 3 Feb 2017 11:09:36 +0100 Subject: [PATCH] Issue #50. Fix type bug in window variable when calculating energy for HLW8012 devices (Sonoff POW) --- code/espurna/pow.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/espurna/pow.ino b/code/espurna/pow.ino index a575baf7..bb6b0fe7 100644 --- a/code/espurna/pow.ino +++ b/code/espurna/pow.ino @@ -242,7 +242,7 @@ void powLoop() { reactive = (apparent > power) ? sqrt(apparent * apparent - power * power) : 0; factor = (apparent > 0) ? 100 * power / apparent : 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; saveEnergy();