mirror of
https://github.com/gunner47/GyverLamp.git
synced 2025-08-12 03:00:42 +03:00
Обновление библиотек
This commit is contained in:
@@ -143,18 +143,17 @@ void WiFiManager::setupConfigPortal() {
|
||||
dnsServer->start(DNS_PORT, "*", WiFi.softAPIP());
|
||||
|
||||
/* Setup web pages: root, wifi config pages, SO captive portal detectors and not found. */
|
||||
server->on(String(F("/")), std::bind(&WiFiManager::handleRoot, this));
|
||||
server->on(String(F("/wifi")), std::bind(&WiFiManager::handleWifi, this, true));
|
||||
server->on(String(F("/0wifi")), std::bind(&WiFiManager::handleWifi, this, false));
|
||||
server->on(String(F("/wifisave")), std::bind(&WiFiManager::handleWifiSave, this));
|
||||
server->on(String(F("/i")), std::bind(&WiFiManager::handleInfo, this));
|
||||
server->on(String(F("/r")), std::bind(&WiFiManager::handleReset, this));
|
||||
server->on(String(F("/")).c_str(), std::bind(&WiFiManager::handleRoot, this));
|
||||
server->on(String(F("/wifi")).c_str(), std::bind(&WiFiManager::handleWifi, this, true));
|
||||
server->on(String(F("/0wifi")).c_str(), std::bind(&WiFiManager::handleWifi, this, false));
|
||||
server->on(String(F("/wifisave")).c_str(), std::bind(&WiFiManager::handleWifiSave, this));
|
||||
server->on(String(F("/i")).c_str(), std::bind(&WiFiManager::handleInfo, this));
|
||||
server->on(String(F("/r")).c_str(), std::bind(&WiFiManager::handleReset, this));
|
||||
//server->on("/generate_204", std::bind(&WiFiManager::handle204, this)); //Android/Chrome OS captive portal check.
|
||||
server->on(String(F("/fwlink")), std::bind(&WiFiManager::handleRoot, this)); //Microsoft captive portal. Maybe not needed. Might be handled by notFound handler.
|
||||
server->on(String(F("/fwlink")).c_str(), 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
|
||||
DEBUG_WM(F("HTTP server started"));
|
||||
|
||||
}
|
||||
|
||||
boolean WiFiManager::autoConnect() {
|
||||
@@ -283,7 +282,7 @@ int WiFiManager::connectWifi(String ssid, String pass) {
|
||||
DEBUG_WM(WiFi.localIP());
|
||||
}
|
||||
//fix for auto connect racing issue
|
||||
if (WiFi.status() == WL_CONNECTED) {
|
||||
if (WiFi.status() == WL_CONNECTED && (WiFi.SSID() == ssid)) {
|
||||
DEBUG_WM(F("Already connected. Bailing out."));
|
||||
return WL_CONNECTED;
|
||||
}
|
||||
@@ -291,7 +290,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(F("Using last saved values, should be faster"));
|
||||
//trying to fix connection in progress hanging
|
||||
ETS_UART_INTR_DISABLE();
|
||||
@@ -332,7 +331,7 @@ uint8_t WiFiManager::waitForConnectResult() {
|
||||
keepConnecting = false;
|
||||
DEBUG_WM (F("Connection timed out"));
|
||||
}
|
||||
if (status == WL_CONNECTED || status == WL_CONNECT_FAILED) {
|
||||
if (status == WL_CONNECTED) {
|
||||
keepConnecting = false;
|
||||
}
|
||||
delay(100);
|
||||
@@ -420,12 +419,12 @@ void WiFiManager::handleRoot() {
|
||||
return;
|
||||
}
|
||||
|
||||
String page = FPSTR(HTTP_HEAD);
|
||||
String page = FPSTR(HTTP_HEADER);
|
||||
page.replace("{v}", "Options");
|
||||
page += FPSTR(HTTP_SCRIPT);
|
||||
page += FPSTR(HTTP_STYLE);
|
||||
page += _customHeadElement;
|
||||
page += FPSTR(HTTP_HEAD_END);
|
||||
page += FPSTR(HTTP_HEADER_END);
|
||||
page += String(F("<h1>"));
|
||||
page += _apName;
|
||||
page += String(F("</h1>"));
|
||||
@@ -441,12 +440,12 @@ void WiFiManager::handleRoot() {
|
||||
/** Wifi config page handler */
|
||||
void WiFiManager::handleWifi(boolean scan) {
|
||||
|
||||
String page = FPSTR(HTTP_HEAD);
|
||||
String page = FPSTR(HTTP_HEADER);
|
||||
page.replace("{v}", "Config ESP");
|
||||
page += FPSTR(HTTP_SCRIPT);
|
||||
page += FPSTR(HTTP_STYLE);
|
||||
page += _customHeadElement;
|
||||
page += FPSTR(HTTP_HEAD_END);
|
||||
page += FPSTR(HTTP_HEADER_END);
|
||||
|
||||
if (scan) {
|
||||
int n = WiFi.scanNetworks();
|
||||
@@ -636,12 +635,12 @@ void WiFiManager::handleWifiSave() {
|
||||
optionalIPFromString(&_sta_static_sn, sn.c_str());
|
||||
}
|
||||
|
||||
String page = FPSTR(HTTP_HEAD);
|
||||
String page = FPSTR(HTTP_HEADER);
|
||||
page.replace("{v}", "Credentials Saved");
|
||||
page += FPSTR(HTTP_SCRIPT);
|
||||
page += FPSTR(HTTP_STYLE);
|
||||
page += _customHeadElement;
|
||||
page += FPSTR(HTTP_HEAD_END);
|
||||
page += FPSTR(HTTP_HEADER_END);
|
||||
page += FPSTR(HTTP_SAVED);
|
||||
page += FPSTR(HTTP_END);
|
||||
|
||||
@@ -657,12 +656,12 @@ void WiFiManager::handleWifiSave() {
|
||||
void WiFiManager::handleInfo() {
|
||||
DEBUG_WM(F("Info"));
|
||||
|
||||
String page = FPSTR(HTTP_HEAD);
|
||||
String page = FPSTR(HTTP_HEADER);
|
||||
page.replace("{v}", "Info");
|
||||
page += FPSTR(HTTP_SCRIPT);
|
||||
page += FPSTR(HTTP_STYLE);
|
||||
page += _customHeadElement;
|
||||
page += FPSTR(HTTP_HEAD_END);
|
||||
page += FPSTR(HTTP_HEADER_END);
|
||||
page += F("<dl>");
|
||||
page += F("<dt>Chip ID</dt><dd>");
|
||||
page += ESP.getChipId();
|
||||
@@ -698,12 +697,12 @@ void WiFiManager::handleInfo() {
|
||||
void WiFiManager::handleReset() {
|
||||
DEBUG_WM(F("Reset"));
|
||||
|
||||
String page = FPSTR(HTTP_HEAD);
|
||||
String page = FPSTR(HTTP_HEADER);
|
||||
page.replace("{v}", "Info");
|
||||
page += FPSTR(HTTP_SCRIPT);
|
||||
page += FPSTR(HTTP_STYLE);
|
||||
page += _customHeadElement;
|
||||
page += FPSTR(HTTP_HEAD_END);
|
||||
page += FPSTR(HTTP_HEADER_END);
|
||||
page += F("Module will reset in a few seconds.");
|
||||
page += FPSTR(HTTP_END);
|
||||
|
||||
|
Reference in New Issue
Block a user