Browse Source

Fix reboot caused by starting scan while wifi is connecting.

Sebastien 5 years ago
parent
commit
ec293f8258
1 changed files with 8 additions and 2 deletions
  1. 8 2
      components/wifi-manager/wifi_manager.c

+ 8 - 2
components/wifi-manager/wifi_manager.c

@@ -835,8 +835,14 @@ void wifi_manager( void * pvParameters ){
 				/* if a scan is already in progress this message is simply ignored thanks to the WIFI_MANAGER_SCAN_BIT uxBit */
 				uxBits = xEventGroupGetBits(wifi_manager_event_group);
 				if(! (uxBits & WIFI_MANAGER_SCAN_BIT) ){
-					xEventGroupSetBits(wifi_manager_event_group, WIFI_MANAGER_SCAN_BIT);
-					ESP_ERROR_CHECK(esp_wifi_scan_start(&scan_config, false));
+					if(esp_wifi_scan_start(&scan_config, false)!=ESP_OK){
+						ESP_LOGW(TAG,"Unable to start scan; wifi is trying to connect");
+//						set_status_message(WARNING, "Wifi Connecting. Cannot start scan.");
+					}
+					else {
+						xEventGroupSetBits(wifi_manager_event_group, WIFI_MANAGER_SCAN_BIT);
+					}
+
 				}
 
 				/* callback */