Skip to content

Commit

Permalink
Fix: Wrong detection of HM-300 inverters
Browse files Browse the repository at this point in the history
Was introduced in v23.8.1; Fixes #1198
  • Loading branch information
tbnobody committed Aug 2, 2023
1 parent 77528f6 commit 686112e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/Hoymiles/src/parser/DevInfoParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,19 @@ uint8_t DevInfoParser::getDevIdx()
&& devInfo[pos].hwPart[2] == _payloadDevInfoSimple[4]
&& devInfo[pos].hwPart[3] == _payloadDevInfoSimple[5]) {
ret = pos;
break;
}
}

// Then only for 3 bytes
for (pos = 0; pos < sizeof(devInfo) / sizeof(devInfo_t); pos++) {
if (devInfo[pos].hwPart[0] == _payloadDevInfoSimple[2]
&& devInfo[pos].hwPart[1] == _payloadDevInfoSimple[3]
&& devInfo[pos].hwPart[2] == _payloadDevInfoSimple[4]) {
ret = pos;
// Then only for 3 bytes but only if not already found
if (ret == 0xff) {
for (pos = 0; pos < sizeof(devInfo) / sizeof(devInfo_t); pos++) {
if (devInfo[pos].hwPart[0] == _payloadDevInfoSimple[2]
&& devInfo[pos].hwPart[1] == _payloadDevInfoSimple[3]
&& devInfo[pos].hwPart[2] == _payloadDevInfoSimple[4]) {
ret = pos;
break;
}
}
}

Expand Down

0 comments on commit 686112e

Please sign in to comment.