Even though ESP8266 can be in softAP + station mode, it actually has only one hardware channel.

So in softAP + station mode, ESP8266 softAP will adjust its channel configuration to be as same as ESP8266 station.

This limitation may cause some inconvenience in softAP + station mode users need to pay attention, for example:Case 1. (1) If user connect ESP8266 station to a router(e.g. router is in channel 6). (2) Then set ESP8266 softAP by wifi_softap_set_config. (3) The API may return true, but channel will always be channel 6. Because we have only one hardware channel.Case 2. (1) If user set ESP8266 softAP a channel number(e.g. channel 5) by wifi_softap_set_config. (2) Some stations connected to ESP8266 softAP. (3) Then connect ESP8266 station to a router of which channel number is different (e.g. channel 6). (4) ESP8266 softAP has to adjust its channel to be as same as ESP8266 station, in this case, is channel 6. (5) So the stations that connected to ESP8266 softAP in step 2 will be disconnected because of the channel change. Case 3. (1) Other stations are connected to the ESP8266 softAP. (2) If the ESP8266‘s station interface has been scanning or trying to connect to a target router, the ESP8266 softAP-end connection may break.This is because the ESP8266 station will try to find its target router in different channels, which means it will keep changing channels, and as a result, the ESP8266 channel is changing, too. Therefore, the ESP8266 softAP-end connection may break.In cases like this, users can set a timer to call wifi_station_disconnect to stop the ESP8266 station from continuously trying to connect to the router. Or they can call wifi_station_set_reconnect_policy or wifi_station_set_auto_connect to disable the ESP8266 station from reconnecting to the router.

wifi_station_set_reconnect_policy(false); // if the ESP8266 station connected to the router, and then the connection broke, ESP8266 will not try to reconnect to the router.

wifi_station_set_auto_connect(false); //the ESP8266 station will not try to connect to the router automatically when power on until wifi_station_connect is called.

wifi_station_disconnect(); // ESP8266 station disconnects to the router, or ESP8266 station stops trying to connect to the target router.

Documentation

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.