From 8b4c04fb26e1e008b243bb2f49e0176014d97c92 Mon Sep 17 00:00:00 2001 From: Emmo Emminghaus Date: Thu, 8 Sep 2022 17:01:05 +0200 Subject: [PATCH 1/2] Making the measurment when buzzing the gear motor reliable by waiting for "silence" ala. finishing all moves Signed-off-by: Emmo Emminghaus --- Klipper_Files/Extra module/ercf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Klipper_Files/Extra module/ercf.py b/Klipper_Files/Extra module/ercf.py index 3c848011..3d2a6c8e 100644 --- a/Klipper_Files/Extra module/ercf.py +++ b/Klipper_Files/Extra module/ercf.py @@ -697,6 +697,7 @@ def _check_filament_in_extruder(self, move_size = 20, threshold = 1): def _check_filament_in_encoder(self): self._log_debug("Checking for filament in encoder") self._servo_down() + self.toolhead.wait_moves() self._do_buzz_gear_motor() final_encoder_pos = self._counter.get_distance() self._log_trace("After buzzing gear motor, encoder read %.1f" % final_encoder_pos) @@ -1252,6 +1253,7 @@ def cmd_ERCF_ENCODER_RUNOUT(self, gcmd): self._counter.reset_counts() self._disable_encoder_sensor() self._servo_down() + self.toolhead.wait_moves() self._do_buzz_gear_motor() self._servo_up() moved = self._counter.get_distance() From a57e82ca0577a80fbb480ee26eb9bf665b2bb627 Mon Sep 17 00:00:00 2001 From: Emmo Emminghaus Date: Thu, 8 Sep 2022 17:32:39 +0200 Subject: [PATCH 2/2] Moar silence for measurments Signed-off-by: Emmo Emminghaus --- Klipper_Files/Extra module/ercf.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Klipper_Files/Extra module/ercf.py b/Klipper_Files/Extra module/ercf.py index 3d2a6c8e..5ec2fb14 100644 --- a/Klipper_Files/Extra module/ercf.py +++ b/Klipper_Files/Extra module/ercf.py @@ -404,6 +404,7 @@ def _do_calculate_calibration_ratio(self, tool): self._select_tool(tool) self._servo_down() self._set_steps(1.) + self.toolhead.wait_moves() self._counter.reset_counts() encoder_moved = self._load_into_encoder() self._load_to_end_of_bowden(load_length-encoder_moved) @@ -482,12 +483,14 @@ def cmd_ERCF_CALIBRATE_ENCODER(self, gcmd): for x in range(repeats): # Move forward + self.toolhead.wait_moves() self._counter.reset_counts() self._gear_stepper_move_wait(dist, True, speed, accel) plus_values.append(self._counter.get_counts()) self.gcode.respond_info("+ counts = %.3f" % (self._counter.get_counts())) # Move backward + self.toolhead.wait_moves() self._counter.reset_counts() self._gear_stepper_move_wait(-dist, True, speed, accel) min_values.append(self._counter.get_counts()) @@ -676,6 +679,7 @@ def _check_filament_in_extruder(self, move_size = 20, threshold = 1): self._servo_up() self._log_debug("Checking for filament in extruder") # reset the counter and move the extruder backwards by move_size + self.toolhead.wait_moves() self._counter.reset_counts() pos = self.toolhead.get_position() pos[3] -= move_size @@ -732,6 +736,7 @@ def _unload_from_extruder(self): out_of_extruder = False for i in range(3): self._log_debug("Testing if filament is still in the extruder - #%d" % i) + self.toolhead.wait_moves() self._counter.reset_counts() pos[3] -= self.encoder_move_step_size self.toolhead.manual_move(pos, 20) @@ -758,6 +763,7 @@ def _unload_encoder(self, max_steps=5): self._log_debug("Unloading from the encoder") for step in range(max_steps): + self.toolhead.wait_moves() self._counter.reset_counts() self._gear_stepper_move_wait(-self.encoder_move_step_size) dist_moved = self._counter.get_distance() @@ -766,6 +772,7 @@ def _unload_encoder(self, max_steps=5): if delta >= 3.0: # if there is a large delta here, we are out of the encoder self.loaded_status = self.LOADED_STATUS_UNLOADED + self.toolhead.wait_moves() self._counter.reset_counts() self._gear_stepper_move_wait(-(self.parking_distance - delta)) if self._counter.get_distance() < 5.0: @@ -788,6 +795,7 @@ def _unload_from_end_of_bowden(self, length): self.toolhead.dwell(0.2) self.toolhead.wait_moves() + self.toolhead.wait_moves() self._counter.reset_counts() # Initial unload in sync (ERCF + extruder) for xx mms @@ -801,6 +809,7 @@ def _unload_from_end_of_bowden(self, length): #length -= counter_distance #self._log_debug("Sync unload move done %.1f / %.1f (diff: %.1f)" % (counter_distance, self.sync_unload_length, counter_distance - self.sync_unload_length)) + self.toolhead.wait_moves() self._counter.reset_counts() # initial attempt to unload the filament for i in range(self.num_moves): @@ -987,6 +996,7 @@ def _load_to_nozzle(self): self._log_debug("Loading to the nozzle") self._servo_up() + self.toolhead.wait_moves() self._counter.reset_counts() pos = self.toolhead.get_position() pos[3] += self.end_of_bowden_to_nozzle @@ -1250,6 +1260,7 @@ def cmd_ERCF_ENCODER_RUNOUT(self, gcmd): self._log_info("Issue on tool %d" % self.tool_selected) self._log_info("Checking if this is a clog or a runout...") + self.toolhead.wait_moves() self._counter.reset_counts() self._disable_encoder_sensor() self._servo_down()