switch to different wifi
PatrickMons opened this issue · 2 comments
PatrickMons commented
when you setup a connection to wifi everithing is fine but if you need to switch to another wifi end the name of new wifi is shorter than the previous one there is a problem because the last part of previous name is attacced to new one
example:
first ssid name "abcdefghilmn"
sec. ssid name "123456"
the secon ssid name will be: "123456ghilmn"
so the result is no wifi found and go again on ap mode
cotestatnt commented
Thanks @PatrickMons for your feedback.
I will check for a solution as soon as possible.
PatrickMons commented
I solved clearing the config before writing new value as this:
file esp-fs-webserver.cpp line303:
#if defined(ESP8266)
struct station_config stationConf;
wifi_station_get_config_default(&stationConf);
//devo azzerare la configurazione prima di salvarla di nuovo
memset(&stationConf, 0, sizeof(stationConf));
os_memcpy(&stationConf.ssid, ssid.c_str(), ssid.length());
os_memcpy(&stationConf.password, pass.c_str(), pass.length());
wifi_set_opmode( STATION_MODE );
wifi_station_set_config(&stationConf);