adafruit / Adafruit_IO_Arduino

Arduino library to access Adafruit IO from WiFi, cellular, and ethernet modules.
Other
209 stars 108 forks source link

Improve WiFi Resilience and Flexibility #103

Closed sellensr closed 4 years ago

sellensr commented 4 years ago

Scope: Add an optional fail_fast parameter to run() and mqttStatus() to allow them to return promptly if desired by the calling sketch.

Detect a wifi failure and attempt to reconnect from inside AIO unless fail_fast is true.

In the WiFi code, test that SSID is a non-empty string before trying to connect. Disconnect any existing wifi connection and pause long enough for it to take effect before going ahead.

References: https://github.com/adafruit/Adafruit_IO_Arduino/issues/99 https://github.com/adafruit/Adafruit_IO_Arduino/issues/102

Limitations: There should be no change in the operation of existing code, except that the initial WiFi connection will take 300 ms longer to wait for the disconnect to take effect. The included example is specific to the Feather WINC1500 platform because it is an example for implementing platform specific code to manage the WiFi outside AIO. I have not tested the modification on all the supported hardware.

sellensr commented 4 years ago

I think my descriptions are correct, but there are parts of the library I haven't used, e.g. times, dashboards, and groups.

brentru commented 4 years ago

Wow, thank you for the doxygen descriptions you've made. This looks ready to merge and release.