[Module] Removed String class from AT commands
This commit is contained in:
parent
caa05f8ad8
commit
d3cec5d3b4
2 changed files with 7 additions and 6 deletions
|
@ -137,19 +137,20 @@ bool Module::ATsendData(uint8_t* data, uint32_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Module::ATgetResponse() {
|
bool Module::ATgetResponse() {
|
||||||
String data = "";
|
char data[128];
|
||||||
|
char* dataPtr = data;
|
||||||
uint32_t start = millis();
|
uint32_t start = millis();
|
||||||
while(millis() - start < _ATtimeout) {
|
while(millis() - start < _ATtimeout) {
|
||||||
while(ModuleSerial->available() > 0) {
|
while(ModuleSerial->available() > 0) {
|
||||||
char c = ModuleSerial->read();
|
char c = ModuleSerial->read();
|
||||||
RADIOLIB_VERBOSE_PRINT(c);
|
RADIOLIB_VERBOSE_PRINT(c);
|
||||||
data += c;
|
*dataPtr++ = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data.indexOf("OK") != -1) {
|
if(strstr(data, "OK") == 0) {
|
||||||
RADIOLIB_VERBOSE_PRINTLN();
|
RADIOLIB_VERBOSE_PRINTLN();
|
||||||
return(true);
|
return(true);
|
||||||
} else if (data.indexOf("ERROR") != -1) {
|
} else if(strstr(data, "ERROR") == 0) {
|
||||||
RADIOLIB_VERBOSE_PRINTLN();
|
RADIOLIB_VERBOSE_PRINTLN();
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,7 @@ class Module {
|
||||||
/*!
|
/*!
|
||||||
\brief Get response after sending AT command.
|
\brief Get response after sending AT command.
|
||||||
|
|
||||||
\returns True if AT response contains the string "OK", false otehrwise.
|
\returns True if AT response contains the string "OK", false otherwise.
|
||||||
*/
|
*/
|
||||||
bool ATgetResponse();
|
bool ATgetResponse();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue