forked from espressif/esp-idf
Merge branch 'bugfix/connect_before_connected_v5.0' into 'release/v5.0'
fix(connect): Change second connect time to 730 See merge request espressif/esp-idf!26974
This commit is contained in:
@@ -24,8 +24,13 @@
|
|||||||
#include "freertos/event_groups.h"
|
#include "freertos/event_groups.h"
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULT_SSID "TEST_SSID"
|
#ifndef TEST_SUFFIX_STR
|
||||||
#define DEFAULT_PWD "TEST_PASS"
|
#define TEST_SUFFIX_STR "_0050"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DEFAULT_SSID "SSID_" CONFIG_IDF_TARGET TEST_SUFFIX_STR
|
||||||
|
#define DEFAULT_PWD "PASS_" CONFIG_IDF_TARGET TEST_SUFFIX_STR
|
||||||
|
|
||||||
#define TEST_DEFAULT_CHANNEL (6)
|
#define TEST_DEFAULT_CHANNEL (6)
|
||||||
#define CONNECT_TIMEOUT_MS (8000)
|
#define CONNECT_TIMEOUT_MS (8000)
|
||||||
|
|
||||||
@@ -63,6 +68,8 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base,
|
|||||||
|
|
||||||
case WIFI_EVENT_STA_DISCONNECTED:
|
case WIFI_EVENT_STA_DISCONNECTED:
|
||||||
ESP_LOGI(TAG, "WIFI_EVENT_STA_DISCONNECTED");
|
ESP_LOGI(TAG, "WIFI_EVENT_STA_DISCONNECTED");
|
||||||
|
wifi_event_sta_disconnected_t *event = (wifi_event_sta_disconnected_t *)event_data;
|
||||||
|
ESP_LOGI(TAG, "disconnect reason: %u", event->reason);
|
||||||
if (! (EVENT_HANDLER_FLAG_DO_NOT_AUTO_RECONNECT & wifi_event_handler_flag) ) {
|
if (! (EVENT_HANDLER_FLAG_DO_NOT_AUTO_RECONNECT & wifi_event_handler_flag) ) {
|
||||||
TEST_ESP_OK(esp_wifi_connect());
|
TEST_ESP_OK(esp_wifi_connect());
|
||||||
}
|
}
|
||||||
@@ -393,6 +400,7 @@ static void esp_wifi_connect_first_time(void)
|
|||||||
memset(&w_config, 0, sizeof(w_config));
|
memset(&w_config, 0, sizeof(w_config));
|
||||||
memcpy(w_config.sta.ssid, DEFAULT_SSID, strlen(DEFAULT_SSID));
|
memcpy(w_config.sta.ssid, DEFAULT_SSID, strlen(DEFAULT_SSID));
|
||||||
memcpy(w_config.sta.password, DEFAULT_PWD, strlen(DEFAULT_PWD));
|
memcpy(w_config.sta.password, DEFAULT_PWD, strlen(DEFAULT_PWD));
|
||||||
|
w_config.sta.channel = 1;
|
||||||
|
|
||||||
wifi_event_handler_flag |= EVENT_HANDLER_FLAG_DO_NOT_AUTO_RECONNECT;
|
wifi_event_handler_flag |= EVENT_HANDLER_FLAG_DO_NOT_AUTO_RECONNECT;
|
||||||
|
|
||||||
@@ -420,7 +428,7 @@ static void test_wifi_connect_before_connected_phase(void)
|
|||||||
esp_wifi_connect_first_time();
|
esp_wifi_connect_first_time();
|
||||||
|
|
||||||
// connect before connected
|
// connect before connected
|
||||||
vTaskDelay(800/portTICK_PERIOD_MS);
|
vTaskDelay(730/portTICK_PERIOD_MS);
|
||||||
ESP_LOGI(TAG, "connect when first connect after scan before connected");
|
ESP_LOGI(TAG, "connect when first connect after scan before connected");
|
||||||
TEST_ESP_ERR(ESP_ERR_WIFI_CONN, esp_wifi_connect());
|
TEST_ESP_ERR(ESP_ERR_WIFI_CONN, esp_wifi_connect());
|
||||||
wifi_event_handler_flag |= EVENT_HANDLER_FLAG_DO_NOT_AUTO_RECONNECT;
|
wifi_event_handler_flag |= EVENT_HANDLER_FLAG_DO_NOT_AUTO_RECONNECT;
|
||||||
|
Reference in New Issue
Block a user