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

modules/battery: Deprioritize capacity /sys value for battery calculation if other methods are available #3381

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

OpenSauce04
Copy link
Contributor

@OpenSauce04 OpenSauce04 commented Jun 23, 2024

Closes #3293

The current code for battery calculation seems to assume that the capacity value returns the non-design battery capacity. This is not the case, and it instead returns the design capacity of the battery.

Currently, the capacity value is used above all other methods if it is present in the /sys directory of the battery. This means that the design capacity of the battery will always be displayed regardless of the design-capacity configuration option.

To remedy this issue, I have restructured the code so that the capacity value is only used if the other possible options for calculation have been exhausted beforehand.

This screenshot shows two instances Waybar while the battery is plugged in at full capacity. The top instance is the current release version, and the bottom instance is the code present in this pull request:
image

This pull request maintains the functionality of the design-capacity configuration option. Here is the previous screenshot taken again with design-capacity set to true:
image

Please correct me if I have done anything incorrectly in this pull request, as I am not very familiar with the codebase.

@OpenSauce04
Copy link
Contributor Author

The CI failure appears to be unrelated to the code in this pull request

@Alexays
Copy link
Owner

Alexays commented Jun 24, 2024

LGTM

@Alexays Alexays merged commit 1003c22 into Alexays:master Jun 24, 2024
8 of 9 checks passed
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.

Battery module gets stuck below 100% at full battery regardless of design-capacity
2 participants