From 821bc2756242f63131bd482dfeaaedd1576541be Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Sat, 24 Aug 2024 21:06:44 +0200 Subject: [PATCH] Fix: VE.Direct data is invalid if no controller has valid data the original implementation of the isDataValid() method worked by returning false if any of the charge controllers had invalid data. if no charge controllers were configured, this function then also needed to also return false. the logic was changed in 415c767d such that if at least one charge controller had valid data, the function would return true. this would have required to adjust the default return statement as well, but it was not. if the user enabled VE.Diret and configured at least one charge controller in the pin mapping, but this controller never delivered any data, the function would now errorneously return true, because the container is not empty. however, if no controller has valid data, this now means we exit the loop and then the return value must be false, which is also desired if the container is empty. --- src/VictronMppt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/VictronMppt.cpp b/src/VictronMppt.cpp index 4e084974..a994e20d 100644 --- a/src/VictronMppt.cpp +++ b/src/VictronMppt.cpp @@ -87,7 +87,7 @@ bool VictronMpptClass::isDataValid() const if (upController->isDataValid()) { return true; } } - return !_controllers.empty(); + return false; } bool VictronMpptClass::isDataValid(size_t idx) const