guild icon
Toit
#How to scan for wifi networks when already connected to wifi?
Thread channel in help
hhv0001
hhv0001 01/11/2024 07:50 AM
Hi, it's probably easy but I can't seem to find out how I can scan for wifi networks. I always get the error "wifi already connected or established". I read some posts by @bmentink and I tried
jag run -D jag.disabled -D jag.timeout=20000s webserver.toit --assets webserver.assets
but the result is the same.

Can I use an active wifi connection to scan for networks? Or is it physically impossible to scan for networks when a wifi connection has already been established? (I didn't think so, but I might be wrong, - it happens.)
hhv0001
hhv0001 01/11/2024 08:08 AM
(I just checked with my old Arduino software and it can scan for networks while having an established wifi connection.)
floitsch
floitsch 01/11/2024 01:53 PM
I think Toit doesn't support scanning while being connected (yet).
hhv0001
hhv0001 01/11/2024 02:02 PM
OK, thanks Florian, no worries, I'll put that one aside then for now. Should I make an issue/request for it somewhere?(edited)
floitsch
floitsch 01/11/2024 02:04 PM
I just looked at the code.
floitsch
floitsch 01/11/2024 02:04 PM
It seems like we just abort the scan if we are already connected.
floitsch
floitsch 01/11/2024 02:05 PM
I removed that check, and things just seem to work.
floitsch
floitsch 01/11/2024 02:05 PM
Will write a PR, and it will likely be in the next SDK release.
hhv0001
hhv0001 01/11/2024 02:09 PM
Excellent! Thanks so much Florian!
👍1
9 messages in total