mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
riscv/esp32c3: Support debug log configuration for Wi-Fi library
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
02968cc124
commit
4fc2f6e28c
@@ -807,6 +807,36 @@ config ESP32C3_WIFI_RECONNECT
|
|||||||
---help---
|
---help---
|
||||||
Select this option to enable Wi-Fi to reconnect for station when disconnected.
|
Select this option to enable Wi-Fi to reconnect for station when disconnected.
|
||||||
|
|
||||||
|
choice ESP32C3_WIFI_LOG_LEVEL
|
||||||
|
depends on DEBUG_INFO
|
||||||
|
prompt "WiFi debug log level"
|
||||||
|
default WIFI_LOG_LEVEL_INFO
|
||||||
|
help
|
||||||
|
The WiFi log is divided into the following levels: ERROR,WARNING,INFO,DEBUG,VERBOSE.
|
||||||
|
|
||||||
|
config WIFI_LOG_LEVEL_NONE
|
||||||
|
bool "No output"
|
||||||
|
config WIFI_LOG_LEVEL_ERROR
|
||||||
|
bool "Error"
|
||||||
|
config WIFI_LOG_LEVEL_WARN
|
||||||
|
bool "Warning"
|
||||||
|
config WIFI_LOG_LEVEL_INFO
|
||||||
|
bool "Info"
|
||||||
|
config WIFI_LOG_LEVEL_DEBUG
|
||||||
|
bool "Debug"
|
||||||
|
config WIFI_LOG_LEVEL_VERBOSE
|
||||||
|
bool "Verbose"
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config WIFI_LOG_LEVEL
|
||||||
|
int
|
||||||
|
default 0 if WIFI_LOG_LEVEL_NONE
|
||||||
|
default 1 if WIFI_LOG_LEVEL_ERROR
|
||||||
|
default 2 if WIFI_LOG_LEVEL_WARN
|
||||||
|
default 3 if WIFI_LOG_LEVEL_INFO
|
||||||
|
default 4 if WIFI_LOG_LEVEL_DEBUG
|
||||||
|
default 5 if WIFI_LOG_LEVEL_VERBOSE
|
||||||
|
|
||||||
endmenu # Wi-Fi configuration
|
endmenu # Wi-Fi configuration
|
||||||
|
|
||||||
menu "BLE Configuration"
|
menu "BLE Configuration"
|
||||||
|
|||||||
@@ -390,6 +390,7 @@ static int esp_wifi_lock(bool lock);
|
|||||||
#ifdef ESP32C3_WLAN_HAS_STA
|
#ifdef ESP32C3_WLAN_HAS_STA
|
||||||
static int esp_wifi_sta_connect_wrapper(void);
|
static int esp_wifi_sta_connect_wrapper(void);
|
||||||
#endif
|
#endif
|
||||||
|
static void esp_wifi_set_debug_log(void);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Extern Functions declaration
|
* Extern Functions declaration
|
||||||
@@ -720,6 +721,32 @@ static int esp_wifi_sta_connect_wrapper(void)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp_wifi_set_debug_log
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Set Wi-Fi log level and module
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void esp_wifi_set_debug_log(void)
|
||||||
|
{
|
||||||
|
uint32_t g_wifi_log_submodule = WIFI_LOG_SUBMODULE_CONN;
|
||||||
|
wifi_log_level_t level = WIFI_LOG_INFO;
|
||||||
|
#ifdef CONFIG_WIFI_LOG_LEVEL
|
||||||
|
level = CONFIG_WIFI_LOG_LEVEL;
|
||||||
|
#endif
|
||||||
|
esp_wifi_internal_set_log_level(level);
|
||||||
|
esp_wifi_internal_set_log_mod(WIFI_LOG_MODULE_WIFI,
|
||||||
|
g_wifi_log_submodule, true);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: osi_errno_trans
|
* Name: osi_errno_trans
|
||||||
*
|
*
|
||||||
@@ -5107,6 +5134,8 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_wifi_set_debug_log();
|
||||||
|
|
||||||
ret = esp_supplicant_init();
|
ret = esp_supplicant_init();
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user