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.
This commit is contained in:
Bernhard Kirchen 2024-08-24 21:06:44 +02:00
parent dcc8313c8c
commit 821bc27562

View File

@ -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