Old scan hangs when using Wifi.scan() #7418
Unanswered
espruino-discuss3
asked this question in
ESP32
Replies: 1 comment
-
Posted at 2020-10-02 by @gfwilliams Hi - as you created the GitHub issue, let's discuss this one on there: espruino/Espruino#1939 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Posted at 2020-09-29 by rj
Hey 🙂,
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.
Problem:
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.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 calledscanCB
. But I see multiplereturn
statements injswrap_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, butg_jsScanCallback
is assigned in line 894, andjswrap_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.Observations:
... in any case, the problem is a bit hard to re-produce, but this is roughly what I observe:
wifi.connect
-function, I get the scan error the next time I try to scan, and now it seems to hang foreverThoughts?
Beta Was this translation helpful? Give feedback.
All reactions