Skip to content

Commit 105f8f9

Browse files
author
Architecting
committed
Merge pull request itead#6 from muesliman/master
added '\0' fix on recvString methods
2 parents d9cebf2 + 9d7fff1 commit 105f8f9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ESP8266.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ String ESP8266::recvString(String target, uint32_t timeout)
381381
while (millis() - start < timeout) {
382382
while(m_puart->available() > 0) {
383383
a = m_puart->read();
384+
if(a == '\0') continue;
384385
data += a;
385386
}
386387
if (data.indexOf(target) != -1) {
@@ -398,6 +399,7 @@ String ESP8266::recvString(String target1, String target2, uint32_t timeout)
398399
while (millis() - start < timeout) {
399400
while(m_puart->available() > 0) {
400401
a = m_puart->read();
402+
if(a == '\0') continue;
401403
data += a;
402404
}
403405
if (data.indexOf(target1) != -1) {
@@ -417,6 +419,7 @@ String ESP8266::recvString(String target1, String target2, String target3, uint3
417419
while (millis() - start < timeout) {
418420
while(m_puart->available() > 0) {
419421
a = m_puart->read();
422+
if(a == '\0') continue;
420423
data += a;
421424
}
422425
if (data.indexOf(target1) != -1) {

0 commit comments

Comments
 (0)