Repository navigation
Fix uneven fine scale brightness steps - #1898
Merged
waydabber merged 1 commit intoSep 15, 2026
Merged
Conversation
Built-in and software-dimmed displays: the fine scale step reused the coarse step's snapping tolerance (1/64), which equals the fine step itself, so a brightness read back as a hair above a 1/64 boundary made the next key press jump two steps. Use a quarter of the actual step, matching the coarse scale. DDC displays: convValueToDDC truncated the float to an integer, so values like 0.29999998 (0.29 + 0.01) were sent as 29 and the following step skipped a value. Round instead. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MA8JGs7pCoXFL2W6jEJ8sD
Member
|
Thank you! |
waydabber
self-requested a review
September 15, 2026 13:38
waydabber
approved these changes
Sep 15, 2026
waydabber
left a comment
Member
There was a problem hiding this comment.
The issue is legitimate, the fix seems fine.
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.
Fixes #1759
Two small bugs that together cause the uneven steps described in the issue.
Built-in / software-dimmed displays (
Display.calcNewBrightness)The fine scale step is 1/64, but the snapping tolerance (
delta) was taken from the coarse step (1/16 / 4 = 1/64). So with fine scale on, tolerance and step were the same size and there was no slack at all. Brightness read back from DisplayServices is often a tiny bit off the 1/64 grid (on my Mac, setting 2/64 reads back as 0.031250004), and whenever it lands just above a boundary the next press jumps two steps. The coarse scale already uses a quarter-step tolerance; this makes the fine scale do the same.Simulating 64 presses with the read-back noise I measured:
1,2,4,5,7,8,9,...; fine down: 55 presses,...57,55,54,...Coarse stepping is unchanged (16 steps either way).
DDC displays (
OtherDisplay.convValueToDDC)The value was converted to an integer by truncating. Fine scale adds 0.01 each press, and in
Float0.29 + 0.01 is 0.29999998, which becomes DDC 29 again. Stepping up from 0 with a max of 100, truncation gives: 4 sent twice, 15 skipped, 29 sent twice, and it tops out at 99. That's exactly the "repeated 4%, skipped 15, repeated 29" from the issue. Rounding gives 1..100 with no repeats or skips. It also means a value read from the display and written back now maps to the same DDC value.This doesn't address the one-off "59 sets the monitor to 100%" from the issue; I couldn't reproduce that from the code path.
Testing
xcodebuild -scheme MonitorControl -configuration Debug(signing disabled).--lintand SwiftLint: no issues in the changed files.Implemented with Claude Code; I reviewed and tested the change.
🤖 Generated with Claude Code
https://claude.ai/code/session_01MA8JGs7pCoXFL2W6jEJ8sD