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:
I have always gotten these two errors when I connect the board, but haven't given them much thought until now:
WARNING: Scan stop failed
WARNING: set rssi scan not implemeted yet
© Espruino, powered by microcosm.
Report a problem