Closed klaasdc closed 6 years ago
You have to set async mode to true to work with ESPAsyncWebServer (please see the example in ESPAsyncWebServer repository - we are off-topic here IMHO...).
Actually, I thought it would have been off topic for ESPAsyncWebserver instead :)
There is only one example in the ESPAsyncwebserver repository but it doesn't say anything about "async mode"? Can you post some more info? Thanks!
:-) try not to read only examples, but documentation also (for example readme.md) https://github.com/me-no-dev/ESPAsyncWebServer#scanning-for-available-wifi-networks , https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/scan-class.html
Ouch, I missed that. Thanks for pointing!
@klaasdc from a quick look, you're using it wrong. You have to check the return value, and kick off another scan. First one is always empty. Also, wrong repo, this is the core. The EspAsyncWebserver is hosted elsewhere. Closing due to user error, and off topic.
Basic Infos
Hardware
Hardware: NodeMCU ESP12E Core Version: 2.3.0 stable
Description
I'm trying to set up a captive portal in WIFI_AP_STA mode. I want to show the user the active networks on the root page using ESPAsyncWebserver. When calling Wifi.scanNetworks() inside the ESPAsyncWebServer handler, it always returns immediately with zero. However, putting the scanNetworks() in the main loop() does work, but creates other issues. I can workaround by using the main loop() to keep updating a network list, but I don't see why it would not work from outside of it.
Below is the minimal working example I could make that exhibits my problem.
Settings in IDE
Module: NodeMCU ESP12E Flash Size: 4MB CPU Frequency: 160Mhz? Flash Mode: ?qio? Flash Frequency: ?40Mhz? Upload Using: SERIAL Reset Method: nodemcu
Sketch