Skip to content

Commit

Permalink
Mkrwan fix waitResponse wrong char read after timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
flhofer committed Aug 24, 2021
1 parent 89890a1 commit 7eae6c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/MKRWAN.h
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ class LoRaModem : public Stream // @suppress("Class has a virtual method and non
data.reserve(msize);
int8_t index = -1;
int length = 0;
int a = 0;
int a = -1;
unsigned long startMillis = millis();
do {
YIELD();
Expand Down Expand Up @@ -1135,7 +1135,7 @@ class LoRaModem : public Stream // @suppress("Class has a virtual method and non
}
} while (millis() - startMillis < timeout);
finish:
if (a != '+') // no follow-up command, get terminator from buffer
if (a >= 0 && a != '+') // no follow-up command, get terminator from buffer
(void)stream.read();

if (index == -1) {
Expand Down

0 comments on commit 7eae6c3

Please sign in to comment.