-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[Power Manager] Round battery percentage #3904
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: master
Are you sure you want to change the base?
Conversation
Thanks! |
I also have noticed that monotonic percentage is not truly monotonic, it fluctuates, instead of only going down when not charging, and up when charging. |
I will see if I can fix it, but anyone else is welcome to take a look as well |
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.
if (settings.forceMonoPercentage){
var p = Math.round((E.getBattery()+E.getBattery()+E.getBattery()+E.getBattery())/4);
var op = E.getBattery;
E.getBattery = function() {
var current = Math.round((op()+op()+op()+op())/4);
if (Bangle.isCharging() && current > p) p = current;
if (!Bangle.isCharging() && current < p) p = current;
return p;
};
}
Rounding the p value right away might be slightly cleaner logic.
Trying to fix Monotonic percentage fluctuating... |
I noticed that when monotonic percentage was selected, it displayed percentages with decimals, which was hard to read in most battery widgets, so I fixed it here.