From 7c6480b53f8ce751cb8242f0a86c63b69ae3cdef Mon Sep 17 00:00:00 2001 From: zhangyanjiao Date: Thu, 30 Apr 2020 16:51:02 +0800 Subject: [PATCH 1/2] esp_wifi: Add softap channel configuration in simple_wifi example --- examples/wifi/simple_wifi/main/Kconfig.projbuild | 7 +++++++ examples/wifi/simple_wifi/main/simple_wifi.c | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/wifi/simple_wifi/main/Kconfig.projbuild b/examples/wifi/simple_wifi/main/Kconfig.projbuild index 67bb8677c4..e95769e48a 100644 --- a/examples/wifi/simple_wifi/main/Kconfig.projbuild +++ b/examples/wifi/simple_wifi/main/Kconfig.projbuild @@ -29,6 +29,13 @@ config ESP_WIFI_PASSWORD help WiFi password (WPA or WPA2) for the example to use. +config ESP_WIFI_CHANNEL + int "WiFi Channel" + range 1 13 + default 1 + help + WiFi channel (network channel) for AP. + config MAX_STA_CONN int "Max STA conn" default 4 diff --git a/examples/wifi/simple_wifi/main/simple_wifi.c b/examples/wifi/simple_wifi/main/simple_wifi.c index 456e880eef..88064456d9 100644 --- a/examples/wifi/simple_wifi/main/simple_wifi.c +++ b/examples/wifi/simple_wifi/main/simple_wifi.c @@ -28,6 +28,7 @@ #define EXAMPLE_ESP_WIFI_MODE_AP CONFIG_ESP_WIFI_MODE_AP //TRUE:AP FALSE:STA #define EXAMPLE_ESP_WIFI_SSID CONFIG_ESP_WIFI_SSID #define EXAMPLE_ESP_WIFI_PASS CONFIG_ESP_WIFI_PASSWORD +#define EXAMPLE_ESP_WIFI_CHANNEL CONFIG_ESP_WIFI_CHANNEL #define EXAMPLE_MAX_STA_CONN CONFIG_MAX_STA_CONN /* FreeRTOS event group to signal when we are connected*/ @@ -84,6 +85,7 @@ void wifi_init_softap() .ap = { .ssid = EXAMPLE_ESP_WIFI_SSID, .ssid_len = strlen(EXAMPLE_ESP_WIFI_SSID), + .channel = EXAMPLE_ESP_WIFI_CHANNEL, .password = EXAMPLE_ESP_WIFI_PASS, .max_connection = EXAMPLE_MAX_STA_CONN, .authmode = WIFI_AUTH_WPA_WPA2_PSK @@ -97,8 +99,9 @@ void wifi_init_softap() ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config)); ESP_ERROR_CHECK(esp_wifi_start()); - ESP_LOGI(TAG, "wifi_init_softap finished.SSID:%s password:%s", - EXAMPLE_ESP_WIFI_SSID, EXAMPLE_ESP_WIFI_PASS); + ESP_LOGI(TAG, "wifi_init_softap finished. SSID:%s password:%s channel:%d", + EXAMPLE_ESP_WIFI_SSID, EXAMPLE_ESP_WIFI_PASS, EXAMPLE_ESP_WIFI_CHANNEL); + } void wifi_init_sta() From 36ad37a1a4c34f1a8681f1c9a23fd93793ddb0b9 Mon Sep 17 00:00:00 2001 From: zhangyanjiao Date: Wed, 20 May 2020 16:19:39 +0800 Subject: [PATCH 2/2] wifi changes: 1. fix the bug for softAP update second channel wrong 2. change wifi_scan_time_t from union to struct 3. query country code wrong when policy change from manual to auto 4. fix the crash issue when fetch peer after delete the cur_peer 5. fix the timeout issue of EAPOL four-way handshake --- components/esp32/include/esp_wifi_types.h | 2 +- components/esp32/lib | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/esp32/include/esp_wifi_types.h b/components/esp32/include/esp_wifi_types.h index 2a3dbc27be..d7c7c567f6 100644 --- a/components/esp32/include/esp_wifi_types.h +++ b/components/esp32/include/esp_wifi_types.h @@ -114,7 +114,7 @@ typedef struct { } wifi_active_scan_time_t; /** @brief Aggregate of active & passive scan time per channel */ -typedef union { +typedef struct { wifi_active_scan_time_t active; /**< active scan time per channel, units: millisecond. */ uint32_t passive; /**< passive scan time per channel, units: millisecond, values above 1500ms may cause station to disconnect from AP and are not recommended. */ diff --git a/components/esp32/lib b/components/esp32/lib index 5951033140..05b2c6edfa 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit 59510331409020dfa61872679b99b39cea4965e2 +Subproject commit 05b2c6edfa31f06724b84a1c65e471d751772880