mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
Merge branch 'bugfix/fix_iperf_example_crash_issue_v4.0' into 'release/v4.0'
Bugfix/fix iperf example crash issue v4.0 (backport v4.0) See merge request espressif/esp-idf!12020
This commit is contained in:
@ -350,7 +350,7 @@ static void example_event_callback(esp_blufi_cb_event_t event, esp_blufi_cb_para
|
|||||||
.channel = 0,
|
.channel = 0,
|
||||||
.show_hidden = false
|
.show_hidden = false
|
||||||
};
|
};
|
||||||
ESP_ERROR_CHECK(esp_wifi_scan_start(&scanConf, true));
|
esp_wifi_scan_start(&scanConf, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESP_BLUFI_EVENT_RECV_CUSTOM_DATA:
|
case ESP_BLUFI_EVENT_RECV_CUSTOM_DATA:
|
||||||
|
@ -161,7 +161,7 @@ static bool wifi_cmd_sta_join(const char *ssid, const char *pass)
|
|||||||
esp_wifi_disconnect();
|
esp_wifi_disconnect();
|
||||||
//ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); //by snake
|
//ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); //by snake
|
||||||
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
|
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
|
||||||
ESP_ERROR_CHECK( esp_wifi_connect() );
|
esp_wifi_connect();
|
||||||
|
|
||||||
xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 5000 / portTICK_RATE_MS);
|
xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 5000 / portTICK_RATE_MS);
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ static bool wifi_cmd_sta_scan(const char *ssid)
|
|||||||
scan_config.ssid = (uint8_t *) ssid;
|
scan_config.ssid = (uint8_t *) ssid;
|
||||||
|
|
||||||
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
|
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||||
ESP_ERROR_CHECK( esp_wifi_scan_start(&scan_config, false) );
|
esp_wifi_scan_start(&scan_config, false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ static void on_wifi_disconnect(void *arg, esp_event_base_t event_base,
|
|||||||
int32_t event_id, void *event_data)
|
int32_t event_id, void *event_data)
|
||||||
{
|
{
|
||||||
ESP_LOGI(TAG, "Wi-Fi disconnected, trying to reconnect...");
|
ESP_LOGI(TAG, "Wi-Fi disconnected, trying to reconnect...");
|
||||||
ESP_ERROR_CHECK(esp_wifi_connect());
|
esp_wifi_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLE_CONNECT_IPV6
|
#ifdef CONFIG_EXAMPLE_CONNECT_IPV6
|
||||||
@ -138,7 +138,7 @@ static void start()
|
|||||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config));
|
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config));
|
||||||
ESP_ERROR_CHECK(esp_wifi_start());
|
ESP_ERROR_CHECK(esp_wifi_start());
|
||||||
ESP_ERROR_CHECK(esp_wifi_connect());
|
esp_wifi_connect();
|
||||||
s_connection_name = CONFIG_EXAMPLE_WIFI_SSID;
|
s_connection_name = CONFIG_EXAMPLE_WIFI_SSID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ void mesh_scan_done_handler(int num)
|
|||||||
esp_wifi_scan_stop();
|
esp_wifi_scan_stop();
|
||||||
scan_config.show_hidden = 1;
|
scan_config.show_hidden = 1;
|
||||||
scan_config.scan_type = WIFI_SCAN_TYPE_PASSIVE;
|
scan_config.scan_type = WIFI_SCAN_TYPE_PASSIVE;
|
||||||
ESP_ERROR_CHECK(esp_wifi_scan_start(&scan_config, 0));
|
esp_wifi_scan_start(&scan_config, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ void mesh_event_handler(void *arg, esp_event_base_t event_base,
|
|||||||
/* mesh softAP is hidden */
|
/* mesh softAP is hidden */
|
||||||
scan_config.show_hidden = 1;
|
scan_config.show_hidden = 1;
|
||||||
scan_config.scan_type = WIFI_SCAN_TYPE_PASSIVE;
|
scan_config.scan_type = WIFI_SCAN_TYPE_PASSIVE;
|
||||||
ESP_ERROR_CHECK(esp_wifi_scan_start(&scan_config, 0));
|
esp_wifi_scan_start(&scan_config, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MESH_EVENT_STOPPED: {
|
case MESH_EVENT_STOPPED: {
|
||||||
@ -243,7 +243,7 @@ void mesh_event_handler(void *arg, esp_event_base_t event_base,
|
|||||||
esp_wifi_scan_stop();
|
esp_wifi_scan_stop();
|
||||||
scan_config.show_hidden = 1;
|
scan_config.show_hidden = 1;
|
||||||
scan_config.scan_type = WIFI_SCAN_TYPE_PASSIVE;
|
scan_config.scan_type = WIFI_SCAN_TYPE_PASSIVE;
|
||||||
ESP_ERROR_CHECK(esp_wifi_scan_start(&scan_config, 0));
|
esp_wifi_scan_start(&scan_config, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -68,7 +68,7 @@ static bool wifi_join(const char *ssid, const char *pass, int timeout_ms)
|
|||||||
|
|
||||||
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
|
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||||
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
|
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
|
||||||
ESP_ERROR_CHECK( esp_wifi_connect() );
|
esp_wifi_connect();
|
||||||
|
|
||||||
int bits = xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT,
|
int bits = xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT,
|
||||||
pdFALSE, pdTRUE, timeout_ms / portTICK_PERIOD_MS);
|
pdFALSE, pdTRUE, timeout_ms / portTICK_PERIOD_MS);
|
||||||
|
@ -141,7 +141,7 @@ static bool wifi_cmd_sta_join(const char* ssid, const char* pass)
|
|||||||
reconnect = true;
|
reconnect = true;
|
||||||
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
|
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||||
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
|
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
|
||||||
ESP_ERROR_CHECK( esp_wifi_connect() );
|
esp_wifi_connect();
|
||||||
|
|
||||||
xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 5000/portTICK_RATE_MS);
|
xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 5000/portTICK_RATE_MS);
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ static bool wifi_cmd_sta_scan(const char* ssid)
|
|||||||
scan_config.ssid = (uint8_t *) ssid;
|
scan_config.ssid = (uint8_t *) ssid;
|
||||||
|
|
||||||
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
|
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||||
ESP_ERROR_CHECK( esp_wifi_scan_start(&scan_config, false) );
|
esp_wifi_scan_start(&scan_config, false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ static void init_wifi(void)
|
|||||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
||||||
ESP_ERROR_CHECK(esp_wifi_start());
|
ESP_ERROR_CHECK(esp_wifi_start());
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_scan_start(NULL, true));
|
esp_wifi_scan_start(NULL, true);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (scan_done == true) {
|
if (scan_done == true) {
|
||||||
|
@ -70,7 +70,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
|
|||||||
|
|
||||||
ESP_ERROR_CHECK( esp_wifi_disconnect() );
|
ESP_ERROR_CHECK( esp_wifi_disconnect() );
|
||||||
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
|
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
|
||||||
ESP_ERROR_CHECK( esp_wifi_connect() );
|
esp_wifi_connect();
|
||||||
} else if (event_base == SC_EVENT && event_id == SC_EVENT_SEND_ACK_DONE) {
|
} else if (event_base == SC_EVENT && event_id == SC_EVENT_SEND_ACK_DONE) {
|
||||||
xEventGroupSetBits(s_wifi_event_group, ESPTOUCH_DONE_BIT);
|
xEventGroupSetBits(s_wifi_event_group, ESPTOUCH_DONE_BIT);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ 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");
|
||||||
if (s_retry_num < MAX_RETRY_ATTEMPTS) {
|
if (s_retry_num < MAX_RETRY_ATTEMPTS) {
|
||||||
ESP_ERROR_CHECK(esp_wifi_connect());
|
esp_wifi_connect();
|
||||||
s_retry_num++;
|
s_retry_num++;
|
||||||
} else if (ap_idx < s_ap_creds_num) {
|
} else if (ap_idx < s_ap_creds_num) {
|
||||||
/* Try the next AP credential if first one fails */
|
/* Try the next AP credential if first one fails */
|
||||||
@ -73,7 +73,7 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base,
|
|||||||
ESP_LOGI(TAG, "Connecting to SSID: %s, Passphrase: %s",
|
ESP_LOGI(TAG, "Connecting to SSID: %s, Passphrase: %s",
|
||||||
wps_ap_creds[ap_idx].sta.ssid, wps_ap_creds[ap_idx].sta.password);
|
wps_ap_creds[ap_idx].sta.ssid, wps_ap_creds[ap_idx].sta.password);
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wps_ap_creds[ap_idx++]) );
|
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wps_ap_creds[ap_idx++]) );
|
||||||
ESP_ERROR_CHECK(esp_wifi_connect());
|
esp_wifi_connect();
|
||||||
}
|
}
|
||||||
s_retry_num = 0;
|
s_retry_num = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -107,7 +107,7 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base,
|
|||||||
* with legacy apps. So directly attempt connection here.
|
* with legacy apps. So directly attempt connection here.
|
||||||
*/
|
*/
|
||||||
ESP_ERROR_CHECK(esp_wifi_wps_disable());
|
ESP_ERROR_CHECK(esp_wifi_wps_disable());
|
||||||
ESP_ERROR_CHECK(esp_wifi_connect());
|
esp_wifi_connect();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WIFI_EVENT_STA_WPS_ER_FAILED:
|
case WIFI_EVENT_STA_WPS_ER_FAILED:
|
||||||
|
Reference in New Issue
Block a user