- tcpip_adapter_init()
- esp_wifi_init()
- esp_wifi_set_mode()
- esp_wifi_set_config()
- esp_wifi_start()
- esp_wifi_connect()
[Solved] Being a WiFi station but not using DHCP ...
[Solved] Being a WiFi station but not using DHCP ...
Studying the WiFi exposed APIs in ESP-IDF, it seems that the correct path to be a station is to:
Last edited by kolban on Sun Oct 16, 2016 5:40 am, edited 1 time in total.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Being a WiFi station but not using DHCP ...
tcpip_adapter_init()
tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_STA)
tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_STA, &static_IP_info)
tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_STA)
tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_STA, &static_IP_info)
Re: Being a WiFi station but not using DHCP ...
Many thanks, so the full recipe would be:
That sounds great. Thank you VERY MUCH. You have awesome knowledge.
- tcpip_adapter_init()
- tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_STA)
- tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_STA, &static_IP_info)
- esp_wifi_init()
- esp_wifi_set_mode()
- esp_wifi_set_config()
- esp_wifi_start()
- esp_wifi_connect()
Code: Select all
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_STA, &ipInfo);
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: [Solved] Being a WiFi station but not using DHCP ...
Hi Kolban,
On which esp-idf version did you get the tcpip_adapter_dhcpc_stop to work for interface TCPIP_ADAPTER_IF_STA?
// Johan
On which esp-idf version did you get the tcpip_adapter_dhcpc_stop to work for interface TCPIP_ADAPTER_IF_STA?
// Johan
Re: [Solved] Being a WiFi station but not using DHCP ...
tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_STA) returns ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS for me.
I guess it works on some versions.
So is there a way to set a static ip?
I guess it works on some versions.
So is there a way to set a static ip?
Who is online
Users browsing this forum: Baidu [Spider] and 134 guests