Repository navigation
Read charging from current, not only IsCharging; HelperBuild 31 - #79
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:Amperagewas +1063 mA into the battery, butIsChargingstayedNountil +23.4 s.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.HelperBuild30 → 31, so the helper (which drives the LED from this reading) reinstalls.Tests
swift test: 284 pass, including 4 new ones.