Skip to content

Feed watchdog a bit more often when initializing MKR GSM 1400/NB 1500 #58

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

Merged
merged 1 commit into from
Apr 29, 2021
Merged
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
18 changes: 18 additions & 0 deletions src/Arduino_GSMConnectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@

static int const GSM_TIMEOUT = 30000;

/******************************************************************************
FUNCTION DEFINITION
******************************************************************************/

__attribute__((weak)) void mkr_gsm_feed_watchdog()
{
/* This function can be overwritten by a "strong" implementation
* in a higher level application, such as the ArduinoIoTCloud
* firmware stack.
*/
}

/******************************************************************************
CTOR/DTOR
******************************************************************************/
Expand Down Expand Up @@ -58,15 +70,21 @@ unsigned long GSMConnectionHandler::getTime()

NetworkConnectionState GSMConnectionHandler::update_handleInit()
{
mkr_gsm_feed_watchdog();

if (_gsm.begin(_pin) != GSM_READY)
{
Debug.print(DBG_ERROR, F("SIM not present or wrong PIN"));
return NetworkConnectionState::ERROR;
}

mkr_gsm_feed_watchdog();

Debug.print(DBG_INFO, F("SIM card ok"));
_gsm.setTimeout(GSM_TIMEOUT);

mkr_gsm_feed_watchdog();

GSM3_NetworkStatus_t const network_status = _gprs.attachGPRS(_apn, _login, _pass, true);
Debug.print(DBG_DEBUG, F("GPRS.attachGPRS(): %d"), network_status);
if (network_status == GSM3_NetworkStatus_t::ERROR)
Expand Down
14 changes: 14 additions & 0 deletions src/Arduino_NBConnectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@

static int const NB_TIMEOUT = 30000;

/******************************************************************************
FUNCTION DEFINITION
******************************************************************************/

__attribute__((weak)) void mkr_nb_feed_watchdog()
{
/* This function can be overwritten by a "strong" implementation
* in a higher level application, such as the ArduinoIoTCloud
* firmware stack.
*/
}

/******************************************************************************
CTOR/DTOR
******************************************************************************/
Expand Down Expand Up @@ -69,6 +81,8 @@ unsigned long NBConnectionHandler::getTime()

NetworkConnectionState NBConnectionHandler::update_handleInit()
{
mkr_nb_feed_watchdog();

if (_nb.begin(_pin, _apn, _login, _pass) == NB_READY)
{
Debug.print(DBG_INFO, F("SIM card ok"));
Expand Down