From 05001fd66c564758596ef8783a30cc0df0310e7c Mon Sep 17 00:00:00 2001 From: Vykori Date: Sat, 10 Jun 2023 22:59:56 -0500 Subject: [PATCH 1/4] Update TEST_SPEED.cfg - Added extra safety measures - Fixed typos --- macros/TEST_SPEED.cfg | 113 ++++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 54 deletions(-) diff --git a/macros/TEST_SPEED.cfg b/macros/TEST_SPEED.cfg index 25d8256..91dbece 100644 --- a/macros/TEST_SPEED.cfg +++ b/macros/TEST_SPEED.cfg @@ -6,7 +6,9 @@ [gcode_macro TEST_SPEED] gcode: # Speed - {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} + {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} + # Safe speed, for homing and setup + {% set safe_speed = params.SAFE_SPEED|default(printer.configfile.settings.printer.max_velocity/2)|int %} # Iterations {% set iterations = params.ITERATIONS|default(5)|int %} # Acceleration @@ -41,70 +43,73 @@ gcode: { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } # Home and get position for comparison later: + {% if "xyz" not in printer.toolhead.homed_axes %} + # Only home if not already homed G28 - # QGL if not already QGLd (only if QGL section exists in config) - {% if printer.configfile.settings.quad_gantry_level %} - {% if printer.quad_gantry_level.applied == False %} - QUAD_GANTRY_LEVEL - G28 Z - {% endif %} - {% endif %} - # 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} - G28 X Y - G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60} - G4 P1000 - GET_POSITION + {% endif %} + # QGL if not already QGLd (only if QGL section exists in config) + {% if printer.configfile.settings.quad_gantry_level %} + {% if printer.quad_gantry_level.applied == False %} + QUAD_GANTRY_LEVEL + G28 Z + {% endif %} + {% endif %} + # Move 50mm away from max position and home X Y (to help with hall effect endstop accuracy - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/24) + G90 + G0 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{safe_speed*60} + G4 P2000 #delay before homing in case StallGuard was triggered and if the printer uses sensorless homing + G28 X Y + # Move to corner for position measurement + G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{safe_speed*60} + G4 P1000 + GET_POSITION # Go to starting position - G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} - + G0 X{x_min} Y{y_min} Z{bound + 10} F{safe_speed*60} + # Set new limits SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} 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} - - # 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 - # 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} + # 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 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} - # Re-home and get position again for comparison: - 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} - G4 P1000 - GET_POSITION + # Re-home + G28 X Y + + # Move to corner for position measurement, to compare against previous measurements + G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{safe_speed*60} + G4 P1000 + 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 a4e8767de6705e087ed6ef928f8918da70671fa4 Mon Sep 17 00:00:00 2001 From: Vykori Date: Mon, 12 Jun 2023 13:34:34 -0700 Subject: [PATCH 2/4] Update TEST_SPEED.cfg - Fix regressions pointed out by Ellis https://github.com/AndrewEllis93/Print-Tuning-Guide/pull/80#issuecomment-1587975793 --- macros/TEST_SPEED.cfg | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/macros/TEST_SPEED.cfg b/macros/TEST_SPEED.cfg index 91dbece..01685d0 100644 --- a/macros/TEST_SPEED.cfg +++ b/macros/TEST_SPEED.cfg @@ -8,7 +8,7 @@ gcode: # Speed {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} # Safe speed, for homing and setup - {% set safe_speed = params.SAFE_SPEED|default(printer.configfile.settings.printer.max_velocity/2)|int %} + {% set safe_speed = params.SAFE_SPEED|default(printer.configfile.settings.printer.max_velocity / 3)|int %} # Iterations {% set iterations = params.ITERATIONS|default(5)|int %} # Acceleration @@ -43,26 +43,23 @@ gcode: { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } # Home and get position for comparison later: - {% if "xyz" not in printer.toolhead.homed_axes %} - # Only home if not already homed G28 - {% endif %} - # QGL if not already QGLd (only if QGL section exists in config) - {% if printer.configfile.settings.quad_gantry_level %} - {% if printer.quad_gantry_level.applied == False %} - QUAD_GANTRY_LEVEL - G28 Z - {% endif %} - {% endif %} - # Move 50mm away from max position and home X Y (to help with hall effect endstop accuracy - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/24) - G90 - G0 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{safe_speed*60} - G4 P2000 #delay before homing in case StallGuard was triggered and if the printer uses sensorless homing - G28 X Y - # Move to corner for position measurement - G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{safe_speed*60} - G4 P1000 - GET_POSITION + # QGL if not already QGLd (only if QGL section exists in config) + {% if printer.configfile.settings.quad_gantry_level %} + {% if printer.quad_gantry_level.applied == False %} + QUAD_GANTRY_LEVEL + G28 Z + {% endif %} + {% endif %} + # Move 50mm away from max position and home X Y (to help with hall effect endstop accuracy - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/24) + G90 + G0 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{safe_speed*60} + G4 P2000 #delay before homing in case StallGuard was triggered and if the printer uses sensorless homing + G28 X Y + # Move to corner for position measurement + G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{safe_speed*60} + G4 P1000 + GET_POSITION # Go to starting position G0 X{x_min} Y{y_min} Z{bound + 10} F{safe_speed*60} @@ -104,9 +101,10 @@ gcode: 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 - G28 X Y + G28 # Move to corner for position measurement, to compare against previous measurements + G90 G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{safe_speed*60} G4 P1000 GET_POSITION From c85e636384a7d4bc1f2771c872526776355d15ea Mon Sep 17 00:00:00 2001 From: Vykori Date: Tue, 13 Jun 2023 12:19:34 -0500 Subject: [PATCH 3/4] Update TEST_SPEED.cfg - Added additional movements to test toolhead moving one way then back again in all combinations --- macros/TEST_SPEED.cfg | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/macros/TEST_SPEED.cfg b/macros/TEST_SPEED.cfg index 01685d0..5bf7be1 100644 --- a/macros/TEST_SPEED.cfg +++ b/macros/TEST_SPEED.cfg @@ -72,29 +72,49 @@ gcode: 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_max} F{speed*60} + G0 X{x_min} Y{y_max} 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_max} Y{y_min} F{speed*60} + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_min} Y{y_max} F{speed*60} + 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_min} Y{y_max} F{speed*60} G0 X{x_max} 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} + G0 X{x_max} Y{y_max} F{speed*60} # 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_max} 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} 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_max} Y{y_center_min} F{speed*60} + 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_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_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_max} F{speed*60} G0 X{x_center_max} Y{y_center_min} F{speed*60} + G0 X{x_center_max} Y{y_center_max} F{speed*60} {% endfor %} # Restore max speed/accel/accel_to_decel to their configured values From 3957415f39c052cbd627be8bc56817d2c11bb205 Mon Sep 17 00:00:00 2001 From: Vykori Date: Tue, 13 Jun 2023 12:40:58 -0500 Subject: [PATCH 4/4] Fix typo in G-code Fixed an accidentally misplaced G0 movement in both the large and small box pattern --- macros/TEST_SPEED.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/TEST_SPEED.cfg b/macros/TEST_SPEED.cfg index 8054595..589214e 100644 --- a/macros/TEST_SPEED.cfg +++ b/macros/TEST_SPEED.cfg @@ -90,9 +90,9 @@ gcode: G0 X{x_max} Y{y_max} 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_max} F{speed*60} G0 X{x_max} Y{y_min} F{speed*60} G0 X{x_max} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} # Small diagonals G0 X{x_center_min} Y{y_center_min} F{speed*60} @@ -114,9 +114,9 @@ gcode: G0 X{x_center_max} Y{y_center_max} 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_max} F{speed*60} G0 X{x_center_max} Y{y_center_min} 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