-
Notifications
You must be signed in to change notification settings - Fork 144
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
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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...
src/helpers/Battery.cpp
Outdated
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 |
There was a problem hiding this comment.
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
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 |
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. |
This feature would be very helpful! |
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
i was just about to submit a bug for this so i'm glad there's a PR to fix it already |
defaults to lipo with no changes to existing variants