Code: Select all
tcpip_adapter_init();
tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_AP);
tcpip_adapter_ip_info_t ipInfo;
IP4_ADDR(&ipInfo.ip, 192,168,1,99);
IP4_ADDR(&ipInfo.gw, 192,168,1,1);
IP4_ADDR(&ipInfo.netmask, 255,255,255,0);
tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_AP, &ipInfo);
ESP_ERROR_CHECK( esp_event_loop_init(wifi_event_handler, NULL) );
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_AP) );
wifi_config_t apConfig = {
.ap = {
.ssid="TestController",
.password=WIFI_PASS,
.ssid_len = 0,
.channel = 0,
.authmode = WIFI_AUTH_OPEN,
.ssid_hidden = 0,
.max_connection=4,
.beacon_interval = 100
}
};
ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_AP, &apConfig) );
ESP_ERROR_CHECK( esp_wifi_start() );