Skip to content
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
12 changes: 10 additions & 2 deletions src/ArduinoCellular.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@


#include "ArduinoCellular.h"
#if defined(ARDUINO_ARCH_MBED)
#include "Watchdog.h"
#endif
Comment on lines +4 to +6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it is mbed only. This change is related to ArduinoIotCloud integration that enables watchdog for mbed and samd boards but not for the renesas one.


unsigned long ArduinoCellular::getTime() {
int year, month, day, hour, minute, second;
Expand Down Expand Up @@ -214,12 +217,17 @@ bool ArduinoCellular::awaitNetworkRegistration(){
if(this->debugStream != nullptr){
this->debugStream->println("Waiting for network registration...");
}
while (!modem.waitForNetwork()) {
while (!modem.waitForNetwork(waitForNetworkTimeout)) {
if(this->debugStream != nullptr){
this->debugStream->print(".");
}
#if defined(ARDUINO_ARCH_MBED)
if(mbed::Watchdog::get_instance().is_running()) {
mbed::Watchdog::get_instance().kick();
}
#endif
delay(2000);
}
}
return true;
}

Expand Down
2 changes: 2 additions & 0 deletions src/ArduinoCellular.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ class ArduinoCellular {
Stream* debugStream = nullptr; /**< The stream to be used for printing debugging messages. */

static unsigned long getTime(); /** Callback for getting the current time as an unix timestamp. */

static constexpr unsigned long waitForNetworkTimeout = 20000L; /**< Maximum wait time for network registration (In milliseconds). */
};


Expand Down