yashsingh1/xdaforums huggingface dataset:
[Magisk] MatteCarra:
It stops charge at 80% and only restarts it when you are below 70%.

It shuts down the phone when you reach 5%, and start cooling down when you are charging above 60% (every 50 seconds of charge it rests 10 seconds).

It check the battery temperature. If temp is > 40°C it cools down with the logic described above despite the charging percent, if temp is > 45°C it pauses for 90 seconds.

All of these settings are editable with config file/terminal/app shared few posts above.
[Magisk] MoHed:
Brilliant. Thanks !

Very nice. Very useful. :good:

Thanks

BTW: What is the format to enter the data for the "On Boot" field? (Edit On Boot Value).
[Magisk] MatteCarra:
Thanks for your nice words!

VR25 asked me to add it mostly for the voltage_max setting, but it's different for different devices.

It is used to apply certain settings on boot.

Just for reference this is written in the thread description:

#onBoot=./usb/device/razer_charge_limit_enable:1 ./usb/device/razer_charge_limit_max:80 ./usb/device/razer_charge_limit_dropdown:70

but for the voltage_max discussion you should use the search function because I'm not really informed.

If you are setting it with my app you should skip the #onBoot=
[Magisk] darkbasic4:
Do you plan to put the app on the play store?
[Magisk] paolocorpo:
The link looks as broken

Can you check please ?

Thank you

Paolo

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] MatteCarra:
Strange. If I click on it the download starts.

Try with this link: https://bit.ly/2UL1P4w

I've not though about this yet.

I will ask VR25 if he thinks it's worth it.

Thanks for the suggestion!
[Magisk] paolocorpo:
Same problem with alternative link

I am trying using mobile device

Inviato dal mio Mi A1 utilizzando Tapatalk
[Magisk] MoHed:
It works !

I had this Module (in an Old version) on my 1+3T. It worked for me. My battery did not show signs of deterioration and I swapped the phone for a 1+6T after 3 years when I cracked the screen.

So, this is a nice theoretical concept, it is well executed (especially that we now have the configuration app), and I think it works in practice.

Thank you VR25. :D:D

I have one minor suggestion: When the phone charges intermittently with cool down mode it vibrates each time the charge comes back on (~ once a minute for 10-15 min). Can we please have a switch to enable turning the vibration off only during the cool down period?
[Magisk] slimshouki:
Have you managed to know the reason?

Is it kernel or some config in acc?

I have fk16 kernel with xtended rom
[Magisk] shouk_1987:
I have the issue and this wakelock is preventing device to go to deepsleep

I had it for 56m and it is the same exact time when acc stopped charging and cable was still plugged

So seems this wakelock kicks in after acc finishes charging and prevent device from deepsleep

When I removed the cable seems to be stopped as its timer didnot increase [MENTION=5228676]VR25[/MENTION] , it seems a bug in the latest version as I am using acc for a good time now and never saw this wakelock before

Screenshots attached
[Magisk] VR25:
I can do it, but - why exactly do you need this?

No, currently, there's no option for that. Nice suggestion, though. I'll implement that.

Unfortunately, not all devices/kernels will allow you to modify that value. This has nothing to do with acc.

You should not limit yourself to testing battery/voltage_max, though. Oftentimes, there are other voltage_max files (and at least one may be modifiable). Forget about voltage_max_design - that's never meant to be modified.

Search for voltage_max in /sdcard/acc/logs/acc-power_supply*.log and test all.

This has nothing to do with acc. It's a Magisk bug. A workaround is renaming /sbin/.magisk/img/acc/service.sh to post-fs-data.sh.

Refer to the previous answer to a similar question above.

If the app had the option to download and flash the module, then yes.

Currently including it in acc zips makes more sense. What do you think, [MENTION=9731715]MatteCarra[/MENTION]?

I'm studying possibilities. Perhaps now that we have an app, this should escalate faster. It's best to have it work at a lower level, though.

Meanwhile, you can search through Play Store for an app that snoozes charger notifications.

This has nothing to do with acc. It's a kernel thing. If acc -s s shows you more than one charging switch, enforcing one might help.
[Magisk] MatteCarra:
Yes, I thought the same.

Right now acc module is a prerequisite and if I don't find the config file I warn the user, but then I don't do anything.

