Skip to content

Commit b8cf16b

Browse files
authored
Merge pull request arduino-libraries#58 from arduino-libraries/mkr-gsm-nb-extra-watchdog-feeding
Feed watchdog a bit more often when initializing MKR GSM 1400/NB 1500
2 parents 83012b7 + bef77f1 commit b8cf16b

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/Arduino_GSMConnectionHandler.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@
2929

3030
static int const GSM_TIMEOUT = 30000;
3131

32+
/******************************************************************************
33+
FUNCTION DEFINITION
34+
******************************************************************************/
35+
36+
__attribute__((weak)) void mkr_gsm_feed_watchdog()
37+
{
38+
/* This function can be overwritten by a "strong" implementation
39+
* in a higher level application, such as the ArduinoIoTCloud
40+
* firmware stack.
41+
*/
42+
}
43+
3244
/******************************************************************************
3345
CTOR/DTOR
3446
******************************************************************************/
@@ -58,15 +70,21 @@ unsigned long GSMConnectionHandler::getTime()
5870

5971
NetworkConnectionState GSMConnectionHandler::update_handleInit()
6072
{
73+
mkr_gsm_feed_watchdog();
74+
6175
if (_gsm.begin(_pin) != GSM_READY)
6276
{
6377
Debug.print(DBG_ERROR, F("SIM not present or wrong PIN"));
6478
return NetworkConnectionState::ERROR;
6579
}
6680

81+
mkr_gsm_feed_watchdog();
82+
6783
Debug.print(DBG_INFO, F("SIM card ok"));
6884
_gsm.setTimeout(GSM_TIMEOUT);
6985

86+
mkr_gsm_feed_watchdog();
87+
7088
GSM3_NetworkStatus_t const network_status = _gprs.attachGPRS(_apn, _login, _pass, true);
7189
Debug.print(DBG_DEBUG, F("GPRS.attachGPRS(): %d"), network_status);
7290
if (network_status == GSM3_NetworkStatus_t::ERROR)

src/Arduino_NBConnectionHandler.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@
2929

3030
static int const NB_TIMEOUT = 30000;
3131

32+
/******************************************************************************
33+
FUNCTION DEFINITION
34+
******************************************************************************/
35+
36+
__attribute__((weak)) void mkr_nb_feed_watchdog()
37+
{
38+
/* This function can be overwritten by a "strong" implementation
39+
* in a higher level application, such as the ArduinoIoTCloud
40+
* firmware stack.
41+
*/
42+
}
43+
3244
/******************************************************************************
3345
CTOR/DTOR
3446
******************************************************************************/
@@ -69,6 +81,8 @@ unsigned long NBConnectionHandler::getTime()
6981

7082
NetworkConnectionState NBConnectionHandler::update_handleInit()
7183
{
84+
mkr_nb_feed_watchdog();
85+
7286
if (_nb.begin(_pin, _apn, _login, _pass) == NB_READY)
7387
{
7488
Debug.print(DBG_INFO, F("SIM card ok"));

0 commit comments

Comments
 (0)