Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update feature asyncwebserver and fix network scanning #1389

Open
wants to merge 41 commits into
base: feature_asyncwebserver
Choose a base branch
from

Conversation

ovidiupruteanu
Copy link
Contributor

No description provided.

tablatronix and others added 30 commits February 23, 2022 16:36
so it has nothing to do with the html , and can have different encoding, we could also just use IDs but scan cannot change, or use bssid

tzapu#1370
any webserver event handlers bound before the webserver new reset would cause memory access issues when triggered.

Should remove all events on reset or make memory safe, not sure if this is the correct way to be reseting the webserver, but there were issues with the ports not releasing etc.
This will avoid support inquiries and add a log
tablatronix and others added 7 commits April 7, 2022 08:37
    // if true (default) then stop the config portal from autoConnect when wifi is saved
    void          setDisableConfigPortal(boolean enable);

Name will change
# Conflicts:
#	WiFiManager.cpp
#	WiFiManager.h
#	examples/Super/OnDemandConfigPortal/OnDemandConfigPortal.ino
- _preloadwifiscan seems to help with pre-populating the network list, otherwise the first time accessing the page it is empty
- _asyncScan needs to be true, otherwise it never does an async scan and never populates the network list
- after changing _asyncScan to true, the hardcoded async=true and force=false in WiFiManager::WiFi_scanNetworks don't seem to be necessary anymore
@tablatronix
Copy link
Collaborator

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

@tablatronix
Copy link
Collaborator

tablatronix commented Apr 11, 2022

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

@ovidiupruteanu
Copy link
Contributor Author

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

@tablatronix
Copy link
Collaborator

ok ill check that also, thanks

@ovidiupruteanu
Copy link
Contributor Author

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...

@tablatronix
Copy link
Collaborator

Yeah thats a known issue

#1121

@ovidiupruteanu
Copy link
Contributor Author

WiFiManager/WiFiManager.cpp

Lines 3698 to 3702 in 7bffda3

#ifdef WM_DEBUG_LEVEL
DEBUG_WM(DEBUG_VERBOSE,F("ESP32 event handler enabled"));
#endif
using namespace std::placeholders;
if(wm_event_id !=0) wm_event_id = WiFi.onEvent(std::bind(&WiFiManager::WiFiEvent,this,_1,_2));

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.

@tablatronix
Copy link
Collaborator

YES

@tablatronix
Copy link
Collaborator

tablatronix commented Apr 12, 2022

483b834

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

@tablatronix tablatronix reopened this Apr 12, 2022
@ovidiupruteanu
Copy link
Contributor Author

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.

@CircuitSetup
Copy link

Any plans on merging this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants