Code: Select all
tcpip_adapter_init();
EspErrorCheck(esp_event_loop_create_default());
wifi_init_config_t Config= WIFI_INIT_CONFIG_DEFAULT();
EspErrorCheck(esp_wifi_init(&Config));
EspErrorCheck(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &wifiEventHandle, NULL));
wifi_config_t WifiConfig;
strcpy((char*)WifiConfig.ap.ssid, (const char*)SSIDServer.c_str());
WifiConfig.ap.ssid_len= SSIDServer.size();
strcpy((char*)WifiConfig.ap.password, (const char*)PasswordServer.c_str());
WifiConfig.ap.max_connection= 8;
WifiConfig.ap.authmode= AuthenticationModeServer;
if (PasswordServer.size()== 0) WifiConfig.ap.authmode= WIFI_AUTH_OPEN;
EspErrorCheck(esp_wifi_set_mode(WIFI_MODE_AP));
EspErrorCheck(esp_wifi_set_config(ESP_IF_WIFI_AP, &WifiConfig));
EspErrorCheck(esp_wifi_start());
How can I set its address and the range of dhcp addresses?