AP caching in station mode

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

AP caching in station mode

Postby blubb » Wed Oct 11, 2017 7:43 am

Hi,

I have a question regarding the AP cache for station mode. I understand that ESP8266 can cache up to 5 APs is was successfully connected to. The SDK says:

wifi_station_ap_number_set

Sets the number of APs that will be cached for ESP8266 Station mode. Whenever
ESP8266 Station connects to an AP, it caches a record of this AP’s SSID and
password. The cached ID index starts from 0.


What I don't understand: Once cached, does ESP automatically connect to any of the cached APs if it comes into range? Or only the first (or zeroth) one? Is it my task to switch between them?

SDK says:

wifi_station_set_auto_connect

Set the ESP8266 Station to connect to the AP (whose ID is cached) automatically
or not when powered on. Auto-connection is enabled by default.


wifi_station_ap_change

Switch ESP8266 Station connection to AP as specified.
uint8 new_ap_id: AP’s record ID; start counting from 0.


wifi_station_get_current_ap_id

Get the current cached ID of AP. ESP8266 records the ID of each AP it connects
with. The ID number starts from 1.


Now that totally confuses me. The ID number, does it start from 0 or 1??

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

Re: AP caching in station mode

Postby ESP_Faye » Wed Oct 11, 2017 2:06 pm

Hi,

Sorry that it is a typo, the ID number starts from 0. We will revise the documentation.

And for the AP caching, you can refer to the examles/iot_demo, #define AT_CACHE.

Thanks for your interest in ESP8266!

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

Re: AP caching in station mode

Postby blubb » Wed Oct 11, 2017 5:11 pm

Ah, ok. I have to do the switching myself. I thought ESP looked for the right AP automatically on boot.

Thanks!

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

Re: AP caching in station mode

Postby blubb » Thu Oct 12, 2017 12:32 am

Is there a way to clear the cache without using system_restore (which clears pretty much everything and requires a restart)?

Who is online

Users browsing this forum: No registered users and 10 guests