From 74527b80bdd08dc902e3d96b6005a04f9515c297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Pal=CC=8Co?= Date: Mon, 5 Oct 2026 21:14:04 +0200 Subject: [PATCH] Fix board rotation from CLI/ini not wrapping to -180..180 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 --- InteractiveHtmlBom/core/config.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/InteractiveHtmlBom/core/config.py b/InteractiveHtmlBom/core/config.py index f183e208..68314ca1 100644 --- a/InteractiveHtmlBom/core/config.py +++ b/InteractiveHtmlBom/core/config.py @@ -600,8 +600,6 @@ def get_ini_defaults(self): def set_from_args(self, args): # type: (argparse.Namespace) -> None - import math - self.kicad_variant = args.kicad_variant # Html @@ -611,7 +609,10 @@ def set_from_args(self, args): self.show_silkscreen = not args.hide_silkscreen self.highlight_pin1 = args.highlight_pin1 self.redraw_on_drag = not args.no_redraw_on_drag - self.board_rotation = math.fmod(args.board_rotation // 5, 37) + # Stored in 5 degree steps, wrap to -180..180 range + self.board_rotation = args.board_rotation // 5 + if not -36 <= self.board_rotation <= 36: + self.board_rotation = (self.board_rotation + 36) % 72 - 36 self.offset_back_rotation = args.offset_back_rotation self.checkboxes = args.checkboxes self.mark_when_checked = args.mark_when_checked