I already imagine the one star reviews because the app "does not work".

Right now I'm not aware of any easy method to install modules but if anyone has some code/commit that I can see let me know.

Anyway I will include a very simple versioning system to let users know when an update is available.

Maybe I can do something about this.
[Magisk] darkbasic4:
That would be even better!
[Magisk] Camerado:
In most cases, I put on charge at night. After charging pause Android starts to consume a lot of energy, but after reboot everything returns to normal.
[Magisk] Macusercom:
@VR Couldn't you reanme it th post-fs-data.sh as default or would that interfere with something? Or is this not possible?

It's really strange because with Magisk v18 all worked fine and v18.1 broke it again. But I see that there is nothing you can do if Magisk is faulty. My other workaround is calling "acc -D start" via Tasker automatically after a reboot.
[Magisk] silmarx:
I think this is must have so we don't loose the quick-charge functionality completely (in case the kernel supports the voltage_max limit).

Especially now we'll have an App, this becomes even more convenient, so in case you implement it, it will also be nice to have the switch to disable the voltage_max easily within the App. I hope it doesn't require a reboot...

What do you mean by "modifiable"? Do you mean be able to write a different value on it? I suppose I will always be able to do it if I'm root (su), right? Or do you mean the value be kept persisted after a reboot? I did manage to modify the file battery/voltage_max but with no effect.

No doubt with need some improvement here, I disabled the periodic coolDown because of this. In MIUI (e.g., MIUI 10.2) it's even worse because the screen always turns on when it stops or resumes charging.

I heard about an App in GooglePlay to snooze notifications but it had several bugs related with SmartLock (e.g., using Bluetooth unlock), so it may not be an option.

---------- Post added at 09:53 AM ---------- Previous post was at 09:38 AM ----------

If I stop the daemon I'm not able to restart it due to this error when running from the Terminal (using Termux):

accd start
awk: not found

The only way to start it again is by rebooting the phone.

I'm using MIUI 10.2.1.0 on a Mi 5s phone.

Using the App it also doesn't start, I suppose due to this error. However there's no way to see what was the error/reason in the App. Maybe it would be better to also have a log for the App itself, not only for the ACC module.
[Magisk] VR25:
Interesting...

Isn't that the wakelock other users are talking about?

I'll enable both. If one is not executed, the other will be available. Likewise, if one is executed, the other will refuse to run. How about that?

Fair Enough

The next version will have this feature.

I mean, you write a different value to it and that value persists until a reboot.

Being root is not enough. You see, root is not a god. What we call "files" in /sys are not actual files - and the kernel dictates who has control over these.

Indeed...

But it's also a shame not being given the ability to disable charging notifications on stock ROM.

Hmmm... I thought I fixed this already.

The issue is: missing BusyBox. If you install it, you solve the problem.

I could've sworn I already made this work with Magisk's built-in BusyBox, though... ? like acc -D start does.
[Magisk] silmarx:
But I see the value is persisted after reboot, so I assume my ROM is using another file. I will investigate this further...

Well, at least it allowed me to disable the sound, so it could be worst :)

For the record, I'm using Magisk 18.0, did not update to 18.1 to avoid any issue.

ACC version is 201901240.

Should I install BusyBox then or is this supposed to be fixed soon? This is not urgent for me, but I think this will happen to other people as they might not have BusyBox installed.

If you need something else from me to help debugging this just let me know.
[Magisk] Macusercom:
[MENTION=5228676]VR25[/MENTION] Implementing both would be a great solution! :)
[Magisk] silmarx:
how does max voltage limit works?

I was trying to understand the effect of limiting the voltage and how this is actually handled by the battery and the phone, after reading the article:

https://batteryuniversity.com/learn/article/how_to_prolong_lithium_based_batteries

If I understood correctly, by limiting the voltage we are actually reducing the effective capacity in that charge session. According to the table from the article:

Charge level (Volts) Discharge Cycles Available Capacity
4.20	300–500	100%
4.15	400–700	90–95%
4.10	600–1000	85–90%
4.05	850–1500	80–85%
...

But how does this reflect on the actually capacity the phone (i.e., the charging controller) reports, if we limit the voltage, for instance, to 4.10?

a) this will make the battery to stop charging around 85-90%?

