mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 11:17:20 +02:00
example: Scan failure should not cause system crash
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:
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
@ -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) {
|
||||||
|
Reference in New Issue
Block a user