fw/services/battery: add optional 80% charge limit to extend battery lifespan#1156
fw/services/battery: add optional 80% charge limit to extend battery lifespan#1156spr4bhu wants to merge 2 commits intocoredevices:mainfrom
Conversation
Signed-off-by: Shashvat Prabhu <shashvatprabhu2006@gmail.com>
7c3ae43 to
a9117f6
Compare
|
Amazing, i have been meaning to circle back on this. Thank you so much! |
|
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? |
| #define CHARGE_LIMIT_PCT 80 | ||
| #define CHARGE_RESUME_PCT 77 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Made the changes, thanks.
Signed-off-by: Shashvat Prabhu <shashvatprabhu2006@gmail.com>
93cd021 to
49c9c2a
Compare
|
@sjp4 can I have the format on how the features are to be added on phone side |
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_limitmodule that callsbattery_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 disabledAdd
charge_limit_enabledpref (persistent on/off setting viaSettingsFile, default false) with getter/setter following the existingstationary_mode_enabledpatternAdd "Charge Limit (80%)" toggle row in System settings menu, mirroring the existing "Stand-By Mode" toggle
Hook
battery_charge_limit_evaluate()intobattery_monitor_handle_state_change_event()andbattery_charge_limit_init()intobattery_monitor_init()Register
battery_charge_limit.cinservices/battery/wscript_buildResolves Ability to limit battery charge to X% #722