b) it will reach the 100% as usual, but the 100% reported by phone corresponds to 85-90% of the original full capacity?

Since I didn't manage to make the voltage limit to work, I cannot confirm it myself.

[MENTION=5228676]VR25[/MENTION], can you please confirm what's the result when max voltage limit is working?
[Magisk] vinnievegas:
Any special instructions for uninstalling? Or will normal uninstall remove everything like it should?
[Magisk] guest4711:
Yes, deleting the module in MagiskManager followed by a reboot will do it.
[Magisk] Camerado:
No, it's my firmware problem :) Anyway, that functional would be helpful, i think.
[Magisk] VR25:
It will be fixed soon. Here's a potential fix, btw: run ln -fs /sbin/.magisk/busybox/awk /sbin/.magisk/img/acc/system/xbin/ and reboot.

So far, all reports I got point to a). You may still be right about b), though.

Devices that don't allow saturation charge, generally behave the b) way - but I don't think yours is one of these.

Alright, I'll support this.
[Magisk] Ahugari:
By MatteCarra!?
[Magisk] semdxd:
[MENTION=5228676]VR25[/MENTION] battery stats does NOT reset on EMUI 8.0 with 2019.1.24 version

it used to reset properly on previous versions, can you please look into that?
[Magisk] C4mine:
And also we want a notification of desired charge completed.
[Magisk] silmarx:
There are already Apps that do that. Look at AccuBattery which allow you to specify a reminder you when the battery reaches some percentage. I was using this App before installing the ACC module.

I would try to keep the ACC App as simple as possible, and avoid notifications or other services that require the App to be running in background which may have other side effects in the phone like preventing the deep sleep.
[Magisk] silmarx:
The App looks nice and clean.

However, I have 2 suggestions:

1) Add a "save" button and only apply the settings when "save" button is pressed. Since you are using a "spinner" widget, one changes the settings accidentally while moving the finger to scroll down or up.

2) Suggestion for a new feature: I think it would be nice to have right at the top, just after the Status section, a button to select a scene/mode with preset values.

Here's how I would use this App if this feature is available:

- Normally, when I'm near a charger, I would limit the capacity to 80 or 85%, and I think would be 90% of the time.

- But if I plan to leave in a while and I will be away from a charger for some time, then I would like to increase it exceptionally up to 90 or 95%, but never allow it to 100% since it's between 90-95 and 100% where the most battery wear occurs.

Basically this would be a shortcut for predefined values for the controls/settings that can be changed currently, but they should apply immediately after pressing, no need to press the save button (if daemon is started of course).

Eventually, to make the App simpler, this could be controls in the main view, where all manual controls that are currently available and require the save button to be pressed, could be moved to an Advanced menu.

This could use the "preset" options that are already available in ACC module, I suppose.

[MENTION=5228676]VR25[/MENTION], [MENTION=9731715]MatteCarra[/MENTION], let me know what you think.
[Magisk] darkbasic4:
The app (Snoozy Charger) isn't in the app store anymore and it's so buggy that I don't suggest you to use it. It locks your phone and you won't be able to use your fingerprint to unlock it: you will have to type your password.

Also it doesn't block sound notifications, it just prevents the screen from turning on.
[Magisk] silmarx:
In case of MIUI one can disable the sound notification in settings, so it's not bad at all.
[Magisk] darkbasic4:
How can I check if mine does it or not?

Let's say that I set onBoot=/sys/class/power_supply/battery/voltage_max:4200000. You also suggest onBootExit=true, so there is nothing preventing the phone from getting a 4.2 voltage until I detach the charging cable.

According to what you said this is not good, because I shouldn't go over 3.92V if I plan to keep the phone attached for a prolonged time.

Then what am I supposed to do when I go sleeping to get the phone to ~80% in the morning without leaving the battery exposed to 4.2V for the whole night?

Ideally I would love to have 3.92V for the whole night, while switching to 4.2V at 7 am in order to get the 80% charge when I wake up. That could be a nice addition for the app.
[Magisk] VR25:
Although my main concern was different (inefficient config.txt writes), I thought someone would suggest this sooner or later.

I agree with that too.

Thanks

Keep suggestion coming.

Usually it does if your battery status is "Not charging" instead of "Discharging" when charging is disabled.

Definitely a Great Suggestion!

I see the interest on voltage control skyrocketing.

To begin with, I'll make it possible to set different voltages with a chain of commands (e.g., acc -s volt 3920; sleep 7h; acc -s volt 4200).

The app will eventually have voltage presets and a scheduling mechanism.

In order to provide users with the best experience in this regard, all of you have to do this: https://xdaforums.com/showpost.php?p=78809121&postcount=2247/.
[Magisk] darkbasic4:
Done!
[Magisk] MatteCarra:
I've finished implementing it (I spent the whole day on it).

I will wait a bit to release it because I don't have time to test it right now.

All the mods are already available on github, if someone wants to compile and run it.

I've added everything you requested plus a tile in the quick settings that once pressed switches the profile you are currently using.

Example: If you have three profiles (default, shortTrip, longTrip), by pressing on it one time you set default, then shortTrip, then longTrip and rotate once again.

I will be happy to receive feedback on this update after release.

I will modify the library that I'm using right now to notify updates because it's a little bit annoying (probably in the next release).
[Magisk] MatteCarra:
I've tested the update a little bit this morning and everything seems to be working fine.

That's a major update so please let me know if you come across any issue.

Changelog: https://github.com/MatteCarra/AccA/releases/tag/v0.3

Download: https://github.com/MatteCarra/AccA/releases/download/v0.3/app-release.apk
[Magisk] darkbasic4:
Will profiles work in case you use onBoot to set max_voltage and onBootExit=true? Or do I still need to do a reboot instead?
[Magisk] VR25:
The next acc update will ship with the acc app.

We're working on the scheduling feature and more.

A major goal is giving users the ability to set different voltage and/or capacity parameters for different times of the day. For example, restrict max charging voltage to 3.92 (best for longevity) during the night (sleep time) and ramp up to 4.1 at 7:00 in the morning.
[Magisk] silmarx:
After a quick look, everything looks fine. We can now switch between profiles easily.

Scheduling the switch between profiles / settings will be a huge improvement.

In future I see already this App selecting the best profile based on the user behavior, powered by AI ;)

Keep the good work ;) Thanks!
[Magisk] Da-BOSS:
Can't wait for the next release :) I'm sure it will something amazing! :D
[Magisk] silmarx:
Here's some more feedback after using it for a while:

1) Since it's not possible to change the order of profiles, I suggest you add an option to "rename" the profile, besides "edit" and "delete", if that doesn't require too much effort. IMO the rename is useful, not only because we may find another name better meanwhile, but it can also be a way of changing order without the need to delete them all and add them again. Of course the ability to change order would also be useful, but I suppose it may be harder to implement because it requires some drag&drop interaction.

2) I noticed a bug when trying to delete several profiles. It seems sometimes the profiles list is not properly updated after deleting a profile. I think this is caused because you may be using the index/position of selected item to delete, which may not be in consistent/updated state after deleting one profile. Can you check that? Try for instance add 4 profiles, then delete the last but one and then the last one. If we restart the App then everything seems ok.
[Magisk] MatteCarra:
2) Very stupid bug lol. I forgot to update the value after copying it from the line above. I've already fixed it.

1) I've thought about changing order, but I didn't find it useful. I can add the rename feature, no prob
[Magisk] Digital God:
Maybe I do not understand something, but it looks like it does not work correctly on my phone. I've installed AccuBattery to monitor battery status. When phone charges up to 80% it stops charging (no led, your app shows discharging) but AccuBattery shows 0mA drain and phone stays at 79% all time connected to charger. I assumed that it should be discharged to 70% and then recharged if connected to charger?
[Magisk] guest4711:
You should be happy that your hardware does a good job to keep the battery on this level and supplying power bypassing the battery. Most devices are not able to do this.
[Magisk] silmarx:
[MENTION=2084318]Digital God[/MENTION], which phone model is?
[Magisk] Digital God:
It's Huawei Honor 8. Rom is Openkirin OmniRom 5.2

If that's the case, then that's great. Bad if it's a bug in the program or phone firmware.
[Magisk] danicadanicadanica:
Help what is the exact command line if i want to auto disable charging when it reach to 99% and will enable when it is 90
[Magisk] silmarx:
acc 99 90

read the first post carefully, it's well explained there.
[Magisk] danicadanicadanica:
I tested this line already but it still charged to 100% do i need to switch charging interface ?
[Magisk] VR25:
You should be happy about this, indeed.

Your device may not be currently supported. Follow https://xdaforums.com/showpost.php?p=78809121&postcount=2247/

No, you can simply restart the daemon. Note however that you should NOT do this from the app yet. Run accd or acc -D restart instead.

That's the spirit. Keep positivity up!
[Magisk] danicadanicadanica:
Finally it worked now setting it to 99% is bugged in my phone. Setting it to 98% works im using a gui app thanks for your help.

---------- Post added at 07:56 AM ---------- Previous post was at 07:54 AM ----------

I believe it is supported im using custom kernel j6 and it enables and disable charging its just that 99% phone assumed as fully charged.
[Magisk] MoHed:
Everything Working

Glad to report that for me everything is working. 1+6T OOS 9.0.12 Magisk 18.1.

ACC is great and the app made it so much easier to configure (I used to do it with Tasker scripts).

Thank you VR25 and MatteCarra.

Waiting for updates with more functions :D
[Magisk] danicadanicadanica:
This saves me time i used to wake up in the morning just to charge and waiting to unplug when it comes full because of fearing it would end up bloated battery. Now the time comes i dont need to wait anymore ?
[Magisk] MatteCarra:
I will automate it in next build and I will add a restart deamon button!

Thanks for the suggestion!
[Magisk] darkbasic4:
Do you know if max_voltage could be used in a Linux laptop as well? I would be willing to patch the kernel if necessary.
[Magisk] ragnarokx:
Is there a link to download the app to configure settings? I don't see it in the first post, unless I'm missing it.
[Magisk] guest4711:
https://github.com/MatteCarra/AccA/releases/download/v0.2/app-release.apk
[Magisk] VR25:
The battery and/or charger drivers could potentially be modified for that. I just haven't played with these much - mostly due to lack of inspiration.
[Magisk] pabloluih:
I have a problem in my LG V30. I've done 'acc 70 60' with default parameters. If I do a charge at 45%-50%-60% it does the job, but below those numbers it does strange things as charging for 1 second and after that 15 seconds of nothing. For example, now at 33% it hasn't charged nothing in 30 minutes because of that. If I reboot the mobile phone it works as expected, but when I reach low percentages it does not charge at all.

Could the problem be Magisk 18.1? I would like to know why it does those thing, it is very annoying.

Thanks in advance and because of your work!
[Magisk] beammer335d:
Wonder if I could benefit from using this mod ,instead of this that's on my Sony XZ Premium

Any thoughts?
[Magisk] kevsestrella:
Anybody experience weird response from phone while charging with acc in effect? It happens when transitioning from charging/discharging, My current activity gets interrupted(ex typing)

Edit: seems it's the transition from/to power saving when chraging/discharging happens

Also, seems qcom_step_chg is causing wakelock when in acc, when not charging
[Magisk] MatteCarra:
Yup, but it's not latest version.

You should use:

https://github.com/MatteCarra/AccA/releases/download/v0.3/app-release.apk

It includes ACC profiles and a versioning checker.

https://github.com/MatteCarra/AccA/releases/download/v0.3/app-release.apk
[Magisk] MarcoCount:
It's caused by the charging switch you are currently using. You should switch it by using acc -s s, pick a number and test.

Am I missing something? Do I blindly pick the number or what?

[MENTION=5228676]VR25[/MENTION] How do I see current working charging switch? I think you should log it in the deamon file so it's easier to pick a different charging switch.

Anyone on OnePlus 6 can suggest a charging switch that does not have the wakelock?
[Magisk] kevsestrella:
Sadly, all the other switches for pocophone isn't working well, it requires you to reboot so that it will charge, and it doesn't work(coolDown, maxCharge) as it should with acc.

You can see the currently used switch in the config file
[Magisk] VR25:
Run acc -s s, pick a number and test. More details below...

You can benefit from that feature, but only so much. This module gives you much more power.

By default, acc cycles through available charging switches until it finds one that works. Hence, the switch variable is not set in config. If you've set it, only that particular switch will be used. acc -s shows the current config.

https://xdaforums.com/showpost.php?p=78809121&postcount=2247/

If you haven't done that already, please do it.