very angry, "esp_wifi_set_config cannot convert 'esp_interface_t' to 'wifi_interface_t'"

tschak909
Posts: 36
Joined: Mon Oct 26, 2020 8:17 pm

very angry, "esp_wifi_set_config cannot convert 'esp_interface_t' to 'wifi_interface_t'"

Postby tschak909 » Sun Jul 25, 2021 7:52 pm

Okay guys, what the hell are you doing to your programming interfaces?

Given this code:

Code: Select all

int WiFiManager::connect(const char *ssid, const char *password)
{
    Debug_printf("WiFi connect attempt to SSID \"%s\"\n", ssid == nullptr ? "" : ssid);

    // Only set an SSID and password if given
    if (ssid != nullptr)
    {
        // Disconnect if we're connected to a different ssid
        if (_connected == true)
        {
            std::string current_ssid = get_current_ssid();
            if (current_ssid.compare(ssid) != 0)
            {
                Debug_printf("Disconnecting from current SSID \"%s\"\n", current_ssid.c_str());
                esp_wifi_disconnect();
                fnSystem.delay(500);
            }
        }

        // Set the new values
        wifi_config_t wifi_config;
        memset(&wifi_config, 0, sizeof(wifi_config));

        strlcpy((char *)wifi_config.sta.ssid, ssid, sizeof(wifi_config.sta.ssid));
        strlcpy((char *)wifi_config.sta.password, password, sizeof(wifi_config.sta.password));

        // Debug_printf("WiFi config double-check: \"%s\", \"%s\"\n", (char *)wifi_config.sta.ssid, (char *)wifi_config.sta.password );

        wifi_config.sta.pmf_cfg.capable = true;
        ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config));
    }

    // Now connect
    _reconnect_attempts = 0;
    esp_err_t e = esp_wifi_connect();
    Debug_printf("esp_wifi_connect returned %d\n", e);
    return e;
}
I am now getting this compile error with the latest IDF:

Code: Select all

In file included from C:/Users/thomc/.platformio/packages/framework-espidf/components/esp_timer/include/esp_timer.h:45,
                 from C:/Users/thomc/.platformio/packages/framework-espidf/components/freertos/port/xtensa/include/freertos/portmacro.h:46,
                 from C:/Users/thomc/.platformio/packages/framework-espidf/components/freertos/include/freertos/portable.h:52,
                 from C:/Users/thomc/.platformio/packages/framework-espidf/components/freertos/include/freertos/FreeRTOS.h:64,
                 from lib/hardware/fnWiFi.cpp:1:
lib/hardware/fnWiFi.cpp: In member function 'int WiFiManager::connect(const char*, const char*)':
lib/hardware/fnWiFi.cpp:149:74: error: cannot convert 'esp_interface_t' to 'wifi_interface_t'
         ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config));
                                                                          ^
C:/Users/thomc/.platformio/packages/framework-espidf/components/esp_common/include/esp_err.h:119:31: note: in definition of macro 'ESP_ERROR_CHECK'
         esp_err_t __err_rc = (x);                                       \
                               ^
In file included from lib/hardware/fnWiFi.cpp:6:
C:/Users/thomc/.platformio/packages/framework-espidf/components/esp_wifi/include/esp_wifi.h:799:48: note:   initializing argument 1 of 'esp_err_t esp_wifi_set_config(wifi_interface_t, wifi_config_t*)'
 esp_err_t esp_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf);
                               ~~~~~~~~~~~~~~~~~^~~~~~~~~
*** [.pio\build\fujinet-v1\lib223\hardware\fnWiFi.o] Error 1
What is happening? The error is nonsensical.

-Thom

tschak909
Posts: 36
Joined: Mon Oct 26, 2020 8:17 pm

Re: very angry, "esp_wifi_set_config cannot convert 'esp_interface_t' to 'wifi_interface_t'"

Postby tschak909 » Sun Jul 25, 2021 8:28 pm

Fix is:

https://github.com/FujiNetWIFI/fujinet- ... 7b36007e75

I love it when things change just because.

-Thom

rwel59
Posts: 97
Joined: Thu Oct 12, 2017 3:32 pm

Re: very angry, "esp_wifi_set_config cannot convert 'esp_interface_t' to 'wifi_interface_t'"

Postby rwel59 » Fri Aug 06, 2021 3:21 pm

Has the problem been fixed for you? I just updated to the latest master branch but still receiving the error

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: very angry, "esp_wifi_set_config cannot convert 'esp_interface_t' to 'wifi_interface_t'"

Postby chegewara » Fri Aug 06, 2021 3:45 pm

tschak909 wrote: I love it when things change just because.

-Thom
It is not just because. ESP-IDF is updated and every major change has some breaking code changes. All such changes are described here:
https://github.com/espressif/esp-idf/releases

From your last link i am guessing you are using platformio, so you should be "very angry" on PIO maintainers.

Who is online

Users browsing this forum: atx823, MicroController and 172 guests