Skip to content

Commit

Permalink
Fixed min_cruise_ratio on older versions of klipper
Browse files Browse the repository at this point in the history
  • Loading branch information
moggieuk committed Dec 11, 2024
1 parent 271af7c commit ba96a80
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions extras/mmu/mmu.py
Original file line number Diff line number Diff line change
Expand Up @@ -3129,8 +3129,11 @@ def _save_toolhead_position_and_park(self, operation, next_pos=None):

# Save toolhead velocity limits and set user defined for macros
self.saved_toolhead_max_accel = self.toolhead.max_accel
self.saved_toolhead_min_cruise_ratio = self.toolhead.min_cruise_ratio
self.gcode.run_script_from_command("SET_VELOCITY_LIMIT ACCEL=%.6f MINIMUM_CRUISE_RATIO=%.6f" % (self.macro_toolhead_max_accel, self.macro_toolhead_min_cruise_ratio))
self.saved_toolhead_min_cruise_ratio = self.toolhead.get_status(eventtime).get('minimum_cruise_ratio', None)
cmd = "SET_VELOCITY_LIMIT ACCEL=%.6f" % self.macro_toolhead_max_accel
if self.saved_toolhead_min_cruise_ratio is not None:
cmd += " MINIMUM_CRUISE_RATIO=%.6f" % self.macro_toolhead_min_cruise_ratio
self.gcode.run_script_from_command(cmd)

# Record the intended X,Y resume position (this is also passed to the pause/resume restore position in pause is later called)
if next_pos:
Expand Down Expand Up @@ -3192,7 +3195,10 @@ def _restore_toolhead_position(self, operation, restore=True):

# Always restore toolhead velocity limits
if self.saved_toolhead_max_accel:
self.gcode.run_script_from_command("SET_VELOCITY_LIMIT ACCEL=%.6f MINIMUM_CRUISE_RATIO=%.6f" % (self.saved_toolhead_max_accel, self.saved_toolhead_min_cruise_ratio))
cmd = "SET_VELOCITY_LIMIT ACCEL=%.6f" % self.saved_toolhead_max_accel
if self.saved_toolhead_min_cruise_ratio is not None:
cmd += " MINIMUM_CRUISE_RATIO=%.6f" % self.saved_toolhead_min_cruise_ratio
self.gcode.run_script_from_command(cmd)
self.saved_toolhead_max_accel = None
else:
pass # Resume will call here again shortly so we can ignore for now
Expand Down

0 comments on commit ba96a80

Please sign in to comment.