Skip to content

Commit

Permalink
GSM: allow watchdog feed in case of connection retry
Browse files Browse the repository at this point in the history
  • Loading branch information
pennam committed Dec 4, 2023
1 parent fcbb950 commit 825c3e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 0 additions & 2 deletions libraries/GSM/src/GSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern

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

_pin = pin;
Expand Down
11 changes: 9 additions & 2 deletions libraries/GSM/src/GSMDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,16 @@ const char * arduino::GSMClass::getRegistrationStateString(const mbed::CellularN
}
}

#endif

void arduino::GSMClass::onStatusChange(nsapi_event_t ev, intptr_t in) {

if(ev == CellularStateRetryEvent) {
Serial.println("Watchdog feed");
feedWatchdog();
}

#if GSM_DEBUG_ENABLE
const cell_callback_data_t *data = (const cell_callback_data_t *)in;

switch(ev)
Expand Down Expand Up @@ -270,6 +278,5 @@ void arduino::GSMClass::onStatusChange(nsapi_event_t ev, intptr_t in) {
}
break;
}
}

#endif
}

0 comments on commit 825c3e3

Please sign in to comment.