Station WiFI - connection to router

FrenkR
Posts: 44
Joined: Thu Dec 04, 2014 9:25 am

Station WiFI - connection to router

Postby FrenkR » Thu Dec 25, 2014 1:28 am

Hi,
using 0.9.4, I am trying to connect to wifi network by code.
After calling wifi_station_connect(), looks like everything is then automatic(reconnect, scanning WiFi networks).
Is there any way to disable this automation steps and doing this by myself?

My code looks like:
Step 1.:wifi_Station_set_auto_connect() ... to disable auto connection to WiFI
Step 2.:wifi_station_get_config() to get structure of configuration
Step 3.:wifi_station_set_config() ... instruction to which wifi to connect
Step 4.: wifi_station_dhcpc_stop() ...disable dhcp (I wan't to setup IP by myself not retrieve it from WiFi network)
Step 5.: wifi_set_ip_info() ... setup my IP address, mask and gateway
Step 6.:wifi_station_connect() ... start connecting to wifi
Step 7.:wifi_station_get_connect_status() ... using timer, check status of connection. if connection is not STATION_GOT_IP(range from STATION_WRONG_PASSWORD to STATION_CONNECT_FAIL), then call
Step 8.:wifi_station_disconnect() and start step 3.

Problem is, that system after calling wifi_station_connect() and when connection is broken, rescans and tries to reconnect to wifi automatically(when system detects unsucessful connect, it does step 8 and step 6 again). Is there any way to disable this behavior?
Also after loosing a connect to AP and automatic reconnection, it looks like that system does not initialize properly. After some time(e.g. 30 min) of constantly losing a connection, system cannot connect anymore. After restart, module connects itself again.

is there any API to totally initializi WiFi infrastructure that can be called before connection?

Rgds,
Frenk

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: Station WiFI - connection to router

Postby ESP_Faye » Thu Dec 25, 2014 5:27 pm

There is a problem of calling wifi_station_get_connect_status() with static ip, we have solved it. http://bbs.espressif.com/viewtopic.php?f=7&t=104

system after calling wifi_station_connect() and when connection is broken, rescans and tries to reconnect to wifi automatically(when system detects unsucessful connect, it does step 8 and step 6 again). Is there any way to disable this behavior?
-> call wifi_station_disconnect() to disconnect a router, we won't connect to it automatically ; call wifi_Station_set_auto_connect(0); we won't connect to router automatically when power on.

After some time(e.g. 30 min) of constantly losing a connection, system cannot connect anymore. After restart, module connects itself again.
-> Sorry that I'm a little confused what are you asking.. Can you offer more information like some logs ? what is the connection means ? TCP connection or wifi connection to a router ?

FrenkR
Posts: 44
Joined: Thu Dec 04, 2014 9:25 am

Re: Station WiFI - connection to router

Postby FrenkR » Fri Dec 26, 2014 8:51 am

wifi connection to a router.

is there any way to get callback immediately after status wifi_station_connect() is set to IDLE or range from STATION_WRONG_PASSWORD to STATION_CONNECT_FAIL?
Right now, after calling wifi_station_connect(), I have timer that checks wifi connection every 1 second. From debug window, I see that if connection is broken, system automatically tries to reconnect again. For me, better option would be callback function on status change. In callback, I would disconnect, (re)initialize parameters and connect again with some delay.

Currently I have only UART1 debug info on GPIO2. Is there any setup (API) to get more detailed (debug) info about connecting to wifi (station mode)?

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: Station WiFI - connection to router

Postby ESP_Faye » Fri Dec 26, 2014 4:00 pm

Sorry , we don't have that callback right now.. But we will think it over..

jackon
Posts: 28
Joined: Thu Oct 23, 2014 9:05 am

Re: Station WiFI - connection to router

Postby jackon » Fri Dec 26, 2014 4:20 pm

FrenkR wrote:wifi connection to a router.

is there any way to get callback immediately after status wifi_station_connect() is set to IDLE or range from STATION_WRONG_PASSWORD to STATION_CONNECT_FAIL?
Right now, after calling wifi_station_connect(), I have timer that checks wifi connection every 1 second. From debug window, I see that if connection is broken, system automatically tries to reconnect again. For me, better option would be callback function on status change. In callback, I would disconnect, (re)initialize parameters and connect again with some delay.

Currently I have only UART1 debug info on GPIO2. Is there any setup (API) to get more detailed (debug) info about connecting to wifi (station mode)?


Our OS version SDK will meet your requirement soon...

FrenkR
Posts: 44
Joined: Thu Dec 04, 2014 9:25 am

Re: Station WiFI - connection to router

Postby FrenkR » Fri Dec 26, 2014 5:58 pm

thank you for your answer. Product is getting better and better.

Who is online

Users browsing this forum: No registered users and 211 guests