direc85 / harbour-batterybuddy

Battery level alert for Sailfish OS
GNU General Public License v3.0
7 stars 8 forks source link

Set charge current to 0mA instead of disabling charging #58

Open direc85 opened 1 year ago

direc85 commented 1 year ago

Originally posted by @Fuzzillogic in https://github.com/direc85/harbour-batterybuddy/issues/11#issuecomment-1368449065

Thanks for the update. May I suggest to use this feature, by setting the charge current to 0mA, instead of suspending charging (/sys/class/power_supply/battery/input_suspend) when the upper charge threshold is reached? This way the battery won't "yo-yo" between charging and discharging when full, but is kept topped up. This might fix this issue I see when using my phone as navigation device, while hooked up to USB power: it charges up to the limit, but given the high load because of active navigation, it drains rather quickly to the lower limit, at which point it starts charging again.

I just tried this when charging the battery: # echo 0 > /sys/class/power_supply/battery/constant_charge_current_max and then checked the current. The current was ~20mA (draining), so while not exactly 0, it drained much slower than when disconnected. And tweaking worked as well, e.g. setting a charge current of 50mA.

It could be combined with the current configured limits, and call it "slow charge mode within limits" or such. While I'm not sure this is actually better for the battery longevity, to me it seems it puts less strain on the battery, and thus might be beneficial.