From f05a471e48bb0ae891df61cdde1679abab0f0f4c Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 28 Sep 2018 17:02:55 +0200 Subject: [PATCH] Fix KNX compile error --- sonoff/xdrv_03_energy.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sonoff/xdrv_03_energy.ino b/sonoff/xdrv_03_energy.ino index 13ab1cb62..341fc71b5 100644 --- a/sonoff/xdrv_03_energy.ino +++ b/sonoff/xdrv_03_energy.ino @@ -560,6 +560,8 @@ void EnergyShow(boolean json) bool show_energy_period = (0 == tele_period); + float power_factor = energy_power_factor; + if (!energy_type_dc) { float apparent_power = energy_apparent_power; if (isnan(apparent_power)) { @@ -569,7 +571,6 @@ void EnergyShow(boolean json) energy_active_power = apparent_power; } - float power_factor = energy_power_factor; if (isnan(power_factor)) { power_factor = (energy_active_power && apparent_power) ? energy_active_power / apparent_power : 0; if (power_factor > 1) power_factor = 1;