Setting wifi configuration

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Setting wifi configuration

Postby burkulesomesh43 » Mon Dec 24, 2018 7:29 pm

Hi all,
I want to connect to two wifi networks with the difference of some interval of time.
for example: network1 for 10 min and network2 for 10 minutes.
but for changing the configuration I want to stop the wifi then set the configuration and then start the wifi.
that is in idf like->>>

Code: Select all

ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config1) );
ESP_ERROR_CHECK( esp_wifi_start() );
esp_wifi_stop();
ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config2) );
ESP_ERROR_CHECK( esp_wifi_start() );
esp_wifi_stop();
ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config1) );
ESP_ERROR_CHECK( esp_wifi_start() );
So does it affect the performance of esp32?
Or there is any another solutions to work this way?
--
Somesh Burkule

hoainguyen265
Posts: 10
Joined: Tue Nov 13, 2018 8:17 am

Re: Setting wifi configuration

Postby hoainguyen265 » Tue Dec 25, 2018 4:04 am

How about just disconnect wifi, set up new config and reconnect to wifi again?

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: Setting wifi configuration

Postby burkulesomesh43 » Tue Dec 25, 2018 5:03 am

hoainguyen265 wrote:
Tue Dec 25, 2018 4:04 am
How about just disconnect wifi, set up new config and reconnect to wifi again?
yes. It will also work.
but I want to ask you that it will affect the performance of esp32 or not.
because I want to do it for several times for whole life cycle of esp32.
--
Somesh Burkule

hoainguyen265
Posts: 10
Joined: Tue Nov 13, 2018 8:17 am

Re: Setting wifi configuration

Postby hoainguyen265 » Tue Dec 25, 2018 7:11 am

I think it just like using wifi on mobile phone. When use want to connect to another wifi, you just disconnect and reconnect. And calling

Code: Select all

esp_wifi_start();  esp_wifi_stop()
is the same with disable and enable wifi on mobile phone and doing this periodically is not good.

So in my opinion, if you just want change wifi ssid, just disconnect, set up new wifi ssid and reconnect is good choice.

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: Setting wifi configuration

Postby burkulesomesh43 » Tue Dec 25, 2018 7:41 am

hoainguyen265 wrote:
Tue Dec 25, 2018 7:11 am
I think it just like using wifi on mobile phone. When use want to connect to another wifi, you just disconnect and reconnect. And calling

Code: Select all

esp_wifi_start();  esp_wifi_stop()
is the same with disable and enable wifi on mobile phone and doing this periodically is not good.

So in my opinion, if you just want change wifi ssid, just disconnect, set up new wifi ssid and reconnect is good choice.
Ok. thank you for your response.
--
Somesh Burkule

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Setting wifi configuration

Postby ESP_igrr » Tue Dec 25, 2018 10:19 am

Since by default Wi-Fi configuration is stored into flash, you may want to call esp_wifi_set_storage function with WIFI_STORAGE_RAM argument. In this case configuration will not be saved in flash, and flash lifetime will not be affected.

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: Setting wifi configuration

Postby burkulesomesh43 » Tue Dec 25, 2018 10:32 am

ESP_igrr wrote:
Tue Dec 25, 2018 10:19 am
Since by default Wi-Fi configuration is stored into flash, you may want to call esp_wifi_set_storage function with WIFI_STORAGE_RAM argument. In this case configuration will not be saved in flash, and flash lifetime will not be affected.
I am already using this.
thanks.
--
Somesh Burkule

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: Setting wifi configuration

Postby burkulesomesh43 » Wed Dec 26, 2018 7:41 am

hoainguyen265 wrote:
Tue Dec 25, 2018 7:11 am
I think it just like using wifi on mobile phone. When use want to connect to another wifi, you just disconnect and reconnect. And calling

Code: Select all

esp_wifi_start();  esp_wifi_stop()
is the same with disable and enable wifi on mobile phone and doing this periodically is not good.

So in my opinion, if you just want change wifi ssid, just disconnect, set up new wifi ssid and reconnect is good choice.
Heyy, it works without wifi_disconnect. just changed ssid and reconnect.
--
Somesh Burkule

hoainguyen265
Posts: 10
Joined: Tue Nov 13, 2018 8:17 am

Re: Setting wifi configuration

Postby hoainguyen265 » Wed Dec 26, 2018 8:37 am

Nice :D

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Setting wifi configuration

Postby Ritesh » Fri Dec 28, 2018 6:31 pm

ESP_igrr wrote:
Tue Dec 25, 2018 10:19 am
Since by default Wi-Fi configuration is stored into flash, you may want to call esp_wifi_set_storage function with WIFI_STORAGE_RAM argument. In this case configuration will not be saved in flash, and flash lifetime will not be affected.
Hi,

We are storing WiFi configurations into flash memory as per our requirements. So, what will be the lifetime of flash operation for single device? Because we are also in same phase like many times WiFi configurations will be changed as per our project requirements.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: karunt and 96 guests