Skip to content

Commit

Permalink
Macros: fix START/END_FEATURE for use with PS
Browse files Browse the repository at this point in the history
Find: (;TYPE:((?:\w+|[[:blank:]])+)\n)(((.|\s|)(?!M204(\w|\s)+;TYPE:))+)
Replace with: ${1}START_FEATURE FEATURE="${2}"\n${3}\nEND_FEATURE FEATURE="${2}"\n

This encapsulates all gcode marked by ;TYPE in START_FEATURE and END_FEATURE.
  • Loading branch information
miklschmidt committed Dec 3, 2024
1 parent c83af4f commit e5f1665
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions macros/util.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -312,24 +312,24 @@ gcode:

[gcode_macro START_FEATURE]
gcode:
RATOS_DEBUG PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode"
{% set scv = printer.toolhead.square_corner_velocity %}
{% set accel = printer.toolhead.accel %}
{% set ratio = printer.toolhead.minimum_cruise_ratio %}
SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv}
SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel}
SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio}
_USER_START_FEATURE FEATURE={params.FEATURE}
DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode"
{% set scv = printer.toolhead.square_corner_velocity|int|default(5) %}
{% set accel = printer.toolhead.max_accel|int|default(10000) %}
{% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %}
SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv}
SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel}
SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio}
_USER_START_FEATURE FEATURE="{params.FEATURE}"


[gcode_macro END_FEATURE]
variable_scv: 5
variable_accel: 10000 # internal use only. Do not touch!
variable_ratio: 0.5 # internal use only. Do not touch!
gcode:
RATOS_DEBUG PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode"
SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio}
_USER_END_FEATURE FEATURE={params.FEATURE} SCV={scv} ACCEL={accel} RATIO={ratio}
DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode"
SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio}
_USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio}


[gcode_macro _ON_LAYER_CHANGE]
Expand Down

0 comments on commit e5f1665

Please sign in to comment.