Conversation
Always fast charging battery to 100% capacity will reduce battery longevity significantly. Complicating factor is that running out of battery is very annoying, and battery below 10% capacity also loses longevity (very significantly around 0%).

So… we can do better, and this is my attempt. Simple idea is to simply charge to 80%, use “batman norm” to do that.

But we can do better. You can add time when you want phone to be ready, and it will try to figure optimal charging profile so that phone is at 80% when requested. Use “batman 15:30” if you want phone to be at half past three.

Code is at https://github.com/pavelmachek/unicsy_demo/tree/master/bat .

#librem5 #linuxphone
1
0
1
Currently logic is:

if m.target_time > 0:
hours = (m.target_time - time.time()) / (60*60)
# If it is already past the time, do fast charge
if hours < 0:
c_rate = 1.0
mode = "past"
else:
c_rate = m.required_c_rate(5000, percent, m.target_perc, hours) * 1.1
mode = "readyby"
print(" %.1fh %.4f C" % (hours, c_rate))
# We can wait to charge if it is far enough in future.
# But we don't want to toggle charging on/off repeatedly
# when we are close.
if c_rate < 0.1 and m.target_perc - percent > 5:
mode = "pause"
c_rate = 0
if m.target_time < 0:
mode = "simple"
c_rate = 0.25
if m.mode == "max":
mode = "max"
c_rate = 1.0
# Below 50%, battery actually ages faster; so lets charge to 60%.
if percent < 30 and c_rate < 0.15:
mode = "go30"
c_rate = 0.15
if percent < 60 and c_rate < 0.10:
mode = "go60"
c_rate = 0.10

If you see some trivial improvements, let me know :-).
0
0
0