From de601105d4a5cd6b9ffa5d6b65f442cc0fe77ddc Mon Sep 17 00:00:00 2001 From: Volodymyr Shymanskyy Date: Thu, 28 Sep 2017 02:14:47 +0300 Subject: [PATCH] Fix localIP() on A6 --- TinyGsmClientA6.h | 2 ++ TinyGsmCommon.h | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/TinyGsmClientA6.h b/TinyGsmClientA6.h index 8baf6b4..0af4f5f 100644 --- a/TinyGsmClientA6.h +++ b/TinyGsmClientA6.h @@ -425,6 +425,8 @@ public: if (waitResponse(10000L, res) != 1) { return ""; } + res.replace(GSM_NL "OK" GSM_NL, ""); + res.replace(GSM_NL, ""); res.trim(); return res; } diff --git a/TinyGsmCommon.h b/TinyGsmCommon.h index 3abc48a..b145bb7 100644 --- a/TinyGsmCommon.h +++ b/TinyGsmCommon.h @@ -97,16 +97,22 @@ uint32_t TinyGsmAutoBaud(T& SerialAT, uint32_t minimum = 9600, uint32_t maximum static inline IPAddress TinyGsmIpFromString(const String& strIP) { - int Parts[4] = {0,0,0,0}; + int Parts[4] = {0, }; int Part = 0; for (uint8_t i=0; i 3) { + return IPAddress(0,0,0,0); + } continue; + } else if (c >= '0' && c <= '9') { + Parts[Part] *= 10; + Parts[Part] += c - '0'; + } else { + if (Part == 3) break; } - Parts[Part] *= 10; - Parts[Part] += c - '0'; } return IPAddress(Parts[0], Parts[1], Parts[2], Parts[3]); }