Fix: Victron MPPT: be happy with at least one that delivers valid data (#1118)

This commit is contained in:
Niko 2024-07-21 19:46:06 +02:00 committed by GitHub
parent 5fee069c65
commit 415c767d1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,12 +75,16 @@ void VictronMpptClass::loop()
} }
} }
/*
* isDataValid()
* return: true = if at least one of the MPPT controllers delivers valid data
*/
bool VictronMpptClass::isDataValid() const bool VictronMpptClass::isDataValid() const
{ {
std::lock_guard<std::mutex> lock(_mutex); std::lock_guard<std::mutex> lock(_mutex);
for (auto const& upController: _controllers) { for (auto const& upController: _controllers) {
if (!upController->isDataValid()) { return false; } if (upController->isDataValid()) { return true; }
} }
return !_controllers.empty(); return !_controllers.empty();