← index #1946PR #11819
Off-topic · high · value 0.388
QUERY · ISSUE

esp8266: wlan.connect() may crash when there're too many scan results

openby ceremcemopened 2016-03-30updated 2016-06-06
port-esp8266

As a follow up of #1943, wlan.connect function causes reset:

print("naber")
naber
>>> import network
>>> wlan = network.WLAN(network.STA_IF)
>>> wlan.active(True)
>>> wlan.scan()
f r0, scandone
[(b'aktos-elektronik', b'\x00\x1c\xa8\xf7\xe8M', 6, -49, 3, 0), (b'UEM', b'\xf4\xe3\xfb\xbak\xdc', 9, -92, 4, 0), (b'TTNET_HUAWEI_827F', b'\xec#=d\x82\x88', 10, -91, 4, 0)]
>>> wlan.isconnected()
False
>>> wlan.connect("aea", "084DA789BF")
Fatal exception 3(LoadStoreErrorCause):
epc1=0x4000deed, epc2=0x00000000, epc3=0x00000000, excvaddr=0x40000008, depc=0x00000000

 ets Jan  8 2013,rst cause:1, boot mode:(1,7)
CANDIDATE · PULL REQUEST

ports/esp32: Support additional scan options when connecting to WiFi.

openby duncfopened 2023-06-19updated 2024-07-29
port-esp32

Support setting scan_method and channel when using WLAN.connect() to connect to a WiFi access point.

Setting scan_method to esp.ALL_CHANNEL_SCAN will cause the ESP32 to connect to the access point with the strongest signal if there are multiple with the same SSID.

Setting channel allows for faster WiFi connections when the channel is known in advance (e.g. if it were previously discovered and cached). This is particularly valuable for battery powered devices. Without this, channels are always scanned sequentially leading to significant delays when the access point is on a high channel.

Also add support for retrieving the bssid from WLAN.config() as this is useful for debugging in environments with multiple access points.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied