Station WiFI - connection to router
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
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
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 ?
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 ?
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)?
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)?
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...
Who is online
Users browsing this forum: No registered users and 91 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.