raphaelhanneken / apple-juice

An advanced battery gauge for macOS, that displays the remaining battery time and more.
MIT License
510 stars 34 forks source link

Displays 99% At Full Charge #3

Closed Jackson-S closed 6 years ago

Jackson-S commented 6 years ago
screen shot 2018-04-25 at 12 25 35 pm

While the charge should be displaying 100% I think there's a floating point or logic error stopping it from displaying correctly.

Device: Macbook Pro 15in Late 2016 OS: 10.13.4 (17E199)

raphaelhanneken commented 6 years ago

Hi @Jackson-S! It seems like the estimate for the current mAh value is wrong. Does the percentage remain at 99%, for a very long time (over 5 minutes)?

Jackson-S commented 6 years ago

It remains that way indefinitely, but corrects its self if I either change power sources or restart the program. I've done some further testing and ioreg reports "FullyCharged" as true, but the program doesn't check this state value when charging, only when initialising or changing states.

raphaelhanneken commented 6 years ago

It's because Apple Juice doesn't poll for changes, but gets notified by the OS whenever something (mAh, power source, etc) changes. That way, when there are no changes to the power source no unnecessary updates are triggered.

The next time you have this issue, could you please run this command pmset -g batt | grep -E "\d+" and post the output here?

Jackson-S commented 6 years ago

$ pmset -g batt | grep -E "\d+" -InternalBattery-0 (id=3866723) 100%; charged; 0:00 remaining present: true

screen shot 2018-04-28 at 3 06 13 pm
raphaelhanneken commented 6 years ago

I've just released a new version, which uses another method of getting the percentage from the system. I hope this fixes the issue.

Jackson-S commented 6 years ago

This seems to have fixed the issue perfectly.