Skip to content

Commit

Permalink
Fix: VE.Direct data is invalid if no controller has valid data
Browse files Browse the repository at this point in the history
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 415c767 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.
  • Loading branch information
schlimmchen committed Aug 24, 2024
1 parent dcc8313 commit 821bc27
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/VictronMppt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 821bc27

Please sign in to comment.