Skip to content

Commit

Permalink
Fix: Clear parser buffers to prevent random numbers if no data was re…
Browse files Browse the repository at this point in the history
…ceived
  • Loading branch information
tbnobody committed Jul 31, 2023
1 parent 2eeb742 commit 5bbc67b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/Hoymiles/src/parser/AlarmLogParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ AlarmLogParser::AlarmLogParser()
{
_xSemaphore = xSemaphoreCreateMutex();
HOY_SEMAPHORE_GIVE(); // release before first use
clearBuffer();
}

void AlarmLogParser::clearBuffer()
Expand Down
2 changes: 2 additions & 0 deletions lib/Hoymiles/src/parser/DevInfoParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ DevInfoParser::DevInfoParser()
{
_xSemaphore = xSemaphoreCreateMutex();
HOY_SEMAPHORE_GIVE(); // release before first use
clearBufferSimple();
clearBufferAll();
}

void DevInfoParser::clearBufferAll()
Expand Down
1 change: 1 addition & 0 deletions lib/Hoymiles/src/parser/StatisticsParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ StatisticsParser::StatisticsParser()
{
_xSemaphore = xSemaphoreCreateMutex();
HOY_SEMAPHORE_GIVE(); // release before first use
clearBuffer();
}

void StatisticsParser::setByteAssignment(const byteAssign_t* byteAssignment, uint8_t size)
Expand Down
1 change: 1 addition & 0 deletions lib/Hoymiles/src/parser/SystemConfigParaParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ SystemConfigParaParser::SystemConfigParaParser()
{
_xSemaphore = xSemaphoreCreateMutex();
HOY_SEMAPHORE_GIVE(); // release before first use
clearBuffer();
}

void SystemConfigParaParser::clearBuffer()
Expand Down

0 comments on commit 5bbc67b

Please sign in to comment.