arduino-libraries / ArduinoMqttClient

ArduinoMqttClient Library for Arduino
GNU Lesser General Public License v2.1
186 stars 73 forks source link

Extension of WiFi connection delay before restart WiFi.begin() #84

Closed sirjeannot closed 1 year ago

sirjeannot commented 1 year ago

The examples are most likely not going to work if the WiFi AP experiences the slightest delay for association. Quickfix : longer delay in the loop

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

aentinger commented 1 year ago

That's a bit simple, as the delay occurs in a while loop. In which combination of board/IDE/CLI/platform does this become a problem?

sirjeannot commented 1 year ago

the condition check restarts the wifi association from the start. usually the while loop is only on the association status variable, or using the status() function. I did submit the smallest possible change for it to work.

WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
  delay(500);
  Serial.print(".");
}
aentinger commented 1 year ago

And this affects which board/platform/etc.?

sirjeannot commented 1 year ago

tested on esp8266. I don't have any esp32 spares currently.

aentinger commented 1 year ago

You see, the thing is, it seems that this problem is contained to ESP8266 and then again to your specific set-up. I don't believe it is warranted to increase the wait time by a factor of three for everyone just to satisfy your specific WiFi situation. Sorry, but for now I recommend to you that you'll just edit your own sketches but we'll leave this library as is.