Skip to content

Commit b3f5cf9

Browse files
authored
Merge pull request #20 from sekyHC/master
Waiting for CMGS when sending the message
2 parents f8933f6 + 8596ac1 commit b3f5cf9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Sim800L.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,11 +481,13 @@ bool Sim800L::sendSms(char* number,char* text)
481481
this->SoftwareSerial::print((char)26);
482482
_buffer=_readSerial(60000);
483483
//expect CMGS:xxx , where xxx is a number,for the sending sms.
484-
if ( (_buffer.indexOf("ER")) == -1)
485-
{
484+
if ((_buffer.indexOf("ER")) != -1) {
485+
return true;
486+
} else if ((_buffer.indexOf("CMGS")) != -1) {
486487
return false;
487-
}
488-
else return true;
488+
} else {
489+
return true;
490+
}
489491
// Error found, return 1
490492
// Error NOT found, return 0
491493
}

0 commit comments

Comments
 (0)