Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>It seems that when an ESP32 connects it goes straight for the first access point it sees. No matter if that access point is not the one you’ve taped it to. This can lead to bad connectivity, especially since I’ve not really observed ESP32’s moving around to other access points.

This is not a characteristic of "ESP32", this is how the software running on the ESP32 is programmed to work, whatever specific program that is. And it is not my experience at all with "ESP32s". In my ESP-IDF based program, the ESP32 device connects to access points exactly how I tell it to connect with the software I wrote that deals with wifi connections. YMMV.



I encountered this a while back and it led me to dig into the ESP-IDF documentation to try to understand the behavior of a device I did not write the code for. Yes, it's software, but it's a footgun from the manufacturer. This in particular I find to violate the principle of least astonishment:

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/...

> It is a possible situation that there are multiple APs that match the target AP info, e.g., two APs with the SSID of "ap" are scanned. In this case, if the scan is WIFI_FAST_SCAN, then only the first scanned "ap" will be found.

The default if esp_wifi_set_config() is not called or, as I see in almost all the sample code that comes up with a quick web search, it is left untouched in the wifi_config_t struct, appears to be WIFI_FAST_SCAN. When you're looking directly at the relevant manual section during a HN discussion of ESP WiFI behavior, it may be obvious, but for a developer focused on the main product functionality who just copies and pastes an example and moves on when it appears to work, I'm not surprised if this always-incorrect-by-default behavior makes it into the vast majority of shipped ESP-based products.

And there's also

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/...

I could have sworn there used to be a "sort by SSID" default, as in it would do the full scan and then connect to the AP with the alphabetically earlier hardware address. In any case, the symptom I was plagued with was that this particular device would consistently connect to the furthest-away access point rather than the one in the same room, resulting in unusable dropouts.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: