Skip to content
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

Add BAS GATT reporting #306

Merged
merged 4 commits into from Nov 2, 2020
Merged

Add BAS GATT reporting #306

merged 4 commits into from Nov 2, 2020

Conversation

Nicell
Copy link
Member

@Nicell Nicell commented Oct 27, 2020

This adds BAS GATT reporting using any device binding with the label BATTERY. Closes #47.

Notes:

  • bt_gatt_bas_set_battery_level has been renamed in Zephyr 2.4.0 -> Upgrade to Zephyr 2.4.0 #223
  • zmk_battery_update should eventually raise a battery event instead of directly posting to the BAS GATT
  • If the board doesn't have a battery reporting device, init will fail and none of the timers will run. Should this be behind a Kconfig value instead?
  • I'm thinking that the update function should only update if the battery value has changed since last time. This would for example save from an unnecessary ePaper display refresh in the future.

@Nicell Nicell added bluetooth Bluetooth related items enhancement New feature or request core Core functionality/behavior of ZMK labels Oct 27, 2020
app/src/battery.c Show resolved Hide resolved
Copy link
Contributor

@petejohanson petejohanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two super minor comments.

app/src/battery.c Show resolved Hide resolved
app/src/battery.c Outdated Show resolved Hide resolved
Co-authored-by: Pete Johanson <peter@peterjohanson.com>
Copy link
Contributor

@petejohanson petejohanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@petejohanson petejohanson merged commit 89b8bfc into zmkfirmware:main Nov 2, 2020
1 check passed
@Katona
Copy link

Katona commented Mar 4, 2022

Hi! Would it be possible to report the battery level of both halves in case of split keyboards? Either through the "master" (maybe with pressing some combo) or directly to the host via Bluetooth (if it's possible at all)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bluetooth Bluetooth related items core Core functionality/behavior of ZMK enhancement New feature or request hacktoberfest-accepted
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Proper battery reporting via BLE battery service
3 participants