Closed Panometric closed 2 months ago
Have you tried using a different esp32? some boards have crystals that aren't quite up to spec and get out of sync quickly.
Thanks for getting back, actually I made some progress. I had these commented out in the scanner, because I did not think they were needed if using scan callbacks:
//pBLEScan->setInterval(1349);
//pBLEScan->setWindow(449);
So I was getting zeros. Turns out if the window is zero, it makes it very difficult to connect. The examples are all over the place, but after tracking it down the default esp-idf value is 16 to get 10 ms. And if you want all the bandwidth used for BLE, the Window should be equal to the interval.
So an improvement might be to default them both to 16, and standardize the examples.
I'm having a difficult time connecting. There are times when I get mostly failures to connect with code 574, occasionally it works. Other times it works the first try. I've turned on all the nimble debugging and no other messages are printed except connect and disconnect. What makes me think this is a bug is that the timing between the failures is sometimes not even a second, or sometimes several seconds, but always on very even 50 mS intervals, which looks like a race condition. It's always much less than the 30 second connection timeout.
My server device is advertising at 300 mS intervals, and on a power monitor. It's advertising behaviour is not changing at all. So it's not even starting attribute discovery. Retrying like was suggested in #140 does not always work. The percentage is just too low.
Why wont it connect more reliably, and why is it returning failures so quickly?
Log where Time markers are in seconds, my device is PIXEL:
Connection Code: