Skip to content

Commit

Permalink
Merge pull request #48 from Cartographer3D/retry-attempt-output
Browse files Browse the repository at this point in the history
fix: CARTOGRAPHER_TOUCH output to display retry attempt numbers
  • Loading branch information
krautech authored Nov 15, 2024
2 parents d9c6848 + 62dc209 commit ec212cc
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,19 @@ def start_touch(self, gcmd, touch_settings, verbose):

samples = []

has_shown_retry_info = False # Initialize the flag

while len(samples) < num_samples:
if retries > 0:
if not has_shown_retry_info:
gcmd.respond_info(f"Retry Attempt {int(retries)}")
has_shown_retry_info = True # Set flag to True after showing the message


self.toolhead.wait_moves()
self.set_accel(accel)
self.log_debug_info(verbose, gcmd, f"Set Acceleration to: {int(accel)}")
gcmd.respond_info(f"Executing Touch {len(samples) + 1} of {int(num_samples)}")
gcmd.respond_info(f"Executing Touch {len(samples) + 1} of {int(num_samples)} [{int(retries)}/{int(max_retries)}]")$

try:
probe_position = self.phoming.probing_move(self.mcu_probe, homing_position, speed)
Expand Down Expand Up @@ -470,6 +478,7 @@ def start_touch(self, gcmd, touch_settings, verbose):
gcmd.respond_info(f"Deviation of {deviation:.4f} exceeds tolerance of {tolerance:.4f}, retrying...")
retries += 1
samples.clear()
has_shown_retry_info = False # Reset the flag for the next retry cycle
self.log_debug_info(verbose, gcmd, f"Deviation: {deviation:.4f}\nNew Average: {average:.4f}\nTolerance: {tolerance:.4f}")

std_dev = np.std(samples)
Expand Down Expand Up @@ -1041,7 +1050,7 @@ def cb(sample):
self, poly, temp_median,
min(z_offset), max(z_offset))
self.models[self.model.name] = self.model
self.model.save(self, not touch)
self.model.save(self)
self._apply_threshold()

self.toolhead.get_last_move_time()
Expand Down

0 comments on commit ec212cc

Please sign in to comment.