Skip to content

Commit 86b4d24

Browse files
No SMS deadlock (#52)
* Prevent deadlock on sms send/receive * Use NB_SMS.ready() * Whitespace * Typo * Code style
1 parent d87f31a commit 86b4d24

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/NB_SMS.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ int NB_SMS::endSMS()
9696
MODEM.write(26);
9797

9898
if (_synch) {
99-
while ((r = MODEM.ready()) == 0) {
100-
delay(100);
101-
}
99+
r = MODEM.waitForResponse(3*60*1000);
102100
} else {
103101
r = MODEM.ready();
104102
}
@@ -129,7 +127,8 @@ int NB_SMS::available()
129127
}
130128

131129
if (_synch) {
132-
while ((r = ready()) == 0) {
130+
unsigned long start = millis();
131+
while ((r = ready()) == 0 && (millis() - start) < 3*60*1000) {
133132
delay(100);
134133
}
135134
} else {

0 commit comments

Comments
 (0)