-
-
Notifications
You must be signed in to change notification settings - Fork 291
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
SunkenHero Code optimization & addition of battery percentage #432
Conversation
…tch-1 Added CPU fan speed display for all devices
Added better Battery func
I hope the code isn't too bad, i am not so experienced as i am only 15 years old. |
auto_cpufreq/core.py
Outdated
@@ -42,9 +42,6 @@ | |||
) | |||
CPUS = os.cpu_count() | |||
|
|||
# ignore these devices under /sys/class/power_supply/ | |||
POWER_SUPPLY_IGNORELIST = ["hidpp_battery"] | |||
|
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.
I think its not needed anymore, but i am not sure
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.
I think we do still need it, check #332 PR for reference.
auto_cpufreq/core.py
Outdated
# If found in ignore list, skip it. | ||
if ignore_supply: | ||
continue | ||
return True if psutil.sensors_battery().power_plugged else False | ||
|
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.
Using psutil to get charging status
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.
As I mentioned in other comment this was all added with #308 as battery state would not be showing properly on certain devices, still thinking if we might need some of it or if psutil
will be able to pick it all up itself ...
""" | ||
get batery percentage | ||
""" | ||
return psutil.sensors_battery().percent | ||
|
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.
Added Function to get Battery Percentage
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.
Another reference on why it was the way it was done in the past #308
Completely tested it on my laptop without encountering any errors |
This is great, and I encourage you stay on this path and you'll get far in life :) I reviewed your changes and left few comments on everything, please take a look. If you haven't seen it already and if you plan on sticking around for awhile I also encourage you to take a look at: https://github.com/AdnanHodzic/auto-cpufreq#looking-for-developers-and-co-maintainers |
Ok i will fix the problems and in the future i will check for issues before changing the code |
so i fixed all problems, and i think its ready for the merge |
A few code optimizations