From e83a8679b435b0809aa98e49d1dce83d791d0568 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Mon, 14 Jan 2019 12:11:30 +0100
Subject: [PATCH] cpu/esp32: cleanup esp_wifi config parameters

---
 cpu/esp32/esp-wifi/esp_wifi_netdev.c | 32 ++++++----------------------
 cpu/esp32/esp-wifi/esp_wifi_params.h | 27 +++++++++++++++++++----
 2 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/cpu/esp32/esp-wifi/esp_wifi_netdev.c b/cpu/esp32/esp-wifi/esp_wifi_netdev.c
index 9037076d92..6af352d3d4 100644
--- a/cpu/esp32/esp-wifi/esp_wifi_netdev.c
+++ b/cpu/esp32/esp-wifi/esp_wifi_netdev.c
@@ -168,34 +168,16 @@ static esp_err_t IRAM_ATTR _esp_system_event_handler(void *ctx, system_event_t *
     return ESP_OK;
 }
 
-/** TODO better place
- * Default WiFi configuration, overwrite them with your configs
- */
-#ifndef CONFIG_WIFI_STA_SSID
-#define CONFIG_WIFI_STA_SSID        "RIOT_AP"
-#endif
-#ifndef CONFIG_WIFI_STA_PASSWORD
-#define CONFIG_WIFI_STA_PASSWORD    "ThisistheRIOTporttoESP"
-#endif
-#ifndef CONFIG_WIFI_STA_CHANNEL
-#define CONFIG_WIFI_STA_CHANNEL     0
-#endif
-
-#define CONFIG_WIFI_STA_SCAN_METHOD WIFI_ALL_CHANNEL_SCAN
-#define CONFIG_WIFI_STA_SORT_METHOD WIFI_CONNECT_AP_BY_SIGNAL
-#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
+        .ssid = ESP_WIFI_SSID,
+        .password = ESP_WIFI_PASS,
+        .channel = 0,
+        .scan_method = WIFI_ALL_CHANNEL_SCAN,
+        .sort_method = WIFI_CONNECT_AP_BY_SIGNAL,
+        .threshold.rssi = -127,
+        .threshold.authmode = WIFI_AUTH_WPA_WPA2_PSK
     }
 };
 
diff --git a/cpu/esp32/esp-wifi/esp_wifi_params.h b/cpu/esp32/esp-wifi/esp_wifi_params.h
index fb780b25c6..e1e9bad492 100644
--- a/cpu/esp32/esp-wifi/esp_wifi_params.h
+++ b/cpu/esp32/esp-wifi/esp_wifi_params.h
@@ -25,14 +25,33 @@
  * @name    Set default configuration parameters for the ESP WiFi netdev driver
  * @{
  */
+
+/**
+ * @brief   The size of the stack used for the ESP WIFI netdev driver thread.
+ */
 #ifndef ESP_WIFI_STACKSIZE
-/** The size of the stack used for the ESP WiFi netdev driver thread */
-#define ESP_WIFI_STACKSIZE    THREAD_STACKSIZE_DEFAULT
+#define ESP_WIFI_STACKSIZE  (THREAD_STACKSIZE_DEFAULT)
 #endif
 
+/**
+ * @brief   The priority of the ESP WiFi netdev driver thread. Should not be changed.
+ */
 #ifndef ESP_WIFI_PRIO
-/** The priority of the ESP WiFi netdev driver thread */
-#define ESP_WIFI_PRIO         GNRC_NETIF_PRIO
+#define ESP_WIFI_PRIO       (GNRC_NETIF_PRIO)
+#endif
+
+/**
+ * @brief   SSID of the AP to be used.
+ */
+#ifndef ESP_WIFI_SSID
+#define ESP_WIFI_SSID       "RIOT_AP"
+#endif
+
+/**
+ * @brief   Passphrase used for the AP as clear text (max. 64 chars).
+ */
+#ifndef ESP_WIFI_PASS
+#define ESP_WIFI_PASS       "ThisistheRIOTporttoESP"
 #endif
 
 /**@}*/
-- 
GitLab