diff --git a/input_shaper.cfg b/input_shaper.cfg index a3adc25..27d5a2e 100644 --- a/input_shaper.cfg +++ b/input_shaper.cfg @@ -4,9 +4,9 @@ # is mzv input shaper. # shaper_type: mzv shaper_type_x: mzv -shaper_freq_x: 53 +shaper_freq_x: 52.8 shaper_type_y: mzv -shaper_freq_y: 53 +shaper_freq_y: 41.2 # Damping ratios of vibrations of X and Y axes used by input shapers # to improve vibration suppression. Default value is 0.1 which is a # good all-round value for most printers. In most circumstances this diff --git a/macros/helpers.cfg b/macros/helpers.cfg index 6bfda81..05ca004 100644 --- a/macros/helpers.cfg +++ b/macros/helpers.cfg @@ -1,55 +1,73 @@ #################################################################### # Helper macros # - MOVE_SPEED -# - ZES +# - ... #################################################################### [gcode_macro MOVE_SPEED] description: move along certain patterns with selected speed gcode: {% set F=params.F|default(3000)|int %} + {% set N=params.N|default(1)|int %} {% if printer.idle_timeout.state != "Printing" %} {% if "xyz" in printer.toolhead.homed_axes %} - {action_respond_info("moving with F%d" % F)} - ; square clockwise - M117 > square clockwise - G0 X275 Y275 F{F} - G0 Y25 - G0 X25 - G0 Y275 - G0 X275 - ; square counter-clockwise - M117 > square counter-clockwise - G0 X25 - G0 Y25 - G0 X275 - G0 Y275 - ; diagonal motor a - M117 > diagonal motor a - G0 X25 Y25 - G0 X275 Y275 - G0 X25 - ; diagonal motor b - M117 > diagonal motor b - G0 X275 Y25 - G0 X25 Y275 - G0 X275 Y275 + M118 moving {N}x with F{F} + {% set X0=275 %} + {% set X1=25 %} + {% set Y0=275 %} + {% set Y1=25 %} + ; start + G0 X{X0} Y{Y0} F3000 + G0 F{F} + {% for i in range(N) %} + M118 move {(i+1)}/{N} + ; move 1 + G0 X{X1} Y{Y0} + G0 X{X0} Y{Y1} + ; move 2 + G0 X{X0} Y{Y0} + G0 X{X1} Y{Y1} + ; move 3 + G0 X{X0} Y{Y1} + G0 X{X1} Y{Y0} + ; move 4 + G0 X{X1} Y{Y1} + G0 X{X0} Y{Y0} + {% endfor %} + M118 done {% else %} - {action_respond_info("Printer not homed")} + M118 Printer not homed {% endif %} {% else %} - {action_respond_info("Already printing")} + M118 Already printing {% endif %} - -[gcode_macro ZES] -description: Z_ENDSTOP_CALIBRATE + extras +[gcode_macro fes] +description: query filament sensor encoder_sensor gcode: - {% if printer.idle_timeout.state != "Printing" %} - G28 - G0 X150 Y150 Z10 F10000 - Z_ENDSTOP_CALIBRATE - TESTZ Z=-9 - {% else %} - {action_respond_info("Already printing")} - {% endif %} + QUERY_FILAMENT_SENSOR SENSOR=encoder_sensor + +[gcode_macro fts] +description: query filament sensor toolhead_sensor +gcode: + QUERY_FILAMENT_SENSOR SENSOR=toolhead_sensor + +[gcode_macro zc] +gcode: + {% set z_run = params.CUR|default(0.4)|float %} + {% set z_hold = z_run %} + {action_respond_info("zc: setting zcurrent to %.2f" % z_run)} + SET_TMC_CURRENT STEPPER=stepper_z CURRENT={z_run} HOLDCURRENT={z_hold} + SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={z_run} HOLDCURRENT={z_hold} + SET_TMC_CURRENT STEPPER=stepper_z2 CURRENT={z_run} HOLDCURRENT={z_hold} + SET_TMC_CURRENT STEPPER=stepper_z3 CURRENT={z_run} HOLDCURRENT={z_hold} + + +[gcode_macro zm] +gcode: + {% set speed = params.SPEED|default(300)|int %} + {action_respond_info("moving with F%d" % speed)} + G0 Z30 F{speed} + G0 Z10 F{speed} + + diff --git a/macros/print.cfg b/macros/print.cfg index 78d9963..98e0128 100644 --- a/macros/print.cfg +++ b/macros/print.cfg @@ -18,28 +18,32 @@ gcode: {% set x0=200 %} {% set x1=250 %} - {% set y0=310 %} - {% set z0=1 %} + {% set y0=309 %} + {% set z0=1.5 %} {% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|int %} {% if "xyz" in printer.toolhead.homed_axes %} - M117 > brushie brushie brushie + M118 brushie brushie brushie G0 Z{z_hop} F1000 # move Z to travel height G0 X{x0} Y{y0} F6000 # move to x0/y0 G0 Z{z0} # lower - G0 X{x1} # back - G0 X{x0} # forth - G0 X{x1} # back + G0 X{x1} # 1 + G0 X{x0} # 2 + G0 X{x1} # 3 + G0 X{x0} # 4 G0 Z{z_hop} F300 # move Z to travel height {% else %} - {action_respond_info("Printer not homed")} + M118 Printer not homed {% endif %} -# CANCEL_PRINT +# # - CANCEL_PRINT [gcode_macro CANCEL_PRINT] description: Cancel the actual running print rename_existing: _CANCEL_PRINT_BASE gcode: + SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=0 + CLEAR_PAUSE + SDCARD_RESET_FILE TURN_OFF_HEATERS PARK _CANCEL_PRINT_BASE @@ -50,7 +54,7 @@ description: Change filament gcode: SAVE_GCODE_STATE NAME=M600_state PAUSE Y=15 - M117 > change filament + M118 M600 change filament RESTORE_GCODE_STATE NAME=M600_state [gcode_macro M900] @@ -72,43 +76,42 @@ gcode: {% set y_park = Y %} {% endif %} # calculate save lift position - {% set max_z = printer.toolhead.axis_maximum.z|float %} - {% set act_z = printer.toolhead.position.z|float %} - {% if act_z < (max_z - 20.0) %} - {% set z_safe = 20.0 %} - {% else %} - {% set z_safe = max_z - act_z %} + {% set z_max = printer.toolhead.axis_maximum.z|float %} + {% set z_act = printer.toolhead.position.z|float %} + {% set z_safe = z_act + 10 %} + {% if z_safe > z_max %} + {% set z_safe = z_max %} {% endif %} G91 G0 Z{z_safe} F1200 G90 G0 X{x_park} Y{y_park} F6000 {% else %} - {action_respond_info("Printer not homed")} + M118 Printer not homed {% endif %} -# PAUSE +# - PAUSE [gcode_macro PAUSE] description: Pause the actual running print rename_existing: _PAUSE_BASE # change this if you need more or less extrusion variable_extrude: 1.0 gcode: - {% set Y=params.Y|default(295) %} + {% set YMIN = printer.toolhead.axis_minimum.y|float + 5.0 %} + {% set Y=params.Y|default(YMIN) %} # read E from pause macro {% set E = printer["gcode_macro PAUSE"].extrude|float %} # end of definitions - M117 > pause + M118 pause _PAUSE_BASE {% if printer.extruder.can_extrude|lower == 'true' %} G91 G1 E-{E} F2100 G90 {% else %} - {action_respond_info("Extruder not hot enough")} + M118 Extruder not hot enough {% endif %} - PARK Y={Y} # - PRINT_START @@ -118,15 +121,15 @@ gcode: {% set EXTRUDER=params.EXTRUDER|default(250)|int %} {% set CHAMBER=params.CHAMBER|default(0)|int %} {% set SHEET=params.SHEET|default("default")|string %} - {% set QGL=params.QGL|default(1)|int %} + {% set QGL=params.QGL|default(0)|int %} {% set BMC=params.BMC|default(0)|int %} {% set PURGE=params.PURGE|default(1)|int %} {% set SOAK=params.SOAK|default(0)|int * 1000 * 60 %} {% set Z_ADJUST=params.Z_ADJUST|default(0.0)|float %} - # TODO: ERCF - {% set ERCF=params.ERCF|default(0) %} - {action_respond_info("starting print BED=%d, EXTRUDER=%d, CHAMBER=%d, SHEET=%s, QGL=%d, BMC=%d, PURGE=%d, SOAK=%d, Z_AJUST=%f" % (BED, EXTRUDER, CHAMBER, SHEET, QGL, BMC, PURGE, SOAK, Z_ADJUST))} - M117 > configuring + {% set ERCF=params.ERCF|default(0)|int %} + {% set ERCF_EXTRUDER=params.ERCF_EXTRUDER|default(0)|int %} + {action_respond_info("starting print BED=%d, EXTRUDER=%d, CHAMBER=%d, SHEET=%s, QGL=%d, BMC=%d, PURGE=%d, SOAK=%d, Z_AJUST=%f, ERCF=%d, ERCF_EXTRUDER=%d" % (BED, EXTRUDER, CHAMBER, SHEET, QGL, BMC, PURGE, SOAK, Z_ADJUST, ERCF, ERCF_EXTRUDER))} + M118 configuring SET_LED LED=caselight RED=0.50 GREEN=0.50 BLUE=0.50 G4 P2000 SET_GCODE_OFFSET Z=0.0 # reset z offset @@ -137,44 +140,56 @@ gcode: G90 # use absolute coordinates M83 # use relative distances for extrusion - M117 > homing G4 P2000 {% if BMC %} BED_MESH_CLEAR {% endif %} - M117 > home + M118 home G28 BRUSHIE - {% if QGL %} - M117 > qgl + {% if ERCF %} + M118 ercf home + ERCF_HOME + {% endif %} + {% if QGL or printer.quad_gantry_level.applied|lower == 'false' %} + M118 qgl QUAD_GANTRY_LEVEL PARK=false BRUSHIE {% endif %} - M117 > calibrate z + M118 calibrate z CALIBRATE_Z {% if BMC %} - M117 > bed mesh calibrate + M118 bed mesh calibrate BED_MESH_CALIBRATE {% else %} - M117 > bed mesh load {SHEET} + M118 bed mesh load {SHEET} BED_MESH_PROFILE LOAD={SHEET} {% endif %} - M117 > heating + M118 heating G4 P2000 G92 E0 # reset extruder M190 S{BED} # set and wait for bed temperature M109 S{EXTRUDER} # set and wait for nozzle temperature TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={CHAMBER} # wait for chamber temp {% if SOAK > 0 %} - M117 > soaking for {SOAK/1000/60|int} min + M118 soaking for {SOAK/1000/60|int} min G4 P{SOAK} {% endif %} - M117 > starting + M118 starting SET_PRESSURE_ADVANCE ADVANCE=0.05 SET_GCODE_OFFSET Z_ADJUST={params.Z_ADJUST|default(0.0)|float} MOVE=1 + + {% if ERCF %} + M118 ercf changing to tool {ERCF_EXTRUDER} + ERCF_CHANGE_TOOL_STANDALONE TOOL={ERCF_EXTRUDER} + {% endif %} G4 P2000 + {% if printer['filament_switch_sensor toolhead_sensor'].filament_detected == False %} + M118 Insert filament and press resume + PAUSE + {% endif %} {% if PURGE %} PURGE_NOZZLE {% endif %} @@ -183,11 +198,15 @@ gcode: # - PRINT_END [gcode_macro PRINT_END] gcode: - M117 > finished + {% set UNLOAD_AT_END=params.UNLOAD_AT_END|default(0)|int %} + M118 finished PARK M400 ; wait for buffer to clear G92 E0 ; zero the extruder G1 E-10.0 F3600 ; retract filament + {% if UNLOAD_AT_END == 1 %} + ERCF_EJECT + {% endif %} TURN_OFF_HEATERS M107 ; turn off fan @@ -200,11 +219,11 @@ gcode: {% set y0=params.y0|default(2) %} {% set y1=params.y1|default(3) %} {% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|int %} - M117 > purge nozzle + M118 purge nozzle G0 Z{z_hop} F300 # move Z to travel height G0 X{x0} Y{y0} F5000 # move to x0/y0 G0 Z0.24 F300 # lower Z - G0 X{x1} E20 # draw line + G0 X{x1} E20 F1500 # draw line G0 Y{y1} # move to y1 G0 X{x0} E10 # draw fine line G0 X{x0-10} # move a little further @@ -217,23 +236,33 @@ gcode: description: Resume the actual running print rename_existing: _RESUME_BASE gcode: - # read E from pause macro - {% set E = printer["gcode_macro PAUSE"].extrude|float %} - # get VELOCITY parameter if specified - {% if 'VELOCITY' in params|upper %} - {% set get_params = ('VELOCITY=' + params.VELOCITY) %} - {%else %} - {% set get_params = "" %} - {% endif %} - # end of definitions - M117 > resume - {% if printer.extruder.can_extrude|lower == 'true' %} - G91 - G1 E{E} F6000 + {% if printer["gcode_macro ERCF_PAUSE"].is_paused|int != 0 %} + M118 You can't resume the print without unlocking the ERCF first. + M118 Run ERCF_UNLOCK and solve any issue before hitting Resume again {% else %} - {action_respond_info("Extruder not hot enough")} + # read E from pause macro + {% set E = printer["gcode_macro PAUSE"].extrude|float %} + # get VELOCITY parameter if specified + {% if 'VELOCITY' in params|upper %} + {% set get_params = ('VELOCITY=' + params.VELOCITY) %} + {%else %} + {% set get_params = "" %} + {% endif %} + # end of definitions + M118 resume + {% if printer.extruder.can_extrude|lower == 'true' %} + G91 + G1 E{E} F6000 + {% else %} + M118 Extruder not hot enough + {% endif %} + {% if printer["gcode_macro ERCF_VAR"].clog_detection|int == 1 %} + SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=1 + {% endif %} + M118 calling _RESUME_BASE + G4 P2000 + _RESUME_BASE {% endif %} - _RESUME_BASE {get_params} [gcode_macro PRINT_LAYER_CHANGE] diff --git a/printer.cfg b/printer.cfg index 0330fda..1b235e0 100644 --- a/printer.cfg +++ b/printer.cfg @@ -32,34 +32,9 @@ serial: /dev/serial/by-id/usb-Klipper_stm32f446xx_1E0030000E5053424E363620-if00 ##-------------------------------------------------------------------- -[gcode_macro zc] -gcode: - {% set z_run = params.CUR|default(0.4)|float %} - {% set z_hold = z_run %} - {action_respond_info("zc: setting zcurrent to %.2f" % z_run)} - SET_TMC_CURRENT STEPPER=stepper_z CURRENT={z_run} HOLDCURRENT={z_hold} - SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={z_run} HOLDCURRENT={z_hold} - SET_TMC_CURRENT STEPPER=stepper_z2 CURRENT={z_run} HOLDCURRENT={z_hold} - SET_TMC_CURRENT STEPPER=stepper_z3 CURRENT={z_run} HOLDCURRENT={z_hold} - - -[gcode_macro zm] -gcode: - {% set speed = params.SPEED|default(300)|int %} - {action_respond_info("moving with F%d" % speed)} - G0 Z30 F{speed} - G0 Z10 F{speed} - - -[gcode_macro foo] -gcode: - {% set SENSOR = params.SENSOR|default("bme280 chamber")|string %} - {action_respond_info("sensor: %s, qgl: %s" % (SENSOR, printer.quad_gantry_level.applied))} - - [printer] kinematics: corexy -max_velocity: 500 +max_velocity: 600 ## regular max_accel: 3000 max_accel_to_decel: 1500 # default half of max_accel @@ -79,6 +54,8 @@ square_corner_velocity: 5.0 [include input_shaper.cfg] # [include resonance_test.cfg] [include z_calibration.cfg] +[include ercf/hardware.cfg] +[include ercf/software.cfg] ##################################################################### @@ -151,7 +128,7 @@ endstop_pin: PG10 position_endstop: 0.5 position_max: 290 position_min: -5 -homing_speed: 13.0 # speed: mm/sec, feedrate: mm/min +homing_speed: 8.0 # speed: mm/sec, feedrate: mm/min homing_retract_speed: 10 second_homing_speed: 2 homing_retract_dist: 3 @@ -223,7 +200,7 @@ stealthchop_threshold: 0 # E0 on MOTOR6 [extruder] step_pin: PE2 -dir_pin: !PE3 +dir_pin: PE3 enable_pin: !PD4 ## Update value below when you perform extruder calibration ## If you ask for 100mm of filament, but in reality it is 98mm: @@ -256,7 +233,14 @@ pressure_advance: 0.05 pressure_advance_smooth_time: 0.040 # Maximum length (in mm of raw filament) that a retraction or # extrude-only move may have, default: 50 -max_extrude_only_distance: 100 +max_extrude_only_distance: 200 +# Maximum area (in mm^2) of an extrusion cross section (eg, +# extrusion width multiplied by layer height). This setting prevents +# excessive amounts of extrusion during relatively small XY moves. +# If a move requests an extrusion rate that would exceed this value +# it will cause an error to be returned. The default is: 4.0 * +# nozzle_diameter^2 +max_extrude_cross_section: 50.0 # default 4 * 0.4 = 0.64 ## E0 on MOTOR6 [tmc2209 extruder] @@ -287,22 +271,6 @@ max_temp: 120 #pid_kd: 363.769 -##################################################################### -# Filament Sensor -##################################################################### - -[filament_switch_sensor filament_switch] -switch_pin: ^!PG12 -pause_on_runout: True -# runout_gcode is executed after pause_on_runout -runout_gcode: - M117 filament removed -insert_gcode: - M117 filament inserted -# event_delay: 3.0 -# pause_delay: 0.5 - - ##################################################################### # Enclosure Temp Sensor Section ##################################################################### @@ -416,13 +384,13 @@ max_adjust: 10 #*# [bed_mesh default] #*# version = 1 #*# points = -#*# 0.075000, 0.060000, 0.040000, 0.045000, 0.040000, 0.072500, 0.072500 -#*# 0.032500, 0.005000, 0.022500, 0.025000, 0.005000, 0.062500, 0.060000 -#*# -0.005000, -0.000000, -0.007500, -0.017500, -0.002500, 0.035000, 0.042500 -#*# -0.007500, 0.000000, 0.002500, 0.000000, 0.007500, 0.010000, 0.015000 -#*# -0.010000, 0.022500, 0.012500, -0.007500, 0.005000, 0.027500, 0.002500 -#*# 0.012500, 0.007500, 0.017500, -0.002500, 0.047500, 0.025000, 0.000000 -#*# 0.060000, 0.072500, 0.035000, 0.075000, 0.057500, 0.057500, 0.065000 +#*# 0.037500, 0.035000, 0.037500, 0.060000, 0.040000, 0.070000, 0.030000 +#*# 0.032500, 0.037500, 0.002500, 0.017500, 0.040000, 0.040000, 0.057500 +#*# 0.010000, -0.002500, 0.020000, -0.005000, -0.005000, 0.012500, 0.037500 +#*# 0.050000, -0.020000, 0.002500, 0.000000, 0.010000, 0.030000, 0.022500 +#*# -0.002500, 0.025000, 0.022500, 0.015000, 0.000000, 0.037500, 0.045000 +#*# 0.020000, 0.015000, 0.030000, 0.027500, 0.025000, 0.015000, 0.005000 +#*# 0.040000, 0.022500, 0.032500, 0.032500, 0.065000, 0.055000, 0.032500 #*# tension = 0.2 #*# min_x = 40.0 #*# algo = bicubic diff --git a/z_calibration.cfg b/z_calibration.cfg index fff2349..cc1d00a 100644 --- a/z_calibration.cfg +++ b/z_calibration.cfg @@ -5,13 +5,13 @@ description: Helper: Contains User defined printer variables ##### Homing and general movement ##### variable_z_endstop_x: 94.5 ; z Endstop x position inside right profile -variable_z_endstop_y: 310 ; z Endstop y position +variable_z_endstop_y: 309 ; z Endstop y position variable_z_hop: 12 ; z hop for moves e.g homing variable_xy_home_current: 0.5 ; reduced homing current for x and y variable_z_home_current: 0.4 ; reduced homing current for z variable_home_accel: 1000 ; reduced ACCEL for homing ##### Mag Probe ##### -variable_probe_dock_x: 52 ; x toolhead position before docking probe +variable_probe_dock_x: 53 ; x toolhead position before docking probe variable_probe_dock_y: 250 ; y toolhead position before docking probe variable_probe_dock_z: 12 ; z toolhead position before docking probe (only for bed dock) variable_probe_undock_x: 110 ; x toolhead position after docking probe @@ -36,7 +36,7 @@ gcode: # The X and Y coordinates (in mm) for clicking the nozzle on the # Z endstop. probe_nozzle_x: 94.5 -probe_nozzle_y: 310 +probe_nozzle_y: 309 # The X and Y coordinates (in mm) for clicking the probe's switch # on the Z endstop. probe_switch_x: 90 @@ -52,7 +52,7 @@ probe_bed_y: 150 # The trigger point offset of the used mag-probe switch. # This needs to be fined out manually. More on this later # in this section. smaller switch_offset -> more distance to the build plate -switch_offset: 0.59 +switch_offset: 0.55 # The maximum allowed deviation of the calculated offset. # If the offset exceeds this value, it will stop! # The default is 1.0 mm.