diff --git a/src/TinyGsmClientA6.h b/src/TinyGsmClientA6.h index 4a5b086..6343d89 100644 --- a/src/TinyGsmClientA6.h +++ b/src/TinyGsmClientA6.h @@ -507,6 +507,9 @@ class TinyGsmA6 index = 2; goto finish; } else if (r3 && data.endsWith(r3)) { + if (r3 == GFP(GSM_CME_ERROR)) { + streamSkipUntil('\n'); // Read out the error + } index = 3; goto finish; } else if (r4 && data.endsWith(r4)) { diff --git a/src/TinyGsmClientBG96.h b/src/TinyGsmClientBG96.h index 0347055..d517655 100644 --- a/src/TinyGsmClientBG96.h +++ b/src/TinyGsmClientBG96.h @@ -422,6 +422,9 @@ class TinyGsmBG96 index = 2; goto finish; } else if (r3 && data.endsWith(r3)) { + if (r3 == GFP(GSM_CME_ERROR)) { + streamSkipUntil('\n'); // Read out the error + } index = 3; goto finish; } else if (r4 && data.endsWith(r4)) { diff --git a/src/TinyGsmClientESP8266.h b/src/TinyGsmClientESP8266.h index 4466e38..a0cf2a5 100644 --- a/src/TinyGsmClientESP8266.h +++ b/src/TinyGsmClientESP8266.h @@ -17,10 +17,9 @@ #include "TinyGsmCommon.h" #define GSM_NL "\r\n" -static const char GSM_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL; -static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL; -static const char GSM_CME_ERROR[] TINY_GSM_PROGMEM = GSM_NL "+CME ERROR:"; -static unsigned TINY_GSM_TCP_KEEP_ALIVE = 120; +static const char GSM_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL; +static const char GSM_ERROR[] TINY_GSM_PROGMEM = "ERROR" GSM_NL; +static unsigned TINY_GSM_TCP_KEEP_ALIVE = 120; // status of ESP8266 station interface // 2 : ESP8266 station connected to an AP and has obtained IP @@ -421,8 +420,7 @@ class TinyGsmESP8266 // TODO(vshymanskyy): Optimize this! uint8_t waitResponse(uint32_t timeout_ms, String& data, GsmConstStr r1 = GFP(GSM_OK), - GsmConstStr r2 = GFP(GSM_ERROR), - GsmConstStr r3 = GFP(GSM_CME_ERROR), + GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL, GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) { /*String r1s(r1); r1s.trim(); String r2s(r2); r2s.trim(); @@ -497,16 +495,14 @@ class TinyGsmESP8266 } uint8_t waitResponse(uint32_t timeout_ms, GsmConstStr r1 = GFP(GSM_OK), - GsmConstStr r2 = GFP(GSM_ERROR), - GsmConstStr r3 = GFP(GSM_CME_ERROR), + GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL, GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) { String data; return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5); } uint8_t waitResponse(GsmConstStr r1 = GFP(GSM_OK), - GsmConstStr r2 = GFP(GSM_ERROR), - GsmConstStr r3 = GFP(GSM_CME_ERROR), + GsmConstStr r2 = GFP(GSM_ERROR), GsmConstStr r3 = NULL, GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) { return waitResponse(1000, r1, r2, r3, r4, r5); } diff --git a/src/TinyGsmClientM590.h b/src/TinyGsmClientM590.h index 8fada7b..522c3e8 100644 --- a/src/TinyGsmClientM590.h +++ b/src/TinyGsmClientM590.h @@ -417,6 +417,9 @@ class TinyGsmM590 index = 2; goto finish; } else if (r3 && data.endsWith(r3)) { + if (r3 == GFP(GSM_CME_ERROR)) { + streamSkipUntil('\n'); // Read out the error + } index = 3; goto finish; } else if (r4 && data.endsWith(r4)) { diff --git a/src/TinyGsmClientM95.h b/src/TinyGsmClientM95.h index 1b6031a..7f259d5 100644 --- a/src/TinyGsmClientM95.h +++ b/src/TinyGsmClientM95.h @@ -541,6 +541,9 @@ class TinyGsmM95 index = 2; goto finish; } else if (r3 && data.endsWith(r3)) { + if (r3 == GFP(GSM_CME_ERROR)) { + streamSkipUntil('\n'); // Read out the error + } index = 3; goto finish; } else if (r4 && data.endsWith(r4)) { diff --git a/src/TinyGsmClientMC60.h b/src/TinyGsmClientMC60.h index 4c51552..0416ded 100644 --- a/src/TinyGsmClientMC60.h +++ b/src/TinyGsmClientMC60.h @@ -523,6 +523,9 @@ class TinyGsmMC60 index = 2; goto finish; } else if (r3 && data.endsWith(r3)) { + if (r3 == GFP(GSM_CME_ERROR)) { + streamSkipUntil('\n'); // Read out the error + } index = 3; goto finish; } else if (r4 && data.endsWith(r4)) { diff --git a/src/TinyGsmClientSIM5360.h b/src/TinyGsmClientSIM5360.h index 49179a7..58bce88 100644 --- a/src/TinyGsmClientSIM5360.h +++ b/src/TinyGsmClientSIM5360.h @@ -616,6 +616,9 @@ class TinyGsmSim5360 : public TinyGsmModem