diff --git a/Adaptive_Mesh.cfg b/Adaptive_Mesh.cfg new file mode 100644 index 0000000..15be434 --- /dev/null +++ b/Adaptive_Mesh.cfg @@ -0,0 +1,100 @@ +# # # Klipper Adaptive Meshing # # # + +# Heads up! If you have any other BED_MESH_CALIBRATE macros defined elsewhere in your config, you will need to comment out / remove them for this to work. (Klicky/Euclid Probe) +# You will also need to be sure that [exclude_object] is defined in printer.cfg, and your slicer is labeling objects. +# This macro will parse information from objects in your gcode to define a min and max mesh area to probe, creating an adaptive mesh! +# This macro will not increase probe_count values in your [bed_mesh] config. If you want richer meshes, be sure to increase probe_count. We recommend at least 5,5. + +[gcode_macro BED_MESH_CALIBRATE] +rename_existing: _BED_MESH_CALIBRATE + +### This section allows control of status LEDs your printer may have. + +variable_led_enable: False # Enables/disables the use of status LEDs in this macro. +variable_status_macro: 'status_meshing' # If you have status LEDs in your printer (StealthBurner), you can use the macro that changes their status here. + +### This section configures mesh point fuzzing, which allows probe points to be varied slightly if printing multiples of the same G-code file. + +variable_fuzz_enable: False # Enables/disables the use of mesh point fuzzing to slightly randomize probing points to spread out wear on a build surface, default is False. +variable_fuzz_min: 0 # If enabled, the minimum amount in mm a probe point can be randomized, default is 0. +variable_fuzz_max: 4 # If enabled, the maximum amount in mm a probe point can be randomized, default is 4. + +### This section is for those using a dockable probe that is stored outside of the print area. ### + +variable_probe_dock_enable: True # Enables/disables the use of a dockable probe that is stored outside of the print area, default is False. +variable_attach_macro: 'ATTACH_PROBE' # Here is where you define the macro that ATTACHES the probe to the printhead. E.g. 'Attach_Probe' +variable_detach_macro: 'DETACH_PROBE' # Here is where you define the macro that DETACHES the probe from the printhead. E.g. 'Dock_Probe' + +gcode: + {% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} + {% set bed_mesh_min = printer.configfile.settings.bed_mesh.mesh_min %} + {% set bed_mesh_max = printer.configfile.settings.bed_mesh.mesh_max %} + {% set probe_count = printer.configfile.settings.bed_mesh.probe_count %} + {% set probe_count = probe_count if probe_count|length > 1 else probe_count * 2 %} + {% set max_probe_point_distance_x = ( bed_mesh_max[0] - bed_mesh_min[0] ) / (probe_count[0] - 1) %} + {% set max_probe_point_distance_y = ( bed_mesh_max[1] - bed_mesh_min[1] ) / (probe_count[1] - 1) %} + {% set x_min = all_points | map(attribute=0) | min | default(bed_mesh_min[0]) %} + {% set y_min = all_points | map(attribute=1) | min | default(bed_mesh_min[1]) %} + {% set x_max = all_points | map(attribute=0) | max | default(bed_mesh_max[0]) %} + {% set y_max = all_points | map(attribute=1) | max | default(bed_mesh_max[1]) %} + + { action_respond_info("{} object points, clamping to bed mesh [{!r} {!r}]".format( + all_points | count, + bed_mesh_min, + bed_mesh_max, + )) } + + {% if fuzz_enable == True %} + {% set fuzz_range = range(fuzz_min * 100 | int, fuzz_max * 100 | int + 1) %} + {% set x_min = (bed_mesh_min[0] + fuzz_max, x_min) | max - (fuzz_range | random / 100.0) %} + {% set y_min = (bed_mesh_min[1] + fuzz_max, y_min) | max - (fuzz_range | random / 100.0) %} + {% set x_max = (bed_mesh_max[0] - fuzz_max, x_max) | min + (fuzz_range | random / 100.0) %} + {% set y_max = (bed_mesh_max[1] - fuzz_max, y_max) | min + (fuzz_range | random / 100.0) %} + {% else %} + {% set x_min = [ bed_mesh_min[0], x_min ] | max %} + {% set y_min = [ bed_mesh_min[1], y_min ] | max %} + {% set x_max = [ bed_mesh_max[0], x_max ] | min %} + {% set y_max = [ bed_mesh_max[1], y_max ] | min %} + {% endif %} + + { action_respond_info("Object bounds, clamped to the bed_mesh: {!r}, {!r}".format( + (x_min, y_min), + (x_max, y_max), + )) } + + {% set points_x = (((x_max - x_min) / max_probe_point_distance_x) | round(method='ceil') | int) + 1 %} + {% set points_y = (((y_max - y_min) / max_probe_point_distance_y) | round(method='ceil') | int) + 1 %} + + {% if (([points_x, points_y]|max) > 6) %} + {% set algorithm = "bicubic" %} + {% set min_points = 4 %} + {% else %} + {% set algorithm = "lagrange" %} + {% set min_points = 3 %} + {% endif %} + { action_respond_info( "Algorithm: {}".format(algorithm)) } + + {% set points_x = [points_x, min_points]|max %} + {% set points_y = [points_y, min_points]|max %} + { action_respond_info( "Points: x: {}, y: {}".format(points_x, points_y) ) } + + {% if printer.configfile.settings.bed_mesh.relative_reference_index is defined %} + {% set ref_index = (points_x * points_y / 2) | int %} + { action_respond_info( "Reference index: {}".format(ref_index) ) } + {% else %} + {% set ref_index = -1 %} + {% endif %} + + {% if probe_dock_enable == True %} + {attach_macro} # Attach/deploy a probe if the probe is stored somewhere outside of the print area + {% endif %} + + {% if led_enable == True %} + {status_macro} # Set status LEDs + {% endif %} + + _BED_MESH_CALIBRATE mesh_min={x_min},{y_min} mesh_max={x_max},{y_max} ALGORITHM={algorithm} PROBE_COUNT={points_x},{points_y} RELATIVE_REFERENCE_INDEX={ref_index} + + {% if probe_dock_enable == True %} + {detach_macro} # Detach/stow a probe if the probe is stored somewhere outside of the print area + {% endif %} diff --git a/basic_macros.cfg b/basic_macros.cfg index 2f5bd57..30be273 100644 --- a/basic_macros.cfg +++ b/basic_macros.cfg @@ -6,20 +6,23 @@ gcode: {% set DWELL = params.DWELL|default(300)|int %} {% set X = 200 %} - M104 S{hotendTemp|float*0.8} # set extruder pre warm temp - M140 S{bedTemp} # set bed temp to warm while starting up - G28 # home after setting temps - M117 Waiting for temperatures... + SET_HEATER_TEMPERATURE HEATER=extruder TARGET={hotendTemp|float*0.8} # set extruder pre warm temp + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={bedTemp} # set bed temp to warm while starting up + G28 # home after setting temps + SET_DISPLAY_TEXT MSG="Waiting for temperatures..." TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={bedTemp} MAXIMUM={bedTemp+1} ; Wait for bed temp (within 1 degree) HEATSOAK DWELL={DWELL} # Dwelling #ATTACH_PROBE # Have probe ready for calibration CLEAN_NOZZLE # Clean before getting offsets - #BED_MESH_CALIBRATE AREA_START={params.AREA_START} AREA_END={params.AREA_END} G28 Z + #BED_MESH_CALIBRATE #CALIBRATE_Z # Auto calibrate the bed height GO_TO_BUCKET # No cleanup from nozzle ooze - M109 S{hotendTemp} # Set extruder to printing temperature + SET_DISPLAY_TEXT MSG="Waiting for final temperatures..." + SET_HEATER_TEMPERATURE HEATER=extruder TARGET={hotendTemp} # Set extruder to printing temperature + TEMPERATURE_WAIT SENSOR=extruder MINIMUM={hotendTemp} MAXIMUM={hotendTemp+3} ; Wait for hotend temp (within 3 degrees) CLEAN_NOZZLE # Final clean before print + SET_DISPLAY_TEXT MSG="Print starting" G90 G1 X{X} F{1000*60} # Avoid brush G91 @@ -34,15 +37,15 @@ gcode: [gcode_macro HEATSOAK] gcode: - M117 Waiting for thermal expansion... + SET_DISPLAY_TEXT MSG="Waiting for thermal expansion..." G4 P{params.DWELL|int*1000/4} - M117 Waiting for thermal expansion 25% + SET_DISPLAY_TEXT MSG="Waiting for thermal expansion 25% done" G4 P{params.DWELL|int*1000/4} - M117 Waiting for thermal expansion 50% + SET_DISPLAY_TEXT MSG="Waiting for thermal expansion 50% done" G4 P{params.DWELL|int*1000/4} - M117 Waiting for thermal expansion 75% + SET_DISPLAY_TEXT MSG="Waiting for thermal expansion 75% done" G4 P{params.DWELL|int*1000/4} - M117 Thermal expansion done + SET_DISPLAY_TEXT MSG="Thermal expansion done" [gcode_macro CANCEL_PRINT] rename_existing: BASE_CANCEL_PRINT @@ -87,7 +90,7 @@ gcode: [gcode_macro UNLOAD_FILAMENT] gcode: G91 - G1 E10.0 F{20*60} + G1 E15.0 F{20*60} G1 E3.0 F{26*60} G1 E-13.14 F{120*60} G1 E-100 F{50*60} @@ -132,77 +135,3 @@ gcode: 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 : 3 -; minimum probe count -variable_min_probe_count : 3 -gcode: - {% 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 %} - diff --git a/calibration_macros.cfg b/calibration_macros.cfg index f7bd5ff..9c05697 100644 --- a/calibration_macros.cfg +++ b/calibration_macros.cfg @@ -1,18 +1,27 @@ [gcode_macro TEST_RESONNANCES_X] gcode: - TEST_RESONANCES AXIS=X - + SHAPER_CALIBRATE AXIS=X [gcode_macro TEST_RESONNANCES_Y] gcode: - TEST_RESONANCES AXIS=Y - + SHAPER_CALIBRATE AXIS=Y [gcode_macro FLOW_CALIBRATION] gcode: M221 S{params.FLOW} SET_PRESSURE_ADVANCE ADVANCE={params.PRESSURE_ADVANCE} +[gcode_macro DISABLE_Z] +gcode: + SET_STEPPER_ENABLE STEPPER=stepper_z ENABLE=0 + +[gcode_macro ENABLE_XY] +gcode: + SET_STEPPER_ENABLE STEPPER=stepper_x ENABLE=1 + #SET_STEPPER_ENABLE STEPPER=stepper_x1 ENABLE=1 + SET_STEPPER_ENABLE STEPPER=stepper_y ENABLE=1 + #SET_STEPPER_ENABLE STEPPER=stepper_y1 ENABLE=1 + [gcode_macro TEST_Z_DOWN] gcode: {% set amount = params.amount|default(1)|int %} @@ -116,7 +125,7 @@ gcode: G0 X{x_center_max} Y{y_center_min} F{speed*60} # Small box - {% for i in range(10) %} + {% for i in range(4) %} 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} diff --git a/fans.cfg b/fans.cfg index 7913f89..7b33836 100644 --- a/fans.cfg +++ b/fans.cfg @@ -31,3 +31,7 @@ shutdown_speed: 0 kick_start_time: 0.1 off_below: 0.10 +[temperature_sensor Host] +sensor_type: temperature_host +min_temp: 10 +max_temp: 100 diff --git a/moonraker.conf b/moonraker.conf index 15f6ba0..cbdc644 100644 --- a/moonraker.conf +++ b/moonraker.conf @@ -1,12 +1,8 @@ [server] host: 0.0.0.0 port: 7125 -enable_debug_logging: False klippy_uds_address: /tmp/klippy_uds -[database] -database_path: /home/kdb424/.moonraker_database - [authorization] trusted_clients: 127.0.0.1 @@ -29,8 +25,6 @@ cors_domains: http://*://app.fluidd.xyz [file_manager] -config_path: /home/kdb424/klipper_config -log_path: /home/kdb424/klipper_logs enable_object_processing: True [octoprint_compat] diff --git a/pico.cfg b/pico.cfg index 85a99df..edcecbf 100644 --- a/pico.cfg +++ b/pico.cfg @@ -1,5 +1,12 @@ [mcu pico] serial: /dev/serial/by-id/usb-Klipper_rp2040_E660583883417B39-if00 +#serial: /dev/serial/by-id/usb-Klipper_rp2040_E6605838834F4439-if00 + +#[temperature_sensor chamber] +#sensor_type: Generic 3950 +#sensor_pin: pico:gpio28 +#min_temp: 0 +#max_temp: 100 [adxl345] spi_bus: spi0a diff --git a/printer.cfg b/printer.cfg index 5d735cc..e22af6f 100644 --- a/printer.cfg +++ b/printer.cfg @@ -17,6 +17,14 @@ [virtual_sdcard] path: ~/gcode_files +[idle_timeout] +timeout: 1800 # change timeout to 30 minutes + +# Tested speeds +# 500mm/s 58k accel +# 700mm/s 45k accel +# 1000mm/s 29k accel +# 1200mm/s 20k accel [printer] kinematics: corexy @@ -50,6 +58,6 @@ unretract_speed: 100 [input_shaper] shaper_type_x = mzv -shaper_freq_x = 90.4 # accel=24100 +shaper_freq_x = 109.4 # accel=35300 shaper_type_y = zv -shaper_freq_y = 70.0 # accel=19100 +shaper_freq_y = 67.0 # accel=17500 diff --git a/probe.cfg b/probe.cfg index 569b0d3..a826cf6 100644 --- a/probe.cfg +++ b/probe.cfg @@ -1,3 +1,5 @@ +[include Adaptive_Mesh.cfg] + [bed_screws] screw1: 12,0 screw2: 12,300 @@ -19,9 +21,9 @@ screw_thread: CCW-M3 [dockable_probe] pin: PF7 -x_offset: 26 -y_offset: 55 -z_offset: 5.707 +x_offset: 3 +y_offset: 12.6 +z_offset: 4.765 samples: 3 sample_retract_dist: 3 samples_result: median @@ -30,23 +32,23 @@ samples_tolerance_retries: 3 speed: 5 lift_speed: 20 -dock_position: 322,313, 15 -safe_z_position: 165,165 -approach_position: 290,319, 15 -detach_position: 322,260 +dock_position: 5,329,20 +approach_position: 5,300,20 +detach_position: 35,329,20 attach_speed: 30 detach_speed: 30 travel_speed: 500 check_open_attach: True dock_fixed_z: True -dock_retries: 1 -allow_delayed_detach: False +dock_retries: 3 +allow_delayed_detach: True [z_calibration] -nozzle_xy_position: 331,249 -switch_xy_position: 305,187 +nozzle_xy_position: 327.5,240 +switch_xy_position: 320,224 bed_xy_position: 150,150 -switch_offset: .5 # Lower number is farther from bed +switch_offset: 0. +switch_offset: 0.43 # Lower number is farther from bed max_deviation: 10 speed: 300 samples: 3 @@ -60,8 +62,8 @@ end_gcode: DETACH_PROBE [bed_mesh] speed: 500 horizontal_move_z: 7 -mesh_min: 26, 66 -mesh_max: 320, 300 +mesh_min: 20, 20 +mesh_max: 320, 295 probe_count: 6, 6 algorithm: bicubic fade_start: 1 diff --git a/purge_bucket.cfg b/purge_bucket.cfg index 0e3d794..9d4e7e0 100644 --- a/purge_bucket.cfg +++ b/purge_bucket.cfg @@ -11,14 +11,14 @@ variable_enable_purge: True # These parameters define your filament purging. The retract variable is used to retract right after purging to prevent unnecessary # oozing. Some filament are particularly oozy and may continue to ooze out of the nozzle for a second or two after retracting. The # ooze dwell variable makes allowance for this. Update as necessary. If you decided to not enable purge, you can ignore this section. -variable_purge_len: 50 ; Amount of filament, in mm, to purge. +variable_purge_len: 20 ; Amount of filament, in mm, to purge. variable_purge_spd: 300 ; Speed, in mm/min, of the purge. variable_purge_temp_min: 220 ; Minimum nozzle temperature to permit a purge. Otherwise, purge will not occur. variable_purge_ret: 0 ; Retract length, in mm, after purging to prevent slight oozing. Adjust as necessary. 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: 6 +variable_brush_top: 8 # 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. @@ -50,7 +50,7 @@ variable_brush_start: 72 variable_brush_width: 30 ## 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: 320 +variable_brush_front: 318 variable_brush_depth: 4 diff --git a/sensorless.cfg b/sensorless.cfg index 86a6551..07dd912 100644 --- a/sensorless.cfg +++ b/sensorless.cfg @@ -16,7 +16,7 @@ gcode: G28 X0 # Move away G90 - G1 x20 F{20*60} + G1 x60 F{20*60} G91 # Set current during print SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CUR} @@ -52,11 +52,10 @@ set_position_z: -1.8 gcode: # Parameters - {% set Z = 10 %} + {% set Z = 20 %} G90 G1 Z{Z} # Z lift - {% set home_all = params.X is not defined and params.Y is not defined and params.Z is not defined %} @@ -80,8 +79,11 @@ gcode: {action_respond_info("Doing G28 Z0")} # You can do your logic for safe z here G4 P2200 - G90 - G1 x329 y246 F{800*60} + G90 + G1 x300 y241 F{800*60} + # Belt is tight on the edge. Go slow to reach the endstop. + G1 x327.5 y240 F{30*60} + SET_GCODE_OFFSET Z=0.0 # Reset offset before homing Z G28 Z0 G1 Z{Z} G91 diff --git a/sherpa_mini.cfg b/sherpa_mini.cfg index 15c5044..e7be5da 100644 --- a/sherpa_mini.cfg +++ b/sherpa_mini.cfg @@ -25,9 +25,9 @@ sensor_pin: PF4 control: pid # Copper -pid_Kp = 19.816 -pid_Ki = 0.751 -pid_Kd = 130.787 +pid_Kp = 19.742 +pid_Ki = 0.752 +pid_Kd = 129.554 # Dragon HF # pid_Kp=19.814 @@ -45,5 +45,5 @@ pid_Kd = 130.787 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.45 +#run_current: 0.35 #max current, equivalent to 0.49A peak (Peak = RMS/0.707) +run_current: 0.45 diff --git a/steppers.cfg b/steppers.cfg index 673f8c4..cd1ddfc 100644 --- a/steppers.cfg +++ b/steppers.cfg @@ -7,7 +7,7 @@ microsteps: 32 rotation_distance: 40 position_endstop: -3 position_min: -3 -position_max: 335 +position_max: 328 homing_speed: 40 full_steps_per_rotation: 200 homing_retract_dist: 0 @@ -21,7 +21,7 @@ run_current: 2 sense_resistor: 0.110 stealthchop_threshold: 0 diag_pin: ^PG6 # Set to MCU pin connected to TMC DIAG pin -driver_SGTHRS: 60 # 255 is most sensitive value, 0 is least sensitive +driver_SGTHRS: 20 # 255 is most sensitive value, 0 is least sensitive driver_TBL: 1 driver_TOFF: 3 driver_HSTRT: 1 @@ -50,7 +50,7 @@ run_current: 2 sense_resistor: 0.110 stealthchop_threshold: 0 diag_pin: ^PG12 # Set to MCU pin connected to TMC DIAG pin -driver_SGTHRS: 90 # 255 is most sensitive value, 0 is least sensitive +driver_SGTHRS: 80 # 255 is most sensitive value, 0 is least sensitive driver_TBL: 1 driver_TOFF: 3 driver_HSTRT: 1 @@ -62,9 +62,8 @@ dir_pin: !PF0 enable_pin: !PF1 microsteps: 16 rotation_distance: 4 -#endstop_pin: PG11 # Bed Endstop endstop_pin: PG10 # Nozzle Endstop -position_endstop: 3.45 +position_endstop: 3.725 position_min: -1 position_max: 400 full_steps_per_rotation: 200