-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection params #211
Connection params #211
Conversation
5376bd2
to
3e7fbab
Compare
This PR is ready for review. |
3e7fbab
to
b7e1e1c
Compare
Rebased after #216 was merged. This PR is essential to keep the PineTime connected at low power. The default connection latency drains too much power. |
b7e1e1c
to
5c15b8e
Compare
Oops, messed up the rebase. I'll fix this PR soon. |
5c15b8e
to
31d0fec
Compare
This should now be fixed. Changes:
|
@aykevl can you please rebase this branch and resolve merge conflict? |
This is very useful for debugging, though we should probably expose this in some way to users of the bluetooth package without changing a constant.
I thought it wasn't available, but in fact it is. So let's make it available in the connect handler.
This is a refactor that is necessary to make it easier to work with connected central devices on a SoftDevice.
This makes it possible to discover services on a connected central while in peripheral mode, for example.
This allows changing the connection latency, slave latency, and connection timeout of an active connection - whether in the central or peripheral role. This is especially helpful on battery operated BLE devices that don't have a lot of power and need to lower the connection latency for improved speed. It might also be useful for devices that need high speed, as the defaults might be too low.
31d0fec
to
f6af395
Compare
I've fixed the merge conflicts. |
@Ayke, notifications on the
|
Huh that's odd. |
OK just tried again and now I cannot repro this myself. I tried on both nano-rp2040 and pyportal, and it worked as expected. Maybe my local config was messed up at the time? Sounds like time to merge. Thanks for working on this @aykevl |
Thank you! 🎉 |
Work in progress: I haven't added macOS support yet.doneThis is a PR that changes a few things to make
Device
objects usable in peripheral mode (when another device connects to it):*Device
toDevice
. This is a breaking change, but makes things a lot easier to deal with on a SoftDevice (no difficult workarounds needed to avoid allocating a heap object in the interrupt handler).SetConnectHandler
so that aDevice
is passed instead of just the address of the connecting device. This is another breaking change, but necessary to support this feature (without ugly hacks). Hopefully this is the last breaking change toSetConnectHandler
.SetConnectionLatency
which is necessary for battery operated devices to lower the connection latency and with that lower the current consumption (for example, it lowers the current consumed from 85µA to 10µA according to the online power profiler). This change was my original motivation for this PR.Discovering services and characteristics was already implemented for central mode, and I've found it works just as well in peripheral mode on the SoftDevice.
Tested: