h2zero / NimBLE-Arduino

A fork of the NimBLE library structured for compilation with Arduino, for use with ESP32, nRF5x.
https://h2zero.github.io/NimBLE-Arduino/
Apache License 2.0
672 stars 138 forks source link

Can you set the BLE channel used? #538

Open I-Connect opened 1 year ago

I-Connect commented 1 year ago

I am having some (intermittent) issues connecting to a BLE device. My suspicion is that there is interference with wifi, ZigBee or other BLE devices that I have running here

If a connection fails I retry it 5 times. I am not sure if this is the way to go or that it even works this way but I was thinking if I could change the channel on which I am connecting for the different connection retries maybe this way I could manage it better...

The option to set the channel is listed in the esp idf documentation: image

But I cannot find a way to set the channel in NimBle...?

h2zero commented 1 year ago

This function may work for you https://github.com/h2zero/NimBLE-Arduino/blob/ebfe4bcbe5165198447a8d8dfe5de5eb15ae998b/src/nimble/nimble/host/include/host/ble_hs_hci.h#L88

h2zero commented 1 month ago

@I-Connect Did this work for you?