From 57399de03fdf4240a92c9bee036948f9a4466af3 Mon Sep 17 00:00:00 2001 From: 2ManyProjects Date: Thu, 8 Jan 2026 20:31:58 -0600 Subject: [PATCH] Fixed max dimensions and scan direction on serpentine pattern --- src/gui.py | 4 ++-- src/stitching_scanner.py | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gui.py b/src/gui.py index e35052d..5f324c6 100644 --- a/src/gui.py +++ b/src/gui.py @@ -353,14 +353,14 @@ class AppGUI: # Max Width ttk.Label(inner2, text="Max W:").pack(side=tk.LEFT) - self.max_width_var = tk.IntVar(value=5000) + self.max_width_var = tk.IntVar(value=1000) self.max_width_entry = ttk.Entry(inner2, textvariable=self.max_width_var, width=7) self.max_width_entry.pack(side=tk.LEFT, padx=(2, 5)) self.max_width_entry.bind('', lambda e: self._update_stitch_config()) # Max Height ttk.Label(inner2, text="Max H:").pack(side=tk.LEFT) - self.max_height_var = tk.IntVar(value=5000) + self.max_height_var = tk.IntVar(value=1000) self.max_height_entry = ttk.Entry(inner2, textvariable=self.max_height_var, width=7) self.max_height_entry.pack(side=tk.LEFT, padx=(2, 5)) self.max_height_entry.bind('', lambda e: self._update_stitch_config()) diff --git a/src/stitching_scanner.py b/src/stitching_scanner.py index e3c0a27..1dda9c1 100644 --- a/src/stitching_scanner.py +++ b/src/stitching_scanner.py @@ -507,10 +507,14 @@ class StitchingScanner: stop_reason = 'timeout' break - if current_dim() >= max_dim: + if current_dim() >= max_dim and direction == ScanDirection.RIGHT: self.log(f"Max dimension reached ({current_dim()}px)") stop_reason = 'max_dim' break + if current_dim() <= 0 and direction == ScanDirection.LEFT: + self.log(f"Max dimension reached ({current_dim()}px)") + stop_reason = 'min_dim' + break if abs(total_x) >= self.config.max_mosaic_width: self.log(f"Max dimension reached ({self.config.max_mosaic_width}px)") @@ -519,8 +523,8 @@ class StitchingScanner: elif direction == ScanDirection.LEFT: self.state.current_x = 0 self.log(f"Current X offset ({self.state.current_x}px)") - stop_reason = 'max_dim' - break + # stop_reason = 'max_dim' + # break # Pulse motor self.motion.send_command(start_cmd) time.sleep(self.config.movement_interval)