From 3b198ca43a75a18c61b16648d219ce0d0a5398a0 Mon Sep 17 00:00:00 2001 From: Suhbat Shugan Date: Fri, 5 Jul 2024 13:27:15 -0400 Subject: [PATCH] Update TEST_SPEED.cfg (#120) * Update TEST_SPEED.cfg Klipper no longer has a MAX_ACCEL_TO_DECEL paramter in the firmware, it has been changed to MINIMUM CRUISE RATIO. This is a patch that works for now. * Update TEST_SPEED.cfg Tested config, I don't know what the klipper internal parameter for minimum cruise ratio name is. Need to figure that out, this is working at he moment. * Update TEST_SPEED.cfg Fixes proposed by jomik. This is working with settings being restored after testing. --- macros/TEST_SPEED.cfg | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/macros/TEST_SPEED.cfg b/macros/TEST_SPEED.cfg index 9f36892..a550ce0 100644 --- a/macros/TEST_SPEED.cfg +++ b/macros/TEST_SPEED.cfg @@ -1,9 +1,11 @@ +[gcode_macro TEST_SPEED] # Home, get position, throw around toolhead, home again. # If MCU stepper positions (first line in GET_POSITION) are greater than a full step different (your number of microsteps), then skipping occured. # We only measure to a full step to accomodate for endstop variance. # Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10 -[gcode_macro TEST_SPEED] +description: Test for max speed and acceleration parameters for the printer. Procedure: Home -> ReadPositionFromMCU -> MovesToolhead@Vel&Accel -> Home -> ReadPositionfromMCU + gcode: # Speed {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} @@ -11,6 +13,8 @@ gcode: {% set iterations = params.ITERATIONS|default(5)|int %} # Acceleration {% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %} + # Minimum Cruise Ratio + {% set min_cruise_ratio = params.MIN_CRUISE_RATIO|default(0)|float %} # Possible location in printer object stack: printer.configfile.settings.printer.minimum_cruise_ratio # Bounding inset for large pattern (helps prevent slamming the toolhead into the sides after small skips, and helps to account for machines with imperfectly set dimensions) {% set bound = params.BOUND|default(20)|int %} # Size for small pattern box @@ -63,7 +67,8 @@ gcode: G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} # Set new limits - SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} + # SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} # DEPRECATED | Due to deprecation of accel_to_decel parameter in Klipper + SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} MIN_CRUISE_RATIO={minCruiseRatio} {% for i in range(iterations) %} # Large pattern diagonals @@ -96,7 +101,8 @@ gcode: {% endfor %} # Restore max speed/accel/accel_to_decel to their configured values - SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel} + #SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel} # DEPRECATED | Depercating of accel_to_decel param in klipper + SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} MIN_CRUISE_RATIO={printer.configfile.settings.printer.minimum_cruise_ratio} # Re-home and get position again for comparison: M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 @@ -108,4 +114,5 @@ gcode: GET_POSITION # Restore previous gcode state (absolute/relative, etc) - RESTORE_GCODE_STATE NAME=TEST_SPEED \ No newline at end of file + RESTORE_GCODE_STATE NAME=TEST_SPEED + \ No newline at end of file