Skip to content

Set NB default restart value to false #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/Modem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -80,6 +75,14 @@ int ModemClass::begin(bool restart)
}
}

if (restart) {
shutdown();
end();
delay(1500);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two thinks are on my mind here:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is a soft reset. The hardReset() method is a final resort if nothing else works. It may brick the modem.

setVIntPin(SARA_VINT_OFF);
begin(false);
}

if (!autosense()) {
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions src/NB.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down