Fixed max dimensions and scan direction on serpentine pattern

This commit is contained in:
2ManyProjects 2026-01-08 20:31:58 -06:00
parent 9a49488760
commit 57399de03f
2 changed files with 9 additions and 5 deletions

View file

@ -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('<Return>', 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('<Return>', lambda e: self._update_stitch_config())

View file

@ -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)