Repository navigation
Fix board rotation from CLI/ini not wrapping to -180..180 - #582
Merged
qu1ck merged 1 commit intoOct 6, 2026
Merged
Conversation
set_from_args converted --board-rotation with fmod(rot // 5, 37), which is not a 360 degree wrap: 270 became 85 degrees, 360 became 175 and 185 became 0. The result was also a float. Values within -180..180 keep their previous behavior; values outside are wrapped to the equivalent angle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Config.set_from_argsconverted--board-rotation(andboard_rotationfrom--use-ini, which goes through the same argparse default) with:fmod(x, 37)is not a 360° wrap. Board rotation is stored in 5° steps with a valid range of -36..36, so 360° corresponds to 72 steps, not 37. Any value outside -180..180 ended up at an unrelated angle:--board-rotation 270gave 85°, 360 gave 175° and 185 gave 0°. The result was also a float ("board_rotation": 17.0in the generated page).This change keeps the existing behavior for every value within -180..180 (including the floor to a multiple of 5) and wraps values outside that range to the equivalent angle in 5° steps. The result is now an int. The now-unused local
import mathis removed.Testing
Config.add_options+set_from_argson master vs this branch:--board-rotationEnd to end, generating a BOM with
--board-rotation 270, and withboard_rotation=54inibom.config.iniplus--use-ini, now produces"board_rotation": -18(-90°) in the page config instead of17.0(85°).Note: the
--board-rotationhelp text says the value is "rounded" to a multiple of 5, but the code floors it (e.g. -7 becomes -10°). I left that unchanged to keep this fix focused.🤖 Generated with Claude Code