Skip to content

Commit

Permalink
Macros: set and restore travel accel where travel speed is set
Browse files Browse the repository at this point in the history
  • Loading branch information
miklschmidt committed Jan 8, 2024
1 parent fb74204 commit 996ff54
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions macros.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ variable_start_print_heat_chamber_bed_temp: 115
variable_end_print_park_in: "back"
variable_pause_print_park_in: "back"
variable_macro_travel_speed: 150
variable_macro_travel_accel: 2000
variable_macro_z_speed: 15
variable_end_print_park_z_hop: 20
# Possible values: 'sensorless' or 'endstops'.
Expand Down Expand Up @@ -72,6 +73,9 @@ gcode:
# Define park positions
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
{% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %}
{% set accel = printer["gcode_macro RatOS"].macro_travel_accel %}
{% set old_accel = priter.toolhead.max_accel %}
{% set old_decel = priter.toolhead.max_accel_to_decel %}
{% set z_speed = printer["gcode_macro RatOS"].macro_z_speed|float * 60 %}
# Calculate safe Z position
{% set max_z = printer.toolhead.axis_maximum.z|float %}
Expand All @@ -81,6 +85,7 @@ gcode:
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
M204 S{accel}
PAUSE_BASE
G91
# Retract
Expand All @@ -96,6 +101,7 @@ gcode:
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
M204 S{old_accel}

[gcode_macro RESUME]
description: Resumes the print if the printer is paused.
Expand Down Expand Up @@ -184,6 +190,9 @@ gcode:
M117 Priming nozzle with prime blob..
RESPOND MSG="Priming nozzle with prime blob.."
{% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %}
{% set accel = printer["gcode_macro RatOS"].macro_travel_accel %}
{% set old_accel = priter.toolhead.max_accel %}
{% set old_decel = priter.toolhead.max_accel_to_decel %}
{% set z_speed = printer["gcode_macro RatOS"].macro_z_speed|float * 60 %}
{% set fan_speed = printer["gcode_macro RatOS"].nozzle_prime_bridge_fan|float %}
{% if printer["gcode_macro RatOS"].nozzle_prime_start_x|lower == 'min' %}
Expand Down Expand Up @@ -214,7 +223,8 @@ gcode:
{% endif %}
{% set z = printer["gcode_macro RatOS"].start_print_park_z_height|float %}
# Absolute positioning
G90
G90
M204 S{accel}
# Relative extrusion
M83
# Lift to start print Z height
Expand Down Expand Up @@ -247,12 +257,16 @@ gcode:
G1 F200 Y{y_start + (50 * y_factor)} Z0.2 E0.6
# Break away wipe
G1 F{speed} Y{y_start + (100 * y_factor)}
M204 S{old_accel}
RESTORE_GCODE_STATE NAME=prime_blob_state


[gcode_macro _PARK]
gcode:
{% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %}
{% set accel = printer["gcode_macro RatOS"].macro_travel_accel %}
{% set old_accel = priter.toolhead.max_accel %}
{% set old_decel = priter.toolhead.max_accel_to_decel %}
# Get X position
{% if params.X != '' %}
{% if params.X|float >= printer.toolhead.axis_minimum.x + 5 and params.X|float <= printer.toolhead.axis_maximum.x - 5 %}
Expand All @@ -275,7 +289,9 @@ gcode:
# Absolute positioning
G90
# Park
M204 S{accel}
G0 X{safe_x} Y{y} F{speed}
M204 S{old_accel}

#####
# COLOR CHANGE
Expand Down Expand Up @@ -611,6 +627,9 @@ gcode:
SAVE_GCODE_STATE NAME=probe_for_priming_state
RESPOND MSG="Probing the prime location.."
{% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %}
{% set accel = printer["gcode_macro RatOS"].macro_travel_accel %}
{% set old_accel = priter.toolhead.max_accel %}
{% set old_decel = priter.toolhead.max_accel_to_decel %}
{% set z_speed = printer["gcode_macro RatOS"].macro_z_speed|float * 60 %}
{% if printer["gcode_macro RatOS"].nozzle_prime_start_x|lower == 'min' %}
{% set x_start = 5 %}
Expand Down Expand Up @@ -655,18 +674,18 @@ gcode:
{% set y_start = [[y_start, max_y]|min, min_y]|max %}

RESPOND MSG="PROBE_FOR_PRIMING: Probing the prime location at X: {x_start} Y: {y_start}"

# Absolute positioning
G90
# Relative extrusion
M83
# Lift to horizontal_move_z
M204 S{accel}
G0 Z{z} F{z_speed}
# move close to blob position
G1 X{x_start} Y{y_start} F{speed}
PROBE_CURRENT_POSITION
SAVE_PROBE_RESULT VARIABLE=probe_for_priming_result

M204 S{old_accel}
RESTORE_GCODE_STATE NAME=probe_for_priming_state
{% endif %}

Expand Down

0 comments on commit 996ff54

Please sign in to comment.