diff --git a/cpu/esp32/esp-wifi/esp_wifi_netdev.c b/cpu/esp32/esp-wifi/esp_wifi_netdev.c index 89efab343f97f6afe036f31d4dcecb6294dc80ec..c3b8dc3d0ed59005aef8999d890d016a12e31e7f 100644 --- a/cpu/esp32/esp-wifi/esp_wifi_netdev.c +++ b/cpu/esp32/esp-wifi/esp_wifi_netdev.c @@ -137,6 +137,19 @@ static esp_err_t IRAM_ATTR _esp_system_event_handler(void *ctx, system_event_t * #define CONFIG_WIFI_STA_RSSI -127 #define CONFIG_WIFI_STA_AUTHMODE WIFI_AUTH_WPA_WPA2_PSK +/* we use predefined station configuration */ +static wifi_config_t wifi_config_sta = { + .sta = { + .ssid = CONFIG_WIFI_STA_SSID, + .password = CONFIG_WIFI_STA_PASSWORD, + .channel = CONFIG_WIFI_STA_CHANNEL, + .scan_method = CONFIG_WIFI_STA_SCAN_METHOD, + .sort_method = CONFIG_WIFI_STA_SORT_METHOD, + .threshold.rssi = CONFIG_WIFI_STA_RSSI, + .threshold.authmode = CONFIG_WIFI_STA_AUTHMODE + } +}; + static void esp_wifi_setup (esp_wifi_netdev_t* dev) { DEBUG("%s: %p\n", __func__, dev); @@ -171,19 +184,6 @@ static void esp_wifi_setup (esp_wifi_netdev_t* dev) /* TODO */ #endif - /* we use predefined station configuration */ - wifi_config_t wifi_config_sta = { - .sta = { - .ssid = CONFIG_WIFI_STA_SSID, - .password = CONFIG_WIFI_STA_PASSWORD, - .channel = CONFIG_WIFI_STA_CHANNEL, - .scan_method = CONFIG_WIFI_STA_SCAN_METHOD, - .sort_method = CONFIG_WIFI_STA_SORT_METHOD, - .threshold.rssi = CONFIG_WIFI_STA_RSSI, - .threshold.authmode = CONFIG_WIFI_STA_AUTHMODE - } - }; - result = esp_wifi_set_mode(WIFI_MODE_STA); if (result != ESP_OK) { LOG_TAG_ERROR("esp_wifi", "esp_wifi_set_mode failed with return value %d\n", result);