I'm working with the ESP32 in an application where I have to switch between being in AP mode, and connect to my home WiFi.
I need to send a list of available access points created using the wifi.scan()-function, but sometimes an old scan seems to "hang" and I get the error: A scan is already in progress. forever.
A scan is already in progress.
I found the place in the source code, that generates the error: jswrap_wifi_scan.
Something strikes me as odd though;
the variable for the callback function g_jsScanCallback is assigned in the beginning of that function, and released again in the end of a function called scanCB. But I see multiple return statements in jswrap_wifi_scan in case of different errors, so couldn't it be that the variable is assigned, but the scan never kicked off 🤔. It would never get cleared again.
I'll admit, I can't figure out how the event that calls scanCB is finally kicked off, but g_jsScanCallback is assigned in line 894, and jswrap_wifi_scan could be exited only a few lines below at line 906, and I don't see the scan getting started anywhere in between.
... in any case, the problem is a bit hard to re-produce, but this is roughly what I observe:
WARNING: Scan stop failed
WARNING: set rssi scan not implemeted yet
Hi - as you created the GitHub issue, let's discuss this one on there: https://github.com/espruino/Espruino/issues/1939
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem