WiFiManager icon indicating copy to clipboard operation
WiFiManager copied to clipboard

Update feature asyncwebserver and fix network scanning

Open ovidiupruteanu opened this issue 2 years ago • 11 comments

ovidiupruteanu avatar Apr 11 '22 00:04 ovidiupruteanu

I am rebuilding this branch, to make it mergable from master, without conflicts

tablatronix avatar Apr 11 '22 01:04 tablatronix

What particularly did you fix, there is a merge in this PR, or is that all it is?

tablatronix avatar Apr 11 '22 01:04 tablatronix

This branch wasn't working for me, I had the same issue described by @dronecz in issue #1121 . I started by merging master, but that didn't fix the issue. It is now mergable from master without conflicts. I did my best to test it, and it works for me on ESP8266, but it should be double checked, I was not familiar with the code before starting this.

The change I made that fixed #1121 was to set _asyncScan to true and remove the hardcoded async=true from WiFiManager::WiFi_scanNetworks

ovidiupruteanu avatar Apr 11 '22 09:04 ovidiupruteanu

ok ill check that also, thanks

tablatronix avatar Apr 11 '22 13:04 tablatronix

I tested some more. On ESP8266 it's working with Auto, OnDemand, AutoNonBlocking, OnDemandNonBlocking, NonBlockingwParams. OTA Update doesn't seem to be working.

I also tested on ESP32 and for some reason it still does a SYNC Scan, I will debug further.

*wm:[2] NUM CLIENTS:  1
*wm:[2] <- Request redirected to captive portal 
*wm:[2] <- HTTP Root 
*wm:[2] WiFi Scan ASYNC started 
*wm:[2] <- HTTP Wifi 
*wm:[2] WiFi Scan SYNC started 
*wm:[0] [ERROR] scan waiting 
*wm:[0] . 
*wm:[0] . 
*wm:[0] . 
.........
*wm:[0] . 
*wm:[0] . 
*wm:[0] . 
E (66893) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (66893) task_wdt:  - async_tcp (CPU 0/1)
E (66893) task_wdt: Tasks currently running:
E (66893) task_wdt: CPU 0: IDLE0
E (66893) task_wdt: CPU 1: loopTask
E (66893) task_wdt: Aborting.
abort() was called at PC 0x40139da4 on core 0

ELF file SHA256: 0000000000000000

Backtrace: 0x400887f0:0x3ffbf810 0x40088a6d:0x3ffbf830 0x40139da4:0x3ffbf850 0x40086f2d:0x3ffbf870 0x401562e3:0x3ffbc210 0x4013b73b:0x3ffbc230 0x4008b22d:0x3ffbc250 0x40089a7e:0x3ffbc270

Rebooting...

ovidiupruteanu avatar Apr 11 '22 17:04 ovidiupruteanu

Yeah thats a known issue

#1121

tablatronix avatar Apr 11 '22 17:04 tablatronix

https://github.com/tzapu/WiFiManager/blob/7bffda3fe67ae7d4cb567fbc6bfa7d4322871d29/WiFiManager.cpp#L3698-L3702

I see that wm_event_id != 0 was added to fix #1383 but this seems to cause it to never subscribe to WiFi events. Shouldn't it be wm_event_id == 0? After I changed this async network scanning started working on ESP32.

ovidiupruteanu avatar Apr 11 '22 22:04 ovidiupruteanu

YES

tablatronix avatar Apr 12 '22 01:04 tablatronix

483b83489b5d0638e0d17bba8490982778caea6e

Sorry, been distracted lately, and I didn't test it..

tablatronix avatar Apr 12 '22 01:04 tablatronix

Thanks! This branch now works for both ESP8266 and ESP32. I am working with AsyncWebServer in my current project. Let me know if you need help with development or testing for this.

ovidiupruteanu avatar Apr 12 '22 08:04 ovidiupruteanu

Any plans on merging this?

CircuitSetup avatar Aug 30 '22 13:08 CircuitSetup