From 200681293a7bab34e03893f2d1aad674a061d798 Mon Sep 17 00:00:00 2001 From: Volodymyr Shymanskyy Date: Fri, 16 Dec 2016 20:01:37 +0200 Subject: [PATCH] Fix waitForNetwork --- TinyGsmClient.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/TinyGsmClient.h b/TinyGsmClient.h index eeb97f2..731edf2 100644 --- a/TinyGsmClient.h +++ b/TinyGsmClient.h @@ -337,12 +337,14 @@ public: bool waitForNetwork(unsigned long timeout = 60000L) { for (unsigned long start = millis(); millis() - start < timeout; ) { RegStatus s = getRegistrationStatus(); - if(s == REG_OK_HOME || s == REG_OK_ROAMING) { + if (s == REG_OK_HOME || s == REG_OK_ROAMING) { return true; + } else if (s == REG_UNREGISTERED) { + return false; } delay(1000); } - return true; + return false; } /*