diff --git a/src/Modem.cpp b/src/Modem.cpp index 7934e3a..63cb224 100644 --- a/src/Modem.cpp +++ b/src/Modem.cpp @@ -61,11 +61,6 @@ int ModemClass::begin(bool restart) // datasheet warns not to use _resetPin, this may lead to an unrecoverable state digitalWrite(_resetPin, LOW); - if (restart) { - shutdown(); - end(); - } - _uart->begin(_baud > 115200 ? 115200 : _baud); // power on module @@ -80,6 +75,14 @@ int ModemClass::begin(bool restart) } } + if (restart) { + shutdown(); + end(); + delay(1500); + setVIntPin(SARA_VINT_OFF); + begin(false); + } + if (!autosense()) { return 0; } diff --git a/src/NB.h b/src/NB.h index 742e356..c05ac8d 100644 --- a/src/NB.h +++ b/src/NB.h @@ -45,9 +45,9 @@ class NB { to call repeatedly ready() until you get a result. Default is TRUE. @return If synchronous, NB_NetworkStatus_t. If asynchronous, returns 0. */ - NB_NetworkStatus_t begin(const char* pin = 0, bool restart = true, bool synchronous = true); - NB_NetworkStatus_t begin(const char* pin, const char* apn, bool restart = true, bool synchronous = true); - NB_NetworkStatus_t begin(const char* pin, const char* apn, const char* username, const char* password, bool restart = true, bool synchronous = true); + NB_NetworkStatus_t begin(const char* pin = 0, bool restart = false, bool synchronous = true); + NB_NetworkStatus_t begin(const char* pin, const char* apn, bool restart = false, bool synchronous = true); + NB_NetworkStatus_t begin(const char* pin, const char* apn, const char* username, const char* password, bool restart = false, bool synchronous = true); /** Check network access status @return 1 if Alive, 0 if down