From 33f491a8e62eff02be0a18b4fa348cc6d168be7a Mon Sep 17 00:00:00 2001 From: Christian Baars Date: Mon, 27 May 2024 15:17:09 +0200 Subject: [PATCH] scan wifi asynchronously (#21498) --- tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index 0dcf52a14..de9b796ba 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -1987,7 +1987,11 @@ void HandleWifiConfiguration(void) { #ifdef USE_EMULATION UdpDisconnect(); #endif // USE_EMULATION - int n = WiFi.scanNetworks(); + int n = WiFi.scanNetworks(true); + while(n<0){ + delay(50); // some magic number - maybe non optimal + n = WiFi.scanComplete(); + } AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_SCAN_DONE)); if (0 == n) {