Hi Mithras,
Small advice for future: if function returns error codes check them - it makes things easier.
This is the link to esp_netif_get_ip_info() documentation.
https://docs.espressif.com/projects/esp ... _ip_info_t
If you check the error code that your implementation returns you will see it is "ESP_ERR_ESP_NETIF_INVALID_PARAMS" error. The reason for that error is you are not passing a pointer to network interface handler but integer (or something else). That is the same reason why nvannote's suggestion also wont work.
If you are using an example code you can obtain interface handler by using
Code: Select all
esp_netif_t *netif = get_example_netif()
If you are using your own code than you probably know how to get it.
So your code should look something like this:
Code: Select all
esp_netif_t *netif = function_that_returns_netif_ptr(); // there are different ways for this I guess
esp_netif_ip_info_t ip_info;
esp_netif_get_ip_info(netif, &ip_info);
printf("My IP: " IPSTR "\n", IP2STR(&ip_info.ip));
printf("My GW: " IPSTR "\n", IP2STR(&ip_info.gw));
printf("My NETMASK: " IPSTR "\n", IP2STR(&ip_info.netmask));
Best regards