From 557d06a557ed802d3e92bafc4a0f0b9db1148b7b Mon Sep 17 00:00:00 2001 From: Pavel Brychta Date: Mon, 12 Aug 2019 10:17:52 +0200 Subject: [PATCH] Zmena default ip adresy --- src/WiFiConfig.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/WiFiConfig.cpp b/src/WiFiConfig.cpp index b4f5e0b..8094c5e 100644 --- a/src/WiFiConfig.cpp +++ b/src/WiFiConfig.cpp @@ -1,4 +1,7 @@ /* + * V6.3 - 12.8.2019 - IP adresa Captive portalu je zmenena na 172.217.28.1 kvuli funkcnosti na Android zarizenich (viz. zmena zde https://github.com/esp8266/Arduino/blob/master/libraries/DNSServer/examples/CaptivePortal/CaptivePortal.ino) + * ladici vypis pri zachyceni presmerovani v Captive portalu. + * * V6.2 - 12.12.2018- Nastaveni jmena zarizeni nadale NENI soucasti WiFiConfig a je treba ho pridat jako uzivatelsky parametr. Je to proto, protoze * se ukazalo, ze neni dobre z externiho kodu sahat do vnitrni struktury WiFiConfig (napr. pri ukladani noveho jmena). * @@ -313,7 +316,13 @@ void WiFiConfig::_handleNotFound(void) } else { - server->sendHeader(F("Location"), String(F("http://")) + server->client().localIP().toString() + String(F("/index.htm")), true); + String redirect; + redirect.reserve(256); + redirect = F("http://"); + redirect.concat(server->client().localIP().toString()); + redirect.concat(F("/index.htm")); + DEBUG_MSG("Redirection to: %s\r\n", redirect.c_str()); + server->sendHeader(F("Location"), redirect, true); server->send_P(302, TEXTPLAIN, PSTR("Redirect")); } } @@ -697,7 +706,7 @@ wificonfigresult_t WiFiConfig::_setupAP(wificonfig_cb cb) #endif /* Soft AP network parameters */ - IPAddress apIP(192, 168, 4, 1); + IPAddress apIP(172, 217, 28, 1); IPAddress netMsk(255, 255, 255, 0); WiFi.disconnect(); // pro jistotu se odpojime