In the function below, if I comment out apconfig.authmode = AUTH_WPA_WPA2_PSK, wifi_softap_setconfig() succeeds, and I can connect to the esp. If I uncomment that line, I see "ESP8266 not set softap config!" printed on the UART and no network is available.
Code: Select all
void ICACHE_FLASH_ATTR setup_wifi_softap_mode(void)
{
struct softap_config apconfig;
if(wifi_softap_get_config(&apconfig))
{
// wifi_softap_dhcps_stop();
os_memset(apconfig.ssid, 0, sizeof(apconfig.ssid));
os_memset(apconfig.password, 0, sizeof(apconfig.password));
os_sprintf(apconfig.ssid, "%s", "john");
os_sprintf(apconfig.password, "%s", "1234");
apconfig.authmode = AUTH_WPA_WPA2_PSK;
apconfig.ssid_len = 0;
apconfig.max_connection = 4;
if(!wifi_softap_set_config(&apconfig))
{
#ifdef PLATFORM_DEBUG
ets_uart_printf("ESP8266 not set softap config!\n");
#endif
}
wifi_set_opmode(SOFTAP_MODE);
// wifi_softap_dhcps_start();
}
if(wifi_get_phy_mode() != PHY_MODE_11N)
wifi_set_phy_mode(PHY_MODE_11N);
#ifdef PLATFORM_DEBUG
ets_uart_printf("ESP8266 in SoftAP mode configured.\n");
#endif
}
I have tried AUTH_WPA_PSK, AUTH_WPA2_PSK, AUTH_WPA_WPA2_PSK and all behave the same. Anyone see anything obvious?