macro cleanup

This commit is contained in:
Kyle Brown 2022-06-13 18:08:59 -07:00
parent 55f7fd8409
commit 22b1a8f3d8
7 changed files with 115 additions and 31 deletions

View file

@ -7,7 +7,7 @@ gcode:
{% set X = 200 %}
SET_VELOCITY_LIMIT ACCEL=5000 ACCEL_TO_DECEL=5000
M104 S{hotendTemp|float*0.75} # set extruder pre warm temp
M104 S{hotendTemp|float*0.6} # set extruder pre warm temp
M140 S{bedTemp} # set bed temp to warm while starting up
G28 # home after setting temps
M140 S{bedTemp} # set & wait for bed temp
@ -15,7 +15,7 @@ gcode:
M190 S{bedTemp} # Wait for bed to come to temperature
M117 Waiting for thermal expansion...
HEATSOAK DWELL={DWELL} # Dwelling
BED_MESH_CALIBRATE
BED_MESH_CALIBRATE AREA_START={params.AREA_START} AREA_END={params.AREA_END}
GO_TO_BUCKET
M109 S{hotendTemp} # Set extruder to printing temperature
CLEAN_NOZZLE
@ -48,6 +48,7 @@ gcode:
BASE_CANCEL_PRINT
SDCARD_RESET_FILE
M221 S100
BED_MESH_CLEAR
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
@ -131,3 +132,79 @@ gcode:
{% if printer.extruder.can_extrude %}
G11
{% endif %}
[gcode_macro BED_MESH_CALIBRATE]
rename_existing: _BED_MESH_CALIBRATE
; gcode parameters
variable_parameter_AREA_START : 0,0
variable_parameter_AREA_END : 0,0
; the clearance between print area and probe area
variable_mesh_area_offset : 5.0
; number of sample per probe point
variable_probe_samples : 1
; minimum probe count
variable_min_probe_count : 3
gcode:
Attach_probe
{% if params.AREA_START and params.AREA_END %}
{% set bedMeshConfig = printer["configfile"].config["bed_mesh"] %}
{% set safe_min_x = bedMeshConfig.mesh_min.split(",")[0]|float %}
{% set safe_min_y = bedMeshConfig.mesh_min.split(",")[1]|float %}
{% set safe_max_x = bedMeshConfig.mesh_max.split(",")[0]|float %}
{% set safe_max_y = bedMeshConfig.mesh_max.split(",")[1]|float %}
{% set area_min_x = params.AREA_START.split(",")[0]|float %}
{% set area_min_y = params.AREA_START.split(",")[1]|float %}
{% set area_max_x = params.AREA_END.split(",")[0]|float %}
{% set area_max_y = params.AREA_END.split(",")[1]|float %}
{% set meshPointX = bedMeshConfig.probe_count.split(",")[0]|float %}
{% set meshPointY = bedMeshConfig.probe_count.split(",")[1]|float %}
{% if (area_min_x < area_max_x) and (area_min_y < area_max_y) %}
{% if area_min_x - mesh_area_offset >= safe_min_x %}
{% set area_min_x = area_min_x - mesh_area_offset %}
{% else %}
{% set area_min_x = safe_min_x %}
{% endif %}
{% if area_min_y - mesh_area_offset >= safe_min_y %}
{% set area_min_y = area_min_y - mesh_area_offset %}
{% else %}
{% set area_min_y = safe_min_y %}
{% endif %}
{% if area_max_x + mesh_area_offset <= safe_max_x %}
{% set area_max_x = area_max_x + mesh_area_offset %}
{% else %}
{% set area_max_x = safe_max_x %}
{% endif %}
{% if area_max_y + mesh_area_offset <= safe_max_y %}
{% set area_max_y = area_max_y + mesh_area_offset %}
{% else %}
{% set area_max_y = safe_max_y %}
{% endif %}
{% set meshPointX = (meshPointX * (area_max_x - area_min_x) / (safe_max_x - safe_min_x))|int %}
{% if meshPointX < min_probe_count %}
{% set meshPointX = min_probe_count %}
{% endif %}
{% set meshPointY = (meshPointY * (area_max_y -area_min_y ) / (safe_max_y - safe_min_y))|int %}
{% if meshPointY < min_probe_count %}
{% set meshPointY = min_probe_count %}
{% endif %}
_BED_MESH_CALIBRATE mesh_min={area_min_x},{area_min_y} mesh_max={area_max_x},{area_max_y} probe_count={meshPointX},{meshPointY} samples={probe_samples|int}
{% else %}
_BED_MESH_CALIBRATE
{% endif %}
{% else %}
_BED_MESH_CALIBRATE
{% endif %}
#_BED_MESH_CALIBRATE {% for p in params
# %}{'%s=%s' % (p, params[p])}{%
# endfor %}

View file

@ -41,11 +41,11 @@ gcode:
# Speed
{% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %}
# Iterations
{% set iterations = params.ITERATIONS|default(5)|int %}
{% set iterations = params.ITERATIONS|default(1)|int %}
# Acceleration
{% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %}
# Bounding inset for large pattern (helps prevent slamming the toolhead into the sides after small skips, and helps to account for machines with imperfectly set dimensions)
{% set bound = params.BOUND|default(20)|int %}
{% set bound = params.BOUND|default(30)|int %}
# Size for small pattern box
{% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %}
@ -73,17 +73,18 @@ gcode:
# Output parameters to g-code terminal
{ action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) }
# Home and get position for comparison later:
G28
# Absolute positioning
G90
# Set new limits
SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel}
# Home and get position for comparison later:
G28
# 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{10} F{speed*60}
{% for i in range(iterations) %}
# Large pattern
@ -111,10 +112,12 @@ gcode:
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}
{% for i in range(10) %}
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 %}
{% endfor %}
# Restore max speed/accel/accel_to_decel to their configured values

