Closed jasta closed 1 year ago
Update: I tried ble5_multi_advertiser and that worked briefly, but the signal strength is very low and the device couldn't be found again after the initial connection. Seems unlikely this is an issue with the esp32-nimble
project but I'm at a loss to describe what is wrong with my setup, hmm...
Actually wait, I think the ble5_multi_advertiser failing to advertise after I connect is because the advertisements are not restarted in software, so that is expected. When I restart the device after connect it once again works and if I get quite close to the device the signal strength is -30dBm so that seems right.
And looking closer, ble5_multi_advertiser shows that perhaps the device name isn't being reflected properly in LightBlue. I see the Local name is Legacy in the advertisement when I expand the UI, but the summarized name in the UI is "Unnamed". It's plausible that the regular ble_server example is doing something similar and I just can't find it in the list because I have so many BLE devices in my house :grin: EDIT: Nope, the ble_server example is not advertising, at least, there's no device with anywhere near the -30dBm signal strength when I run that example. I can only see this device using the Legacy advertisement when extended advertisements are enabled which makes zero sense to me. Hmm.
Do you have any insight into why LightBlue might be doing this? Is there another app you would recommend for troubleshooting here?
Looks like my issue is describing the same thing as #29, I'll double check that downgrading fixes it.
Confirmed advertising of ble_server works as expected with the v0.1.4 tag checkout. And the name appears correct in LightBlue as well with this tag. Strange.
Just confirmed that updating to esp-idf v4.4.5 from the esp32-nimble v0.1.4 tag still has advertising working which means that it's unlikely to be an upstream esp-idf regression. Still digging deeper to find out what happened to break it...
Did some bisecting and observed that v0.2.1 introduced the problem (not v0.2.0 as #29 says!). I can confirm that the offending change is:
https://github.com/taks/esp32-nimble/commit/9b5262140f5a40d1eadb3bc5e0e619362c643418#r129947887
EDIT: Looks like we should be using esp_idf_sys::BLE_HS_FOREVER
(which is i32::MAX) but for some reason that's not found in esp_idf_sys for me.
I have an ESP32-C3-DevKitM-1 and tried to get the ble_server example working and while everything seemingly is working right from the logs:
https://gist.github.com/jasta/25be24926dd3c2067e26461ebd54b09a
The device doesn't appear in scan results from LightBlue on my Android phone. Not sure what I could've done wrong since I just ran the example without modification (except to change the default target in .cargo/config.toml) on two different boards just to sanity check and neither have externally visible advertisements. Any pointers are greatly appreciated!