From dcad3c16c68e4fae47bcc6289051b75a35271a12 Mon Sep 17 00:00:00 2001 From: Adrian Scillato <35405447+ascillato@users.noreply.github.com> Date: Mon, 12 Apr 2021 13:31:31 -0300 Subject: [PATCH 1/4] Move WifiManager Log to Webserver file --- tasmota/support_wifi.ino | 1 - 1 file changed, 1 deletion(-) diff --git a/tasmota/support_wifi.ino b/tasmota/support_wifi.ino index 804070103..e85374eda 100644 --- a/tasmota/support_wifi.ino +++ b/tasmota/support_wifi.ino @@ -106,7 +106,6 @@ void WifiConfig(uint8_t type) } #ifdef USE_WEBSERVER else if (WIFI_MANAGER == Wifi.config_type || WIFI_MANAGER_RESET_ONLY == Wifi.config_type) { - AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_WCFG_2_WIFIMANAGER " " D_ACTIVE_FOR_3_MINUTES)); WifiManagerBegin(WIFI_MANAGER_RESET_ONLY == Wifi.config_type); } #endif // USE_WEBSERVER From c63b211009592bed93cf8d8aa5a0d19d4e2a52a5 Mon Sep 17 00:00:00 2001 From: Adrian Scillato <35405447+ascillato@users.noreply.github.com> Date: Mon, 12 Apr 2021 13:35:34 -0300 Subject: [PATCH 2/4] Fix Double Call of StartWebserver when it is in WiFiManager Mode --- tasmota/support_tasmota.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index eb852ca77..dab8dffc0 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -1305,7 +1305,7 @@ void Every250mSeconds(void) if (Settings.webserver) { #ifdef ESP8266 - StartWebserver(Settings.webserver, WiFi.localIP()); + if (!WifiIsInManagerMode()) { StartWebserver(Settings.webserver, WiFi.localIP()); } #endif // ESP8266 #ifdef ESP32 #ifdef USE_ETHERNET From 6a48b1a63d2e92991c1c70def2f207ea7d8573d5 Mon Sep 17 00:00:00 2001 From: Adrian Scillato <35405447+ascillato@users.noreply.github.com> Date: Mon, 12 Apr 2021 13:36:43 -0300 Subject: [PATCH 3/4] Webserver: Simplify Initial WiFi Configuration --- tasmota/xdrv_01_webserver.ino | 328 ++++++++++++++++++++++++++++------ 1 file changed, 270 insertions(+), 58 deletions(-) diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index e61df582f..25f8fa68f 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -34,6 +34,19 @@ #define WIFI_SOFT_AP_CHANNEL 1 // Soft Access Point Channel number between 1 and 11 as used by WifiManager web GUI #endif +#ifndef MAX_WIFI_NETWORKS_TO_SHOW +#define MAX_WIFI_NETWORKS_TO_SHOW 3 // Maximum number of Wifi Networks to show in the Wifi Configuration Menu BEFORE clicking on Show More Networks. +#endif + +#ifndef RESTART_AFTER_INITIAL_WIFI_CONFIG +#define RESTART_AFTER_INITIAL_WIFI_CONFIG true // Restart Tasmota after initial Wifi Config of a blank device +#endif // If disabled, Tasmota will keep both the wifi AP and the wifi connection to the router + // but only until next restart. +#ifndef AFTER_INITIAL_WIFI_CONFIG_GO_TO_NEW_IP // If RESTART_AFTER_INITIAL_WIFI_CONFIG and AFTER_INITIAL_WIFI_CONFIG_GO_TO_NEW_IP are true, +#define AFTER_INITIAL_WIFI_CONFIG_GO_TO_NEW_IP true // the user will be redirected to the new IP of Tasmota (in the new Network). +#endif // If the first is true, but this is false, the device will restart but the user will see + // a window telling that the WiFi Configuration was Ok and that the window can be closed. + const uint16_t CHUNKED_BUFFER_SIZE = (MESSZ / 2) - 100; // Chunk buffer size (should be smaller than half mqtt_data size = MESSZ) const uint16_t HTTP_REFRESH_TIME = 2345; // milliseconds @@ -102,6 +115,17 @@ const char HTTP_SCRIPT_WIFI[] PROGMEM = "eb('p1').focus();" "}"; +const char HTTP_SCRIPT_HIDE[] PROGMEM = + "function hidBtns() {" + "eb('butmo').style.display = 'none';" + "eb('butmod').style.display = 'none';" + "eb('but0').style.display = 'block';" + "eb('but1').style.display = 'block';" + "eb('but13').style.display = 'block';" + "eb('but0d').style.display = 'block';" + "eb('but13d').style.display = 'block';" + "}"; + const char HTTP_SCRIPT_RELOAD_TIME[] PROGMEM = "setTimeout(function(){location.href='.';},%d);"; @@ -259,13 +283,19 @@ const char HTTP_FORM_MODULE[] PROGMEM = "
" D_MODULE_TYPE " (%s)