Browse Source

Fix waitForNetwork

v_master
Volodymyr Shymanskyy 8 years ago
parent
commit
200681293a
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      TinyGsmClient.h

+ 4
- 2
TinyGsmClient.h View File

@ -337,12 +337,14 @@ public:
bool waitForNetwork(unsigned long timeout = 60000L) { bool waitForNetwork(unsigned long timeout = 60000L) {
for (unsigned long start = millis(); millis() - start < timeout; ) { for (unsigned long start = millis(); millis() - start < timeout; ) {
RegStatus s = getRegistrationStatus(); RegStatus s = getRegistrationStatus();
if(s == REG_OK_HOME || s == REG_OK_ROAMING) {
if (s == REG_OK_HOME || s == REG_OK_ROAMING) {
return true; return true;
} else if (s == REG_UNREGISTERED) {
return false;
} }
delay(1000); delay(1000);
} }
return true;
return false;
} }
/* /*


Loading…
Cancel
Save