@@ -27,7 +27,7 @@ extern "C" {
2727 #include " utility/debug.h"
2828}
2929
30- WiFiClass::WiFiClass () : _timeout(50000 )
30+ WiFiClass::WiFiClass () : _timeout(50000 ), _feed_watchdog_func( 0 )
3131{
3232}
3333
@@ -49,6 +49,7 @@ int WiFiClass::begin(const char* ssid)
4949 {
5050 for (unsigned long start = millis (); (millis () - start) < _timeout;)
5151 {
52+ feedWatchdog ();
5253 delay (WL_DELAY_START_CONNECTION);
5354 status = WiFiDrv::getConnectionStatus ();
5455 if ((status != WL_IDLE_STATUS) && (status != WL_NO_SSID_AVAIL) && (status != WL_SCAN_COMPLETED)) {
@@ -71,6 +72,7 @@ int WiFiClass::begin(const char* ssid, uint8_t key_idx, const char *key)
7172 {
7273 for (unsigned long start = millis (); (millis () - start) < _timeout;)
7374 {
75+ feedWatchdog ();
7476 delay (WL_DELAY_START_CONNECTION);
7577 status = WiFiDrv::getConnectionStatus ();
7678 if ((status != WL_IDLE_STATUS) && (status != WL_NO_SSID_AVAIL) && (status != WL_SCAN_COMPLETED)) {
@@ -92,6 +94,7 @@ int WiFiClass::begin(const char* ssid, const char *passphrase)
9294 {
9395 for (unsigned long start = millis (); (millis () - start) < _timeout;)
9496 {
97+ feedWatchdog ();
9598 delay (WL_DELAY_START_CONNECTION);
9699 status = WiFiDrv::getConnectionStatus ();
97100 if ((status != WL_IDLE_STATUS) && (status != WL_NO_SSID_AVAIL) && (status != WL_SCAN_COMPLETED)) {
@@ -382,4 +385,16 @@ void WiFiClass::setTimeout(unsigned long timeout)
382385{
383386 _timeout = timeout;
384387}
388+
389+ void WiFiClass::setFeedWatchdogFunc (FeedHostProcessorWatchdogFuncPointer func)
390+ {
391+ _feed_watchdog_func = func;
392+ }
393+
394+ void WiFiClass::feedWatchdog ()
395+ {
396+ if (_feed_watchdog_func)
397+ _feed_watchdog_func ();
398+ }
399+
385400WiFiClass WiFi;
0 commit comments