From cf9b9d772c624f76941b72f6103f605469921aaa Mon Sep 17 00:00:00 2001 From: Frank Tackitt Date: Fri, 20 Dec 2024 06:37:57 -0700 Subject: [PATCH] Add danger_option log_velocity_limit_changes (#489) When false, this prevents `toolhead` from logging every change to velocity limits to klippy.log --- docs/Config_Reference.md | 3 +++ klippy/extras/danger_options.py | 4 ++++ klippy/toolhead.py | 22 ++++++++++------------ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/docs/Config_Reference.md b/docs/Config_Reference.md index 9c1381124..29bfa8e15 100644 --- a/docs/Config_Reference.md +++ b/docs/Config_Reference.md @@ -137,6 +137,9 @@ A collection of Kalico-specific system options # If the bed mesh should be logged at startup # (helpful for keeping the log clean during development) # The default is True. +#log_velocity_limit_changes: True +# If changes to velocity limits should be logged. If False, velocity limits will only +# be logged at rollover. Some slicers emit very frequent SET_VELOCITY_LIMIT commands #log_shutdown_info: True # If we should log detailed crash info when an exception occurs # Most of it is overly-verbose and fluff and we still get a stack trace diff --git a/klippy/extras/danger_options.py b/klippy/extras/danger_options.py index 697dedc6d..dcec7aa9e 100644 --- a/klippy/extras/danger_options.py +++ b/klippy/extras/danger_options.py @@ -8,6 +8,9 @@ def __init__(self, config): self.log_bed_mesh_at_startup = config.getboolean( "log_bed_mesh_at_startup", True ) + self.log_velocity_limit_changes = config.getboolean( + "log_velocity_limit_changes", True + ) self.log_shutdown_info = config.getboolean("log_shutdown_info", True) self.log_serial_reader_warnings = config.getboolean( "log_serial_reader_warnings", True @@ -58,6 +61,7 @@ def __init__(self, config): self.log_statistics = False self.log_config_file_at_startup = False self.log_bed_mesh_at_startup = False + self.log_velocity_limit_changes = False self.log_shutdown_info = False self.log_serial_reader_warnings = False self.log_startup_info = False diff --git a/klippy/toolhead.py b/klippy/toolhead.py index 408b30b71..0b6cfe2cb 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -804,25 +804,23 @@ def cmd_SET_VELOCITY_LIMIT(self, gcmd): self.min_cruise_ratio = min_cruise_ratio self._calc_junction_deviation() msg = ( - "max_velocity: %.6f\n" - "max_accel: %.6f\n" - "minimum_cruise_ratio: %.6f\n" - "square_corner_velocity: %.6f" - % ( - self.max_velocity, - self.max_accel, - self.min_cruise_ratio, - self.square_corner_velocity, - ) + "max_velocity: %.6f" % self.max_velocity, + "max_accel: %.6f" % self.max_accel, + "minimum_cruise_ratio: %.6f" % self.min_cruise_ratio, + "square_corner_velocity: %.6f" % self.square_corner_velocity, + ) + self.printer.set_rollover_info( + "toolhead", + "toolhead: %s" % (" ".join(msg),), + log=get_danger_options().log_velocity_limit_changes, ) - self.printer.set_rollover_info("toolhead", "toolhead: %s" % (msg,)) if ( max_velocity is None and max_accel is None and square_corner_velocity is None and min_cruise_ratio is None ): - gcmd.respond_info(msg, log=False) + gcmd.respond_info("\n".join(msg), log=False) def cmd_M204(self, gcmd): # Use S for accel