bugfix: fix some wifi bugs
1. optimization esp_wifi_set_max_tx_power description 2. Add API esp_wifi_ap_get_sta_aid 3. Fix the timeout issue of EAPOL four-way handshake 4. esp_wifi:Add softap example channel configuration
This commit is contained in:
parent
977d98cb6d
commit
ba06ecf96d
4 changed files with 63 additions and 9 deletions
|
@ -806,6 +806,21 @@ esp_err_t esp_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf);
|
|||
*/
|
||||
esp_err_t esp_wifi_ap_get_sta_list(wifi_sta_list_t *sta);
|
||||
|
||||
/**
|
||||
* @brief Get AID of STA connected with soft-AP
|
||||
*
|
||||
* @param mac STA's mac address
|
||||
* @param[out] aid Store the AID corresponding to STA mac
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
|
||||
* - ESP_ERR_INVALID_ARG: invalid argument
|
||||
* - ESP_ERR_NOT_FOUND: Requested resource not found
|
||||
* - ESP_ERR_WIFI_MODE: WiFi mode is wrong
|
||||
* - ESP_ERR_WIFI_CONN: WiFi internal error, the station/soft-AP control block is invalid
|
||||
*/
|
||||
esp_err_t esp_wifi_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid);
|
||||
|
||||
/**
|
||||
* @brief Set the WiFi API configuration storage type
|
||||
|
@ -862,28 +877,59 @@ esp_err_t esp_wifi_set_vendor_ie(bool enable, wifi_vendor_ie_type_t type, wifi_v
|
|||
esp_err_t esp_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx);
|
||||
|
||||
/**
|
||||
* @brief Set maximum WiFi transmitting power
|
||||
* @brief Set maximum transmitting power after WiFi start.
|
||||
*
|
||||
* @param power Maximum WiFi transmitting power, unit is 0.25dBm, range is [40, 82] corresponding to 10dBm - 20.5dBm here.
|
||||
* @attention 1. Maximum power before wifi startup is limited by PHY init data bin.
|
||||
* @attention 2. The value set by this API will be mapped to the max_tx_power of the structure wifi_country_t variable.
|
||||
* @attention 3. Mapping Table {Power, max_tx_power} = {{8, 2}, {20, 5}, {28, 7}, {34, 8}, {44, 11},
|
||||
* {52, 13}, {56, 14}, {60, 15}, {66, 16}, {72, 18}, {78, 20}}.
|
||||
* @attention 4. Param power unit is 0.25dBm, range is [8, 78] corresponding to 2dBm - 20dBm.
|
||||
* @attention 5. Relationship between set value and actual value. As follows:
|
||||
* +------------+--------------+
|
||||
* | set value | actual value |
|
||||
* +============+==============+
|
||||
* | [8, 19] | 8 |
|
||||
* +------------+--------------+
|
||||
* | [20, 27] | 20 |
|
||||
* +------------+--------------+
|
||||
* | [28, 33] | 28 |
|
||||
* +------------+--------------+
|
||||
* | [34, 43] | 34 |
|
||||
* +------------+--------------+
|
||||
* | [44, 51] | 44 |
|
||||
* +------------+--------------+
|
||||
* | [52, 55] | 52 |
|
||||
* +------------+--------------+
|
||||
* | [56, 59] | 56 |
|
||||
* +------------+--------------+
|
||||
* | [60, 65] | 60 |
|
||||
* +------------+--------------+
|
||||
* | [66, 71] | 66 |
|
||||
* +------------+--------------+
|
||||
* | [72, 77] | 72 |
|
||||
* +------------+--------------+
|
||||
* | 78 | 78 |
|
||||
* +------------+--------------+
|
||||
* @param power Maximum WiFi transmitting power.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
|
||||
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
|
||||
* - ESP_ERR_WIFI_NOT_ARG: invalid argument
|
||||
* - ESP_ERR_WIFI_ARG: invalid argument, e.g. parameter is out of range
|
||||
*/
|
||||
esp_err_t esp_wifi_set_max_tx_power(int8_t power);
|
||||
|
||||
/**
|
||||
* @brief Get maximum WiFi transmiting power
|
||||
* @brief Get maximum transmiting power after WiFi start
|
||||
*
|
||||
* @param power Maximum WiFi transmitting power, unit is 0.25dBm.
|
||||
* @param power Maximum WiFi transmitting power, unit is 0.25dBm.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
|
||||
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
|
||||
* - ESP_ERR_INVALID_ARG: invalid argument
|
||||
* - ESP_ERR_WIFI_ARG: invalid argument
|
||||
*/
|
||||
esp_err_t esp_wifi_get_max_tx_power(int8_t *power);
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit b0e70aba99b9b05f0111b76c375a7f39047ceed3
|
||||
Subproject commit 4db9824d54b3df6e5bcdcac7bf306f6743f02aee
|
|
@ -11,6 +11,12 @@ menu "Example Configuration"
|
|||
default "mypassword"
|
||||
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 the example to use.
|
||||
|
||||
config ESP_MAX_STA_CONN
|
||||
int "Maximal STA connections"
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
#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_ESP_MAX_STA_CONN
|
||||
|
||||
static const char *TAG = "wifi softAP";
|
||||
|
@ -58,6 +59,7 @@ void wifi_init_softap(void)
|
|||
.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
|
||||
|
@ -71,8 +73,8 @@ void wifi_init_softap(void)
|
|||
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 app_main(void)
|
||||
|
|
Loading…
Reference in a new issue