From 557d06a557ed802d3e92bafc4a0f0b9db1148b7b Mon Sep 17 00:00:00 2001 From: Pavel Brychta Date: Mon, 12 Aug 2019 10:17:52 +0200 Subject: [PATCH 1/2] 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 From 4590e99a540cafad66ea820e6853e8371705495a Mon Sep 17 00:00:00 2001 From: Pavel Brychta Date: Mon, 12 Aug 2019 11:04:01 +0200 Subject: [PATCH 2/2] Oprava chovani pri vynucene konfiguraci a pozadavku rychleho startu. Posun cisla verze v json --- library.json | 2 +- library.properties | 2 +- src/WiFiConfig.cpp | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/library.json b/library.json index 97f2f20..bc41079 100644 --- a/library.json +++ b/library.json @@ -12,7 +12,7 @@ "type": "git", "url": "http://git.xpablo.cz/pablo2048/WiFiConfig.git" }, - "version": "6.0", + "version": "6.3", "license": "MIT", "frameworks": "arduino", "platforms": ["espressif8266", "espressif32"], diff --git a/library.properties b/library.properties index 81d4c67..62ceb51 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=WiFiConfig -version=6.0 +version=6.3 author=Pavel Brychta maintainer=Pavel Brychta sentence=Enables seamless module configuration. diff --git a/src/WiFiConfig.cpp b/src/WiFiConfig.cpp index 8094c5e..b3a23d2 100644 --- a/src/WiFiConfig.cpp +++ b/src/WiFiConfig.cpp @@ -24,7 +24,7 @@ * * V5.3 - 8.12.2017 - prepracovano presmerovani v Captive portalu, DEBUG_MSG makro upraveno na posledni pouzivanou verzi, scitani retezcu prepracovano na .concat. Pripsany Informace o modulu, reakce na Reset * - * V5.2 - 20.4.2017 - Pokud je pouzite v timeoutu EC_DONT_RUN_CONFIGAP tak se vracime okamzite a necekame na pripojeni k WiFi (take nevolame zadnou callback metodu). + * V5.2 - 20.4.2017 - Pokud je pouzite v timeoutu WC_DONT_RUN_CONFIGAP tak se vracime okamzite a necekame na pripojeni k WiFi (take nevolame zadnou callback metodu). * Navratovy kod je pak WCR_CONFIGAP_NOT_STARTED . * * V5.1 - 3.4.2017 - Webove rozhrani upravene pro snadnejsi ovladani na telefonu/tabletu, sila signalu AP zobrazena jako barevne odliseny indikator. @@ -921,6 +921,8 @@ wificonfigresult_t WiFiConfig::begin(int configarea, int forceConfigure, int tim if ((timeout > 0) && (40 > timeout)) timeout = 40; // timeout musi byt minimalne 40 sekund + if ((0 == forceConfigure) && (WC_DONT_RUN_CONFIGAP == timeout)) + timeout = 40; _timeout = timeout; if (_timeout > 0) _time = millis() + (_timeout * 1000); // spocitame si novy cas, kdy budeme modul restartovat