From cd96f1ca6d8190d4db6d3a75d07cecb1083e92e7 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Thu, 17 Dec 2020 03:50:30 +0300 Subject: [PATCH] sns: load energy from settings unconditionally fixes #2407 avoid depending on other settings technically, it could be another block in the snsConfigure for magnitudes, however it also should be a new type of one-shot logic --- code/espurna/sensor.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/code/espurna/sensor.cpp b/code/espurna/sensor.cpp index a8d73272..b1ec9642 100644 --- a/code/espurna/sensor.cpp +++ b/code/espurna/sensor.cpp @@ -454,17 +454,15 @@ void _sensorApiResetEnergy(const sensor_magnitude_t& magnitude, const String& pa } sensor::Energy _sensorEnergyTotal(unsigned char index) { - sensor::Energy result; if (rtcmemStatus() && (index < (sizeof(Rtcmem->energy) / sizeof(*Rtcmem->energy)))) { result = _sensorRtcmemLoadEnergy(index); - } else if (_sensor_save_every > 0) { + } else { result = _sensorParseEnergy(getSetting({"eneTotal", index})); } return result; - } sensor::Energy sensorEnergyTotal() {