yoe / fdpowermon

simple battery monitor for acpi laptops and freedesktop.org-compatible system trays
14 stars 3 forks source link

Ignore invalid battery. #4

Closed kak-tus closed 9 months ago

kak-tus commented 2 years ago

I have bluetooth mouse, which reports its battery state.

In acpi report it looks like this

$ acpi -bi
Battery 0: Full, 100%
Battery 0: design capacity 4473 mAh, last full capacity 1452 mAh = 32%
Battery 1: Discharging, 0%, rate information unavailable

In fdpowrmon tooltip I get this

image

And icon

Снимок экрана в 2022-09-09 00-12-42

As is acpi never reports correct state - I never see correct icon (charging/discharging/percent).

This PR add code to skip batteries without rate information.

mckaygerhard commented 9 months ago

fdpowerdown only reports the process of charging.. if the battery its full then fdpowerdown will hide from the icon tray.. so due the first bat is already full, its just showing process of charging of the second battery (that will never charge fully unfortunatelly) so i guess is an expected result

yoe commented 9 months ago

fdpowerdown only reports the process of charging..

Not true.

It will show the current state of acpi. It changes the icon based on what the state of acpi is, but that's all configurable.

if the battery its full then fdpowerdown will hide from the icon tray..

Not quite.

If the battery levels of all batteries are at 100%, then by default it does indeed hide the icon, but that's just a default that can be changed.

This PR (which I kept open for far too long, sorry about that) does indeed solve a legitimate issue.

so due the first bat is already full, its just showing process of charging of the second battery (that will never charge fully unfortunatelly) so i guess is an expected result

Nope, not true.

fdpowermon shows the icon that represents the value of the arithmetic average of all the battery load levels combined. If you have one battery that'sh 25% full and one battery that's 75% full, then it will show an icon for 50% full.

This bug indeed meant that it would add the mouse battery to the denominator of the calculation for the average battery level, but add it did not report any level, would not any corresponding battery level to the numerator, resulting in there being no possibility to ever get to 100% full battery.

mckaygerhard commented 9 months ago

thanks for clarifications @yoe i answered based on the rest of post in others issues.. now we can assume fdpd is active and working.. :+1:

yoe commented 9 months ago

what's this fdpd you're talking about? this code is called "fdpowermon", not fdpd.