diff --git a/README.md b/README.md index 441b0cf..23a679d 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,11 @@ WiFiManager wifi; ``` //parameter is name of access point wifi.autoConnect("AP-NAME"); +``` +or if you want to use and auto generated name from 'ESP' and the esp's Chip ID use +``` +wifi.autoConnect(); + ``` After you write your sketch and start the ESP, it will try to connect to WiFi. If it fails it starts in Access Point mode. diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 077ff4b..8dc1d58 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -62,7 +62,8 @@ void WiFiManager::begin(char const *apName) { } boolean WiFiManager::autoConnect() { - return autoConnect("NoNetESP"); + String ssid = "ESP" + String(ESP.getChipId()); + return autoConnect(ssid.c_str()); } boolean WiFiManager::autoConnect(char const *apName) { @@ -283,7 +284,7 @@ void WiFiManager::handleRoot() { server.sendContent(HTTP_HEAD_END); server.sendContent( - "
" + "

" ); server.sendContent( "
" diff --git a/WiFiManager.h b/WiFiManager.h index 4727c27..d288a2d 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -65,11 +65,11 @@ private: const String HTTP_404 = "HTTP/1.1 404 Not Found\r\n\r\n"; const String HTTP_200 = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"; const String HTTP_HEAD = "{v}"; - const String HTTP_STYLE = ""; + const String HTTP_STYLE = ""; const String HTTP_SCRIPT = ""; const String HTTP_HEAD_END = ""; const String HTTP_ITEM = "
{v}
"; - const String HTTP_FORM = "

"; + const String HTTP_FORM = "

"; const String HTTP_SAVED = "
Credentials Saved
Node will reboot in 5 seconds.
"; const String HTTP_END = ""; //const char HTTP_END[] PROGMEM = R"=====( diff --git a/examples/AutoConnect/AutoConnect.ino b/examples/AutoConnect/AutoConnect.ino index 286ba28..a0fb0f4 100644 --- a/examples/AutoConnect/AutoConnect.ino +++ b/examples/AutoConnect/AutoConnect.ino @@ -25,6 +25,9 @@ void setup() { //here "AutoConnectAP" //and goes into a blocking loop awaiting configuration wifi.autoConnect("AutoConnectAP"); + //or use this for auto generated name ESP + ChipID + //wifi.autoConnect(); + //if you get here you have connected to the WiFi Serial.println("connected...yeey :)");