Browse Source

Added AAAAA's to help with autoBaud

v_master
SRGDamia1 8 years ago
parent
commit
5725d727ca
1 changed files with 16 additions and 15 deletions
  1. +16
    -15
      TinyGsmClientSIM800.h

+ 16
- 15
TinyGsmClientSIM800.h View File

@ -187,6 +187,7 @@ public:
} }
bool autoBaud(unsigned long timeout = 10000L) { bool autoBaud(unsigned long timeout = 10000L) {
streamWrite(GF("AAAAAAAAAAAA")); // some extra A's to help detect the baud rate
for (unsigned long start = millis(); millis() - start < timeout; ) { for (unsigned long start = millis(); millis() - start < timeout; ) {
sendAT(GF("")); sendAT(GF(""));
if (waitResponse(200) == 1) { if (waitResponse(200) == 1) {
@ -620,9 +621,9 @@ private:
String streamReadUntil(char c) { String streamReadUntil(char c) {
String return_string = stream.readStringUntil(c); String return_string = stream.readStringUntil(c);
return_string.trim(); return_string.trim();
// if (String(c) == GSM_NL || String(c) == "\n"){
// DBG(return_string, c, " ");
// } else DBG(return_string, c);
if (String(c) == GSM_NL || String(c) == "\n"){
DBG(return_string, c, " ");
} else DBG(return_string, c);
return return_string; return return_string;
} }
@ -630,9 +631,9 @@ private:
String skipped = stream.readStringUntil(c); String skipped = stream.readStringUntil(c);
skipped.trim(); skipped.trim();
if (skipped.length()) { if (skipped.length()) {
// if (String(c) == GSM_NL || String(c) == "\n"){
// DBG(skipped, c, " ");
// } else DBG(skipped, c);
if (String(c) == GSM_NL || String(c) == "\n"){
DBG(skipped, c, " ");
} else DBG(skipped, c);
return true; return true;
} else return false; } else return false;
} }
@ -710,15 +711,15 @@ private:
} }
data = ""; data = "";
} }
// else {
// data.trim();
// data.replace(GSM_NL GSM_NL, GSM_NL);
// data.replace(GSM_NL, GSM_NL " ");
// if (data.length()) {
// DBG(GSM_NL, "<<< ", data);
// }
// data = "";
// }
else {
data.trim();
data.replace(GSM_NL GSM_NL, GSM_NL);
data.replace(GSM_NL, GSM_NL " ");
if (data.length()) {
DBG(GSM_NL, "<<< ", data);
}
data = "";
}
if (gotData) { if (gotData) {
sockets[mux]->sock_available = modemGetAvailable(mux); sockets[mux]->sock_available = modemGetAvailable(mux);
} }


Loading…
Cancel
Save