From d4e1bacf763beff54b03282444a33271f75c2ee1 Mon Sep 17 00:00:00 2001 From: Suhbat Shugan Date: Mon, 18 Mar 2024 00:15:34 -0400 Subject: [PATCH 1/3] 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. --- macros/TEST_SPEED.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/TEST_SPEED.cfg b/macros/TEST_SPEED.cfg index 9f36892..f1b30d1 100644 --- a/macros/TEST_SPEED.cfg +++ b/macros/TEST_SPEED.cfg @@ -63,7 +63,7 @@ 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} MIN_CRUISE_RATIO={0.5} #OLD: ACCEL_TO_DECEL={accel / 2} {% for i in range(iterations) %} # Large pattern diagonals @@ -96,7 +96,7 @@ 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} # Re-home and get position again for comparison: M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 @@ -108,4 +108,4 @@ 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 From e4935409480d176ba65974d783d702329c47b69f Mon Sep 17 00:00:00 2001 From: Suhbat Shugan Date: Mon, 18 Mar 2024 00:40:43 -0400 Subject: [PATCH 2/3] 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. --- macros/TEST_SPEED.cfg | 68 ++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/macros/TEST_SPEED.cfg b/macros/TEST_SPEED.cfg index f1b30d1..7aaff58 100644 --- a/macros/TEST_SPEED.cfg +++ b/macros/TEST_SPEED.cfg @@ -1,9 +1,9 @@ +[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] gcode: # Speed {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} @@ -11,6 +11,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(printer.configfile.settings.printer.minimum_cruise_ratio)|float %} # 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 @@ -41,7 +43,6 @@ gcode: { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } # Home and get position for comparison later: - M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 G28 # QGL if not already QGLd (only if QGL section exists in config) {% if printer.configfile.settings.quad_gantry_level %} @@ -53,7 +54,6 @@ gcode: # Move 50mm away from max position and home again (to help with hall effect endstop accuracy - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/24) G90 G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{30*60} - M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 G28 X Y G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60} G4 P1000 @@ -63,44 +63,45 @@ gcode: G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} # Set new limits - SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} MIN_CRUISE_RATIO={0.5} #OLD: ACCEL_TO_DECEL={accel / 2} + SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} #MIN_CRUISE_RATIO = {0.5} #ACCEL_TO_DECEL={accel / 2} {% for i in range(iterations) %} - # Large pattern diagonals - G0 X{x_min} Y{y_min} F{speed*60} - G0 X{x_max} Y{y_max} F{speed*60} - G0 X{x_min} Y{y_min} F{speed*60} - G0 X{x_max} Y{y_min} F{speed*60} - G0 X{x_min} Y{y_max} F{speed*60} - G0 X{x_max} Y{y_min} F{speed*60} - - # Large pattern box - G0 X{x_min} Y{y_min} F{speed*60} - G0 X{x_min} Y{y_max} F{speed*60} - G0 X{x_max} Y{y_max} F{speed*60} - G0 X{x_max} Y{y_min} F{speed*60} - - # Small pattern diagonals - G0 X{x_center_min} Y{y_center_min} F{speed*60} - G0 X{x_center_max} Y{y_center_max} F{speed*60} - G0 X{x_center_min} Y{y_center_min} F{speed*60} - G0 X{x_center_max} Y{y_center_min} F{speed*60} - G0 X{x_center_min} Y{y_center_max} F{speed*60} - G0 X{x_center_max} Y{y_center_min} F{speed*60} + # Large pattern + # Diagonals + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_max} Y{y_max} F{speed*60} + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + G0 X{x_min} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + + # Box + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_min} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} - # Small patternbox - G0 X{x_center_min} Y{y_center_min} F{speed*60} - G0 X{x_center_min} Y{y_center_max} F{speed*60} - G0 X{x_center_max} Y{y_center_max} F{speed*60} - G0 X{x_center_max} Y{y_center_min} F{speed*60} + # Small pattern + # Small diagonals + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_max} Y{y_center_max} F{speed*60} + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} + G0 X{x_center_min} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} + + # Small box + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_min} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} {% 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} #MIN_CRUISE_RATIO={printer.configfile.settings.printer.minimum_cruise_ratio} #ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel} # Re-home and get position again for comparison: - M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 - G28 # This is a full G28 to fix an issue with CoreXZ - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/12 + G28 # Go to XY home positions (in case your homing override leaves it elsewhere) G90 G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60} @@ -109,3 +110,4 @@ gcode: # Restore previous gcode state (absolute/relative, etc) RESTORE_GCODE_STATE NAME=TEST_SPEED + From 20d464e985dd280522757015241e28aca917b0de Mon Sep 17 00:00:00 2001 From: Suhbat Shugan Date: Wed, 26 Jun 2024 14:28:59 -0400 Subject: [PATCH 3/3] Update TEST_SPEED.cfg Fixes proposed by jomik. This is working with settings being restored after testing. --- macros/TEST_SPEED.cfg | 71 +++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/macros/TEST_SPEED.cfg b/macros/TEST_SPEED.cfg index 7aaff58..a550ce0 100644 --- a/macros/TEST_SPEED.cfg +++ b/macros/TEST_SPEED.cfg @@ -4,6 +4,8 @@ # We only measure to a full step to accomodate for endstop variance. # Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10 +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 %} @@ -12,7 +14,7 @@ gcode: # 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(printer.configfile.settings.printer.minimum_cruise_ratio)|float %} + {% 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 @@ -43,6 +45,7 @@ gcode: { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } # Home and get position for comparison later: + M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 G28 # QGL if not already QGLd (only if QGL section exists in config) {% if printer.configfile.settings.quad_gantry_level %} @@ -54,6 +57,7 @@ gcode: # Move 50mm away from max position and home again (to help with hall effect endstop accuracy - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/24) G90 G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{30*60} + M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 G28 X Y G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60} G4 P1000 @@ -63,45 +67,46 @@ gcode: G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} # Set new limits - SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} #MIN_CRUISE_RATIO = {0.5} #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 - G0 X{x_min} Y{y_min} F{speed*60} - G0 X{x_max} Y{y_max} F{speed*60} - G0 X{x_min} Y{y_min} F{speed*60} - G0 X{x_max} Y{y_min} F{speed*60} - G0 X{x_min} Y{y_max} F{speed*60} - G0 X{x_max} Y{y_min} F{speed*60} - - # Box - G0 X{x_min} Y{y_min} F{speed*60} - G0 X{x_min} Y{y_max} F{speed*60} - G0 X{x_max} Y{y_max} F{speed*60} - G0 X{x_max} Y{y_min} F{speed*60} + # Large pattern diagonals + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_max} Y{y_max} F{speed*60} + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + G0 X{x_min} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + + # Large pattern box + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_min} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + + # Small pattern diagonals + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_max} Y{y_center_max} F{speed*60} + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} + G0 X{x_center_min} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} - # Small pattern - # Small diagonals - G0 X{x_center_min} Y{y_center_min} F{speed*60} - G0 X{x_center_max} Y{y_center_max} F{speed*60} - G0 X{x_center_min} Y{y_center_min} F{speed*60} - G0 X{x_center_max} Y{y_center_min} F{speed*60} - G0 X{x_center_min} Y{y_center_max} F{speed*60} - G0 X{x_center_max} Y{y_center_min} F{speed*60} - - # Small box - G0 X{x_center_min} Y{y_center_min} F{speed*60} - G0 X{x_center_min} Y{y_center_max} F{speed*60} - G0 X{x_center_max} Y{y_center_max} F{speed*60} - G0 X{x_center_max} Y{y_center_min} F{speed*60} + # Small patternbox + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_min} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} {% 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} #MIN_CRUISE_RATIO={printer.configfile.settings.printer.minimum_cruise_ratio} #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: - G28 + M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 + G28 # This is a full G28 to fix an issue with CoreXZ - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/12 # Go to XY home positions (in case your homing override leaves it elsewhere) G90 G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60} @@ -110,4 +115,4 @@ gcode: # Restore previous gcode state (absolute/relative, etc) RESTORE_GCODE_STATE NAME=TEST_SPEED - + \ No newline at end of file