diff --git a/code/espurna/web.ino b/code/espurna/web.ino index d86735c0..5e8c2fbc 100644 --- a/code/espurna/web.ino +++ b/code/espurna/web.ino @@ -244,14 +244,20 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) { #endif // Clean wifi networks - for (int i = 0; i < network; i++) { - if (getSetting("pass" + String(i)).length() > 0) delSetting("pass" + String(i)); + int i = 0; + while (i < network) { + if (getSetting("ssid" + String(i)).length() == 0) { + delSetting("ssid" + String(i)); + break; + } + if (getSetting("pass" + String(i)).length() == 0) delSetting("pass" + String(i)); if (getSetting("ip" + String(i)).length() == 0) delSetting("ip" + String(i)); if (getSetting("gw" + String(i)).length() == 0) delSetting("gw" + String(i)); if (getSetting("mask" + String(i)).length() == 0) delSetting("mask" + String(i)); if (getSetting("dns" + String(i)).length() == 0) delSetting("dns" + String(i)); + ++i; } - for (int i = network; i 0) { save = changed = true; } @@ -261,6 +267,7 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) { delSetting("gw" + String(i)); delSetting("mask" + String(i)); delSetting("dns" + String(i)); + ++i; } }