Skip to content
Discussion options

You must be logged in to vote

@swimleftproducts Good catch.

I have commented those lines out now but I left them in as this is how you can force the ESP32 to use a static IP.
new code as follows

esp_err_t wifi_connect_sta(const char *ssid, const char *pass, int timeout)
{
    Wifi_events = xEventGroupCreate();
    wifi_config_t wifi_config;
    memset(&wifi_config, 0, sizeof(wifi_config_t));
    strncpy((char *)wifi_config.sta.ssid, ssid, sizeof(wifi_config.sta.ssid) - 1);
    strncpy((char *)wifi_config.sta.password, pass, sizeof(wifi_config.sta.password) - 1);

    esp_netif = esp_netif_create_default_wifi_sta();

    // for static ip...
    // esp_netif_dhcpc_stop(esp_netif);
    // esp_netif_ip_info_t ip_info;
    /…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Mair
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants