[已解决] 求大神指导。esp32 怎么禁用DHCP和设置静态IP?
Posted: Thu Apr 29, 2021 3:20 am
如题
Code: Select all
const esp_netif_ip_info_t ip_info = {
.ip = { .addr = ESP_IP4TOADDR( 192, 168, 3, 41) },
.gw = { .addr = ESP_IP4TOADDR( 192, 168, 3, 1) },
.netmask = { .addr = ESP_IP4TOADDR( 255, 255, 255, 0) },
};
esp_netif_t* netif = esp_netif_create_default_wifi_sta();
esp_netif_dhcpc_stop(netif);
esp_netif_set_ip_info(netif, &ip_info);