Skip to content

Commit

Permalink
Simplify inverter handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tbnobody committed Sep 26, 2024
1 parent 595b153 commit 818fdc4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/Hoymiles/src/Hoymiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ std::shared_ptr<InverterAbstract> HoymilesClass::getInverterByPos(const uint8_t

std::shared_ptr<InverterAbstract> HoymilesClass::getInverterBySerial(const uint64_t serial)
{
for (uint8_t i = 0; i < _inverters.size(); i++) {
if (_inverters[i]->serial() == serial) {
return _inverters[i];
for (auto& inv : _inverters) {
if (inv->serial() == serial) {
return inv;
}
}
return nullptr;
Expand All @@ -209,9 +209,7 @@ std::shared_ptr<InverterAbstract> HoymilesClass::getInverterByFragment(const fra
return nullptr;
}

std::shared_ptr<InverterAbstract> inv;
for (uint8_t i = 0; i < _inverters.size(); i++) {
inv = _inverters[i];
for (auto& inv : _inverters) {
serial_u p;
p.u64 = inv->serial();

Expand Down

0 comments on commit 818fdc4

Please sign in to comment.