From 917242909bd1762c0b1cc499d5af9116ab7d76ed Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Thu, 19 Oct 2023 16:14:36 +0200 Subject: [PATCH] Fix: PowerMeter: update _lastPowerMeterUpdate for SOURCE_SML (#506) closes #498. --- src/PowerMeter.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/PowerMeter.cpp b/src/PowerMeter.cpp index 4598c85ab..a7b1fee8e 100644 --- a/src/PowerMeter.cpp +++ b/src/PowerMeter.cpp @@ -134,14 +134,17 @@ void PowerMeterClass::loop() CONFIG_T const& config = Configuration.get(); _verboseLogging = config.PowerMeter_VerboseLogging; - if (config.PowerMeter_Enabled && config.PowerMeter_Source == SOURCE_SML) { + if (!config.PowerMeter_Enabled) { return; } + + if (config.PowerMeter_Source == SOURCE_SML) { if (!smlReadLoop()) { return; + } else { + _lastPowerMeterUpdate = millis(); } } - if (!config.PowerMeter_Enabled - || (millis() - _lastPowerMeterCheck) < (config.PowerMeter_Interval * 1000)) { + if ((millis() - _lastPowerMeterCheck) < (config.PowerMeter_Interval * 1000)) { return; }