Skip to content

Commit 1564d0a

Browse files
authored
Merge pull request #353 from pennam/at-parse-fix-2
WiFiS3: Skip unaligned responses from WiFi chip
2 parents 731b943 + e322670 commit 1564d0a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: libraries/WiFiS3/src/Modem.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -228,28 +228,36 @@ bool ModemClass::buf_read(const string &prompt, string &data_res) {
228228
}
229229
else {
230230
if(string::npos != data_res.rfind(RESULT_DATA)) {
231-
found = true;
232231
data_res = data_res.substr(0, data_res.length() - (sizeof(RESULT_DATA) - 1));
233232
if(prompt != DO_NOT_CHECK_CMD) {
234233
if(removeAtBegin(data_res, prompt)) {
235234
res = true;
235+
found = true;
236+
} else {
237+
data_res.clear();
238+
continue;
236239
}
237240
}
238241
else {
239242
res = true;
243+
found = true;
240244
}
241245
break;
242246
}
243247
else if(string::npos != data_res.rfind(RESULT_OK)){
244-
found = true;
245248
data_res = data_res.substr(0, data_res.length() - (sizeof(RESULT_OK) - 1) );
246249
if(prompt != DO_NOT_CHECK_CMD) {
247250
if(removeAtBegin(data_res, prompt)) {
248251
res = true;
252+
found = true;
253+
} else {
254+
data_res.clear();
255+
continue;
249256
}
250257
}
251258
else {
252259
res = true;
260+
found = true;
253261
}
254262
break;
255263
}

0 commit comments

Comments
 (0)