Skip to content

fw/shell: add a normal/fast charge setting - #2052

Draft
adipascu wants to merge 3 commits into
coredevices:mainfrom
peblum:fast-charge-setting
Draft

adipascu wants to merge 3 commits into
coredevices:mainfrom
peblum:fast-charge-setting

Conversation

@adipascu

@adipascu adipascu commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Adds a fastCharge setting so the charge current can be chosen between the board's fast and normal rates from the phone, instead of changing the default for everyone. Follows @gmarull's review on #1841, where lowering Pebble Time 2 to 0.5C outright was nacked in favour of a setting. Draft while I run it on my own Pebble Time 2. The companion control is coredevices/mobileapp#419.

drivers/pmic/npm1300: switch the charge current at runtime

Npm1300Config gains an optional chg_current_normal_ma next to the existing chg_current_ma, and battery_set_fast_charge(), which was an empty stub on this PMIC, now moves the charger between the two. The nPM1300 wants the charger disabled while BCHGISET changes, so the switch disables it around the write and only re-enables it if it was enabled before, which keeps a charge-limit pause in place across the switch. The charge-mode ADC full scale follows the live current rather than the board constant, otherwise current readings would be scaled wrongly after a switch. Boards that leave the new field at 0 keep their fixed current.

fw/shell: add the fastCharge setting

A fastCharge shell preference, on by default so shipped behaviour does not change, drives battery_set_fast_charge() when synced from the phone and once at boot after the prefs load. It is whitelisted for settings sync and gated on CONFIG_FAST_CHARGE_SETTING, which depends on the nPM1300 driver, so boards without a switchable charger never expose the key.

fw/board/obelix: enable the fast charge setting

Pebble Time 2 keeps 190 mA (1C, the cell's rapid-charge maximum) as its fast rate and gets 96 mA (0.5C, the standard charge rate) as the normal rate. From a month of logged charging on my watch, 0.5C halves the charge current and, with the limiter from #1841, halves the overshoot past the limit, at the cost of a 20 point top-up taking about 22 minutes instead of 11.

Written with AI assistance (Claude).


Aside: I am currently available for firmware contracting or full-time work. Contact: adrian@pascu.be.

adipascu and others added 3 commits September 11, 2026 17:31
Add an optional chg_current_normal_ma board setting next to the
existing chg_current_ma and implement battery_set_fast_charge() so the
charger can move between the two without a reboot. The charger is
disabled around the BCHGISET write, as the PMIC requires, and only
re-enabled if it was enabled before, so a paused charger is not
silently resumed by a switch.

Two consumers derived their scale from the board constant and now
follow the live current instead: the charge-mode ADC full scale, which
would otherwise misreport charge current, and the fuel gauge's charge
current limit and termination current, which are re-informed on the
next sample after a switch.

Boards that leave the new field at 0 keep their fixed current.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Adrian Pascu <adrian@pascu.be>
Add a fastCharge shell preference, on by default, that selects between
the board's fast and normal charge currents through
battery_set_fast_charge(). It is synced from the phone through the
settings blob db whitelist and applied once at boot after the prefs
load. The setting is gated on CONFIG_FAST_CHARGE_SETTING, which
depends on the nPM1300 driver, so boards without a switchable charger
never expose the key.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Adrian Pascu <adrian@pascu.be>
Pebble Time 2 keeps 190 mA (1C, the cell's rapid-charge maximum) as its
fast charge current and gains 96 mA (0.5C, the standard charge rate) as
the normal current, selectable through the fastCharge setting. Charging
at 0.5C halves the current stress on the cell and, on a watch running
the charge limiter, halves the overshoot past the limit, at the cost of
a 20 point top-up taking about 22 minutes instead of 11.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Adrian Pascu <adrian@pascu.be>
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.

1 participant