From bb8e787947d24ffa54ea6a26356698d0d21b87c3 Mon Sep 17 00:00:00 2001 From: Adrian Scillato <35405447+ascillato@users.noreply.github.com> Date: Fri, 9 Jul 2021 13:27:47 -0300 Subject: [PATCH] Initial Wi-Fi Config: Fix Bug with SAVEDATA In some conditions, if the save button is pressed more than once, or the page is refreshed several times, the Wi-Fi credentials checking routine was disabling SAVEDATA in flash. This Fixs that condition. --- tasmota/xdrv_01_webserver.ino | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index 7eb9978aa..85a589a39 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -1792,16 +1792,17 @@ void HandleWifiConfiguration(void) { if ( WifiIsInManagerMode() ) { // Test WIFI Connection to Router // As Tasmota is in this case in AP mode, a STA connection can be established too at the same time + + if (WIFI_NOT_TESTING == Web.wifiTest) { + if (MAX_WIFI_OPTION == Web.old_wificonfig) { Web.old_wificonfig = Settings->sta_config; } + TasmotaGlobal.wifi_state_flag = Settings->sta_config = WIFI_MANAGER; + Web.save_data_counter = TasmotaGlobal.save_data_counter; + } + Web.wifi_test_counter = 9; // seconds to test user's proposed AP Web.wifiTest = WIFI_TESTING; - - Web.save_data_counter = TasmotaGlobal.save_data_counter; TasmotaGlobal.save_data_counter = 0; // Stop auto saving data - Updating Settings Settings->save_data = 0; - - if (MAX_WIFI_OPTION == Web.old_wificonfig) { Web.old_wificonfig = Settings->sta_config; } - TasmotaGlobal.wifi_state_flag = Settings->sta_config = WIFI_MANAGER; - TasmotaGlobal.sleep = 0; // Disable sleep TasmotaGlobal.restart_flag = 0; // No restart TasmotaGlobal.ota_state_flag = 0; // No OTA