I'am using a Linage Android image (rooted) to control the battery charge and discharge with the commands:
Charge:
echo 0 > /sys/class/power_supply/battery/batt_slate_mode
Stop charging:
echo 1 > /sys/class/power_supply/battery/batt_slate_mode
The problem that after sending the command to charge, the charge type changes from "AC charge" to "USB Charge" and the current level drop to less than 500mA. I am connected AC power outlet. If I disconnect and connect again the power outlet the current goes to 1A.
Reading the following article bellow some devices are a file to change the voltage (/sys/class/power_supply/battery/voltage_max), but mine doesn't have.
The picture show the files that I have on the folder:
Samsung Tab E 7.0 SM-T113NU
Android 7.0.1 - Linage 14.1
App and ADB rooted
Best regards,
Slate_mode
is messy in the sense it doesn't seem to work as expected always//If you are keen to do it your way only, this answer may help