WiFiManager icon indicating copy to clipboard operation
WiFiManager copied to clipboard

Any reason why setConnectRetries has a constraint between 1 and 10?

Open sommerper opened this issue 1 year ago • 1 comments

Hi!

I have a device that's on a network that can have a network disconnection for longer periods of time. Once the network is back I need the device to come back asap. Retrying 10 times is not enough and ideally I'd like to retry an infinite amount of times.

What is the best way to achieve this without modifying the library directly in this piece of code?

/**
 * [setConnectRetries description]
 * @access public
 * @param {[type]} uint8_t numRetries [description]
 */
void WiFiManager::setConnectRetries(uint8_t numRetries){
  _connectRetries = constrain(numRetries,1,10);
}

Thank you and thanks for a great project!

sommerper avatar Sep 20 '22 21:09 sommerper

That is the connect retry for autoconnect, you do not want your coding sitting stuck in autoconnect like that nor should it be used like that.

You probably want to make your own loop for checking if connected or not, or call autoconnect itself in a loop

tablatronix avatar Sep 20 '22 21:09 tablatronix

Thanks for the clarification! I didn't know I could call autoconnect multiple times.

sommerper avatar Sep 22 '22 15:09 sommerper

Yeah technically we could do that but it's blocking and probably not what you want. It mostly to fix some aps that always reject the first conx

tablatronix avatar Sep 22 '22 17:09 tablatronix