From c18e11bb8e88e04d22cf2fdc16b56dad089e7def Mon Sep 17 00:00:00 2001 From: SoftFever Date: Sun, 25 Sep 2022 12:22:17 +0800 Subject: [PATCH] update gcode macros for klipper --- README.md | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2ef6dda4dc..ee4aa81e69 100644 --- a/README.md +++ b/README.md @@ -43,11 +43,35 @@ You can enable gcode_arcs(G2/G3) support by adding following section into you pr [gcode_arcs] resolution: 0.1 +[gcode_macro m201] +gcode: + {% if 'X' in params or 'Y' in params %} + {% set accel = (params.X|default(params.Y)|float, + params.Y|default(params.X)|float)|min %} + SET_VELOCITY_LIMIT ACCEL={accel} ACCEL_TO_DECEL={accel * 0.5} + {% else %} + SET_VELOCITY_LIMIT + {% endif %} + +[gcode_macro m203] +gcode: + {% if 'X' in params or 'Y' in params %} + {% set speed = (params.X|default(params.Y)|float, + params.Y|default(params.X)|float)|min %} + SET_VELOCITY_LIMIT VELOCITY={speed} + {% else %} + SET_VELOCITY_LIMIT + {% endif %} + [gcode_macro M205] gcode: - {% set x_jerk = params.X|default(5)|float %} - {% set y_jerk = params.Y|default(5)|float %} - SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={x_jerk} + {% if 'X' in params or 'Y' in params %} + {% set corner_speed = (params.X|default(params.Y)|float, + params.Y|default(params.X)|float)|min %} + SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={corner_speed} + {% else %} + SET_VELOCITY_LIMIT + {% endif %} ```