From a4e23128127989ecd9118dc50843ed65a2c12539 Mon Sep 17 00:00:00 2001 From: Tercio Gaudencio Filho Date: Sun, 21 Oct 2018 18:59:27 -0300 Subject: [PATCH] Fix reset. --- code/espurna/sensors/PZEM004TSensor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/espurna/sensors/PZEM004TSensor.h b/code/espurna/sensors/PZEM004TSensor.h index 85a60f87..5f643ae9 100644 --- a/code/espurna/sensors/PZEM004TSensor.h +++ b/code/espurna/sensors/PZEM004TSensor.h @@ -116,7 +116,7 @@ class PZEM004TSensor : public BaseSensor { // If called with value = -1, the offset will be the last energy reading // otherwise, it will be the value provided float resetEnergy(unsigned char dev, float value = -1) { - _energy_offsets[dev] = value != 0 ? value : _readings[dev].energy; + _energy_offsets[dev] = value != -1 ? value : _readings[dev].energy; return _energy_offsets[dev]; }