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

feat(sensors): Battery charging status detection #1923

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ReFil
Copy link
Contributor

@ReFil ReFil commented Sep 4, 2023

Adds the ability to detect if the battery is charging if the charger is connected to a GPIO on the microcontroller

Can tie into #1456 for an all encompassing battery state underglow effect.
the chg-gpios parameter is entirely optional so shouldn't break existing boards/configs and hasn't so far in my testing

@ReFil ReFil requested a review from a team as a code owner September 4, 2023 20:49
@caksoylar caksoylar added enhancement New feature or request core Core functionality/behavior of ZMK labels Sep 7, 2023
@ReFil ReFil changed the title feat(sensors): Battery charge state detection feat(sensors): Battery charging status detection Sep 8, 2023
@ReFil
Copy link
Contributor Author

ReFil commented Dec 13, 2023

I've added the same detection functionality to the VDDH sense driver. I haven't tested it with vddh yet as i haven't got a suitable test setup yet, but i will be designing a board to do it soon

feat(battery): Initial battery charging state setection
@ReFil
Copy link
Contributor Author

ReFil commented Mar 21, 2024

I've just given this a major refactor to use interrupts to detect the charging state so it's not polled on the timer, confirmed working on VDDH and BVD, tested with a custom display widget on a board using a BQ24075 and VDDH and BVD and TP4054 on a different board, also added the charging state to the battery state changed event as well. Slightly reworked the documentation too with these changes in mind

@ReFil ReFil requested a review from caksoylar March 21, 2024 14:42

:::note Charging indication

The battery charging status is not consumed by any built-in indicators currently and it cannot be conveyed to the host over BLE.
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this is a bit confusing, because the widgets still show a charging indicator tied to the USB status, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered converting all the display widgets in this pr but that's already been done in #2153 and i didn't want to document a feature that didn't exist yet or hijack someone else's PR. If #2153 gets merged first I'll rebase this with that in mind, if this gets merged first the other PR can document it

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense, let's see how it goes.

Copy link
Contributor

Choose a reason for hiding this comment

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

yea i think whichever one gets merged first, the other one will just rebase on top

@petejohanson petejohanson self-assigned this Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core functionality/behavior of ZMK enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants