Skip to content

Read charging from current, not only IsCharging; HelperBuild 31 - #79

Merged
broisnees merged 1 commit into
mainfrom
fix/charging-from-current
Nov 15, 2026
Merged

broisnees merged 1 commit into
mainfrom
fix/charging-from-current

Conversation

@broisnees

Copy link
Copy Markdown
Collaborator

Why

A plug trace (scripts/plug-trace.py, added here) logged the battery, macOS, the helper and the menu bar every 250 ms. Two things stood out:

  • The flag lags the current. At +1.0 s after the plug, Amperage was +1063 mA into the battery, but IsCharging stayed No until +23.4 s.
  • The flag drove everything. The panel showed "Plugged in, not charging" and the icon had no bolt. The helper's MagSafe LED (Status mode) set green over a charging battery, so the light went amber (macOS), then green (helper), then amber again.
  • eWiz's own layers were not slow. The menu-bar item matched the hardware within one sample at every change.

Change

  • BatteryMonitor.isCharging(flag:amperage:cableIn:full:): macOS's flag, OR ≥ 300 mA flowing in with the cable in and the battery not full. A flag saying yes is always kept.
  • HelperBuild 30 → 31, so the helper (which drives the LED from this reading) reinstalls.

Tests

swift test: 284 pass, including 4 new ones.

A traced plug-in showed +1063 mA into the battery 1 s after the cable while
IsCharging stayed No for 23 s. The panel, icon and the helper's MagSafe LED all
waited on the flag (LED went amber, green, amber). BatteryMonitor now counts
>= 300 mA in, with the cable in and the battery not full, as charging.

Adds scripts/plug-trace.py to log hw/macOS/helper/menu-bar state across a plug.
@broisnees
broisnees merged commit 7944e7e into main Nov 15, 2026
1 check passed
@broisnees
broisnees deleted the fix/charging-from-current branch November 15, 2026 15:22
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