You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that the while loop takes 20 seconds to time out. For those using SAMD21 or SAMD51 MCUs, which have a 16 second maximum on the watchdog timer, this can cause the device to reset if a connection is delayed.
A simple solution is to substitute a smaller value for the timeout, say 10000 ms. This allows the routine to proceed without triggering a reset. I suspect that is a connection is not established in 10 seconds, it is not likely to respond bu waiting long.
A much more user friendly solution is to create a new public function, say SetConnectionTimeout(uint_16 timeoutVal) which would then set a private variable used for the timeout value in this function. The default value can still be 2000, if that is desired for some reason, but users of the library can then set it to the value they need without meddling in the library code.
Changing the timeout from 20000 to 10000 stopped a highly annoying intermittent reset problem I spent quite some time wresting with. The function now happily co-exists with the SAMD51 watchdog timer.
This may explain the problems seen by others in issue #211 and #181.
I note that the WiFiSocketClass::bind and WiFiSocketClass::listen also have hard-coded timeouts, although not as long. In general, hardcoding these values seems like a bad idea.
The text was updated successfully, but these errors were encountered:
WiFiSocketClass::connect() has a hard-coded loop in which includes the following:
}
Note that the while loop takes 20 seconds to time out. For those using SAMD21 or SAMD51 MCUs, which have a 16 second maximum on the watchdog timer, this can cause the device to reset if a connection is delayed.
A simple solution is to substitute a smaller value for the timeout, say 10000 ms. This allows the routine to proceed without triggering a reset. I suspect that is a connection is not established in 10 seconds, it is not likely to respond bu waiting long.
A much more user friendly solution is to create a new public function, say SetConnectionTimeout(uint_16 timeoutVal) which would then set a private variable used for the timeout value in this function. The default value can still be 2000, if that is desired for some reason, but users of the library can then set it to the value they need without meddling in the library code.
Changing the timeout from 20000 to 10000 stopped a highly annoying intermittent reset problem I spent quite some time wresting with. The function now happily co-exists with the SAMD51 watchdog timer.
This may explain the problems seen by others in issue #211 and #181.
I note that the WiFiSocketClass::bind and WiFiSocketClass::listen also have hard-coded timeouts, although not as long. In general, hardcoding these values seems like a bad idea.
The text was updated successfully, but these errors were encountered: