-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat(ble): Support peripheral battery levels. #2045
feat(ble): Support peripheral battery levels. #2045
Conversation
e74c976
to
05f7cd1
Compare
I've merged these changes into a branch and config the
And tested it with the @Maksim-Isakau zmk-split-battery app for windows. But it only shows one battery level. On a previous version. It can show both: Will it need some extra configuration on my corne-zmk-config? |
It seems that the app from @Katona assumes it just needs to use the first Battery Service, I stead of aggregating all of them from the device: https://github.com/Katona/zmk-ble/blob/main/zmk-ble/ZmkPeripheral.swift#L53 It will need to get updated to work properly. |
@equiman fixed. Please note that you have to specify
in your KConfig file of zmk-config, split battery reporting is off by default. I stumbled upon this at first |
@petejohanson iOS 17 seems to work fine: 15% is peripheral, 49 main. |
Good note. I added to the Testing section of the PR description. |
It's a shame they don't use our display string at all or otherwise disambiguate the two battery levels, but at least they show them both. |
Thanks @petejohanson and @Maksim-Isakau. Now it's working again. It's possible to add some config labels to rename each one? I think |
I wonder if perhaps I can enhance this to add a CUD based on the keyboard name? Or we offer an additional Kconfig for the battery label, and we proxy the CUD from the connected peripherals once they are connected.... I'd probably do that as a follow up enhancement, once this core work is in. |
I like more the idea of an additional I am thoroughly satisfied with monitoring only the battery levels for each side, regardless of the labels. I believe this enhancement would be beneficial for future improvements. |
Ok, so the Zephyr PR was accepted and merged, so I've cherry picked that into our Zephyr fork in zmkfirmware/zephyr#27 Waiting to see if @Katona is able to work on his macOS app bits, but I don't think that's a blocker for merging this in the meantime. |
It seems like there should be an API for getting the peripheral battery level that's similar to |
e834a9e
to
398a241
Compare
Changed the storage to the central code, added a new API for fetching the levels there, and then leveraged that in the BAS proxy code instead. |
c0420fa
to
ede5f0c
Compare
No, I’m using MoErgo’s main (Zephyr 3.2) as my base and replaced their split battery reporting commit with the work here and updated the underglow status to use the new API. I’ll test this against a stock ZMK later this afternoon to try to narrow down the issue. |
I suspect you'll find the same thing occurring, and it's simply that the macOS selection of the battery level to display is non-deterministic. |
I don't think we're getting any help any time soon... My gut is to not hold up our merge of this just because macOS doesn't do sane battery level characteristic selection. The new Sonoma battery widget actually shows the multiple levels. Hopefully it will do so with labels when we add the GATT CUD to each battery level. Also, the proxy portion is optional, and not enabled by default so there's less risk of this being an issue while we continue to iterate. @bryanforbes Any concerns? |
No concerns from me |
I've added the parameters to my config but I do not see peripheral battery status on macOs: |
here is a python script to see split battery levels on linux. https://gist.github.com/madushan1000/9744eb6350a5dd9685fb6bfbb25fbb8a |
It’s just the battery widget in Sonoma in the notification center. |
Great script. I have fused this to another gnome extension, so it is graphically shown in gnome v.42 (ubuntu 22.04). |
I created an app inspired by the @Maksim-Isakau project just for Linux on Dbus Bluez. |
@bryanforbes can you please share what widget are you using for mac? |
Figured out how to display the split battery status on mac:
|
thanks! created a polybar module if anyone uses it with i3 or other wms https://gist.github.com/mike1808/13af77145a292c627fa6508f5fb6730b |
Thank you, I made a bash version of this script |
This is a continuation of the great work from @Katona in #1243 with some important changes:
auxiliary
to disambiguate them from the main one. The new service properly handles multiple peripherals now as well.-ENOMEM
errors on reconnects to peripherals.Many thanks to @Katona for all the work they put into this!
Testing
I've performed the following testing so far:
main
battery is the one displayed on the follow OSes:bluetoothctl
I can subscribe to notifications on the other Battery Level service on a split central, and properly receive notifications it has "proxied" from the split peripheral.The following testing would be nice:
To test, you need to enable the following off-by-default Kconfig settings: