Skip to content

Commit

Permalink
IRUtils:typeToString() — simplify (#2002)
Browse files Browse the repository at this point in the history
Remove redundant code.
  • Loading branch information
dilyanpalauzov authored Jun 9, 2023
1 parent 9d0a919 commit 4e4b158
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/IRutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,12 @@ String typeToString(const decode_type_t protocol, const bool isRepeat) {
result = kUnknownStr;
} else {
auto *ptr = reinterpret_cast<const char*>(kAllProtocolNamesStr);
if (protocol > kLastDecodeType || protocol == decode_type_t::UNKNOWN) {
result = kUnknownStr;
} else {
for (uint16_t i = 0; i <= protocol && STRLEN(ptr); i++) {
if (i == protocol) {
result = FPSTR(ptr);
break;
}
ptr += STRLEN(ptr) + 1;
for (uint16_t i = 0; i <= protocol && STRLEN(ptr); i++) {
if (i == protocol) {
result = FPSTR(ptr);
break;
}
ptr += STRLEN(ptr) + 1;
}
}
if (isRepeat) {
Expand Down

0 comments on commit 4e4b158

Please sign in to comment.