-
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.
I've renamed the monotonic percentage and voltage to be stable percentage, because it is not truly monotonic, and in my mind, it makes much more sense this way. To not break existing user's settings, I only changed the display name. Under the hood, it's still saved as monotonic. |
@bobrippling @stweedo What do you guys think, should it be monotonic, or does stable make sense here? Just making sure everyone else is fine with the change, and it doesn't just make sense to me... |
Gonna be honest with you, I don't know what monotonic means and wouldn't expect the average bangle user to either, so I would vote for stable or bounded too |
@bobrippling Yeah, I had to look it up when I came across it as well 🤣, stable seems much more user-friendly to me. Monotonic is how smartphones' battery meters work, only going in one direction unless charging, and while this stabilizes it, it doesn't prevent fluctuations, so stable seems like a much better choice here.. |
Nice, yeah that makes sense to me - happy to merge if you are (looks like there's a small linting thing left to sort) |
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.