From 679d957ab924dc40235f3d82b1596216eb8c5f05 Mon Sep 17 00:00:00 2001 From: Volodymyr Shymanskyy Date: Wed, 27 Sep 2017 23:53:38 +0300 Subject: [PATCH] Wait for isGprsConnected() --- TinyGsmClientM590.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/TinyGsmClientM590.h b/TinyGsmClientM590.h index 0ced31b..7356ecf 100644 --- a/TinyGsmClientM590.h +++ b/TinyGsmClientM590.h @@ -392,22 +392,22 @@ public: sendAT(GF("+XIIC=1")); waitResponse(); - delay(10000L); // TODO - - sendAT(GF("+XIIC?")); - waitResponse(); + for (unsigned long start = millis(); millis() - start < timeout; ) { + if (isGprsConnected()) { + return true; + } + delay(500); + } /* sendAT(GF("+DNSSERVER=1,8.8.8.8")); waitResponse(); sendAT(GF("+DNSSERVER=2,8.8.4.4")); - if (waitResponse() != 1) { - return false; - } + waitResponse(); */ - return true; + return false; } bool gprsDisconnect() {