Repository navigation
Stop charging at once when a limit is set; read the cable through adapter cuts - #81
Merged
Merged
Conversation
…pter cuts Traced on a Mac that limits through macOS's charge limit: macOS took 42 s to stop charging after the limit was set. The helper now cuts the adapter for up to 90 s after setting a native limit below the current level (1.4 s to stop). On the same Mac an adapter cut (eWiz's, or macOS draining to its limit) clears ExternalConnected exactly like an unplug; ExternalChargeCapable stays Yes until a real pull. BatteryMonitor.cablePresent uses both. The helper also reports the SMC AC-W reading where present, the app follows a cut every 3 s, and plug cues check the helper before sounding. HelperBuild 33.
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 (traced on a Mac with no charge-inhibit key, which limits through macOS's charge limit)
ExternalConnected. The panel said "On battery" with the cable in, and the plug cue could fire.ExternalChargeCapablestays Yes; on a real unplug it goes No in the same sample.AdapterDetailslingers ~1 s after a pull, so it can't be used.Changes
nativeBridgeWanted), then hands back to macOS's limit. Measured: 1.4 s from the limit being set to charging stopping.BatteryMonitor.cablePresent=ExternalConnected || ExternalChargeCapable.ControlResponse.adapterPresentpasses on the SMCAC-Wreading where the key exists. The app uses it fordischarging, re-reads every 3 s while a cut is on, and checks the helper before a plug or unplug cue.HelperBuild31 → 33.Tests
swift test: 287 pass (new: cable presence through a cut). Helper build 33 was run on the Mac described above, and the bridge behaviour was verified withscripts/plug-trace.py.