From 025e2b0439b0e2b2f11e6a96ff8a1de28b22d41d Mon Sep 17 00:00:00 2001 From: xiehang Date: Fri, 15 Jan 2021 20:03:25 +0800 Subject: [PATCH] example: Scan failure should not cause system crash --- .../bluetooth/bluedroid/ble/blufi/main/blufi_example_main.c | 2 +- .../ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c | 2 +- examples/mesh/manual_networking/main/mesh_main.c | 6 +++--- examples/wifi/iperf/main/cmd_wifi.c | 2 +- examples/wifi/scan/main/scan.c | 3 +-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/bluetooth/bluedroid/ble/blufi/main/blufi_example_main.c b/examples/bluetooth/bluedroid/ble/blufi/main/blufi_example_main.c index c25e5c2fdb..f33a2125aa 100644 --- a/examples/bluetooth/bluedroid/ble/blufi/main/blufi_example_main.c +++ b/examples/bluetooth/bluedroid/ble/blufi/main/blufi_example_main.c @@ -371,7 +371,7 @@ static void example_event_callback(esp_blufi_cb_event_t event, esp_blufi_cb_para .channel = 0, .show_hidden = false }; - ESP_ERROR_CHECK(esp_wifi_scan_start(&scanConf, true)); + esp_wifi_scan_start(&scanConf, true); break; } case ESP_BLUFI_EVENT_RECV_CUSTOM_DATA: diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c index c5444bf656..810b58b4a8 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c @@ -194,7 +194,7 @@ static bool wifi_cmd_sta_scan(const char *ssid) scan_config.ssid = (uint8_t *) ssid; 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; } diff --git a/examples/mesh/manual_networking/main/mesh_main.c b/examples/mesh/manual_networking/main/mesh_main.c index 7da60a50fd..2893f7ee7d 100644 --- a/examples/mesh/manual_networking/main/mesh_main.c +++ b/examples/mesh/manual_networking/main/mesh_main.c @@ -152,7 +152,7 @@ void mesh_scan_done_handler(int num) esp_wifi_scan_stop(); scan_config.show_hidden = 1; 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); } } @@ -173,7 +173,7 @@ void mesh_event_handler(void *arg, esp_event_base_t event_base, /* mesh softAP is hidden */ scan_config.show_hidden = 1; 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; case MESH_EVENT_STOPPED: { @@ -244,7 +244,7 @@ void mesh_event_handler(void *arg, esp_event_base_t event_base, esp_wifi_scan_stop(); scan_config.show_hidden = 1; 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; diff --git a/examples/wifi/iperf/main/cmd_wifi.c b/examples/wifi/iperf/main/cmd_wifi.c index 6909f46021..15424fb344 100644 --- a/examples/wifi/iperf/main/cmd_wifi.c +++ b/examples/wifi/iperf/main/cmd_wifi.c @@ -174,7 +174,7 @@ static bool wifi_cmd_sta_scan(const char* ssid) scan_config.ssid = (uint8_t *) ssid; 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; } diff --git a/examples/wifi/scan/main/scan.c b/examples/wifi/scan/main/scan.c index 15edb4b831..3ac8230ade 100644 --- a/examples/wifi/scan/main/scan.c +++ b/examples/wifi/scan/main/scan.c @@ -124,7 +124,7 @@ static void wifi_scan(void) ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); ESP_ERROR_CHECK(esp_wifi_start()); - ESP_ERROR_CHECK(esp_wifi_scan_start(NULL, true)); + esp_wifi_scan_start(NULL, true); ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&number, ap_info)); ESP_ERROR_CHECK(esp_wifi_scan_get_ap_num(&ap_count)); ESP_LOGI(TAG, "Total APs scanned = %u", ap_count); @@ -137,7 +137,6 @@ static void wifi_scan(void) } ESP_LOGI(TAG, "Channel \t\t%d\n", ap_info[i].primary); } - } void app_main(void)