Skip to content

add board battery percentage #413

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

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

Conversation

446564
Copy link
Contributor

@446564 446564 commented Jun 19, 2025

defaults to lipo with no changes to existing variants

  • adds two chemistry types to start lipo and lifepo4
  • adds getBattPercent to MainBoard
  • adds getBattType to MainBboard
  • companion UI now uses getBattPercent in renderBatteryIndicator

Copy link
Contributor Author

@446564 446564 left a comment

Choose a reason for hiding this comment

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

can't approve my own review after changes...

uint16_t batt_percent(uint8_t batt, uint16_t mv) {
uint16_t last = mv; // set last to mv so it can never start greater than itself
uint16_t p = 0;
for (int i = 0; i < 102; i++) { // always 101 elements, 100 percent and 0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

pretty sure I have a small bug here, 0-99 == 100 so should be i < 101. will fix shortly

@446564
Copy link
Contributor Author

446564 commented Jul 18, 2025

Any reason we aren't moving forward with some version of this?

Example: my companion is currently reporting 53% in app @3.65V but that's about 10% maybe.

We can of course offload this to the mobile app but it's not future proof and doesn't allow custom power setups. As well the UI will show incorrect battery status.

cc @ripplebiz

@taedryn
Copy link

taedryn commented Aug 7, 2025

I would like to see this move forward as well, reporting (accurate and realistic) battery percentage is a very valuable feature to have.

@446564
Copy link
Contributor Author

446564 commented Aug 7, 2025

I would like to see this move forward as well, reporting (accurate and realistic) battery percentage is a very valuable feature to have.

And should be done at the lowest level possible so different clients not only do not have to implement their own but the implementations do not differ. Only the hardware knows what SoC a given voltage is equal to.

@shultsb
Copy link

shultsb commented Aug 7, 2025

This feature would be very helpful!

446564 added 2 commits August 9, 2025 21:04
defaults to lipo with no changes to existing variants

- adds two chemistry types to start lipo and lifepo4
- adds getBattPercent to MainBoard
- adds getBattType to MainBboard
- companion UI now uses getBattPercent in renderBatteryIndicator
@khudson
Copy link

khudson commented Aug 11, 2025

i was just about to submit a bug for this so i'm glad there's a PR to fix it already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants