by Filipe Tavares
ROOT is required.
Version 2 - small flow optimization
A small flow to limit charging the battery up to 80% and only return charging when under 75%. It checks if power supply plugged and disables enables/charge accordingly. Clears battery stats when at 80%.
Li-Ion and Li-Po life expectancy is increased if not charged over 80% and not discharged under 20%. Several studies prove it, google is your friend.
Tested on OnePlus 6 but should work if rooted and sys/class/power_supply/battery/charging_enabled is present. This variable can be modified manually to 1 or phone rebooted if not charging after use and under 75%.