[Resolved]wifi_station_set_config() fails sporadically.

robertfoss
Posts: 3
Joined: Thu Jul 09, 2015 5:43 pm

[Resolved]wifi_station_set_config() fails sporadically.

Postby robertfoss » Thu Sep 10, 2015 5:32 am

About 50% of the calls to wifi_station_set_config() fail. Which are the possible failure modes of wifi_station_set_config()?

Code: Select all

  struct station_config cnf;
  c_memset(&cnf, 0, sizeof(struct station_config));
  dns_hijack_http_urldecode(cnf.ssid, name_str_start, name_str_len);
  dns_hijack_http_urldecode(cnf.password, pwd_str_start, pwd_str_len);
 
  c_printf("\n"); 
  c_printf("WiFi Credentials Stored\n");
  c_printf("-----------------------\n");
  c_printf("name: \"%s\"\n", cnf.ssid);
  c_printf("pass: \"%s\"\n", cnf.password);
  c_printf("bssid_set: %u\n", cnf.bssid_set);
  c_printf("bssid: \"%s\"\n", cnf.bssid);
  c_printf("-----------------------\n\n");

  wifi_station_disconnect();
  while (wifi_station_set_config(&cnf) == FALSE)
  {
    c_printf("dns_hijack_http_handle_credentials failed. Unable to set STATION mode config.\n");
  }


Produces:

Code: Select all

WiFi Credentials Stored
-----------------------
name: "lovenest"
pass: "sweetlove"
bssid_set: 0
bssid: ""
-----------------------

dns_hijack_http_handle_credentials failed. Unable to set STATION mode config.

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

Re: wifi_station_set_config() fails sporadically.

Postby ESP_Faye » Thu Sep 10, 2015 1:53 pm

Hi,

Did you call “wifi_set_opmode(STATION_MODE)” first ?

Here is an example of wifi_station_set_config http://bbs.espressif.com/viewtopic.php?f=31&t=228

Thanks for your interest in ESP8266 !

robertfoss
Posts: 3
Joined: Thu Jul 09, 2015 5:43 pm

Re: wifi_station_set_config() fails sporadically.

Postby robertfoss » Thu Sep 10, 2015 11:04 pm

That does work better! Thank you.

It would have been nice if that was documented in the SDK or if there was a failure code describing the failure better.

blubb
Posts: 116
Joined: Mon Jun 22, 2015 5:35 am

Re: wifi_station_set_config() fails sporadically.

Postby blubb » Fri Sep 11, 2015 1:13 am

It is documented. In the manual it says: "This API can be called only if ESP8266 station is enabled."

Of course, it would be better to be able to set the config in every mode. But I guess there are technical reasons.

Who is online

Users browsing this forum: No registered users and 84 guests