Browse Source

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
mcspr-patch-1
Maxim Prokhorov 3 years ago
parent
commit
cd96f1ca6d
1 changed files with 1 additions and 3 deletions
  1. +1
    -3
      code/espurna/sensor.cpp

+ 1
- 3
code/espurna/sensor.cpp View File

@ -454,17 +454,15 @@ void _sensorApiResetEnergy(const sensor_magnitude_t& magnitude, const String& pa
} }
sensor::Energy _sensorEnergyTotal(unsigned char index) { sensor::Energy _sensorEnergyTotal(unsigned char index) {
sensor::Energy result; sensor::Energy result;
if (rtcmemStatus() && (index < (sizeof(Rtcmem->energy) / sizeof(*Rtcmem->energy)))) { if (rtcmemStatus() && (index < (sizeof(Rtcmem->energy) / sizeof(*Rtcmem->energy)))) {
result = _sensorRtcmemLoadEnergy(index); result = _sensorRtcmemLoadEnergy(index);
} else if (_sensor_save_every > 0) {
} else {
result = _sensorParseEnergy(getSetting({"eneTotal", index})); result = _sensorParseEnergy(getSetting({"eneTotal", index}));
} }
return result; return result;
} }
sensor::Energy sensorEnergyTotal() { sensor::Energy sensorEnergyTotal() {


Loading…
Cancel
Save