Skip to content

Commit

Permalink
signalDecoder.cpp
Browse files Browse the repository at this point in the history
make a reset if bufferMove wants to move more than in buffer
sidey79 committed Oct 6, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 79d97fd commit 98a2ed3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/_micro-api/libraries/signalDecoder/src/signalDecoder.cpp
Original file line number Diff line number Diff line change
@@ -36,7 +36,8 @@ void SignalDetectorClass::bufferMove(const uint8_t start)
m_truncated = false;
//DBG_PRINTLN("");
if (start > messageLen - 1 || start == 0) {
//DBG_PRINT(__FUNCTION__); DBG_PRINT(" start oor "); DBG_PRINT(start); DBG_PRINT(" "); DBG_PRINT(messageLen);
//DBG_PRINT(__FUNCTION__); DBG_PRINT(" start oor "); DBG_PRINT(start); DBG_PRINT(" "); DBG_PRINTLN(messageLen);
reset();

This comment has been minimized.

Copy link
@Ralf9

Ralf9 Oct 7, 2017

Contributor

Dies gefällt mir nicht so richtig, damit wird es schwierig die Ursache für das Problem zu finden.
Mir wäre sowas lieber:

if (start > messageLen - 1) {
  MSG_PRINT(" msglen="); MSG_PRINT(messageLen);
  MSG_PRINT(" mend="); MSG_PRINT(mend);
  MSG_PRINT(" start="); MSG_PRINT(start);
  MSG_PRINTLN(F(" bufferMove overflow!!"));
  reset();
}
else if (start == 0)
{

This comment has been minimized.

Copy link
@sidey79

sidey79 Oct 7, 2017

Author Contributor

Kann man machen, bringt uns aber auch nicht weiter.
Wenn der komplette Puffer weggeschoben werden soll, dann muss das kein overflow sein. Das ist ein normales Verhalten, wenn der komplette Inhalt entfernt werden soll.

}
else if (message.moveLeft(start))
{

0 comments on commit 98a2ed3

Please sign in to comment.