very angry, "esp_wifi_set_config cannot convert 'esp_interface_t' to 'wifi_interface_t'"
Posted: Sun Jul 25, 2021 7:52 pm
Okay guys, what the hell are you doing to your programming interfaces?
Given this code:
I am now getting this compile error with the latest IDF:
What is happening? The error is nonsensical.
-Thom
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;
}
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
-Thom