Skip to content

fw/services/battery: add optional 80% charge limit to extend battery lifespan#1156

Open
spr4bhu wants to merge 2 commits into
coredevices:mainfrom
spr4bhu:battery-charge-limit
Open

fw/services/battery: add optional 80% charge limit to extend battery lifespan#1156
spr4bhu wants to merge 2 commits into
coredevices:mainfrom
spr4bhu:battery-charge-limit

Conversation

@spr4bhu
Copy link
Copy Markdown
Contributor

@spr4bhu spr4bhu commented Apr 25, 2026

This PR adds a software charge limit feature that stops charging at 80% and resumes at 77% (3% hysteresis) to reduce lithium battery degradation from sustained high charge levels. The feature is exposed as a user-facing toggle in System settings, off by default.

Changes:

  • Add battery_charge_limit module that calls battery_set_charge_enable() to disable/re-enable charging based on battery percentage thresholds; includes a 60s rate limit to prevent rapid charger cycling and a 60s periodic timer to cover gaps in fuel gauge event delivery when charging is disabled

  • Add charge_limit_enabled pref (persistent on/off setting via SettingsFile, default false) with getter/setter following the existing stationary_mode_enabled pattern

  • Add "Charge Limit (80%)" toggle row in System settings menu, mirroring the existing "Stand-By Mode" toggle

  • Hook battery_charge_limit_evaluate() into battery_monitor_handle_state_change_event() and battery_charge_limit_init() into battery_monitor_init()

  • Register battery_charge_limit.c in services/battery/wscript_build

    Resolves Ability to limit battery charge to X% #722

Signed-off-by: Shashvat Prabhu <shashvatprabhu2006@gmail.com>
@spr4bhu spr4bhu force-pushed the battery-charge-limit branch from 7c3ae43 to a9117f6 Compare April 25, 2026 10:14
@EspressoTini
Copy link
Copy Markdown

Amazing, i have been meaning to circle back on this. Thank you so much!

@ericmigi
Copy link
Copy Markdown
Collaborator

Awesome. Thanks for the PR! Need to add this behind one of the features that only enables the setting to be shown on the phone side. We're reducing how many settings are shown on the Watch UI and encouraging people to add the setting on the phone side.

@jplexer do you have an example that we can show to folks on how to add this on both sides?

@jplexer
Copy link
Copy Markdown
Member

jplexer commented Apr 27, 2026

fw side it needs to be added to the settings blob db whitelist (like: 4d8abd9)

On the mobile side I do not know, @sjp4 definitely knows more there

Comment on lines +12 to +13
#define CHARGE_LIMIT_PCT 80
#define CHARGE_RESUME_PCT 77
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While plugged in, if not charging, the watch will run from USB power, so the battery will not drain. I guess you can simply disable the charger and forget about any hysteresis.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the changes, thanks.

Signed-off-by: Shashvat Prabhu <shashvatprabhu2006@gmail.com>
@spr4bhu spr4bhu force-pushed the battery-charge-limit branch from 93cd021 to 49c9c2a Compare April 28, 2026 10:54
@spr4bhu spr4bhu requested a review from gmarull April 28, 2026 11:15
@spr4bhu
Copy link
Copy Markdown
Contributor Author

spr4bhu commented Apr 28, 2026

@sjp4 can I have the format on how the features are to be added on phone side

@Flexximilian
Copy link
Copy Markdown

Flexximilian commented Jun 1, 2026

While plugged in, if not charging, the watch will run from USB power, so the battery will not drain. I guess you can simply disable the charger and forget about any hysteresis.

So then if the watch runs on USB power directly when plugged in, what's the use of a charge limit in the first place? The only reason to do that, then is to avoid topping up if the watch comes on and off the charger repeatedly, correct? That is something a user can simply avoid.

But even if someone would put the watch on the charger say, every night, out of habit. Would it not be smarter then, to have a setting that goes like this: Do not charge to 100% (or some max level) unless you've been discharged to 80% (or some min level) or lower since being at or over the max level.

That way you do allow a full charge, but not a repeated trickle charge at a high level (which is unnecessary if 80% gives multi-day operation).

I am not a battery expert, but charging a battery to 100% is not so much the problem if I understand it correctly, it's keeping it there constantly via trickle charging, or discharging fully and leaving it there for any amount of time. I also heard that the best would be to keep Li-Ion between 40%-ish and 60%-ish at all times for maximum lifespan. So, I'd love a function where the watch simple alerts when it wants to be charged for maximum lifespan (via a notification) and beeps every 5 minutes for 5 - 10 seconds when it wants to come off the charger (or it simply ends charging and runs on the USB power) at 60%, again optimizing for battery health instead of charge frequency. I'd rather charge once a week for 10 years, than once every three weeks for 5 years...

So I'd a good default and recommendation from a vendor and the freedom to override it. And while I bought two Time 2s to have a spare, I certainly would love the battery to last as long as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to limit battery charge to X%

6 participants