Closed alexanderturner closed 5 years ago
Digging a bit deeper into this to force the IDF functions event-drivenness with a new arg in wifi_manager_event_handler
and passing false to the blocking attribute. It appears to be an issue with esp-idf blocking the thread when running the scan. Perhaps there should be a timer arg for the wifi scan instead of it being called every time jquery call it.
Helo Alex,
You can indeed set it to false but this brings a whole lot of new issues with thread synchronization. However, it is true blocking the thread is not ideal.
The whole architecture of the manager is hindered by the events being only triggered by a bitfield.
I am currently re-writing the app so that it uses a RTOS queue as primary thread sync instead. This a major rewrite so bear with me; I do not wish to commit broken code to the repository for now!
This is fixed in branch 2.0
Fixed in latest master trunk -- scans are now non blocking
Thanks for this Tony! I should have jumped in with a PR sooner but awesome to see this being actively maintained. I had set the blocking field to false and actioned the update task on in the event handler but whilst it's now 'non blocking' it's still blocking the thread for similar time when it's executing the scan (which is pretty frequently when the jquery script is running).
I'm working on project which could benefit from RTOS queues - are you keeping that effort in a working branch?
I merged my dev branch into the master so you can simply get the master :)
Queue process starts here: https://github.com/tonyp7/esp32-wifi-manager/blob/1a710dabcb9e7f7e0f3a8bb68fd0048ff4681908/wifi_manager/main/wifi_manager.c#L730
Ah awesome :) Thanks. Would be awesome to have a build status for master :)
Hey there, I'm writing an application on top of wifi-manager that extends the web server such to support my own API. In development I noticed that the esp_wifi_scan_start appears to be stealing 2.5s of CPU time every time it runs (which if often). My next course of action is to disable scanning once the unit enters STA however I was wondering if it was something you've come across and if there are more event driven alternatives?
Alex
time to scan AP list: 2500 ms time to scan AP list: 2497 ms time to scan AP list: 2497 ms