r-downing / PersWiFiManager

Persistent WiFiManager Arduino library for ESP8266
http://ryandowning.net/PersWiFiManager/
MIT License
111 stars 34 forks source link

Add ESP32 support, changed layout of inline HTML, small fixes #26

Closed Jeroen88 closed 5 years ago

Jeroen88 commented 5 years ago

Added ESP32 support for the main files PersWiFiManager.h and PersWiFiManager.cpp using #if defined(ESP8266) and defined(ESP32) to make the difference.

Added ESP32 support for the first example basic_rest_api.ino using the same #if defined's. To make this example work you need to install the ESP32 port of the ESP8266SSDP library too. This port is called ESP32SSDP and can be found here.

The other two examples can be adapted easily, although spiffs_rest_api_nonblocking.ino requires adaptation of the EasySSDP and SPIFFSReadServer files too.

Other changes are, in basic_rest_api.ino:

and in PersWiFiManager.cpp:

Jeroen88 commented 5 years ago

Changed Access Point IP address to 192.168.4.1 instead of 192.168.1.1, because that is what the ESP32 reported back even if I set it to 192.168.1.1.

Jeroen88 commented 5 years ago

If no WiFi credentials are found (e.g. when the ESP has never connected to a WiFi network before or the credentials have been reset) do not wait for a timeout but start the AP inmediately

Jeroen88 commented 5 years ago

Fixed a bug in starting the AP inmediately if no WiFi credentials are found.

Jeroen88 commented 5 years ago

On an ESP32 it was more difficult to detect if no WiFi credentials are present. This feature is not tested yet on an ESP32 completely fresh out of the box, neither is it tested yet on an ESP8266.

Jeroen88 commented 5 years ago

Changed the DNS server IP to 192.168.4.1 too, so all clients connecting in AP mode are redirected to the ESP webserver root.

Jeroen88 commented 5 years ago

Tested on a 'fresh out of the box' ESP32 and works like a charm! Tested on a previously used before ESP8266 and, after the last commit, works like a charm too!

Jeroen88 commented 5 years ago

Added a method ::resetSettings() to clear WiFi credentials, e.g. for testing purposes. If ::resetSettings() is called before ::begin(), the ESP should start in AP mode, because it has no more a known SSID to connect to.

Jeroen88 commented 5 years ago

Some more changes:

r-downing commented 5 years ago

Very cool, thanks!