Skip to content

Commit

Permalink
Add danger_option log_velocity_limit_changes (#489)
Browse files Browse the repository at this point in the history
When false, this prevents `toolhead` from logging every change to
 velocity limits to klippy.log
  • Loading branch information
kageurufu authored Dec 20, 2024
1 parent ec8edf3 commit cf9b9d7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
3 changes: 3 additions & 0 deletions docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions klippy/extras/danger_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
22 changes: 10 additions & 12 deletions klippy/toolhead.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cf9b9d7

Please sign in to comment.