From bdedb2b7ae51ed13c2b3e766ad7eac126c201c92 Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Fri, 13 Mar 2020 04:43:54 +0300 Subject: [PATCH] wifi: unconditionally erase all settings after fixed index (#2175) --- code/espurna/wifi.ino | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/code/espurna/wifi.ino b/code/espurna/wifi.ino index 331644d2..c7c21104 100644 --- a/code/espurna/wifi.ino +++ b/code/espurna/wifi.ino @@ -94,13 +94,17 @@ void _wifiConfigure() { const auto pass = getSetting({"pass", index}, _wifiPass(index)); if (!ssid.length()) { - delSetting({"ssid", index}); - delSetting({"pass", index}); - delSetting({"ip", index}); - delSetting({"gw", index}); - delSetting({"mask", index}); - delSetting({"dns", index}); - continue; + auto current = index; + do { + delSetting({"ssid", index}); + delSetting({"pass", index}); + delSetting({"ip", index}); + delSetting({"gw", index}); + delSetting({"mask", index}); + delSetting({"dns", index}); + } while (++index < WIFI_MAX_NETWORKS); + index = current; + break; } bool result = false;