Limit battery charge level with kernel - Google Pixel 4a 5G Guides, News, & Discussion

DISCLAIMER: I'm not responsible if your battery or phone ever borked due to you used the commands in this post!
Just found out that there's "parameter" in /sys for limiting battery charging behavior, which probably works just like "battery charge limit"
Obviously this requires root, if you have no idea what is this for and why, read this first
As I'm no pro here, I'm just sharing what I found out, and the method may not be 100% reliable as ACC (the Magisk module, which currently somehow doesn't want to work on my 4a 5G)
Note that the following commands may not work due to you're running different kernel
To make your phone stop charging after reaching 80%, run the following command:
# echo 80 > /sys/devices/platform/soc/soc:google,charger/charge_stop_level
You can use cat against /sys/devices/platform/soc/soc:google,charger/charge_disable to check if your phone had stopped charging.
There's charge_start_level as well, I guess that the phone will start charging again after your battery level drops to the level that this "parameter" specifies, but I don't really leave my phone plugged in that long so I'll leave that for you guys to test it.
PS. I don't know why but this method may only work once for one boot, in other words, you need to reboot the phone for this method to be effective when you charge again. Edit: it worked more than once for me now.

Many thanks. The battery on this phone is amazing. I would like it to last as long as possible.

Since it's been a few months since this phone is out; are there apps that can do this yet? I run CalyxOS and can't root. This feature is #1 on my wishlist for a CalyxOS update.

Thsi can be done with ACCA Magisk Module and there is even an app for it called AccA on github. You can set different profiles with the app.

AccA only works on the 4a 5G when using a custom kernel such as protonkernel or elementalx. The stock kernel doesn't have the right switches.

Confirmed working on Android 12PB2 thank you so much the AccA app is not working on my pixel 5 either appreciate your brain

On Pixel 4a 5g control file that works for me is sm7250_bms/charge disable and Automatically cycle through switches is ON. I've installed ACC through Termux from downloaded github zip, thren I've installed AccA from F-droid and disabled ACC module in Magisk. And it works, it stops charging, in my case, at 85 % .
Maybe it's worth to mention that I'm on LineageOS for microG 18.1, Proton kernel 1.4, Magisk rooted.

It is at different pass in my Pixel6a, but it works! (Android13 2022/11/5 updated)
echo 80 > /sys/devices/platform/google,charger/charge_stop_level
Thanks a lot!

There's actually just a parameter that needs to be enabled under vendor/etc/perf section.... I forget which one of the XML files it's in, but you'll see something along the lines of "support idle xxxxxx" I can't look at the moment but it's fairly obvious when you do see it. If I get some free time I'll dig back through there and find it

Related

[XDANDROID DEV] Development beta tests (Battery driver, diamond panel, ...)

Hi,
First of all, I want to thanks all people that helped me testing the battery driver last time.
I'm starting a new thread for those tests as I seen many "users" of xdandroid were using my zImage as if it was an official one and claims having troubles with them.
As it's some still at devel level, I prefet to have a separate thread, this will avoid any confusion between official releases and development release.
As you may know, the first images I've released didn't not contains the modules, thus, wifi was not working. Also, I did broke the rodhium boot because of the battery temperature reporting false temperature for this model.
For those who wants to help me by testing this driver, the important thing is to clearly describe the problem you have (I.E : don't tell that the battery level is wrong only, tell me how you do know that, by comparison to winmo or else...). Second important thing is to make a "dmesg log" :
How-to make a dmesg log :
1/ Go to the "Dev tools" menu and launch the "Terminal Emulator"
2/ type "cd sdcard" (without the quote)
3/ type "dmesg >dmesg.log" (without the quotes)
4/ Send/Post me the dmesg file that will be made on the root of the SD card (either you can get it using android - don't work on my diamond - or you can get the file by rebooting the phone under winmo.
You can also do this using adb if you know how it works.
Shell script method :
1/ Make a txt file with "dmesg > /sdcard/dmesg.txt" on the root of your sdcard name it dumpdmesg.sh
2/ Under xdandroid, browse to the sdcard folder and execute the dumpdmesg.sh file
P.S : yu may have to make the dumpdmesg.sh executable using the followinf method : under a terminal (see above), type "cd sdcard" and then type "chmod +x dumpdmesg.sh".
If you need some special help or want to contact me, just send me a pm.
Here is a new set of zImages INCLUDING modules (hope it will work this time !). It have been build with the most recent kernel changes (Friday 10th September). The packages include the zImage+module in the folder zImage. Modified source files are available in the folder src.
1/ Only battery driver changes :
http://www.mediafire.com/?02qlq504pihhnnp
2/ Battery driver + Diamond panel on/off "improvement" (some people reports the screen does not powers up with this zImage. If you are experiencing same problem, please restore a working zImage (from your previous version or the last official build) and send me a dmesg log after having power on/off the screen at least 3 times. Thanks)
http://www.mediafire.com/?55qb3xpbrajivya
i think you may have the download links mixed up
hamagc said:
i think you may have the download links mixed up
Click to expand...
Click to collapse
Hard working day...thanks, I've fixed it.
Jerome
How to use?
viruscrazy said:
Hi,
First of all, I want to thanks all people that helped me testing the battery driver last time.
I'm starting a new thread for those tests as I seen many "users" of xdandroid were using my zImage as if it was an official one and claims having troubles with them.
As it's some still at devel level, I prefet to have a separate thread, this will avoid any confusion between official releases and development release.
As you may know, the first images I've released didn't not contains the modules, thus, wifi was not working. Also, I did broke the rodhium boot because of the battery temperature reporting false temperature for this model.
For those who wants to help me by testing this driver, the important thing is to clearly describe the problem you have (I.E : don't tell that the battery level is wrong only, tell me how you do know that, by comparison to winmo or else...). Second important thing is to make a "dmesg log" :
How-to make a dmesg log :
1/ Go to the "Dev tools" menu and launch the "Terminal Emulator"
2/ type "cd sdcard" (without the quote)
3/ type "dmesg >dmesg.log" (without the quotes)
4/ Send/Post me the dmesg file that will be made on the root of the SD card (either you can get it using android - don't work on my diamond - or you can get the file by rebooting the phone under winmo.
You can also do this using adb if you know how it works.
If you need some special help or want to contact me, just send me a pm.
Click to expand...
Click to collapse
another way to get the dmesg log that was advised to me some time ago was to make a txt file with "dmesg > /sdcard/dmesg.txt" inside of it and name it dumpdmesg.sh. when in android (using a file manager) execute the dmesg.sh file and it will create a dmesg log for you on the root of your sdcard. may be easier than typing it in terminal.
here is my log: http://pastebin.com/dPeEwFYr
winmo showed 80% when i booted android, android showed 77. this is on a siedio 1500mah battery. hopefully it will help with something. let me know if you need more info from me.
hamagc said:
another way to get the dmesg log that was advised to me some time ago was to make a txt file with "dmesg > /sdcard/dmesg.txt" inside of it and name it dumpdmesg.sh. when in android (using a file manager) execute the dmesg.sh file and it will create a dmesg log for you on the root of your sdcard. may be easier than typing it in terminal.
here is my log: http://pastebin.com/dPeEwFYr
winmo showed 80% when i booted android, android showed 77. this is on a siedio 1500mah battery. hopefully it will help with something. let me know if you need more info from me.
Click to expand...
Click to collapse
Thanks for the script thing, I will put it in my first post.
Thanks also for your log. Will have a look at it.
Jerome
still have wifi error
I used both fixes: battery driver and Battery driver + Diamond panel on/off "improvement" and with both of them I have Wifi error.
I attached dmesg for the first fix - battery driver
My device is DIAM100 with standard 900 mah battery
i can confirm this too. wifi still shows error.
Is the patch for Diamond only (reason to have "Diamond" on the name?)
I found it easier to just dump the file by doing this:
1. Open "cmd", type in "adb shell".
2. Type in "cd sdcard", then type "dmesg > dmesg.log"
3. Type "exit", then type "adb pull /sdcard/dmesg.log C:\Users\UserNameHere\Desktop\dmesg.log".
Also, check this post for my dmesg log. It's a whole day of me using my phone including charging and not, etc, etc..
http://forum.xda-developers.com/showpost.php?p=8097023&postcount=2281 <<
The only issues I've found so far are...
Sometimes the screen does not come back on. (Known issue, been about for a long time)
Touchpad seems to stop working randomly. I have to hit the up arrow on the "trackball" to re-enable the capacitive touchpad.
When plugging the phone into charge, it immediately reads 100% battery.
The good part is that my phone doesn't heat up to dangerous temperatures as it used to! It's a little warm, but definitely a huge improvement over the older revisions. I'm running the kernel with the Diamond patch, and I'm using an HTC Fuze with 3G Data turned on, Facebook, Handscent, Pandora, and GMail all running. I made a few phone calls in the process, too. The phone held together through all of that .
im'going to test it on my diam100!
edit: the battery seems to work better but wifi doesn't work and when i set the screen off the led start to blink like diamond is charging....this mean a battery consumption...!but this is the good way bro!!!!
edit2: android shows me 55% winMo 58%!!!
hey viruscrazy, are you working to get better battery life also?? I used your kernel update, kept the phone on standby (95% batt) throughout the night and saw low batt in the morning
But i got the correct battery %age and the panel worked well too
I just grabbed this tonight, and will DEFINITELY help to give feedback, it's one of 2 reason's I don't already use it daily (other being camera, i use alot), i know we got the fakecharge option, but it doesn't help to use and just have it go dead from actually being dead cause of no way to monitor it. This will be great to tweak it in time to be close to accurate as WM is. And get the patches officially added!!!
I am a little confused though, i over wrote my zimage, but the module's file was only like 400-500KB, versus the daily one i grab (when ever a new one is thrown up to DL.) is like 5MB in size. (current one i got is named "modules-2.6.27.46-01163-ge008466.tar.gz" and has 61 files, but on the site i got it from, it says "Kernels are built without debugging, for increase of speed." which i take it to mean a lot more compiled files are included to help speed.) I get them from http://balsat.hopto.org/.
I am still learning, but each time a new module file comes out, you DO delete the old one and use the new one right? Versus just ADDING the new one in your android directory (adding more and more doing this.)
I want to test, but don't want to mess up things that might make testing worse for you doing this'
EDIT- Ok, i havent's had time YET to follow the log instructions for info, BUT for now I ran it (didn't look at the battery level unfortunately, and will properly test more, but JUST wanted to give quick feedback since i already noticed a MMAASSIIVVEE difference in the metering of battery ALREADY.),
USUALLY ALWAYS after about 20-30 minutes (at most) it shows about 10-15% left. With new patches here provided on my CDMA Touch Pro, i was ACTIVELY was downloading and installing new games and utilities from the marketplace for over 3 HOURS, and it was showing battery power level pretty well, it showed 18% battery power left, i then rebooted into WM and battery power showed 34%, which isn't right, HOWEVER is WAY closer to showing proper battery levels compared to normal Android 2.2 builds by themselves. I will offer active helping support (using the shown proper proceedures.) in giving feedback with the rest of the helper here to help get us to the point where the battery level % is as closest to accurate as WM is. That is the 2nd only reason i don't use Android as my PRIMARY OS (forgetting about WM completely), Battery accurate level meter (TONS closer with current patches linked here), and CAMERA (as i use it a lot for normal images and family photo's and nephew
Hi there.
Fisrt of all, sorry for the wifi problem, I will have a closer look to the building process as it seems there is a problem with it. I don't use wifi myself so I don't test it but I will do for the next releases.
@m4f1050 : The diamond patch is for all phones but changes only affect the diamond phone. I made a different archive because maybe the panel stuff is not working correctly on all diamonds and people still want to test the battery stuff.
@gm112 : Thanks for the tip. I didn't put the adb method because on my diamond, the adb is not working all time. sometimes it will work (even using the Mass Storage profile under windows) and sometimes it won't work (even using the actyvesync profile)... Anywya, it's an easier way for people that have usb working on their phone.
@imrock : I'm not currently working on battery life but during my tests, I've seen a big difference between sleep mode using winmo (around 50mA drained over the usb cable) and android (arout 130mA drained over the usb cable). I've not yet measured the current drained from battery as I will have to make a small isolation between battery and contact.
@djdafreund : My modules are having problems because wifi won't work. When you download a new zImage, you should get the module that is provided with and you can delete the old one.
Thanks all for tests. I will at first try to figure out why I can't get the modules to compile properly.
Small questions : Do someone experienced problem letting the phone on charger all night ? I had a problem with one of my charger that will show charging but after a night, the battery is not fully charged, like if the charger stopped during the night. The other one charger works without any problem and the battery is fully charged. Maybe a problem with my charger but I want to be sure the problem is not coming from the android 2.2 (I just updated to 2.2 this week end, never had this problem before).
Hi,
I found the magic script that generates the modules correctly. I've updated the second post links to the new builded images + modules. Modules are not the smalles one without debug but I will make them withut debug for the next time.
Now, it's time for me to work on the rhodium temperature.
Please, continue testing,*especially for diamonds users that have problems with their screen.
Thanks
viruscrazy said:
Hi,
I found the magic script that generates the modules correctly. I've updated the second post links to the new builded images + modules. Modules are not the smalles one without debug but I will make them withut debug for the next time.
Now, it's time for me to work on the rhodium temperature.
Please, continue testing,*especially for diamonds users that have problems with their screen.
Thanks
Click to expand...
Click to collapse
Good job on the work, man! ..Question. Do you need a Fuze? I have one with a broken touchscreen, lol.
EDIT: After charging the phone a bit, it seems the battery level drops 1% every 8 seconds.
EDIT #2: It seems to get back in-sync with what Windows Mobile reports after dropping down to the accurate amount . After rebooting, the reported battery life was lower tahn what it actually was, and added up till it was fairly close to the actual value. It may jump around a few percentiles off, but it's much more accurate than ever before, it seems. My panel doesn't seem to "freeze" up like it did before, too. Waking up from sleep seems a bit more responsive, but that could be related to other things. I'd like to report that my HTC Fuze(RAPH110) does not get very much hot when it's charging and discharging ;P. I'll post a dmesg log in a few hours.
EDIT #3: Figured I'd mirror your kernel images!
http://gd-u.com/files/Android/HtcBatterySmem_1.tar.gz
http://gd-u.com/files/Android/BoardDiamondPanel_FullPatch.tar.gz
I to have the wifi error but at least 3g is still there. Im on rhod400, though as for the battery work that has been implemented at least so far seems to be a vast improvement. So far though its making me feel more like I know how much juice I got. Love the charging animation. Can tell for sure it's getting some charge. Thanks for the hard work you guys do.
Ok now I can confirm wifi working with newest update.
Sent from my MSM using Tapatalk
very exciting. thanks, the battery driver works fine on my diam100.
it's full charged when I charge it all night. I'd like to try it more ,I'll post it later if i find some problems

[ROOT]Faster Wireless Charging using Automate

Untested on the Q Beta!
For information about the way the mod functions read this.
This mod is possibly dangerous given its nature of modifying the safeguards built into your phone by Google. I am not responsible for your actions using this mod. This mod is meant only for Pixel 3 and 3 XL devices, I would recommend against trying this on other devices.
All that being said I use this mod daily and decided to share. Attached is a ".flo" file used by the app "Automate," link to download from play store, to import the flowchart for the mod. The reason I used automate instead of the typical Advanced Charging Control Magisk module is due to the module having much more functionality that I didn't need or want. Examples include weird charging behavior with USB-PD chargers and overall charging instability. This also allows the mod to be disabled by booting in safe mode.
Details about the mod:
This mod may stop working after any android update
This mod seems to even allow non "fast charge" wireless chargers to be faster
This mod allows a max of 9v to be accepted through wireless charging instead of stock 5v without Google Certification.
This mod reverts whenever the phone stops charging (this is the part that this Automate Flow automates)
Details about the Flow:
This Flow requires 2 apps (Automate and Automate superuser permissions plugin) be installed from Google Play Store
This Flow requires superuser permission on the device (Magisk recommended)
This Flow does NOT modify /system
The file that is modified by the Flow is reset upon unplugging/lifting off a wireless charger so uninstalling Automate will undo the mod completely
The Flow runs like this:
Wait for wireless charging state to change
If wireless charging connected: run shell command then Go to 1
If wireless charging disconnected: Go to 1
So if the phone is not charging or cable charging there isn't an endless loop running.
Instructions:
Download and extract the .flo file
Download Automate app if you have not already
Open Automate app and go through its first time setup
Use the 3 dots menu in the top right to select "import"
Navigate to where you extracted the .flo file and select it
Select the new Flow that just appeared
Under Privileges check the checkbox "full (superuser) access..."
Google play store will prompt you to download the superuser permission app for automate
Grant superuser to automate
Press Start, you'll get a persistent notification about the flow running
OPTIONAL: Go back to Automate app's settings and check the "run on system startup" to enable the mod on boot
You can verify success based on the log in Automate or by observing the charging text on the lockscreen/ambient display. If it says "charging slowly" then the mod failed if it says "charging" then the mod succeeded. You can also check in apps such as Ampere, the charging current pre-mod for me was always <600ma and up to 1200ma after. Note after ~70% charge the Pixel 3(xl) seem to slow charging speed so have a <50% battery for a good comparison.
To uninstall the mod just uninstall Automate or open the Flow and then in the 3 dots menu press delete.
EDIT: Now available in Tasker flavor for those of you who use Tasker and don't want a second automation app running on your phone. Just open the .XML file and select open with in the top right and then Tasker on the pop-up.
@StykerB
Thanks for your work, but i use the App "Automagic" https://play.google.com/store/apps/details?id=ch.gridvision.ppam.androidautomagic
Attached is the flow for Automagic. Need also Root permissions.
Procedure:
1. wireless power connected
2. send command
I just installed this on my Pixel 3 XL and will try it out with my Choetech wireless car charger. Typically I was seeing < 500maH of current with this stock charger. I hope to see over 1A with this patch.
Thanks,
So we have finally found away around the google certified fast chargers?
Works great for me, Thanks.
Would be great to get the assistant features of the pixel stand working too.
I got 850mA when using this MOD and a Choetech wireless charger. Now I can top off my battery while streaming audio and running waze. Previously, I can only stay flat on my batter charge.
Well done!
I used the Automagic version. Worked good. Was seeing 500mA before then it bumped it up to 850mA - 1A range.
Thank you for this
Other Apps Charge money
Has anyone had an issue where it start charging and the 2 seconds later it stops and then starts again and keeps repeating?
Cozzeck said:
Has anyone had an issue where it start charging and the 2 seconds later it stops and then starts again and keeps repeating?
Click to expand...
Click to collapse
I've noticed this behavior with one of my old nokia wireless chargers or if i have a charging speed reading app open while the battery is >70% (when the battery management locks charging speed to 7.5w or less). But for me it seems to either go away after a minute or two or re-situating the phone on the charger.
Works great with my Samsung fast wireless charger! Goes from 600 ma to 1000+
Sent from my Pixel 3 XL using Tapatalk
Get this error using tasker. Any ideas? On April update. Was working previously.
01.07.14/E Run Shell: ->
01.07.14/E Run Shell: ->
01.07.14/E Run Shell: ->
01.07.14/Shell runBackground echo 9000000 > /sys/class/power_supply/wireless/voltage_max root: true timeout: -1
01.07.14/Shell start process-thread ID 263
01.07.14/E add wait type Shell1 time 2147483647
01.07.14/E add wait type Shell1 done
01.07.14/E add wait task
01.07.14/E Error: 1
PLEASE IGNORE THIS POST. I GOT MY ANSWER. SORRY.
Hm I'm trying to understand the exact shell command that is sent as I use Macrodroid.
What is the exact command I should use?
Also does this method still work on Android 10?

Question Automatic shutdown according to battery percentage app or Magisk module.

As the title says, is there any app or Magisk module that can automatically shutdown your device according to battery percentage?
ahhh we have almost the same issue but my issue is whenever my battery percentage reach 20% wifi get disconnected i need to to setting and wifi and click scan again for it to get reconnected i think it is some sort of battery saver
i hate it whenever i'm playing it disconnect me
Actually, I'm not asking about an issue.
I'm asking if anyone knows of an app or module for Magisk that can shutdown the device accordingly to battery percentage.
I'd really like to set my phone to shutdown when the battery hits 15%.
Nemix77 said:
Actually, I'm not asking about an issue.
I'm asking if anyone knows of an app or module for Magisk that can shutdown the device accordingly to battery percentage.
I'd really like to set my phone to shutdown when the battery hits 15%.
Click to expand...
Click to collapse
Macrodroid can (with root). It's like a simpler tasker app. I'll pm you my telegram link, i can send you a quick video if you like...?
Nemix77 said:
Actually, I'm not asking about an issue.
I'm asking if anyone knows of an app or module for Magisk that can shutdown the device accordingly to battery percentage.
I'd really like to set my phone to shutdown when the battery hits 15%.
Click to expand...
Click to collapse
ohh you don't have my issue?
reg66 said:
Macrodroid can (with root). It's like a simpler tasker app. I'll pm you my telegram link, i can send you a quick video if you like...?
Click to expand...
Click to collapse
I do at 20% although 30% or higher be better.
After 20% there's a lot less usable power available and charging from that low is more stressful on a Li especially if fast charging.
I'll do 20% shutdown and 90% battery charging stop.
That's 70% usable power, I can't do anything better than that.
Nemix77 said:
I'll do 20% shutdown and 90% battery charging stop.
That's 70% usable power, I can't do anything better than that.
Click to expand...
Click to collapse
I generally do 40 - 70% or so. On my device it's 3 hrs on SOT and take 15 minutes to fast charge.
Li's like frequent midrange power cycling; use it if it fits your needs.
Nemix77 said:
As the title says, is there any app or Magisk module that can automatically shutdown your device according to battery percentage?
Click to expand...
Click to collapse
Magisk module : Advanced Charging Controller (acc)
https://forum.xda-developers.com/t/advanced-charging-controller-acc.3668427/
It has features as:
Shutdown at set percentage, eg. 20%
Stop charging when reach a percentage, eg. 75%
Cool down charging, so the device and battery won't be very hot using temperature detect on battery.
Charging voltage/current limitation.
Charge cool down as set, eg. 50 seconds charge and 10 seconds cool down without charging, then repeat.
Read the README in github.
ACC app has some issues. Module is working better and updated.
The module will need you to manually edit the settings profile, and you need to use command line.
If you just want to stop charging at certain percentage, Battery Charge Limit is enough.
On F-droid
https://f-droid.org/en/packages/com.slash.batterychargelimit/
Play store
https://play.google.com/store/apps/details?id=com.slash.batterychargelimit&hl=en&gl=US
Both need root.
I use Battery Charge Limit already on my Mi Pad 4.
Advanced Charging Controller seems to have a lot more features.
I haven't been able to get ACC with ACCA (GUI) or Battery Charge Limit to work on the Poco F3 with Xiaomi.EU rom and root.
None of the control files work on both apps.
AccA is faulty.
Use the Magisk module.
You might want to ask cutsom ROM developers because they had managed to get smart charge working, so there's definitely control file that works.
I got Acc with AccA working!
I was testing the charging switches without plugging in the charger, my bads...
Some how Battery Charge Limit does not work, it's a simpler app and I used it with my Mi Pad 4 so I thought it would just work with the Poco F3.
Nemix77 said:
I got Acc with AccA working!
I was testing the charging switches without plugging in the charger, my bads...
Some how Battery Charge Limit does not work, it's a simpler app and I used it with my Mi Pad 4 so I thought it would just work with the Poco F3.
Click to expand...
Click to collapse
Check ACC control config what control file your phone uses, then see in Battery Charge Limit if you can select that control file manually.
I think it can also manually write the control file, but not quite sure.
pl1992aw said:
Check ACC control config what control file your phone uses, then see in Battery Charge Limit if you can select that control file manually.
I think it can also manually write the control file, but not quite sure.
Click to expand...
Click to collapse
Yeah I figured that, but since I have Acc with AccA working there's really no need to go back to Battery Charge Limit.
Nemix77 said:
Yeah I figured that, but since I have Acc with AccA working there's realy not need to go back to Battery Charge Limit.
Click to expand...
Click to collapse
Just to clear the things that you've already said
You mean ACC with AccA is working properly? If not, is there any problems with using ACC with AccA app?
I used ACC with AccA app before on my raphael times with EvoX Custom ROM, works well and haven't encountered any problems with using with ACC via AccA App

Themes / Apps / Mods [MOD/magisk/root] Set charging limit to 90%

Based on: https://forum.xda-developers.com/t/limit-charge.4355851/
All credits to @rickysidhu_
Attached a simple Magisk module to set the charging limit to 90% at boot time.
If you want to "undo", just remove the Magisk module and reboot.
foobar66 said:
Based on: https://forum.xda-developers.com/t/limit-charge.4355851/
All credits to @rickysidhu_
Attached a simple Magisk module to set the charging limit to 90% at boot time.
If you want to "undo", just remove the Magisk module and reboot.
Click to expand...
Click to collapse
I really appreciate you uploading this, man. However, not sure the masses realize that ACCA magisk module can not only do exactly this, but it also has a litany of far more features.
Not only that, but it can actually increase the charging speed slightly. Cool stuff.
Just flash the module, and then install the APK. Then going to settings and set the parameters/limit, or increased charging speed you want.
I can't seem to get this to work on my P6P.
I am running Magisk 23014
The module is installed and "on"
The Damon is running in the App and In settings only temperature control and automatically cycle through switches are selected.
But, it always charged to 100%
Any suggestions?
biTToe said:
I can't seem to get this to work on my P6P.
I am running Magisk 23014
The module is installed and "on"
The Damon is running in the App and In settings only temperature control and automatically cycle through switches are selected.
But, it always charged to 100%
Any suggestions?
Click to expand...
Click to collapse
I have the same experience.
I suspect we can use it but have to change something manually like setting what the control file is, based on the thread that's referenced in the OP:
rickysidhu_ said:
If anyone is wondering how to stop the Pixel from charging at a certain percentage, it's the following command:
Code:
echo 90 > /sys/devices/platform/google,charger/charge_stop_level
Replace 90 with whatever percentage you want to stop charging at!
Click to expand...
Click to collapse
biTToe said:
I can't seem to get this to work on my P6P.
I am running Magisk 23014
The module is installed and "on"
The Damon is running in the App and In settings only temperature control and automatically cycle through switches are selected.
But, it always charged to 100%
Any suggestions?
Click to expand...
Click to collapse
Until the correct switches are implemented in acc, you can make it work by using the current & voltage controls as the charging switch.
> Click on the gear icon for Custom settings
> Click the pencil icon next to Charging switch
> Change the value to 0 mA & Save
> Save the custom settings (save icon in the top right corner)
> Restart ACC daemon
craigacgomez said:
Until the correct switches are implemented in acc, you can make it work by using the current & voltage controls as the charging switch.
> Click on the gear icon for Custom settings
> Click the pencil icon next to Charging switch
> Change the value to 0 mA & Save
> Save the custom settings (save icon in the top right corner)
> Restart ACC daemon
Click to expand...
Click to collapse
Everything is good, until i restart the daemon. then the app crashes. When i restart the settings in charging switch have reverted to automatic.
... test charging switch hangs.
Have disabled pixel battery stuff.
Have force closed and deleted all data for app.
with no luck
biTToe said:
Everything is good, until i restart the daemon. then the app crashes. When i restart the settings in charging switch have reverted to automatic.
... test charging switch hangs.
Have disabled pixel battery stuff.
Have force closed and deleted all data for app.
with no luck
Click to expand...
Click to collapse
Yeah, I don't know why the "Test Charging Switch" hangs in the app. But I'm not sure why restarting the daemon causes the app to crash for you.. You can try to set the charging switch to 0mA, save and reboot
Question from a noob, but why would I want to have my battery at 90% instead of 100%? Does it have something to do with battery health?
batpoil said:
Question from a noob, but why would I want to have my battery at 90% instead of 100%? Does it have something to do with battery health?
Click to expand...
Click to collapse
Correct.
batpoil said:
Question from a noob, but why would I want to have my battery at 90% instead of 100%? Does it have something to do with battery health?
Click to expand...
Click to collapse
Yep. For the last five years, I never quick charge, I charge as soon as my phone gets to 25% and I try to only charge to 75%. That 50% take still lasts me about a day.
Good battery health is also a selling point when I sell my old phones on Swappa.
craigacgomez said:
Yeah, I don't know why the "Test Charging Switch" hangs in the app. But I'm not sure why restarting the daemon causes the app to crash for you.. You can try to set the charging switch to 0mA, save and reboot
Click to expand...
Click to collapse
I finally got it working after multiple uninstall/reinstall/reboot cycles...
Or at least I thought I did. I changed the AccA version from Developer to Master.
That seems to have stopped the crashes and everything seemed to be working correctly. I plugged it in at 75% charge when I went to bed, but when i woke-up this morning I was at 40% charge -Status indicated discharging.
After a few more app and phone reboots it began charging again and now seems to be working: charge to 80%, discharge to 70%...
One thing I did notice was, if I set my Superuser access to "ask every time" I am constantly asks to grant permission every 20-30 seconds.
If it continues to be an issue I will post the log files if you can tell me where they can be found.
biTToe said:
I finally got it working after multiple uninstall/reinstall/reboot cycles...
Or at least I thought I did. I changed the AccA version from Developer to Master.
That seems to have stopped the crashes and everything seemed to be working correctly. I plugged it in at 75% charge when I went to bed, but when i woke-up this morning I was at 40% charge -Status indicated discharging.
After a few more app and phone reboots it began charging again and now seems to be working: charge to 80%, discharge to 70%...
One thing I did notice was, if I set my Superuser access to "ask every time" I am constantly asks to grant permission every 20-30 seconds.
If it continues to be an issue I will post the log files if you can tell me where they can be found.
Click to expand...
Click to collapse
After some time, I realised that the current/voltage switch was not working reliably, especially if you switch between chargers with different capacitites.
But I did find a better way to make acc work on the Pixel 6 / Pro. It uses the same charging switch that the modules above uses, but it will work with the acc pause/resume charging.
I do not know how to set this up using the app becuase it actually uses a combination of two switches the charge_stop_level and charge_start_level.
What you need:
Root (Magisk)
acc magisk modules (AccA app installs this. Tested with acc v2021.11.3)
Terminal emulator app
Steps:
Connect the phone to a charger
Open the terminal emulator app
Elevate to root
Code:
$ su
Reset acc to default (to eleminate any potential conflicts with previous configs)
Code:
# acc -s r
Set your pause (pc) and resume (rc) charge levels
Code:
# acc -s pc=80 rc=70
Specify the control switch
Code:
# acc -s s="/sys/devices/platform/google,charger/charge_start_level 0 95 /sys/devices/platform/google,charger/charge_stop_level 95 5 --"
Validate the config. Check the values for resume_capacity, pause_capacity and charging_switch
Code:
# acc -s
Restart accd (acc daemon)
Code:
# accd
(Optional) Reboot
After that, you can tweak using AccA. Just leave the Charging switch & automatically cycle through switches" options untouched.
Further explanantion about the switch configuration
Code:
/sys/devices/platform/google,charger/charge_start_level 0 95 /sys/devices/platform/google,charger/charge_stop_level 95 5 --
- set charge_start_level to 0 when below the "resume capacity" so that the phone will charge
- set charge_start_level to 95 when at the "pause capacity" so that the phone will stop charging (effectively forces the phone to only start charging if the battery is 95%)
- set charge_stop_level to 95 when below the "resume capacity" so that the phone will charge
- set charge_stop_level to 5 when at the "pause capacity" so that the phone will stop charging (effectively forces the phone to only stop charging if the battery is 5%)
- the double hyphen at the end disables the "automatically cycle through switches" to guarantee that the specified switch is the only one that will be used.
It doesn't work for me neither way. Hmmm
Burt Squirtz said:
I really appreciate you uploading this, man. However, not sure the masses realize that ACCA magisk module can not only do exactly this, but it also has a litany of far more features.
Not only that, but it can actually increase the charging speed slightly. Cool stuff.
Just flash the module, and then install the APK. Then going to settings and set the parameters/limit, or increased charging speed you want.
Click to expand...
Click to collapse
Hiya. What's the best method to keep up with more recent AccA Magisk Module versions? Asking for a friend who doesn't compile stuff. Seriously, I see it on GitHub https://github.com/Magisk-Modules-Repo/acc and I see instructions for building and installing, but is there any easy way for us lazy folks who never compile? i.e. is there any easy way for us non-developers to get files such as "Advanced_Charging_Controller_(ACC)-v2021.11.3(202111030).zip" out of the GitHub entry? Thanks.
@foobar66
I've changed the prefix of this thread from "Development" to "Themes / Apps / Mods" as it didn't qualify for the first one. Please review the stuck guidances at the top of the forum and do not change the prefix back.
Regards
Oswald Boelcke
Senior Moderator
I have the latest ACCA from August and the Dec version of ACC which is installed under the latest Magisk and the December update. I am also running the Kirisa kernel.
My issue is that the settings for "Apply on plug" never stick. The capacity control settings seem to stick.
I made the edit to the default profile which seems to work.
Hey.
Is it possible to make this module work on every charge without reboot?
craigacgomez said:
After some time, I realised that the current/voltage switch was not working reliably, especially if you switch between chargers with different capacitites.
But I did find a better way to make acc work on the Pixel 6 / Pro. It uses the same charging switch that the modules above uses, but it will work with the acc pause/resume charging.
I do not know how to set this up using the app becuase it actually uses a combination of two switches the charge_stop_level and charge_start_level.
What you need:
Root (Magisk)
acc magisk modules (AccA app installs this. Tested with acc v2021.11.3)
Terminal emulator app
Steps:
Connect the phone to a charger
Open the terminal emulator app
Elevate to root
Code:
$ su
Reset acc to default (to eleminate any potential conflicts with previous configs)
Code:
# acc -s r
Set your pause (pc) and resume (rc) charge levels
Code:
# acc -s pc=80 rc=70
Specify the control switch
Code:
# acc -s s="/sys/devices/platform/google,charger/charge_start_level 0 95 /sys/devices/platform/google,charger/charge_stop_level 95 5 --"
Validate the config. Check the values for resume_capacity, pause_capacity and charging_switch
Code:
# acc -s
Restart accd (acc daemon)
Code:
# accd
(Optional) Reboot
After that, you can tweak using AccA. Just leave the Charging switch & automatically cycle through switches" options untouched.
Further explanantion about the switch configuration
Code:
/sys/devices/platform/google,charger/charge_start_level 0 95 /sys/devices/platform/google,charger/charge_stop_level 95 5 --
- set charge_start_level to 0 when below the "resume capacity" so that the phone will charge
- set charge_start_level to 95 when at the "pause capacity" so that the phone will stop charging (effectively forces the phone to only start charging if the battery is 95%)
- set charge_stop_level to 95 when below the "resume capacity" so that the phone will charge
- set charge_stop_level to 5 when at the "pause capacity" so that the phone will stop charging (effectively forces the phone to only stop charging if the battery is 5%)
- the double hyphen at the end disables the "automatically cycle through switches" to guarantee that the specified switch is the only one that will be used.
Click to expand...
Click to collapse
hi! I'm quite new to ACC(A) and was wondering how to better keep my phone's battery healthy. I was wondering about battery idle mode and saw that Roll3r found a working battery idle mode for use with Kirisakura kernel which I'm on. However, I'm just a noob with all the terminal things and don't know how to implement it myself. it's this one:
Just an FYI (because others have asked), the only ACC (Advanced Charging Controller) charging switch with working battery idle mode is:
gcpm/constant_charge_current_max 1866420 0
Several other switches tested as supported idle, but they'd all crash ACC when idle priority is enabled. You may have to add it manually.
Edit: I shouldn't say "only" - this is the only switch (supported by this kernel) that I found get the phone to idle with. There might be others out there, too.
Click to expand...
Click to collapse
was wondering if you could list the terminal commands for this and what options am I not to touch afterwards (since in your example, which I have been using, you said not to touch the cycling option anymore)
As someone who doesn't like touching command lines/terminals, I just did these commands following craigacgomez and hoped for the best, but this time using Roll3r's switch that they found that allowed battery idle mode
su
acc -s r
acc -s pc=80 rc=70
acc -s s="gcpm/constant_charge_current_max 1866420 0 --"
accd
edit: ironically, idk how you add this switch using ACCA itself because entering the switch then the start and stop values just kicks me back to the previous dialogue, the one that says if I should choose auto or add a switch
craigacgomez's switch ( "/sys/devices/platform/google,charger/charge_start_level 0 95 /sys/devices/platform/google,charger/charge_stop_level 95 5 --" ) oddly stops charging when I enable the cooldown cycle feature on ACCA. So if I set the cooldown cycle to start at 45%, my phone stops charging at 45%.
I'm testing Roll3r's switch ( "gcpm/constant_charge_current_max 1866420 0 --" ) now, which passed the battery idle mode test. I've stayed on 80% since reaching it and ACCA reports a -10 current every so often so definitely staying on that battery idle mode. I also have the cooldown feature enabled, also set to 45% and it was working well with no premature paused charging / battery idling.
Quick question, if it says charging speed goes from -10 to +10, does that already signify battery idle mode? That's what happens to either switch so I'm assuming it is since I know my phone would have dropped in battery by now
Delete

Themes / Apps / Mods [MOD/magisk/root] Set charging limit to 80/85/90/95% v2

After some readings on: https://forum.xda-developers.com/t/limit-charge.4355851/
and https://forum.xda-developers.com/t/mod-magisk-root-set-charging-limit-to-90.4363477/
( Credits to @rickysidhu_ and @foobar66 )
There is a thing I found and tested:
"charge_stop_level" must be used together with "charge_start_level"
Spoiler: Details
If set start @40 / stop @60, the phone will begin charging when (and only when) the battery drops to 40%, and stops charging @ 60%.
(it defines a range, and the first time the user hit the range boundary activates this range function)
If set stop @90 without setting a start, the phone will refuse the 2nd time charging until the battery drops to default 0 (or the battery service/phone has been restarted)
(This explained many "phone not charging" reports in the above links posts)
I like @foobar66's magisk mod solution. It is simple and safe.
It has only 1 line of working script in the zip.
So I "clone" it with some different values (added the fix, so 2 lines of script code in each zip now, that's all it does)
These are for the lazy people who don't want to deal with advanced settings, and who want a 10-second trouble-free simple solution for battery health.
The 4 clones:
P6n_charginglimit_95.zip (charging limit to 95%, it should give you an extra ~30% battery life span in lab-tested theory)
P6n_charginglimit_90.zip (charging to 90%, an extra ~60% battery life span)
P6n_charginglimit_85.zip (charging to 85%, double the battery life span, recommended for joe and johns)
P6n_charginglimit_80.zip (charging to 80%, should give more than double the battery life span)
Those numbers are the best estimates from other battery research papers, no guarantee.
To install, pick the one you want and flash it in Magisk.
To uninstall, simply disable or remove it in Magisk.
A12.1 tested. It should work on A13.
Edit: A13 is also confirmed working.
Reply problems if you find any.
I use advanced charging controller, I stop charging at 81% and I can regulate voltage as well. Temperature triggers etc it's great.
How does it increase battery life by 30%?
Or you mean battery health ?
I use ACC plus Tasker to keep the battery entering idle mode at around 50% while plugged. I got my pixel 6 last November, now the battery gets 82 cycles so far.
ChongoDroid said:
I use advanced charging controller, I stop charging at 81% and I can regulate voltage as well. Temperature triggers etc it's great.
Click to expand...
Click to collapse
bush911 said:
I use ACC plus Tasker to keep the battery entering idle mode at around 50% while plugged. I got my pixel 6 last November, now the battery gets 82 cycles so far.
Click to expand...
Click to collapse
The thing is, ACC monitors/controls too many components in the system that I don't fully get, and I am not sure if it conflicts with built-in "smart charging" or other circuit controllers or not, and have to combine a Magisk backend module and a root-access frontend APP to make it work with so many details settings to setup....... It is just......too heavy?
(or I am too old to tinkering those things.....my sad middle-age life)
These .zips are the "10-second solution" for lazy folks.
It does only 1 thing, It is transparent and super snappy (only 2 lines of script, no binary), and it can hardly go wrong.....it just works.
Paz9 said:
How does it increase battery life by 30%?
Or you mean battery health ?
Click to expand...
Click to collapse
You are right Shakespeare, "life span" to be precise, sorry for my English ahahahah.
bush911 said:
I use ACC plus Tasker to keep the battery entering idle mode at around 50% while plugged. I got my pixel 6 last November, now the battery gets 82 cycles so far.
Click to expand...
Click to collapse
Would you like to share how (ACC + Tasker. Tasker project, everything)?
Thanks
E!ad said:
Would you like to share how (ACC + Tasker. Tasker project, everything)?
Thanks
Click to expand...
Click to collapse
Yes, this might be device dependent. It is better to choose and set proper charging switch which supports battery idle mode.
Latest AcC module must be flashed
kylechen said:
The thing is, ACC monitors/controls too many components in the system that I don't fully get, and I am not sure if it conflicts with built-in "smart charging" or other circuit controllers or not, and have to combine a Magisk backend module and a root-access frontend APP to make it work with so many details settings to setup....... It is just......too heavy?
(or I am too old to tinkering those things.....my sad middle-age life)
These .zips are the "10-second solution" for lazy folks.
It does only 1 thing, It is transparent and super snappy (only 2 lines of script, no binary), and it can hardly go wrong.....it just works.
You are right Shakespeare, "life span" to be precise, sorry for my English ahahahah.
Click to expand...
Click to collapse
It doesn't interfere with the built in stuff and you don't need magisk module anymore. It takes 20.9mb on system so it's not heavy, I also like being able to adjust on the fly (have it set to 70% for long home use and 85% for out and about)
ChongoDroid said:
It doesn't interfere with the built in stuff and you don't need magisk module anymore. It takes 20.9mb on system so it's not heavy, I also like being able to adjust on the fly (have it set to 70% for long home use and 85% for out and about)
Click to expand...
Click to collapse
Are you referring to the Tasker implementation or ACC?
Zilla0617 said:
Are you referring to the Tasker implementation or ACC?
Click to expand...
Click to collapse
Acc
Yay finally a solution that works. Pixel 6 here, A13 Stock
Thanks.
ChongoDroid said:
Acc
Click to expand...
Click to collapse
Could you share your config file? What phone and is are you using? Thanks
Zilla0617 said:
Could you share your config file? What phone and is are you using? Thanks
Click to expand...
Click to collapse
Pixel 6 pro stop charging at 82 and start at 76 that's all I used
ChongoDroid said:
Pixel 6 pro stop charging at 82 and start at 76 that's all I used
Click to expand...
Click to collapse
So when I setup acc stopping at 80% on Android 13 and its place on pixel stand 2, the charging oscillates on/off. It would charge for few minutes then stop and charge for few mins and stop. Are you experiencing this? This behavior did not occur with Android 12
Zilla0617 said:
So when I setup acc stopping at 80% on Android 13 and its place on pixel stand 2, the charging oscillates on/off. It would charge for few minutes then stop and charge for few mins and stop. Are you experiencing this? This behavior did not occur with Android 12
Click to expand...
Click to collapse
Oh weird I get the osculation on car charger but it was always random. It won't even charge on 13.
Change the switch to 0 should have it working I don't know if that causes the switch enough
ChongoDroid said:
Oh weird I get the osculation on car charger but it was always random. It won't even charge on 13.
Change the switch to 0 should have it working I don't know if that causes the switch enough
Click to expand...
Click to collapse
Hmmm I don't use the front end app. Maybe I should try it and see if the behavior changes. Which version of the app are you using?
Zilla0617 said:
Hmmm I don't use the front end app. Maybe I should try it and see if the behavior changes. Which version of the app are you using?
Click to expand...
Click to collapse
1.0.35
kylechen said:
The thing is, ACC monitors/controls too many components in the system that I don't fully get, and I am not sure if it conflicts with built-in "smart charging" or other circuit controllers or not, and have to combine a Magisk backend module and a root-access frontend APP to make it work with so many details settings to setup....... It is just......too heavy?
(or I am too old to tinkering those things.....my sad middle-age life)
These .zips are the "10-second solution" for lazy folks.
It does only 1 thing, It is transparent and super snappy (only 2 lines of script, no binary), and it can hardly go wrong.....it just works.
You are right Shakespeare, "life span" to be precise, sorry for my English ahahahah.
Click to expand...
Click to collapse
I strongly agree, just not worth having to deal with acc, getting idle mode to work, debugging, getting it to work again and hoping it still works. If I get the time to do so might write a module that integrates a slider in settings or as a quick setting to set to what percentage it should charge and executing those lines of code with that percentage.
kylechen said:
P6n_charginglimit_80.zip (charging to 80%, should give more than double the battery life span)
Click to expand...
Click to collapse
I peeked inside this one (as it's the one I'm successfully using), and noticed the following:
echo 79 > /sys/devices/platform/google,charger/charge_start_level
echo 80 > /sys/devices/platform/google,charger/charge_stop_level
Click to expand...
Click to collapse
I get the "80" for the charge_stop_level, but I don't understand why "79" is the charge_start_level value? (But I'm new at this, so..forgive my ignorance.)

Categories

Resources