Skip to content

Commit 6170a7e

Browse files
committed
GSM: allow watchdog feed in case of connection retry
1 parent fcbb950 commit 6170a7e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

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;

libraries/GSM/src/GSMDebug.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,16 @@ 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+
Serial.println("Watchdog feed");
193+
feedWatchdog();
194+
}
195+
196+
#if GSM_DEBUG_ENABLE
189197
const cell_callback_data_t *data = (const cell_callback_data_t *)in;
190198

191199
switch(ev)
@@ -270,6 +278,5 @@ void arduino::GSMClass::onStatusChange(nsapi_event_t ev, intptr_t in) {
270278
}
271279
break;
272280
}
273-
}
274-
275281
#endif
282+
}

0 commit comments

Comments
 (0)