From ec293f82586d4d8454d8b8dcfed7eeeff47038d8 Mon Sep 17 00:00:00 2001 From: Sebastien Date: Mon, 28 Oct 2019 23:24:14 -0400 Subject: [PATCH] Fix reboot caused by starting scan while wifi is connecting. --- components/wifi-manager/wifi_manager.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/wifi-manager/wifi_manager.c b/components/wifi-manager/wifi_manager.c index e91bfc7d..065eb873 100644 --- a/components/wifi-manager/wifi_manager.c +++ b/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 */