From fbe215f3c03d790866869a8f2810ffac49b64a7e Mon Sep 17 00:00:00 2001 From: xiehang Date: Wed, 26 Feb 2020 11:52:20 +0800 Subject: [PATCH 1/2] esp_wifi: backport some wifi bugs 0323 1.Reduce wifi bin size 2.Add TX packets size check 3.Fix scan get rssi error 4.Return fail when setting AP's channel out of range --- components/esp_wifi/esp32/esp_adapter.c | 1 + .../include/esp_private/wifi_os_adapter.h | 1 + components/esp_wifi/include/esp_wifi_types.h | 2 +- components/esp_wifi/lib | 2 +- .../idf_test/integration_test/TC_IT_WIFI_CONN.yml | 2 +- components/log/include/esp_log.h | 9 +++++++++ components/log/log.c | 15 ++++++++++++--- 7 files changed, 26 insertions(+), 6 deletions(-) diff --git a/components/esp_wifi/esp32/esp_adapter.c b/components/esp_wifi/esp32/esp_adapter.c index 99ccd1434..9321cc2b6 100644 --- a/components/esp_wifi/esp32/esp_adapter.c +++ b/components/esp_wifi/esp32/esp_adapter.c @@ -595,6 +595,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._get_time = get_time_wrapper, ._random = os_random, ._log_write = esp_log_write, + ._log_writev = esp_log_writev, ._log_timestamp = esp_log_timestamp, ._malloc_internal = malloc_internal_wrapper, ._realloc_internal = realloc_internal_wrapper, diff --git a/components/esp_wifi/include/esp_private/wifi_os_adapter.h b/components/esp_wifi/include/esp_private/wifi_os_adapter.h index 06cb730ee..7fde7bf3c 100644 --- a/components/esp_wifi/include/esp_private/wifi_os_adapter.h +++ b/components/esp_wifi/include/esp_private/wifi_os_adapter.h @@ -111,6 +111,7 @@ typedef struct { uint32_t (* _slowclk_cal_get)(void); #endif void (* _log_write)(uint32_t level, const char* tag, const char* format, ...); + void (* _log_writev)(uint32_t level, const char* tag, const char* format, va_list args); uint32_t (* _log_timestamp)(void); void * (* _malloc_internal)(size_t size); void * (* _realloc_internal)(void *ptr, size_t size); diff --git a/components/esp_wifi/include/esp_wifi_types.h b/components/esp_wifi/include/esp_wifi_types.h index 0c4a461fb..15dd2c113 100644 --- a/components/esp_wifi/include/esp_wifi_types.h +++ b/components/esp_wifi/include/esp_wifi_types.h @@ -217,7 +217,7 @@ typedef struct { uint8_t channel; /**< Channel of ESP32 soft-AP */ wifi_auth_mode_t authmode; /**< Auth mode of ESP32 soft-AP. Do not support AUTH_WEP in soft-AP mode */ uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */ - uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 4 */ + uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 10 */ uint16_t beacon_interval; /**< Beacon interval, 100 ~ 60000 ms, default 100 ms */ } wifi_ap_config_t; diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index c47f210ea..2b8ab43de 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit c47f210ea59a820f2b03706b9c9632b8d8e01757 +Subproject commit 2b8ab43dee18d1b79bda2a3f7623661eb1424ec1 diff --git a/components/idf_test/integration_test/TC_IT_WIFI_CONN.yml b/components/idf_test/integration_test/TC_IT_WIFI_CONN.yml index 6906252fc..d941039ef 100644 --- a/components/idf_test/integration_test/TC_IT_WIFI_CONN.yml +++ b/components/idf_test/integration_test/TC_IT_WIFI_CONN.yml @@ -78,7 +78,7 @@ test cases: - - SSC SSC2 sta -C -s - - R SSC2 RE "\+JAP:CONNECTED,%%s"%%() - - SSC SSC1 ap -S -s -n 15 - - - R SSC1 C +SAP:OK + - - R SSC1 C +SAP:ERROR - - SSC SSC2 sta -C -s - - R SSC2 RE "\+JAP:CONNECTED,%%s"%%() - - SSC SSC2 sta -D diff --git a/components/log/include/esp_log.h b/components/log/include/esp_log.h index 994174ec4..f41b223cb 100644 --- a/components/log/include/esp_log.h +++ b/components/log/include/esp_log.h @@ -125,6 +125,15 @@ uint32_t esp_log_early_timestamp(void); */ void esp_log_write(esp_log_level_t level, const char* tag, const char* format, ...) __attribute__ ((format (printf, 3, 4))); +/** + * @brief Write message into the log, va_list variant + * @see esp_log_write() + * + * This function is provided to ease integration toward other logging framework, + * so that esp_log can be used as a log sink. + */ +void esp_log_writev(esp_log_level_t level, const char* tag, const char* format, va_list args); + /** @cond */ #include "esp_log_internal.h" diff --git a/components/log/log.c b/components/log/log.c index 289fdf3dc..3de014619 100644 --- a/components/log/log.c +++ b/components/log/log.c @@ -162,9 +162,10 @@ void clear_log_level_list(void) #endif } -void esp_log_write(esp_log_level_t level, +void esp_log_writev(esp_log_level_t level, const char *tag, - const char *format, ...) + const char *format, + va_list args) { if (!esp_log_impl_lock_timeout()) { return; @@ -185,9 +186,17 @@ void esp_log_write(esp_log_level_t level, return; } + (*s_log_print_func)(format, args); + +} + +void esp_log_write(esp_log_level_t level, + const char *tag, + const char *format, ...) +{ va_list list; va_start(list, format); - (*s_log_print_func)(format, list); + esp_log_writev(level, tag, format, list); va_end(list); } From 55abe2eba8aa0d9dafe6baa057beb8e7e87a4ef0 Mon Sep 17 00:00:00 2001 From: xiehang Date: Fri, 13 Mar 2020 14:48:18 +0800 Subject: [PATCH 2/2] esp_wifi: Fix ESP32S2 wifi log not printing --- components/esp_wifi/esp32s2beta/esp_adapter.c | 1 + 1 file changed, 1 insertion(+) diff --git a/components/esp_wifi/esp32s2beta/esp_adapter.c b/components/esp_wifi/esp32s2beta/esp_adapter.c index 012a39f89..9afe1d387 100644 --- a/components/esp_wifi/esp32s2beta/esp_adapter.c +++ b/components/esp_wifi/esp32s2beta/esp_adapter.c @@ -586,6 +586,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._slowclk_cal_get = esp_clk_slowclk_cal_get, #endif ._log_write = esp_log_write, + ._log_writev = esp_log_writev, ._log_timestamp = esp_log_timestamp, ._malloc_internal = malloc_internal_wrapper, ._realloc_internal = realloc_internal_wrapper,