-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Battery indicator is misleading with two batteries #656
Labels
🐛 bug
Something isn't working as expected.
🌱 good first issue
Good first issue to get your feet wet.
Comments
Interesting! It looks like we can certainly add logic to handle multiple batteries: |
8 tasks
dbanetto
added a commit
to dbanetto/starship
that referenced
this issue
Dec 1, 2019
Changes the calculation of the battery percentage to take into account many batteries. This is by summing their current energy & capacity, then getting a percentage from that. This is what the `battery` crate describes what `Battery::state_of_charge` does but with less accuracy. This should be fine because the percentage is just 2 s.f. Since there is now many batteries the overall state of the battery must be merged from many to one. The strategy here is: if any are discharging then report as discharging; if none are discharging & at least one is charging, then report as charging; if the battery states (e.g. full/empty) are the same, report as that; otherwise, report as unknown. Closes issue starship#656
dbanetto
added a commit
to dbanetto/starship
that referenced
this issue
Dec 1, 2019
Changes the calculation of the battery percentage to take into account many batteries. This is by summing their current energy & capacity, then getting a percentage from that. This is what the `battery` crate describes what `Battery::state_of_charge` does but with less accuracy. This should be fine because the percentage is just 2 s.f. Since there is now many batteries the overall state of the battery must be merged from many to one. The strategy here is: if any are discharging then report as discharging; if none are discharging & at least one is charging, then report as charging; if the battery states (e.g. full/empty) are the same, report as that; otherwise, report as unknown. Closes issue starship#656
dbanetto
added a commit
to dbanetto/starship
that referenced
this issue
Dec 1, 2019
Changes the calculation of the battery percentage to take into account many batteries. This is by summing their current energy & capacity, then getting a percentage from that. This is what the `battery` crate describes what `Battery::state_of_charge` does but with less accuracy. This should be fine because the percentage is just 2 s.f. Since there is now many batteries the overall state of the battery must be merged from many to one. The strategy here is: if any are discharging then report as discharging; if none are discharging & at least one is charging, then report as charging; if the battery states (e.g. full/empty) are the same, report as that; otherwise, report as unknown. Closes issue starship#656
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
🐛 bug
Something isn't working as expected.
🌱 good first issue
Good first issue to get your feet wet.
Bug Report
Current Behavior
The low battery will say that I have 5% left when one battery is low but the other battery has plenty left. See screenshots below.
Expected Behavior
The battery indicator will only show when the overall charge of multiple batteries is low, not when a single battery is.
Additional context/Screenshots
Environment
Relevant Shell Configuration
Starship Configuration
I have not have a config file.
Possible Solution
total remaining charge
/total capacity of all batteries
)battery
crate & used hereThe text was updated successfully, but these errors were encountered: