Have noticed that AP mode is unstable. Here is screenshot. "White" is my ESP8266 signal that is located near me.
Such behavior leads to situation when you can't connect to AP and AP is not shown in list of available access points on phone.
Sometimes this "silence" intervals are short, sometimes they can be for more than 10 seconds. But the interesting thing is that when any client is connected to AP, the signal became stable.
Code to initialize AP mode:
Code: Select all
LOCAL bool ICACHE_FLASH_ATTR setup_wifi_ap_mode()
{
struct softap_config apconfig;
if(wifi_softap_get_config(&apconfig))
{
wifi_set_opmode(SOFTAP_MODE);
os_memset(apconfig.ssid, 0, sizeof(apconfig.ssid));
os_memset(apconfig.password, 0, sizeof(apconfig.password));
apconfig.ssid_len = os_sprintf(apconfig.ssid, _sys_cfg.ap_ssid);
os_sprintf(apconfig.password, "%s", _sys_cfg.ap_pass);
apconfig.authmode = _sys_cfg.ap_authmode;
apconfig.ssid_hidden = _sys_cfg.ap_hidden;
apconfig.channel = _sys_cfg.ap_channel;
apconfig.max_connection = 4;
apconfig.beacon_interval = 100;
if(wifi_softap_set_config(&apconfig))
{
wifi_softap_dhcps_stop();
struct ip_info ipinfo;
wifi_get_ip_info(SOFTAP_IF, &ipinfo);
char *ip = (char*) _sys_cfg.ap_ip;
char *mask = (char*) _sys_cfg.ap_mask;
char *gw = (char*) _sys_cfg.ap_gw;
if (ip) ipinfo.ip.addr = ipaddr_addr(ip);
if (mask) ipinfo.netmask.addr = ipaddr_addr(mask);
if (gw) ipinfo.gw.addr = ipaddr_addr(gw);
wifi_set_ip_info(SOFTAP_IF, &ipinfo);
wifi_softap_dhcps_start();
return true;
}
}
return false;
}
_sys_cfg is my internal system config struct.