Skip to content

Commit

Permalink
No SMS deadlock (#52)
Browse files Browse the repository at this point in the history
* Prevent deadlock on sms send/receive

* Use NB_SMS.ready()

* Whitespace

* Typo

* Code style
  • Loading branch information
janakelarsson authored Dec 2, 2020
1 parent d87f31a commit 86b4d24
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/NB_SMS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ int NB_SMS::endSMS()
MODEM.write(26);

if (_synch) {
while ((r = MODEM.ready()) == 0) {
delay(100);
}
r = MODEM.waitForResponse(3*60*1000);
} else {
r = MODEM.ready();
}
Expand Down Expand Up @@ -129,7 +127,8 @@ int NB_SMS::available()
}

if (_synch) {
while ((r = ready()) == 0) {
unsigned long start = millis();
while ((r = ready()) == 0 && (millis() - start) < 3*60*1000) {
delay(100);
}
} else {
Expand Down

0 comments on commit 86b4d24

Please sign in to comment.