Closed bradrblack closed 2 years ago
I just realized after submitting this and doing some more research that a previous change (PR# 103) allowed a call to AdafruitIO_WiFI with an empty SSID and password - like this.. AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, "", ""); and if the SSID was zero length, then the connect code is skipped. This provides the same capability as overloading the function. I had previously tried passing in NULL but not an empty string.
I tested with my example sketch and this seems to work fine.
Brent - I'm not 100% sure how to revert the changes to the src/wifi/ESP.h and .cpp files. Can you remove them from the PR or tell me how to do it without removing the orig files from the repo?
@bradrblack If you're uncomfortable with git-revert
, do you want to checkout another PR with the correct files?
Closing Pull Request - The existing library is already "compatible" with WiFiManager. I'll submit an example sketch in a separate pull request.
Thank you for creating a pull request to contribute to Adafruit's GitHub code! Before you open the request please review the following guidelines and tips to help it be more easily integrated:
Files changed.. src/wifi/AdafruitIO_ESP8266.h src/wifi/AdafruitIO_ESP8266.cpp src/wifi/AdafruitIO_ESP32.h src/wifi/AdafruitIO_ESP32.cpp
Files added... examples/adafruitio_27_wifimanager/adafruitio_27_wifimanager.ino
Overloaded the wifi functions with an additional method that only requires the AIO_USERNAME and AIO_KEY parameters. The SSID and Password are not required as WiFiManager will be used to connect to wifi. The connect code was changed to detect a NULL SSID and bypass the connect code.
Changes only apply to ESP8266 and ESP32 platforms which are supported by WiFiManager.
I tested on both ESP8266 and ESP32 boards with a modified "subscribe" example sketch and the provided wifimanager example sketch. The subscribe example used was: https://github.com/adafruit/Adafruit_IO_Arduino/tree/master/examples/adafruitio_01_subscribe but I modified this line as it was not working with the published library without this change...
while io.mqqtStatus() < AIO_CONNECTED) {
was changed to..
while(io.status() < AIO_CONNECTED) {
These tests exercised the existing 4 parameter invocation...
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);
and the newly added 2 parameter method...
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY);
Thank you again for contributing! We will try to test and integrate the change as soon as we can, but be aware we have many GitHub repositories to manage and can't immediately respond to every request. There is no need to bump or check in on a pull request (it will clutter the discussion of the request).
Also don't be worried if the request is closed or not integrated--sometimes the priorities of Adafruit's GitHub code (education, ease of use) might not match the priorities of the pull request. Don't fret, the open source community thrives on forks and GitHub makes it easy to keep your changes in a forked repo.