Skip to content

Commit

Permalink
Merge pull request #4849 from dobrykod/gpio_fixes
Browse files Browse the repository at this point in the history
[GPIO] Fix mode reported in response to Status command
  • Loading branch information
TD-er authored Oct 12, 2023
2 parents b4f9d48 + a0b567a commit 2fabe31
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/src/Helpers/PortStatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,14 @@ String getPinStateJSON(bool search, uint32_t key, const String& log, int16_t noS
int16_t value = noSearchValue;
bool found = false;

if (search) {
const auto it = globalMapPortStatus.find(key);
if (it != globalMapPortStatus.end()) {
mode = it->second.mode;
const auto it = globalMapPortStatus.find(key);
if (it != globalMapPortStatus.end()) {
found = true;
// update mode even if search = false, otherwise it will print mode assigned above
mode = it->second.mode;
// update value only if search = true, otherwise use noSearchValue
if(search)
value = it->second.getValue();
found = true;
}
}

if (!search || found)
Expand Down

0 comments on commit 2fabe31

Please sign in to comment.