View file

@ -19,9 +19,9 @@ path: ~/gcode_files
[printer]
kinematics: corexy
max_velocity: 100
max_accel: 5000
max_accel_to_decel: 5000
max_velocity: 1000
max_accel: 15000
max_accel_to_decel: 15000
max_z_velocity: 80
max_z_accel: 1000
square_corner_velocity: 8
@ -70,7 +70,7 @@ unretract_speed: 80
pin: PF7 # your probe pin goes here
x_offset: 26 # offset for microswitch x direction off nozzle
y_offset: 55 # offset for microswitch y direction off nozzle
#z_offset: 5.644 # offset for microswitch in z height
z_offset: 5.644 # offset for microswitch in z height
samples: 1
sample_retract_dist: 3 # this is so the machine has time for the switch to reset properly, especially with a higher retract speed
samples_result: median
@ -79,9 +79,9 @@ samples_tolerance_retries: 3
speed: 15 # do not go higher than 10mm/s, you will destroy the switch
lift_speed: 20
dock_position: 322,317, 25 #you need to set these on your own
dock_position: 322,317, 15 #you need to set these on your own
safe_z_position: 165,165 #used the center of the bed for this
approach_position: 290,317, 25 #you need to set these on your own
approach_position: 290,317, 15 #you need to set these on your own
detach_position: 322,280 #you need to set these on your own
attach_speed: 30
detach_speed: 30
@ -93,15 +93,18 @@ allow_delayed_detach: False
[bed_mesh]
speed: 500
horizontal_move_z: 10
horizontal_move_z: 7
mesh_min: 26, 66
mesh_max: 320, 305
probe_count: 6, 6
algorithm: bicubic
fade_start: 1
fade_end: 10
fade_target: 0
[input_shaper]
shaper_type_x = zv
shaper_freq_x = 79.4 # accel=62700
shaper_freq_x = 119.2 # accel=55400
shaper_type_y = zv
shaper_freq_y = 58.2 # accel=13200
shaper_freq_y = 60.4 # accel=14200

View file

@ -18,13 +18,13 @@ variable_purge_ret: 2 ; Retract length, in mm, after
variable_ooze_dwell: 1 ; Dwell/wait time, in seconds, after purging and retracting.
# Adjust this so that your nozzle scrubs within the brush. Currently defaulted to be a lot higher for safety. Be careful not to go too low!
variable_brush_top: 8
variable_brush_top: 6
# These parameters define your scrubbing, travel speeds, safe z clearance and how many times you want to wipe. Update as necessary. Wipe
# direction is randomized based off whether the left or right bucket is randomly selected in the purge & scrubbing routine.
variable_clearance_z: 10 ; When traveling, but not cleaning, the clearance along the z-axis between nozzle and brush.
variable_wipe_qty: 3 ; Number of complete (A complete wipe: left, right, left OR right, left, right) wipes.
variable_prep_spd_xy: 6000 ; Travel (not cleaning) speed along x and y-axis in mm/min.
variable_prep_spd_xy: 12000 ; Travel (not cleaning) speed along x and y-axis in mm/min.
variable_prep_spd_z: 1500 ; Travel (not cleaning) speed along z axis in mm/min.
variable_wipe_spd_xy: 5000 ; Nozzle wipe speed in mm/min.
@ -44,13 +44,13 @@ variable_wipe_spd_xy: 5000 ; Nozzle wipe speed in mm/min.
#
#
## For V1.8, you may need to measure where your brush is on the x axis and input manually into any of the variable_brush_start uncommented.
variable_brush_start: 235
variable_brush_start: 230
# This value is defaulted from brush location in CAD (rear left). Change if your brush width is different.
variable_brush_width: 34
## These are only used if location_bucket_rear is False. You specify a custom location in y axis for your brush - see diagram above. ##
variable_brush_front: 325
variable_brush_front: 320
variable_brush_depth: 243
@ -165,7 +165,7 @@ gcode:
G1 Z{brush_top + clearance_z} F{prep_spd_z}
## Restore the gcode state to how it was before the macro.
RESTORE_GCODE_STATE NAME=clean_nozzle MOVE=1
RESTORE_GCODE_STATE NAME=clean_nozzle MOVE=1 MOVE_SPEED=1000
{% else %}

View file

@ -53,7 +53,7 @@ set_position_z: -1.8
gcode:
# Parameters
{% set Y = -20 %} # Avoid dock
{% set Z = 20 %}
{% set Z = 10 %}
SET_VELOCITY_LIMIT ACCEL=500 ACCEL_TO_DECEL=500 VELOCITY=100
G90

View file

@ -14,7 +14,7 @@ max_extrude_only_velocity: 75.0
max_extrude_only_accel: 1500
min_temp: 0
max_temp: 350
max_temp: 500
step_pin: PG4
dir_pin: !PC1
@ -45,4 +45,5 @@ pid_Kd=93.558
uart_pin: PC7
#Run current is listed in RMS
#run_current: 0.30 #min current, equivalent to 0.42A peak (Peak = RMS/0.707)
run_current: 0.35 #max current, equivalent to 0.49A peak (Peak = RMS/0.707)
#run_current: 0.35 #max current, equivalent to 0.49A peak (Peak = RMS/0.707)
run_current: 0.45

View file

@ -37,8 +37,8 @@ enable_pin: !PG5
microsteps: 16
rotation_distance: 4
endstop_pin: PG10
position_endstop: -2.460
position_min: -2.5
position_endstop: -2.510
position_min: -2.6
position_max: 400
full_steps_per_rotation: 200
homing_retract_dist: 5.0