Skip to content

Commit

Permalink
MACRO: override SET_VELOCITY_LIMIT
Browse files Browse the repository at this point in the history
  • Loading branch information
HelgeKeck committed Nov 5, 2024
1 parent 72c392c commit 21dbd5f
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions macros/overrides.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,39 @@ gcode:
{% else %}
SDCARD_PRINT_FILE_BASE { rawparams }
{% endif %}


[gcode_macro SET_VELOCITY_LIMIT]
rename_existing: SET_VELOCITY_LIMIT_BASE
gcode:
{% if params.ACCEL_TO_DECEL is defined %}

{% if params.ACCEL is defined %}
{% set accel = params.ACCEL|float %}
{% else %}
{% set accel = printer.toolhead.max_accel|float %}
{% endif %}

{% if params.VELOCITY is defined %}
{% set velocity = params.VELOCITY|float %}
{% else %}
{% set velocity = printer.toolhead.max_velocity|float %}
{% endif %}

{% if params.SQUARE_CORNER_VELOCITY is defined %}
{% set scv = params.SQUARE_CORNER_VELOCITY|float %}
{% else %}
{% set scv = printer.toolhead.square_corner_velocity|float %}
{% endif %}

{% set mcr = params.ACCEL_TO_DECEL|float / accel %}

DEBUG_ECHO PREFIX="SET_VELOCITY_LIMIT" MSG="ACCEL={accel}, VELOCITY={velocity}, SQUARE_CORNER_VELOCITY={scv}, MINIMUM_CRUISE_RATIO={mcr}"

SET_VELOCITY_LIMIT_BASE ACCEL={accel} VELOCITY={velocity} SQUARE_CORNER_VELOCITY={scv} MINIMUM_CRUISE_RATIO={mcr}

{% else %}

SET_VELOCITY_LIMIT_BASE { rawparams }

{% endif %}

0 comments on commit 21dbd5f

Please sign in to comment.