mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-06 19:51:03 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04d47882a7 | ||
|
|
028bdeeb17 | ||
|
|
44e828e77a | ||
|
|
801ae82ef5 |
@@ -273,7 +273,11 @@ If you connect to the created configuration Access Point but the configuration p
|
||||
If trying to connect ends up in an endless loop, try to add `setConnectTimeout(60)` before `autoConnect();`. The parameter is timeout to try connecting in seconds.
|
||||
|
||||
## Releases
|
||||
#### 0.11
|
||||
#### 0.12
|
||||
- removed 204 header response
|
||||
- fixed incompatibility with other libs using isnan and other std:: functions without namespace
|
||||
|
||||
##### 0.11
|
||||
- a lot more reliable reconnecting to networks
|
||||
- custom html in custom parameters (for read only params)
|
||||
- custom html in custom parameter form (like labels)
|
||||
|
||||
+19
-22
@@ -115,7 +115,7 @@ void WiFiManager::setupConfigPortal() {
|
||||
server->on("/wifisave", std::bind(&WiFiManager::handleWifiSave, this));
|
||||
server->on("/i", std::bind(&WiFiManager::handleInfo, this));
|
||||
server->on("/r", std::bind(&WiFiManager::handleReset, this));
|
||||
server->on("/generate_204", std::bind(&WiFiManager::handle204, this)); //Android/Chrome OS captive portal check.
|
||||
//server->on("/generate_204", std::bind(&WiFiManager::handle204, this)); //Android/Chrome OS captive portal check.
|
||||
server->on("/fwlink", std::bind(&WiFiManager::handleRoot, this)); //Microsoft captive portal. Maybe not needed. Might be handled by notFound handler.
|
||||
server->onNotFound (std::bind(&WiFiManager::handleNotFound, this));
|
||||
server->begin(); // Web server start
|
||||
@@ -229,7 +229,7 @@ int WiFiManager::connectWifi(String ssid, String pass) {
|
||||
if (ssid != "") {
|
||||
WiFi.begin(ssid.c_str(), pass.c_str());
|
||||
} else {
|
||||
if(WiFi.SSID()) {
|
||||
if (WiFi.SSID()) {
|
||||
DEBUG_WM("Using last saved values, should be faster");
|
||||
//trying to fix connection in progress hanging
|
||||
ETS_UART_INTR_DISABLE();
|
||||
@@ -400,30 +400,27 @@ void WiFiManager::handleWifi(boolean scan) {
|
||||
// RSSI SORT
|
||||
|
||||
// old sort
|
||||
// for (int i = 0; i < n; i++) {
|
||||
// for (int j = i + 1; j < n; j++) {
|
||||
// if (WiFi.RSSI(indices[j]) > WiFi.RSSI(indices[i])) {
|
||||
// //int temp = indices[j];
|
||||
// //indices[j] = indices[i];
|
||||
// //indices[i] = temp;
|
||||
// std::swap(indices[i], indices[j]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (int j = i + 1; j < n; j++) {
|
||||
if (WiFi.RSSI(indices[j]) > WiFi.RSSI(indices[i])) {
|
||||
std::swap(indices[i], indices[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(indices, indices + n, [](const int & a, const int & b) -> bool
|
||||
{
|
||||
/*std::sort(indices, indices + n, [](const int & a, const int & b) -> bool
|
||||
{
|
||||
return WiFi.RSSI(a) > WiFi.RSSI(b);
|
||||
});
|
||||
});*/
|
||||
|
||||
// remove duplicates ( must be RSSI sorted )
|
||||
if(_removeDuplicateAPs){
|
||||
if (_removeDuplicateAPs) {
|
||||
String cssid;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if(indices[i] == -1) continue;
|
||||
if (indices[i] == -1) continue;
|
||||
cssid = WiFi.SSID(indices[i]);
|
||||
for (int j = i + 1; j < n; j++) {
|
||||
if(cssid == WiFi.SSID(indices[j])){
|
||||
if (cssid == WiFi.SSID(indices[j])) {
|
||||
DEBUG_WM("DUP AP: " + WiFi.SSID(indices[j]));
|
||||
indices[j] = -1; // set dup aps to index -1
|
||||
}
|
||||
@@ -433,7 +430,7 @@ void WiFiManager::handleWifi(boolean scan) {
|
||||
|
||||
//display networks in page
|
||||
for (int i = 0; i < n; i++) {
|
||||
if(indices[i] == -1) continue; // skip dups
|
||||
if (indices[i] == -1) continue; // skip dups
|
||||
DEBUG_WM(WiFi.SSID(indices[i]));
|
||||
DEBUG_WM(WiFi.RSSI(indices[i]));
|
||||
int quality = getRSSIasQuality(WiFi.RSSI(indices[i]));
|
||||
@@ -651,14 +648,14 @@ void WiFiManager::handleReset() {
|
||||
|
||||
|
||||
|
||||
|
||||
void WiFiManager::handle204() {
|
||||
//removed as mentioned here https://github.com/tzapu/WiFiManager/issues/114
|
||||
/*void WiFiManager::handle204() {
|
||||
DEBUG_WM(F("204 No Response"));
|
||||
server->sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||
server->sendHeader("Pragma", "no-cache");
|
||||
server->sendHeader("Expires", "-1");
|
||||
server->send ( 204, "text/plain", "");
|
||||
}
|
||||
}*/
|
||||
|
||||
void WiFiManager::handleNotFound() {
|
||||
if (captivePortal()) { // If captive portal redirect instead of displaying the error page.
|
||||
|
||||
+1
-5
@@ -17,21 +17,17 @@
|
||||
#include <ESP8266WebServer.h>
|
||||
#include <DNSServer.h>
|
||||
#include <memory>
|
||||
#undef min
|
||||
#undef max
|
||||
#include <algorithm>
|
||||
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
|
||||
const char HTTP_200[] PROGMEM = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n";
|
||||
const char HTTP_HEAD[] PROGMEM = "<!DOCTYPE html><html lang=\"en\"><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\"/><title>{v}</title>";
|
||||
const char HTTP_STYLE[] PROGMEM = "<style>.c{text-align: center;} div,input{padding:5px;font-size:1em;} input{width:95%;} body{text-align: center;font-family:verdana;} button{border:0;border-radius:0.3rem;background-color:#1fa3ec;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%;} .q{float: right;width: 64px;text-align: right;} .l{background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAALVBMVEX///8EBwfBwsLw8PAzNjaCg4NTVVUjJiZDRUUUFxdiZGSho6OSk5Pg4eFydHTCjaf3AAAAZElEQVQ4je2NSw7AIAhEBamKn97/uMXEGBvozkWb9C2Zx4xzWykBhFAeYp9gkLyZE0zIMno9n4g19hmdY39scwqVkOXaxph0ZCXQcqxSpgQpONa59wkRDOL93eAXvimwlbPbwwVAegLS1HGfZAAAAABJRU5ErkJggg==\") no-repeat left center;background-size: 1em;}</style>";
|
||||
const char HTTP_SCRIPT[] PROGMEM = "<script>function c(l){document.getElementById('s').value=l.innerText||l.textContent;document.getElementById('p').focus();}</script>";
|
||||
const char HTTP_HEAD_END[] PROGMEM = "</head><body><div style='text-align:left;display:inline-block;min-width:260px;'>";
|
||||
const char HTTP_PORTAL_OPTIONS[] PROGMEM = "<form action=\"/wifi\" method=\"get\"><button>Configure WiFi</button></form><br/><form action=\"/0wifi\" method=\"get\"><button>Configure WiFi (No Scan)</button></form><br/><form action=\"/i\" method=\"get\"><button>Info</button></form><br/><form action=\"/r\" method=\"post\"><button>Reset</button></form>";
|
||||
const char HTTP_ITEM[] PROGMEM = "<div><a href='#p' onclick='c(this)'>{v}</a> <span class='q {i}'>{r}%</span></div>";
|
||||
//const char HTTP_ITEM_PADLOCK[] PROGMEM = "<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAALVBMVEX///8EBwfBwsLw8PAzNjaCg4NTVVUjJiZDRUUUFxdiZGSho6OSk5Pg4eFydHTCjaf3AAAAZElEQVQ4je2NSw7AIAhEBamKn97/uMXEGBvozkWb9C2Zx4xzWykBhFAeYp9gkLyZE0zIMno9n4g19hmdY39scwqVkOXaxph0ZCXQcqxSpgQpONa59wkRDOL93eAXvimwlbPbwwVAegLS1HGfZAAAAABJRU5ErkJggg==' width='13px'/>";
|
||||
const char HTTP_FORM_START[] PROGMEM = "<form method='get' action='wifisave'><input id='s' name='s' length=32 placeholder='SSID'><br/><input id='p' name='p' length=64 type='password' placeholder='password'><br/>";
|
||||
const char HTTP_FORM_PARAM[] PROGMEM = "<br/><input id='{i}' name='{n}' length={l} placeholder='{p}' value='{v}' {c}>";
|
||||
const char HTTP_FORM_END[] PROGMEM = "<br/><button type='submit'>save</button></form>";
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@
|
||||
},
|
||||
"frameworks": "arduino",
|
||||
"platforms": "espressif",
|
||||
"version": "0.11"
|
||||
"version": "0.12"
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
name=WiFiManager
|
||||
version=0.11
|
||||
version=0.12
|
||||
author=tzapu
|
||||
maintainer=tzapu
|
||||
sentence=ESP8266 WiFi Connection manager with fallback web configuration portal
|
||||
|
||||
Reference in New Issue
Block a user