esp8266: wlan.connect() may crash when there're too many scan results
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)
ports/esp32: Support additional scan options when connecting to WiFi.
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.