From d85e83f04932cbb18c3972c21883dc2af20926b7 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 31 Jan 2020 17:03:10 -0500 Subject: [PATCH] Fixes to BG96 Signed-off-by: Sara Damiano --- src/TinyGsmClientBG96.h | 11 +++++++---- src/TinyGsmClientSequansMonarch.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/TinyGsmClientBG96.h b/src/TinyGsmClientBG96.h index 2a0bfa1..bc40c6e 100644 --- a/src/TinyGsmClientBG96.h +++ b/src/TinyGsmClientBG96.h @@ -231,7 +231,7 @@ TINY_GSM_MODEM_GET_INFO_ATI() if (waitResponse(60000L, GF("POWERED DOWN")) != 1) { return false; } - delay(3000); + waitResponse(5000L, GF("RDY")); return init(); } @@ -348,8 +348,11 @@ TINY_GSM_MODEM_GET_GPRS_IP_CONNECTED() */ String getLocalIP() { - sendAT(GF("+QILOCIP")); - stream.readStringUntil('\n'); + sendAT(GF("+CGPADDR=1")); + if (waitResponse(GF(GSM_NL "+CGPADDR:")) != 1) { + return ""; + } + streamSkipUntil(','); // Skip context id String res = stream.readStringUntil('\n'); if (waitResponse() != 1) { return ""; @@ -590,7 +593,7 @@ protected: sendAT(GF("+QISTATE=1,"), mux); //+QISTATE: 0,"TCP","151.139.237.11",80,5087,4,1,0,0,"uart1" - if (waitResponse(GF("+QISTATE:"))) + if (waitResponse(GF("+QISTATE:")) != 1) return false; streamSkipUntil(','); // Skip mux diff --git a/src/TinyGsmClientSequansMonarch.h b/src/TinyGsmClientSequansMonarch.h index 7065f9b..8e65d93 100644 --- a/src/TinyGsmClientSequansMonarch.h +++ b/src/TinyGsmClientSequansMonarch.h @@ -214,7 +214,7 @@ public: // with CFUN=0 not CFUN=1 (that is, at minimum functionality instead of full functionality // The module cannot even detect the sim card if the cellular functionality is disabled so // unless we explicitly enable the functionality the init will fail. - sendAT(GF("+CFUN=1")); // turn off error codes + sendAT(GF("+CFUN=1")); waitResponse(); int ret = getSimStatus();