Skip to content

Commit 8074ecf

Browse files
authored
Merge pull request #779 from pennam/gsm_watchdog
GSM: allow watchdog feed in case of connection retry
2 parents fb002d4 + 230d917 commit 8074ecf

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Diff for: libraries/GSM/src/GSM.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern
7171

7272
_device->set_cmux_status_flag(_cmuxGSMenable);
7373
_device->set_retry_timeout_array(_retry_timeout, sizeof(_retry_timeout) / sizeof(_retry_timeout[0]));
74-
#if GSM_DEBUG_ENABLE
7574
_device->attach(mbed::callback(this, &GSMClass::onStatusChange));
76-
#endif
7775
_device->init();
7876

7977
_pin = pin;

Diff for: libraries/GSM/src/GSMDebug.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,15 @@ const char * arduino::GSMClass::getRegistrationStateString(const mbed::CellularN
184184
}
185185
}
186186

187+
#endif
188+
187189
void arduino::GSMClass::onStatusChange(nsapi_event_t ev, intptr_t in) {
188190

191+
if(ev == CellularStateRetryEvent) {
192+
feedWatchdog();
193+
}
194+
195+
#if GSM_DEBUG_ENABLE
189196
const cell_callback_data_t *data = (const cell_callback_data_t *)in;
190197

191198
switch(ev)
@@ -270,6 +277,5 @@ void arduino::GSMClass::onStatusChange(nsapi_event_t ev, intptr_t in) {
270277
}
271278
break;
272279
}
273-
}
274-
275280
#endif
281+
}

0 commit comments

Comments
 (0)