How to remember more than one Wifi credentials

Bluescreen2001
Posts: 2
Joined: Fri Jun 01, 2018 12:39 am
Location: Germany
Contact:

How to remember more than one Wifi credentials

Postby Bluescreen2001 » Fri Jun 01, 2018 12:53 am

Hi,

as I read in the docs the ESP8266 can chache up to five Wifi networks. But I cannot get that working. During startup I set the maximum number of networks to five by using the following code:

Code: Select all

   printf("err:%i\r\n",wifi_station_ap_number_set(5));


Then I connect to one WLAN and query the Wifi list like this:

Code: Select all

   struct station_config config[5];
   int cnt = wifi_station_get_ap_info(config);
   printf("Number of known networks: %i\r\n", cnt);
   for (int i = 0; i < cnt; i++)
   {
      printf("%i: '%-16s' '%s'\r\n", i, config[i].ssid, config[i].password);
   }
   printf ("Connected to %i\r\n",wifi_station_get_current_ap_id());


I get two (?) networks, one is the right one, the other is empty.

Then I disconnect and connect to another WLAN and query again. Now I get five(?) networks. Three empty ones and the two I connected to. Looks nice.

But if I power cycle the ESP the ESP tries to connect only to the second Network even if that one is offline. And the list contains only the last connected Network. So it seems the network cache is not persistent. Is that normal behaviour, what sense is in caching the Networks like that? Or do I miss something?

Thorsten

Who is online

Users browsing this forum: No registered users and 299 guests