ESP8266 Developer Zone The Official ESP8266 Forum 2015-09-11T01:13:16+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=1085 2015-09-11T01:13:16+08:00 2015-09-11T01:13:16+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1085&p=3651#p3651 <![CDATA[Re: wifi_station_set_config() fails sporadically.]]>
Of course, it would be better to be able to set the config in every mode. But I guess there are technical reasons.

Statistics: Posted by blubb — Fri Sep 11, 2015 1:13 am


]]>
2015-09-10T23:04:23+08:00 2015-09-10T23:04:23+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1085&p=3649#p3649 <![CDATA[Re: wifi_station_set_config() fails sporadically.]]>
It would have been nice if that was documented in the SDK or if there was a failure code describing the failure better.

Statistics: Posted by robertfoss — Thu Sep 10, 2015 11:04 pm


]]>
2015-09-10T13:53:29+08:00 2015-09-10T13:53:29+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1085&p=3631#p3631 <![CDATA[Re: wifi_station_set_config() fails sporadically.]]>
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 !

Statistics: Posted by ESP_Faye — Thu Sep 10, 2015 1:53 pm


]]>
2015-09-10T05:32:42+08:00 2015-09-10T05:32:42+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1085&p=3615#p3615 <![CDATA[[Resolved]wifi_station_set_config() fails sporadically.]]>

Code:

  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:

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

dns_hijack_http_handle_credentials failed. Unable to set STATION mode config.

Statistics: Posted by robertfoss — Thu Sep 10, 2015 5:32 am


]]>