diff --git a/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.cfg b/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.cfg index 6924b0f2..beaecd40 100644 --- a/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.cfg +++ b/meta-opencentauri/recipes-apps/grumyscreen/files/grumpyscreen.cfg @@ -28,20 +28,20 @@ switch_to_stock_cmd: /usr/bin/switch-to-oc-patched support_zip_cmd: [fan "fan"] -display_name: Toolhead +display_name: Part_Cooling -[fan "fan_generic model_helper_fan"] -display_name: Model Helper +[fan "fan_generic aux_fan"] +display_name: Aux_Cooling -[fan "fan_generic box_fan"] -display_name: Chamber +[fan "fan_generic case_fan"] +display_name: Case_Exhaust [led "led hotend"] -display_name: Toolhead +display_name: Led_Hotend pwm: true [led "led case"] -display_name: Case +display_name: Led_Case pwm: true [monitored_sensor "extruder"] @@ -54,7 +54,7 @@ display_name: Bed color: purple controllable: true -[monitored_sensor "temperature_sensor box"] +[monitored_sensor "temperature_sensor chamber"] display_name: Chamber color: blue -controllable: true +controllable: false diff --git a/meta-opencentauri/recipes-apps/klipper/files/calibration.cfg b/meta-opencentauri/recipes-apps/klipper/files/calibration.cfg index 05cec51c..12d8afb5 100644 --- a/meta-opencentauri/recipes-apps/klipper/files/calibration.cfg +++ b/meta-opencentauri/recipes-apps/klipper/files/calibration.cfg @@ -127,13 +127,13 @@ gcode: SET_DISPLAY_TEXT MSG="Performing extruder PID calibration" MOVE_TO_TRAY PID_CALIBRATE HEATER=extruder TARGET={hotend_temperature} - M729 + CLEAN_NOZZLE M400 SET_DISPLAY_TEXT MSG="Performing probe z-offset & bed mesh calibration" G90 G1 X128 Y128 F6000 - BED_MESH_CALIBRATE_WITH_WIPE BED_TEMP={bed_temperature} + BED_MESH_CALIBRATE BED_TEMP={bed_temperature} SET_DISPLAY_TEXT MSG="Performing shaper calibration" RUN_SHELL_COMMAND CMD=CAMERA_STOP diff --git a/meta-opencentauri/recipes-apps/klipper/files/kamp.cfg b/meta-opencentauri/recipes-apps/klipper/files/kamp.cfg new file mode 100644 index 00000000..14df7c4e --- /dev/null +++ b/meta-opencentauri/recipes-apps/klipper/files/kamp.cfg @@ -0,0 +1,351 @@ + +# Original code: https://github.com/kyleisah/Klipper-Adaptive-Meshing-Purging + +[gcode_macro _KAMP_Settings] +description: This macro contains all adjustable settings for KAMP + +# The following variables are settings for KAMP as a whole. +variable_verbose_enable: True # Set to True to enable KAMP information output when running. This is useful for debugging. + +# The following variables are for adjusting adaptive purge settings for KAMP. +variable_purge_height: 0.8 # Z position of nozzle during purge, default is 0.8. +variable_tip_distance: 5 # Distance between tip of filament and nozzle before purge. Should be similar to PRINT_END final retract amount. +variable_purge_margin: 10 # Distance the purge will be in front of the print area, default is 10. +variable_purge_amount: 30 # Amount of filament to be purged prior to printing. +variable_flow_rate: 12 # Flow rate of purge in mm3/s. Default is 12. + +# The following variables are for adjusting the Smart Park feature for KAMP, which will park the printhead near the print area at a specified height. +variable_smart_park_height: 5 # Z position for Smart Park, default is 10. + +gcode: # Gcode section left intentionally blank. Do not disturb. + + {action_respond_info(" Running the KAMP_Settings macro does nothing, it is only used for storing KAMP settings. ")} + + +# Original code: https://github.com/kyleisah/Klipper-Adaptive-Meshing-Purging + +[gcode_macro LINE_PURGE] +description: A purge macro that adapts to be near your actual printed objects +gcode: + # Get relevant printer params + {% set travel_speed = (printer.toolhead.max_velocity) * 30 | float %} + {% set cross_section = printer.configfile.settings.extruder.max_extrude_cross_section | float %} + + # Use firmware retraction if it is defined + {% if printer.firmware_retraction is defined %} + {% set RETRACT = G10 | string %} + {% set UNRETRACT = G11 | string %} + {% else %} + {% set RETRACT = 'G1 E-.5 F2100' | string %} + {% set UNRETRACT = 'G1 E.5 F2100' | string %} + {% endif %} + + # Get purge settings from _Kamp_Settings + {% set verbose_enable = printer["gcode_macro _KAMP_Settings"].verbose_enable | abs %} + {% set purge_height = printer["gcode_macro _KAMP_Settings"].purge_height | float %} + {% set tip_distance = printer["gcode_macro _KAMP_Settings"].tip_distance | float %} + {% set purge_margin = printer["gcode_macro _KAMP_Settings"].purge_margin | float %} + {% set purge_amount = printer["gcode_macro _KAMP_Settings"].purge_amount | float %} + {% set flow_rate = printer["gcode_macro _KAMP_Settings"].flow_rate | float %} + + + # Calculate purge origins and centers from objects + {% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Get all object points + {% set purge_x_min = (all_points | map(attribute=0) | min | default(0)) %} # Object x min + {% set purge_x_max = (all_points | map(attribute=0) | max | default(0)) %} # Object x max + {% set purge_y_min = (all_points | map(attribute=1) | min | default(0)) %} # Object y min + {% set purge_y_max = (all_points | map(attribute=1) | max | default(0)) %} # Object y max + + {% set purge_x_center = ([((purge_x_max + purge_x_min) / 2) - (purge_amount / 2), 0] | max) %} # Create center point of purge line relative to print on X axis + {% set purge_y_center = ([((purge_y_max + purge_y_min) / 2) - (purge_amount / 2), 0] | max) %} # Create center point of purge line relative to print on Y axis + + {% set purge_x_origin = ([purge_x_min - purge_margin, 0] | max) %} # Add margin to x min, compare to 0, and choose the larger + {% set purge_y_origin = ([purge_y_min - purge_margin, 0] | max) %} # Add margin to y min, compare to 0, and choose the larger + + # Calculate purge speed + {% set purge_move_speed = (flow_rate / 5.0) * 60 | float %} + + {% if cross_section < 5 %} + + {action_respond_info("[Extruder] max_extrude_cross_section is insufficient for purge, please set it to 5 or greater. Purge skipped.")} + + {% else %} + + {% if verbose_enable == True %} + + {action_respond_info("Moving filament tip {}mms".format( + (tip_distance), + )) } + {% endif %} + + {% if printer.firmware_retraction is defined %} + {action_respond_info("KAMP purge is using firmware retraction.")} + {% else %} + {action_respond_info("KAMP purge is not using firmware retraction, it is recommended to configure it.")} + {% endif %} + + {% if purge_y_origin > 0 %} + + {action_respond_info("KAMP purge starting at {}, {} and purging {}mm of filament, requested flow rate is {}mm3/s.".format( + (purge_x_center), + (purge_y_origin), + (purge_amount), + (flow_rate), + )) } + + {% else %} + + {action_respond_info("KAMP purge starting at {}, {} and purging {}mm of filament, requested flow rate is {}mm3/s.".format( + (purge_x_origin), + (purge_y_center), + (purge_amount), + (flow_rate), + )) } + + {% endif %} + + SAVE_GCODE_STATE NAME=Prepurge_State # Create gcode state + + {% if purge_y_origin > 0 %} # If there's room on Y, purge along X axis in front of print area + + G92 E0 # Reset extruder + G0 F{travel_speed} # Set travel speed + G90 # Absolute positioning + G0 X{purge_x_center} Y{purge_y_origin} # Move to purge position + G0 Z{purge_height} # Move to purge Z height + M83 # Relative extrusion mode + G1 E{tip_distance} F{purge_move_speed} # Move filament tip + G1 X{purge_x_center + purge_amount} E{purge_amount} F{purge_move_speed} # Purge line + {RETRACT} # Retract + G0 X{purge_x_center + purge_amount + 10} F{travel_speed} # Rapid move to break string + G92 E0 # Reset extruder distance + M82 # Absolute extrusion mode + G0 Z{purge_height * 2} F{travel_speed} # Z hop + + {% else %} # If there's room on X, purge along Y axis to the left of print area + + G92 E0 # Reset extruder + G0 F{travel_speed} # Set travel speed + G90 # Absolute positioning + G0 X{purge_x_origin} Y{purge_y_center} # Move to purge position + G0 Z{purge_height} # Move to purge Z height + M83 # Relative extrusion mode + G1 E{tip_distance} F{purge_move_speed} # Move filament tip + G1 Y{purge_y_center + purge_amount} E{purge_amount} F{purge_move_speed} # Purge line + {RETRACT} # Retract + G0 Y{purge_y_center + purge_amount + 10} F{travel_speed} # Rapid move to break string + G92 E0 # Reset extruder distance + M82 # Absolute extrusion mode + G0 Z{purge_height * 2} F{travel_speed} # Z hop + + {% endif %} + + RESTORE_GCODE_STATE NAME=Prepurge_State # Restore gcode state + + {% endif %} + + + +[gcode_macro ELEGOO_PURGE] +description: A purge macro that adapts to be near your actual printed objects +gcode: + # Get relevant printer params + {% set travel_speed = (printer.toolhead.max_velocity) * 60 | float %} + {% set cross_section = printer.configfile.settings.extruder.max_extrude_cross_section | float %} + + # Use firmware retraction if it is defined + {% if printer.firmware_retraction is defined %} + {% set RETRACT = G10 | string %} + {% set UNRETRACT = G11 | string %} + {% else %} + {% set RETRACT = 'G1 E-.5 F2100' | string %} + {% set UNRETRACT = 'G1 E.5 F2100' | string %} + {% endif %} + +# Get purge settings from _Kamp_Settings + {% set verbose_enable = printer["gcode_macro _KAMP_Settings"].verbose_enable | abs %} + {% set purge_height = printer["gcode_macro _KAMP_Settings"].purge_height | float %} + {% set tip_distance = printer["gcode_macro _KAMP_Settings"].tip_distance | float %} + {% set purge_margin = printer["gcode_macro _KAMP_Settings"].purge_margin | float %} + {% set purge_amount = printer["gcode_macro _KAMP_Settings"].purge_amount | float %} + {% set flow_rate = printer["gcode_macro _KAMP_Settings"].flow_rate | float %} + {% set size = 10 | float %} + + # Calculate purge origins and centers from objects + {% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Get all object points + {% set purge_x_min = (all_points | map(attribute=0) | min | default(0)) %} # Object x min + {% set purge_x_max = (all_points | map(attribute=0) | max | default(0)) %} # Object x max + {% set purge_y_min = (all_points | map(attribute=1) | min | default(0)) %} # Object y min + {% set purge_y_max = (all_points | map(attribute=1) | max | default(0)) %} # Object y max + + {% set purge_x_center = ([((purge_x_max + purge_x_min) / 2), 0] | max) %} # Center of print area on X axis + {% set purge_y_center = ([((purge_y_max + purge_y_min) / 2), 0] | max) %} # Center of print area on Y axis + {% set purge_x_base = ([purge_x_center - size/2, 0] | max) %} # Left edge so normalized path is centered on print + + {% set purge_x_origin = ([purge_x_min - purge_margin, 0] | max) %} # Add margin to x min, compare to 0, and choose the larger + {% set purge_y_front_origin = (purge_y_min - purge_margin - size) %} # Front placement (no clamping for availability check) + {% set purge_x_left_origin = (purge_x_min - purge_margin - size) %} # Left placement (no clamping for availability check) + {% set purge_y_side_base = ([purge_y_center - size/2, 0] | max) %} # Vertically center shape when using left side + + {% set has_front_room = (purge_y_front_origin >= 0) %} + {% set has_left_room = (purge_x_left_origin >= 0) %} + + {% if has_front_room %} + {% set purge_mode = 'front' %} + {% set purge_x_plot_base = purge_x_base %} + {% set purge_y_plot_base = purge_y_front_origin %} + {% elif has_left_room %} + {% set purge_mode = 'left' %} + {% set purge_x_plot_base = purge_x_left_origin %} + {% set purge_y_plot_base = purge_y_side_base %} + {% else %} + {% set purge_mode = 'skip' %} + {% set purge_x_plot_base = purge_x_base %} + {% set purge_y_plot_base = ([purge_y_front_origin, 0] | max) %} + {% endif %} + + # Calculate purge speed + {% set purge_move_speed = (flow_rate / 5.0) * 60 | float %} + + {% if cross_section < 5 %} + + {action_respond_info("[Extruder] max_extrude_cross_section is insufficient for purge, please set it to 5 or greater. Purge skipped.")} + + {% else %} + + {% if verbose_enable == True %} + + {action_respond_info("Moving filament tip {}mms".format( + (tip_distance), + )) } + {% endif %} + + {% if printer.firmware_retraction is defined %} + {action_respond_info("KAMP purge is using firmware retraction.")} + {% else %} + {action_respond_info("KAMP purge is not using firmware retraction, it is recommended to configure it.")} + {% endif %} + + {% if purge_mode == 'skip' %} + {action_respond_info("KAMP purge: no full front/left space available, skipping purge to avoid overlap.")} + {% elif purge_mode == 'front' %} + {action_respond_info("KAMP purge: using front placement.")} + {% else %} + {action_respond_info("KAMP purge: using left-side placement.")} + {% endif %} + + {% if purge_mode != 'skip' %} + + SAVE_GCODE_STATE NAME=Prepurge_State # Create gcode state + + G92 E0 # Reset extruder + G0 F{travel_speed} # Set travel speed + G90 # Absolute positioning + G0 X{purge_x_plot_base + size/2} Y{purge_y_plot_base + size/2} # Move to purge position + G0 Z{purge_height} # Move to purge Z height + M83 # Relative extrusion mode + G1 E{tip_distance} F{purge_move_speed} # Move tip of filament to nozzle + + G1 X{purge_x_plot_base + size*0.346} Y{purge_y_plot_base + size*0.042} E{purge_amount*0.019} F{purge_move_speed} + G1 X{purge_x_plot_base + size*0.280} Y{purge_y_plot_base + size*0.005} E{purge_amount*0.025} + G1 X{purge_x_plot_base + size*0.205} Y{purge_y_plot_base + size*0.003} E{purge_amount*0.027} + G1 X{purge_x_plot_base + size*0.136} Y{purge_y_plot_base + size*0.044} E{purge_amount*0.027} + G1 X{purge_x_plot_base + size*0.076} Y{purge_y_plot_base + size*0.127} E{purge_amount*0.028} + G1 X{purge_x_plot_base + size*0.029} Y{purge_y_plot_base + size*0.248} E{purge_amount*0.030} + G1 X{purge_x_plot_base + size*0.002} Y{purge_y_plot_base + size*0.407} E{purge_amount*0.033} + G1 X{purge_x_plot_base + size*0.000} Y{purge_y_plot_base + size*0.512} E{purge_amount*0.021} + G1 X{purge_x_plot_base + size*0.012} Y{purge_y_plot_base + size*0.661} E{purge_amount*0.029} + G1 X{purge_x_plot_base + size*0.039} Y{purge_y_plot_base + size*0.779} E{purge_amount*0.026} + G1 X{purge_x_plot_base + size*0.067} Y{purge_y_plot_base + size*0.841} E{purge_amount*0.016} + G1 X{purge_x_plot_base + size*0.095} Y{purge_y_plot_base + size*0.902} E{purge_amount*0.016} + G1 X{purge_x_plot_base + size*0.146} Y{purge_y_plot_base + size*0.966} E{purge_amount*0.022} + G1 X{purge_x_plot_base + size*0.204} Y{purge_y_plot_base + size*0.998} E{purge_amount*0.022} + G1 X{purge_x_plot_base + size*0.281} Y{purge_y_plot_base + size*0.997} E{purge_amount*0.028} + G1 X{purge_x_plot_base + size*0.342} Y{purge_y_plot_base + size*0.960} E{purge_amount*0.023} + G1 X{purge_x_plot_base + size*0.385} Y{purge_y_plot_base + size*0.905} E{purge_amount*0.019} + G1 X{purge_x_plot_base + size*0.431} Y{purge_y_plot_base + size*0.818} E{purge_amount*0.024} + G1 X{purge_x_plot_base + size*0.456} Y{purge_y_plot_base + size*0.737} E{purge_amount*0.018} + G1 X{purge_x_plot_base + size*0.486} Y{purge_y_plot_base + size*0.590} E{purge_amount*0.030} + G1 X{purge_x_plot_base + size*0.535} Y{purge_y_plot_base + size*0.295} E{purge_amount*0.061} + G1 X{purge_x_plot_base + size*0.573} Y{purge_y_plot_base + size*0.172} E{purge_amount*0.028} + G1 X{purge_x_plot_base + size*0.631} Y{purge_y_plot_base + size*0.070} E{purge_amount*0.030} + G1 X{purge_x_plot_base + size*0.690} Y{purge_y_plot_base + size*0.017} E{purge_amount*0.024} + G1 X{purge_x_plot_base + size*0.752} Y{purge_y_plot_base + size*0.000} E{purge_amount*0.022} + G1 X{purge_x_plot_base + size*0.833} Y{purge_y_plot_base + size*0.019} E{purge_amount*0.029} + G1 X{purge_x_plot_base + size*0.886} Y{purge_y_plot_base + size*0.071} E{purge_amount*0.022} + G1 X{purge_x_plot_base + size*0.934} Y{purge_y_plot_base + size*0.150} E{purge_amount*0.024} + G1 X{purge_x_plot_base + size*0.977} Y{purge_y_plot_base + size*0.273} E{purge_amount*0.028} + G1 X{purge_x_plot_base + size*1.000} Y{purge_y_plot_base + size*0.445} E{purge_amount*0.035} + G1 X{purge_x_plot_base + size*0.997} Y{purge_y_plot_base + size*0.613} E{purge_amount*0.033} + G1 X{purge_x_plot_base + size*0.986} Y{purge_y_plot_base + size*0.689} E{purge_amount*0.016} + G1 X{purge_x_plot_base + size*0.945} Y{purge_y_plot_base + size*0.826} E{purge_amount*0.031} + G1 X{purge_x_plot_base + size*0.888} Y{purge_y_plot_base + size*0.931} E{purge_amount*0.029} + G1 X{purge_x_plot_base + size*0.814} Y{purge_y_plot_base + size*0.991} E{purge_amount*0.029} + G1 X{purge_x_plot_base + size*0.731} Y{purge_y_plot_base + size*1.000} E{purge_amount*0.029} + G1 X{purge_x_plot_base + size*0.651} Y{purge_y_plot_base + size*0.954} E{purge_amount*0.030} + G1 X{purge_x_plot_base + size*0.612} Y{purge_y_plot_base + size*0.902} E{purge_amount*0.017} + + {RETRACT} # Retract + {% if purge_mode == 'left' %} + G0 Y{purge_y_plot_base + size + purge_amount + 10} F{travel_speed} # Rapid move to break string + {% else %} + G0 X{purge_x_plot_base + size + purge_amount + 10} F{travel_speed} # Rapid move to break string + {% endif %} + G92 E0 # Reset extruder distance + M82 # Absolute extrusion mode + G0 Z{purge_height*2} F{travel_speed} # Z hop + + RESTORE_GCODE_STATE NAME=Prepurge_State # Restore gcode state + + {% endif %} + + {% endif %} + + +# Original code: https://github.com/kyleisah/Klipper-Adaptive-Meshing-Purging + + +[gcode_macro SMART_PARK] +description: Parks your printhead near the print area for pre-print hotend heating. +gcode: + + {% set kamp_settings = printer["gcode_macro _KAMP_Settings"] %} # Pull all variables from _KAMP_Settings + {% set z_height = kamp_settings.smart_park_height | float %} # Set Z height variable + {% set purge_margin = kamp_settings.purge_margin | float %} # Set purge margin variable + {% set verbose_enable = kamp_settings.verbose_enable | abs %} # Set verbosity + {% set center_x = printer.toolhead.axis_maximum.x / 2 | float %} # Create center point of x for fallback + {% set center_y = printer.toolhead.axis_maximum.y / 2 | float %} # Create center point of y for fallback + {% set axis_minimum_x = printer.toolhead.axis_minimum.x | float %} + {% set axis_minimum_y = printer.toolhead.axis_minimum.y | float %} + {% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Gather all object points + {% set x_min = all_points | map(attribute=0) | min | default(center_x) %} # Set x_min from smallest object x point + {% set y_min = all_points | map(attribute=1) | min | default(center_y) %} # Set y_min from smallest object y point + {% set travel_speed = (printer.toolhead.max_velocity) * 30 | float %} # Set travel speed from config + + {% if purge_margin > 0 and x_min != center_x and y_min != center_y %} # If objects are detected and purge margin + {% set x_min = [ x_min - purge_margin , x_min ] | min %} # value is greater than 0, move + {% set y_min = [ y_min - purge_margin , y_min ] | min %} # to purge location + margin + {% set x_min = [ x_min , axis_minimum_x ] | max %} + {% set y_min = [ y_min , axis_minimum_y ] | max %} + {% endif %} + + # Verbose park location + {% if verbose_enable == True %} + + { action_respond_info("Smart Park location: {},{}.".format( + (x_min), + (y_min), + )) } + + {% endif %} + + SAVE_GCODE_STATE NAME=Presmartpark_State # Create gcode state + + G90 # Absolute positioning + {% if printer.toolhead.position.z < z_height %} + G0 Z{z_height} # Move Z to park height if current Z position is lower than z_height + {% endif %} + G0 X{x_min} Y{y_min} F{travel_speed} # Move near object area + G0 Z{z_height} # Move Z to park height + + RESTORE_GCODE_STATE NAME=Presmartpark_State # Restore gcode state \ No newline at end of file diff --git a/meta-opencentauri/recipes-apps/klipper/files/klipper-init-d b/meta-opencentauri/recipes-apps/klipper/files/klipper-init-d index 68efd0e4..ddfe4d0f 100644 --- a/meta-opencentauri/recipes-apps/klipper/files/klipper-init-d +++ b/meta-opencentauri/recipes-apps/klipper/files/klipper-init-d @@ -13,7 +13,7 @@ KLIPPER_PRINTER_CONFIG="/etc/klipper/config/printer.cfg" KLIPPY_ARGS="-O /usr/share/klipper/klippy/klippy.py $KLIPPER_PRINTER_CONFIG -l /board-resource/klippy.log -a /run/klippy.sock" PIDFILE="/var/run/klipper.pid" KLIPPER_VAR_CONFIG_BUILDER="/usr/bin/build-klipper-var-config" -KLIPPER_CONFIG_VERSION="0.0.6" +KLIPPER_CONFIG_VERSION="0.0.7" KLIPPER_CONFIG_VERSION_FILE="/etc/klipper-config.ver" KLIPPER_CONFIG_BACKUP_DIR="/etc/klipper/config/config_backups" @@ -23,7 +23,7 @@ ensure_klipper_config_version() { if [ -f "$KLIPPER_CONFIG_VERSION_FILE" ]; then current_version="$(tr -d '[:space:]' < "$KLIPPER_CONFIG_VERSION_FILE" 2>/dev/null)" else - current_version="$KLIPPER_CONFIG_VERSION" + current_version="" #reset configs echo "$current_version" > "$KLIPPER_CONFIG_VERSION_FILE" || return 1 fi diff --git a/meta-opencentauri/recipes-apps/klipper/files/machine.cfg b/meta-opencentauri/recipes-apps/klipper/files/machine.cfg index a9c5e7fd..84f52b54 100644 --- a/meta-opencentauri/recipes-apps/klipper/files/machine.cfg +++ b/meta-opencentauri/recipes-apps/klipper/files/machine.cfg @@ -17,6 +17,38 @@ is_non_critical: true serial: /dev/serial/by-path/platform-4101400.usb-usb-0:1:1.0 restart_method: command + +[printer] +kinematics: corexy +max_velocity: 500 +max_accel: 20000 +max_z_velocity: 20 +max_z_accel: 500 +square_corner_velocity: 9 + +# kinematics: limited_corexy +# max_x_accel:10000 +# max_y_accel:5000 +# max_velocity: 500 +# max_accel: 20000 +# max_z_velocity: 20 +# max_z_accel: 500 + + +[gcode_arcs] +resolution: 0.5 + +[pause_resume] + +[exclude_object] + +[idle_timeout] +gcode: _IDLE_TIMEOUT +timeout: 1800 + +[virtual_sdcard] +path: /etc/klipper/gcodes + [danger_options] multi_mcu_trsync_timeout: 0.03 @@ -27,13 +59,25 @@ enable_pin: !PE10 endstop_pin: tmc2209_stepper_x:virtual_endstop microsteps: 16 full_steps_per_rotation: 200 -position_endstop: 256.5 -position_max: 256.5 -position_min: -2.01 +position_endstop: 256 +position_max: 256 +position_min: -2 homing_speed: 80 -homing_retract_dist: 0 +homing_retract_dist: 20 rotation_distance: 39.872 +[tmc2209 stepper_x] +tx_pin: PE9 +uart_pin: PE6 +uart_address: 0 +interpolate: true +run_current: 1 +home_current: 0.8 +sense_resistor: 0.1 +driver_sgthrs: 130 +diag_pin: !PG4 + + [stepper_y] step_pin: PE14 dir_pin: !PE13 @@ -41,28 +85,52 @@ enable_pin: !PE15 endstop_pin: tmc2209_stepper_y:virtual_endstop microsteps: 16 full_steps_per_rotation: 200 -position_endstop: -2.5 -position_max: 270.000000 -position_min: -2.5 +position_endstop: -2 +position_max: 265 +position_min: -2 homing_speed: 80 -homing_retract_dist: 0 +homing_retract_dist: 30 rotation_distance: 39.872 +[tmc2209 stepper_y] +tx_pin: PE9 +uart_pin: PE6 +interpolate: 1 +run_current: 1.0 +home_current: 0.8 +uart_address: 3 +sense_resistor: 0.1 +driver_sgthrs: 130 +diag_pin: !PF6 + + [stepper_z] step_pin: PG3 dir_pin: !PG2 enable_pin: !PG1 endstop_pin: PG8 +rotation_distance: 8 microsteps: 16 full_steps_per_rotation: 200 -position_endstop: 4.5 -position_max: 258.000000 -position_min: -5 -homing_speed: 8.000000 +position_endstop: 4 +position_max: 258 +position_min: -4 +homing_speed: 8 homing_retract_dist: 10 homing_retract_speed: 6 -second_homing_speed: 3.000000 -rotation_distance: 8 +second_homing_speed: 3 + + +[tmc2209 stepper_z] +tx_pin: PE9 +uart_pin: PE6 +interpolate: true +run_current: 0.8 +uart_address: 1 +sense_resistor: 0.1 +driver_sgthrs: 130 +stealthchop_threshold: 99999 + [extruder] step_pin: hotend:PC13 @@ -73,80 +141,98 @@ sensor_pin: hotend:PA3 microsteps: 16 full_steps_per_rotation: 200 gear_ratio: 52:10 -rotation_distance: 28.8 -nozzle_diameter: 0.400000 -filament_diameter: 1.750000 -sensor_type: hotend_termistor -min_temp: -200 +rotation_distance: 28.8 #could be 27.3 needs more testing 28.8 default +nozzle_diameter: 0.4 +filament_diameter: 1.75 +sensor_type: hotend_thermistor_stock +min_temp: 5 max_temp: 335 -min_extrude_temp: 170 +min_extrude_temp: 180 pressure_advance: 0.04 pressure_advance_smooth_time: 0.04 -max_extrude_only_velocity: 60 -max_extrude_only_accel: 5000 -max_extrude_only_distance: 120 +max_extrude_only_distance: 150 +max_extrude_cross_section: 5 control: pid pid_Kp: 24.860427 pid_Ki: 2.702253 pid_Kd: 57.178292 -[tmc2209 stepper_x] -tx_pin: PE9 -uart_pin: PE6 -uart_address: 0 -interpolate: 1 -run_current: 1.0 -home_current: 0.8 -sense_resistor: 0.1 -driver_sgthrs: 120 -stealthchop_threshold: 0 -diag_pin: !PG4 - -[tmc2209 stepper_y] -tx_pin: PE9 -uart_pin: PE6 -interpolate: 1 -run_current: 1.0 -home_current: 0.8 -uart_address: 3 -sense_resistor: 0.1 -driver_sgthrs: 120 -stealthchop_threshold: 0 -diag_pin: !PF6 - -[tmc2209 stepper_z] -tx_pin: PE9 -uart_pin: PE6 -interpolate: 1 -run_current: 0.8 -uart_address: 1 -sense_resistor: 0.1 -driver_sgthrs: 120 -stealthchop_threshold: 99999 - [tmc2209 extruder] tx_pin: hotend:PC6 uart_pin: hotend:PC7 -interpolate: 1 -run_current: 0.8 -hold_current: 0.5 +interpolate: true +run_current: 0.7 uart_address: 3 sense_resistor: 0.1 -driver_sgthrs: 10 -stealthchop_threshold: 0 -[led case] -white_pin: PG15 -initial_WHITE: 1 +[verify_heater extruder] + +[thermistor hotend_thermistor_stock] +temperature1: 25 +resistance1: 100000 +beta: 4700 + +[thermistor hotend_thermistor_canvas] +temperature1: 25 +resistance1: 100000 +beta: 4800 + +# CC1 "classic" hotend config +# Fixed beta value based on Atom's measurements +# beta: 4700 +[thermistor elegoo_stock_thermistor] +temperature1: 25 +resistance1: 100000 +temperature2: 242 +resistance2: 132.162 +temperature3: 297 +resistance3: 51.929 + +# CC1 CANVAS hotend config +# Fixed beta value based on Atom's measurements +# beta: 4800 +[thermistor elegoo_canvas_thermistor] +temperature1: 72 +resistance1: 9206.431 +temperature2: 95 +resistance2: 4186.247 +temperature3: 293 +resistance3: 47.387 + +[heater_fan extruder] +pin: hotend:PC8 +tachometer_pin: hotend:PA1 +tachometer_poll_interval: 0.001 + +[fan] +pin: hotend:PB5 +tachometer_pin: hotend:PA0 + + +[lis2dw] +spi_speed: 5000000 +cs_pin: hotend:PA4 +spi_bus: spi1 +axes_map: x,z,-y + +[input_shaper] +damping_ratio_x: 0.06 +damping_ratio_y: 0.082 + +[resonance_tester] +probe_points: 128,128,20 +accel_chip: lis2dw +min_freq: 10 +max_freq: 100 +accel_per_hz: 100 +hz_per_sec: 2 -[led hotend] -white_pin: hotend:PC9 [heater_bed] heater_pin: PG13 sensor_pin: PB14 sensor_type: Generic 3950 -min_temp: -200 +min_temp: 5 max_temp: 125 control: pid pid_Kp: 46.504839 @@ -154,51 +240,32 @@ pid_Ki: 1.453276 pid_Kd: 372.038710 [verify_heater heater_bed] -max_error: 120 -check_gain_time: 120 -hysteresis: 5 -heating_gain: 2 - -[verify_heater extruder] -max_error: 120 -check_gain_time: 20 -hysteresis: 5 -heating_gain: 2 - -[temperature_sensor box] -sensor_pin: PB13 -sensor_type: Generic 3950 -min_temp: -200 -max_temp: 125 - -[fan_generic model_helper_fan] -pin: PG17 - -[fan_generic box_fan] -pin: PG18 - -[temperature_fan mainboard] -pin: PG16 -tachometer_pin: PG6 -min_temp: 5 -max_temp: 85 -target_temp: 65 -min_speed: 0 -sensor_type: temperature_host -control: pid -pid_Kp: 2 -pid_Ki: 5 -pid_Kd: 0.5 [bed_mesh] -speed: 150.0 -horizontal_move_z: 2.0 -mesh_min: 20,20 +speed: 150 +horizontal_move_z: 2 +mesh_min: 10,10 mesh_max: 246,246 -probe_count: 11,11 +probe_count: 9,9 mesh_pps: 3,3 algorithm: bicubic -adaptive_margin: 5.0 +adaptive_margin: 3 +zero_reference_position: 128, 128 + +[load_cell_probe] +sensor_type: load_cell_fusion +sensors: hx71x sg0, hx71x sg1, hx71x sg2, hx71x sg3 +samples: 2 +samples_tolerance_retries: 3 +speed: 2 +sample_retract_dist: 1 +lift_speed: 5 +counts_per_gram: 29.11 +reference_tare_counts: 71000 +z_offset: -0.15 +samples_result: median +trigger_force: 50 +drop_first_result: true [hx71x sg0] chip: hx711 @@ -228,77 +295,40 @@ sclk_pin: bed:PC9 sample_rate: 80 gain: A-128 -[load_cell_probe] -sensor_type: load_cell_fusion -sensors: hx71x sg0, hx71x sg1, hx71x sg2, hx71x sg3 -samples: 2 -samples_tolerance_retries: 2 -speed: 2.0 -sample_retract_dist: 1.0 -lift_speed: 5.0 -counts_per_gram: 29.11 -reference_tare_counts: 71000 -z_offset: -0.15 -trigger_force: 50 -[printer] -kinematics: corexy -max_velocity: 500.000000 -max_accel: 20000.000000 -max_z_velocity: 20.000000 -max_z_accel: 500.000000 -square_corner_velocity: 9.000000 +[filament_switch_sensor filament_sensor] +switch_pin: PC0 +pause_on_runout: false +debounce_delay: 1 +runout_distance: 770 +runout_gcode: + RESPOND TYPE=echo MSG="Refill filament" + PAUSE STATE=runout +immediate_runout_gcode: + RESPOND TYPE=echo MSG="Ran out of filament, using remaining filament in PTFE" +insert_gcode: + RESPOND TYPE=echo MSG="Filament is inserted" -[gcode_arcs] -resolution: 0.5 -[pause_resume] - -[exclude_object] - -[input_shaper] -damping_ratio_x: 0.06 -damping_ratio_y: 0.082 - -[resonance_tester] -probe_points: 128,128,5 -accel_chip: lis2dw -min_freq: 5.000000 -max_freq: 75.000000 -accel_per_hz: 100.000000 -hz_per_sec: 1.000000 +[led case] +white_pin: PG15 +initial_WHITE: 1 -[screws_tilt_adjust] -screw1: 28.5, 28.5 -screw1_name: front left screw -screw2: 228.5, 28.5 -screw2_name: front right screw -screw3: 228.5, 228.5 -screw3_name: rear right screw -screw4: 28.5, 228.5 -screw4_name: rear left screw -horizontal_move_z: 5 -speed: 350 -screw_thread: CW-M3 +[led hotend] +white_pin: hotend:PC9 -[thermistor hotend_termistor] -temperature1: 25 -resistance1: 100000 -beta: 4300 +[temperature_sensor chamber] +sensor_pin: PB13 +sensor_type: Generic 3950 +min_temp: 5 +max_temp: 125 -[lis2dw] -spi_speed: 5000000 -cs_pin: hotend:PA4 -spi_bus: spi1 -axes_map: x,z,-y +[fan_generic aux_fan] +pin: PG17 -[heater_fan extruder] -pin: hotend:PC8 -tachometer_pin: hotend:PA1 +[fan_generic case_fan] +pin: PG18 -[fan] -pin: hotend:PB5 -tachometer_pin: hotend:PA0 [temperature_sensor mcu_toolhead] sensor_type: temperature_mcu @@ -307,3 +337,31 @@ sensor_mcu: hotend [temperature_sensor mcu_bed] sensor_type: temperature_mcu sensor_mcu: bed + + +[temperature_fan mainboard] +pin: PG16 +tachometer_pin: PG6 +min_temp: 5 +max_temp: 80 +target_temp: 60 +min_speed: 0 +sensor_type: temperature_host +control: pid +pid_Kp: 2 +pid_Ki: 5 +pid_Kd: 0.5 + + +[screws_tilt_adjust] +screw1: 231, 25 +screw1_name: front right screw +screw2: 231, 225 +screw2_name: rear right screw +screw3: 31, 225 +screw3_name: rear left screw +screw4: 31, 25 +screw4_name: front left screw +horizontal_move_z: 5 +speed: 300 +screw_thread: CCW-M3 \ No newline at end of file diff --git a/meta-opencentauri/recipes-apps/klipper/files/macros.cfg b/meta-opencentauri/recipes-apps/klipper/files/macros.cfg index 856ddb90..633acef2 100644 --- a/meta-opencentauri/recipes-apps/klipper/files/macros.cfg +++ b/meta-opencentauri/recipes-apps/klipper/files/macros.cfg @@ -3,233 +3,350 @@ # EDITING THIS FILE WILL EXCLUDE YOUR CHANGES FROM FUTURE UPDATES. # ----- -[gcode_macro _GLOBAL_VARS] -variable_extruder_target: 230 +[gcode_macro _global_var] +variable_target_extruder: 0 +variable_pause_park:{'x': 10, 'y': 240, 'z': 10, 'e': 2} +variable_cancel_park:{'x': 240, 'y': 240, 'z': 10, 'e': 5} +variable_extruder_temp:{'probing': 140, 'cleaning': 180, 'loading': 230, 'purging': 250} +variable_z_maximum_lifting_distance: 256 +variable_pause_resume_travel_speed: 150 +variable_heatsoak: 1 +variable_adaptive_mesh: False +variable_adaptive_purge: True gcode: -[gcode_macro PRINT_START] -gcode: - SET_GCODE_VARIABLE MACRO=_GLOBAL_VARS VARIABLE=extruder_target VALUE={params.EXTRUDER_TEMP} -# Home Z with Strain Gauge, ends up with the nozzle 2mm above bed -[gcode_macro STRAINGAUGE_Z_HOME] +[gcode_macro PRINT_START] gcode: - SAVE_GCODE_STATE NAME=straingauge_z_home_state + {% set target_bed = params.BED|int %} + {% set target_extruder = params.EXTRUDER|int %} + {% set target_chamber = params.CHAMBER|int %} + {% set sensor = printer['filament_switch_sensor filament_sensor'] %} + {% set svar = printer['gcode_macro _global_var'] %} - # TODO: Clear bed mesh + SET_GCODE_VARIABLE MACRO=_global_var VARIABLE=target_extruder VALUE={target_extruder} - # Move down a Z to get some clearance - G91 ; Relative positioning - G1 Z2 F600 ; Move up 2mm + TURN_OFF_FANS + BED_MESH_CLEAR + CLEAR_PAUSE G90 + #SET_DISPLAY_TEXT MSG="Bed: {target_bed}c" + M140 S{target_bed} + G28 + {% if sensor.enabled and not sensor.filament_detected %} + SET_DISPLAY_TEXT MSG="NO FILAMENT LOADED!" + CANCEL_PRINT + RETURN + {% endif %} + CLEAN_NOZZLE + + {% if target_chamber > 0 %} + SET_DISPLAY_TEXT MSG="Chamber: {target_chamber}c" + M106 S255 + G0 X128 Y128 Z10 F9000 + TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={target_chamber} + M107 + {% endif %} + M190 S{target_bed} + + # rehome after thermal expansion + SET_DISPLAY_TEXT MSG="Heatsoak: {svar.heatsoak}m" + G4 P{svar.heatsoak*1000*60} + LOADCELL_Z_HOME + {% if svar.adaptive_mesh %} + M109 S{svar.extruder_temp.probing} + SET_DISPLAY_TEXT MSG="Bed mesh adaptive" + BED_MESH_CALIBRATE ADAPTIVE=1 + {% else %} + {% if "default" in printer.bed_mesh.profiles %} + SET_DISPLAY_TEXT MSG="Bed mesh default" + BED_MESH_PROFILE LOAD=default + {% else %} + SET_DISPLAY_TEXT MSG="NO BED MESH!" + CANCEL_PRINT + RETURN + {% endif %} + {% endif %} - PROBE ; Probe with strain gauge + {% if svar.adaptive_purge %} + SMART_PARK + {% endif %} - M400 ; Wait for moves to finish + #SET_DISPLAY_TEXT MSG="Hotend: {target_extruder}c" + M109 S{target_extruder} + {% if svar.adaptive_purge %} + LINE_PURGE + {% endif %} + SET_TEMPERATURE_FAN_TARGET temperature_fan=mainboard TARGET=30 + #_TEXT MSG="Printer goes brr" + G90 - # Store the end position as new Z=0 - SET_KINEMATIC_POSITION Z=0 SET_HOMED=Z ; Set current Z as 0 +[gcode_macro PRINT_END] +gcode: + {% set svar = printer['gcode_macro _global_var'] %} + {% set z_max = svar.z_maximum_lifting_distance|int %} + {% set e_mintemp = printer.configfile.settings['extruder'].min_extrude_temp %} + {% set sensor = printer['filament_switch_sensor filament_sensor'] %} + + {% if printer.toolhead.homed_axes|lower == "xyz" %} + G91 + {% if sensor.enabled and sensor.filament_detected %} + {% if (printer.extruder.target != 0 and printer.extruder.temperature >= printer.extruder.target and printer.extruder.temperature >= e_mintemp) %} + G1 E-5 F2700 + G1 E-2 Z0.2 F2400 + {% endif %} + {% endif %} - # Move up 2mm from the probed position - G91 ; Relative positioning - G1 Z2 F600 ; Move up 2mm - M400 ; Wait for moves to finish - G90 ; Absolute positioning + {% if (printer.gcode_move.position.z + 10) < z_max %} + G1 Z+10 F3000 + {% else %} + G1 Z+{(z_max - printer.gcode_move.position.z)} F3000 + {% endif %} + G90 + G1 X240 Y240 F9000 + {% endif %} + TURN_OFF_FANS + TURN_OFF_HEATERS + M220 S100 + M221 S100 + CLEAR_PAUSE + M84 + SET_DISPLAY_TEXT MSG="Finish Print!" + + +[gcode_macro CANCEL_PRINT] +description: +rename_existing: CANCEL_PRINT_BASE +gcode: + {% set svar = printer['gcode_macro _global_var'] %} + {% set x_park = svar.cancel_park.x %} + {% set y_park = svar.cancel_park.y %} + {% set z_park = svar.cancel_park.z %} + {% set z_lift_max = svar.z_maximum_lifting_distance %} + {% set e_restract = svar.cancel_park.e %} + {% set e_mintemp = printer.configfile.settings['extruder'].min_extrude_temp %} + {% set sensor = printer['filament_switch_sensor filament_sensor'] %} + + CANCEL_PRINT_BASE + {% if printer.toolhead.homed_axes|lower == "xyz" %} + G91 + {% if sensor.enabled and sensor.filament_detected %} + {% if (printer.extruder.target != 0 and printer.extruder.temperature >= printer.extruder.target and printer.extruder.temperature >= e_mintemp) %} + G1 E-{e_restract} F2700 + {% else %} + RESPOND TYPE=command MSG="Nozzle not hot enough" + {% endif %} + {% endif %} - # TODO: Restore bed mesh + {% if (printer.gcode_move.position.z + 10) < z_lift_max %} + G1 Z+10 F3000 + {% else %} + G1 Z+{(z_lift_max - printer.gcode_move.position.z)} F3000 + {% endif %} + G90 + G1 X{x_park} Y{y_park} F9000 + {% endif %} + TURN_OFF_FANS + TURN_OFF_HEATERS + M220 S100 + M221 S100 + CLEAR_PAUSE + M84 + SET_GCODE_VARIABLE MACRO=_global_var VARIABLE=target_extruder VALUE=0 + #SET_DISPLAY_TEXT MSG="Cancel Print Success!" + +[gcode_macro PAUSE] +rename_existing: PAUSE_BASE +variable_state: 'normal' +gcode: + {% set svar = printer['gcode_macro _global_var'] %} + {% set state = params.STATE|default('normal') %} + {% set x_park = svar.pause_park.x|float %} + {% set y_park = svar.pause_park.y|float %} + {% set e_retract = svar.pause_park.e|float %} + {% set z_lift_max = svar.z_maximum_lifting_distance|int %} + {% set sensor = printer['filament_switch_sensor filament_sensor'] %} + {% set pos = printer.gcode_move.position %} + + {% if printer.pause_resume.is_paused == False %} + SET_DISPLAY_TEXT MSG="Pausing" + + PAUSE_BASE + + + {% if (printer.extruder.temperature + 5 >= printer.extruder.target) and printer.extruder.can_extrude %} + {% if sensor.enabled and sensor.filament_detected %} + G91 + G1 E-{e_retract} F300 + G90 + {% endif %} + {% endif %} - RESTORE_GCODE_STATE NAME=straingauge_z_home_state + {% if printer.toolhead.homed_axes|lower == "xyz" %} + {% set zpos = printer.gcode_move.position.z %} + G91 + {% if (zpos + 5) < z_lift_max %} + G1 Z+5 F3000 + {% else %} + G1 Z+{(z_lift_max - zpos)} F3000 + {% endif %} + G90 + {% if pos.x != x_park or pos.y != y_park %} + G1 X{x_park} Y{y_park} F{svar.pause_resume_travel_speed * 60} + {% endif %} + {% endif %} -# Wipe Nozzle, see auto_leveling.cpp:443 -[gcode_macro M729] -gcode: - SAVE_GCODE_STATE NAME=m729_saved_state + # Keep heater on so resume can prime quickly + M104 S{svar.extruder_temp.probing} - G90 + {% if state == 'normal' %} + SET_DISPLAY_TEXT MSG="Paused normal" - # Move to tray - G1 X202 F6000 - G1 Y264.5 F6000 + {% elif state == 'filament_change' %} + # Ensure nozzle is up to temp for filament change/unload + {% if printer.extruder.temperature + 5 < printer.extruder.target %} + M109 S{printer.extruder.target} + {% endif %} + SET_DISPLAY_TEXT MSG="Paused for filament change" + UNLOAD_FILAMENT + LOAD_FILAMENT - # Wipe - G1 X173 F8000 - G1 X187 - G1 X173 - G1 X187 - G1 X173 + {% elif state == 'runout' %} + # Runout pause: keep heater on and prompt user to insert filament + SET_DISPLAY_TEXT MSG="Paused for runout" + PURGE + LOAD_FILAMENT - # Move a 2mm on Y - G1 Y262.5 + {% endif %} - # Wipe - G1 X187 F8000 - G1 X173 - G1 X187 - G1 X173 - G1 X187 - G1 X173 + {% else %} + SET_DISPLAY_TEXT MSG="Printer already paused" + {% endif %} - # Add some clearance - G1 Y250 +[delayed_gcode _resume_wait] +gcode: + {% if printer['gcode_macro RESUME'].execute|lower != 'false' %} + RESUME + {% endif %} - # Move back to tray - G1 X202 - G1 Y264.5 F1200 +[gcode_macro RESUME] +rename_existing: RESUME_BASE +variable_state: 'normal' +gcode: + {% set svar = printer['gcode_macro _global_var'] %} + {% set e_retract = svar.pause_park.e|float %} + #{% set extruder_target_temp = printer.extruder.target|int %} + {% set sensor = printer['filament_switch_sensor filament_sensor'] %} + {% set extruder_target_temp = printer['gcode_macro _global_var'].target_extruder %} + + # If filament sensor is enabled require filament present before resuming + {% if sensor.enabled and not sensor.filament_detected %} + RESPOND TYPE=command MSG="Please insert filament before resuming." + RETURN + {% endif %} - # Clear command queue - M400 + # Ensure nozzle heated to target before attempting to prime/extrude + # if printer.extruder.temperature + 5 < extruder_target_temp %} + #SET_DISPLAY_TEXT MSG="Heating nozzle to {extruder_target_temp}C" + M109 S{extruder_target_temp} + # {% endif %} + G91 + G1 E{e_retract} F300 + G90 + #SET_DISPLAY_TEXT MSG="Resuming" + RESUME_BASE - RESTORE_GCODE_STATE NAME=m729_saved_state -[gcode_macro WIPE_NOZZLE] +[gcode_macro PURGE] gcode: - {% set bed_temp = params.BED_TEMP|default(60)|float %} - - G28 ; Home - M204 S5000 ; Set acceleration to 5000 mm/s - M400 ; Wait for moves to finish - G90 ; Absolute positioning - M106 S0 ; Turn off part cooling fan - SET_FAN_SPEED FAN=model_helper_fan SPEED=0 ; Turn off auxiliary fan - M83 ; Relative extrusion mode + {% set svar = printer['gcode_macro _global_var'] %} + {% if "xyz" not in printer.toolhead.homed_axes %} + G28 ; Home if necessary + {% endif %} # Move to purge position - G1 X202 Y250 F20000 ; Rapid move to purge area - G1 Y264.5 F1200 ; Move to exact purge Y position - M109 S250 ; Heat nozzle to 250°C and wait + MOVE_TO_TRAY + M104 S{svar.extruder_temp.purging} ; Heat nozzle to purging temp + TEMPERATURE_WAIT SENSOR=extruder MINIMUM={svar.extruder_temp.purging} MAXIMUM={svar.extruder_temp.purging+5} + ; Heat nozzle to 250°C and wait # Purge filament (8 cycles) G92 E0 ; Reset extruder position - M106 S255 ; Turn on part cooling fan (full speed) - SET_FAN_SPEED FAN=model_helper_fan SPEED=1 ; Turn on auxiliary fan (full speed) - G1 E13 F523 ; Extrude 13mm at medium speed - G1 E2 F150 ; Extrude 2mm slowly (ensure flow) - M400 ; Wait for completion - G1 E13 F523 ; Repeat purge cycle 2 - G1 E2 F150 - M400 - G1 E13 F523 ; Repeat purge cycle 3 - G1 E2 F150 - M400 - G1 E13 F523 ; Repeat purge cycle 4 - G1 E2 F150 - M400 - G1 E13 F523 ; Repeat purge cycle 5 - G1 E2 F150 - M400 - G1 E13 F523 ; Repeat purge cycle 6 - G1 E2 F150 - M400 - G1 E13 F523 ; Repeat purge cycle 7 - G1 E2 F150 - M400 - G1 E13 F523 ; Repeat purge cycle 8 - G1 E2 F150 - M400 + M106 S0 ; Turn off part cooling fan (full speed) + {% for purge in range(4) %} + G1 E25 F300 ; Extrude 13mm at medium speed + G1 E10 F150 ; Extrude 2mm slowly (ensure flow) + M400 ; Wait for completion + {% endfor %} + M104 S{svar.extruder_temp.loading} + TEMPERATURE_WAIT SENSOR=extruder MAXIMUM={svar.extruder_temp.loading} MINIMUM={svar.extruder_temp.loading-5} + {% for purge in range(4) %} + G1 E25 F300 ; Extrude 13mm at medium speed + G1 E10 F150 ; Extrude 2mm slowly (ensure flow) + M400 ; Wait for completion + {% endfor %} G1 E-2 F1800 ; Retract 2mm to prevent oozing - - # Cool nozzle for cleaning - M109 S180 ; Cool to 180°C and wait - M400 ; Wait for moves - M104 S140 ; Start cooling to final temp (140°C) - G4 S4 ; Dwell 4 seconds - - # Wipe nozzle using M729 pattern - M204 S15000 ; Set high acceleration for wipe - M729 ; Execute wipe pattern (moves across wiper) - M204 S5000 ; Restore normal acceleration - - # --- ADDITIONAL NOZZLE CLEANING --- - G1 X128 Y254 F3000 ; Move to cleaning brush area - M140 S{bed_temp} ; Keep bed at target temp - - STRAINGAUGE_Z_HOME ; Home Z using strain gauge - - M400 ; Wait for completion - #G91 ; Relative positioning - #G1 Z2 F600 ; Lift Z by 2mm - #G90 ; Absolute positioning - G1 Z2 F600 ; Ensure Z is 2mm above bed - - G1 Y261.5 F9000 ; Move to brush position - G91 ; Relative positioning - G1 Z-2.5 F600 ; Lower into brush - M400 ; Wait for position - - # Scrub nozzle back and forth (4 passes) - G90 ; Absolute positioning - G1 X140 F2000 ; Scrub right - G1 X110 ; Scrub left - G1 X140 F2000 ; Scrub right - G1 X110 ; Scrub left - G1 X140 F2000 ; Scrub right - G1 X110 ; Scrub left - G1 X140 F2000 ; Scrub right - G1 X110 ; Scrub left - G1 X140 F2000 ; Final scrub right - G1 X128 ; Return to center - M400 ; Wait for completion - - # Lift and move away from brush - G91 ; Relative positioning - G1 Z3 F600 ; Lift Z by 3mm - M400 ; Wait - G90 ; Absolute positioning - G1 Y254 F9000 ; Move away from brush - G1 X128 F9000 ; Center X position - - # --- CALIBRATION PREPARATION --- - M140 S{bed_temp} ; Keep bed at target temp - STRAINGAUGE_Z_HOME ; Home Z with strain gauge again - #G91 ; Relative positioning - #G1 Z-2.5 F600 ; Lower slightly - #G90 ; Absolute positioning - M400 ; Wait for completion - - # Heat to calibration temperatures - M140 S{bed_temp} ; Heat bed to target temp - M109 S140 ; Heat nozzle to 140°C and wait - M400 ; Wait for stability - M106 S0 ; Turn off part cooling fan - SET_FAN_SPEED FAN=model_helper_fan SPEED=0 ; Turn off auxiliary fan - - # Final positioning before probe calibration - G91 ; Relative positioning - G1 Z2 F600 ; Lift Z by 2mm - G90 ; Absolute positioning - -# Bed Mesh Calibration Macro with temperature and wipe -[gcode_macro BED_MESH_CALIBRATE_WITH_WIPE] + M104 S0 + M106 S255 + TEMPERATURE_WAIT SENSOR=extruder MAXIMUM={svar.extruder_temp.cleaning} MINIMUM={svar.extruder_temp.cleaning-5} + M107 + G0 X170 + G0 Y250 + G4 P1000 + MOVE_TO_TRAY + G0 X170 + G0 Y250 + +[gcode_macro CLEAN_NOZZLE] gcode: - {% set bed_temp = params.BED_TEMP|default(60)|float %} - - M104 S140 ; Set nozzle temp to 140°C - M140 S{bed_temp} ; Set bed temp - M106 S0 ; Turn off part cooling fan - SET_FAN_SPEED FAN=model_helper_fan SPEED=0 ; Turn off auxiliary fan - SET_FAN_SPEED FAN=box_fan SPEED=0 ; Turn off box fan - - WIPE_NOZZLE BED_TEMP={bed_temp} ; Clean nozzle before probing - - M140 S{bed_temp} ; Set bed temp - M104 S140 ; Set nozzle temp to 140°C - - SET_GCODE_OFFSET Z=0 MOVE=0 ; Reset Z offset - - G28 Z0 ; Home Z only using photoelectric sensor + {% set svar = printer['gcode_macro _global_var'] %} + BED_MESH_CLEAR + M104 S{svar.extruder_temp.cleaning} + {% if printer.toolhead.homed_axes != "xyz" %} + G28 + {% endif %} + G90 - M109 S140 ; Ensure nozzle at 140°C - M190 S{bed_temp} ; Ensure bed temp + # Move to tray + MOVE_TO_TRAY + #SET_DISPLAY_TEXT MSG="Cleaning nozzle: {svar.extruder_temp.cleaning}c" + M104 S{svar.extruder_temp.cleaning} + TEMPERATURE_WAIT SENSOR=extruder MINIMUM={svar.extruder_temp.cleaning} MAXIMUM={svar.extruder_temp.cleaning+5} + M104 S{svar.extruder_temp.probing} + M106 S255 + # Wipe + G1 F9000 + {% for wipes in range(4) %} + {% for i in range(8) %} + {% set x = 187 - (i * 2) %} + {% set y = 265 if i % 2 == 0 else 263 %} + G1 X{x} Y{y} + {% endfor %} + G1 X187 + {% endfor %} + # Move a 2mm on Y + G1 Y263 + TEMPERATURE_WAIT SENSOR=extruder MAXIMUM={svar.extruder_temp.probing} + M104 S0 + + G1 F9000 + {% for wipes in range(4) %} + {% for i in range(8) %} + {% set x = 187 - (i * 2) %} + {% set y = 263 if i % 2 == 0 else 265 %} + G1 X{x} Y{y} + {% endfor %} + G1 X187 + {% endfor %} + # Add some clearance + G1 Y250 - BED_MESH_CALIBRATE ; Start bed mesh calibration + # Clear command queue - MOVE_TO_TRAY ; Move to tray after calibration - M106 S0 ; Turn off part cooling fan - SET_FAN_SPEED FAN=model_helper_fan SPEED=0 ; Turn off auxiliary fan - M104 S0 ; Turn off nozzle heater - M140 S0 ; Turn off bed heater + M107 + M400 + ; Absolute positioning -# Move the toolhead to the tray [gcode_macro MOVE_TO_TRAY] gcode: {% if "xyz" not in printer.toolhead.homed_axes %} @@ -237,18 +354,23 @@ gcode: {% endif %} G90 ; Absolute positioning - G0 X202 Y250 F12000 ; Move near to the try - G0 Y264.5 F1200 ; Move slowly back to the tray + G0 X202 F12000 + G0 Y250 F12000 ; Move near to the try + G0 Y265 F1200 ; Move slowly back to the tray M400 ; Wait for movements to complete + [gcode_macro _LOAD_FILAMENT_STEP_PUSH] gcode: - _CLOSE_PROMPT ; Close any existing prompt + ; Close any existing prompt M83 ; Relative extrusion mode G92 E0 ; Reset extruder position - G1 E120 F240 ; Move filament into the extruder (120mm at 4mm/s) - M729 ; Wipe nozzle after loading + G1 E70 F420 + ; Move filament into the extruder (120mm at 4mm/s) + G4 P1000 + _CLOSE_PROMPT + #CLEAN_NOZZLE ; Wipe nozzle after loading RESPOND TYPE=command MSG="action:prompt_begin Loading Filament" RESPOND TYPE=command MSG="action:prompt_text Load completed. Do you want to purge more?" @@ -258,152 +380,161 @@ gcode: [gcode_macro _LOAD_FILAMENT_STEP_DONE] gcode: - M729 ; Wipe nozzle after loading - M104 S0 ; Turn off nozzle heater - M106 S0 ; Turn off part cooling fan _CLOSE_PROMPT ; Close the loading prompt - + CLEAN_NOZZLE ; Wipe nozzle after loading + M104 S0 ; Turn off nozzle heater + #M106 S0 ; Turn off part cooling fan + [gcode_macro LOAD_FILAMENT] gcode: - {% set extruder_temp = params.EXTRUDER_TEMP|default(250)|float %} + {% set svar = printer['gcode_macro _global_var'] %} + _CLOSE_PROMPT - M104 S{extruder_temp} ; Start heating the nozzle + {% if "xyz" not in printer.toolhead.homed_axes %} + G28 ; Home if necessary + {% endif %} MOVE_TO_TRAY ; Move to the tray - M109 S{extruder_temp} ; Wait for nozzle to reach temp - M106 S255 ; Turn on part cooling fan (full speed) - _LOAD_FILAMENT_STEP_PUSH ; Push filament into extruder and wipe + M104 S{svar.extruder_temp.loading} + TEMPERATURE_WAIT SENSOR=extruder MINIMUM={svar.extruder_temp.loading} MAXIMUM={svar.extruder_temp.loading+5} + M107 ; Turn off part cooling fan (full speed) + RESPOND TYPE=command MSG="action:prompt_begin Load Filament" + RESPOND TYPE=command MSG="action:prompt_text Insert filament all the way into extruder before continuing" + RESPOND TYPE=command MSG="action:prompt_footer_button LOAD|_LOAD_FILAMENT_STEP_PUSH" + RESPOND TYPE=command MSG="action:prompt_footer_button CANCEL|_CLOSE_PROMPT" + RESPOND TYPE=command MSG="action:prompt_show" -# Cuts the tip of the filament and ejects it from the extruder [gcode_macro UNLOAD_FILAMENT] gcode: {% if "xyz" not in printer.toolhead.homed_axes %} G28 ; Home if necessary {% endif %} - - G90 ; Absolute positioning - G0 Z14.5 F600 ; Ensure we have some Z clearance - G0 Y30 F15000 ; Get some clearance for Y - G0 X255 F8000 ; Move to cutting position - G0 Y3 F1200 ; Cut - G0 Y30 F8000 ; Retract from cutting + ; Absolute positioning + CUT_FILAMENT ; Wait for movements to complete + + MOVE_TO_TRAY + COLD_EXTRUDE HEATER=extruder ENABLE=1 ; Move to the tray + G1 E-30 F600 + COLD_EXTRUDE HEATER=extruder ENABLE=0 + G0 Y250 M400 ; Wait for movements to complete - MOVE_TO_TRAY ; Move to the tray - FORCE_MOVE STEPPER=extruder DISTANCE=-30 VELOCITY=4 ; Move the filament out of the extruder - - M400 ; Wait for movements to complete -[gcode_macro _HOME_X] +[homing_override] +axes: xyz # This forces the z position to be at 0 when we start homing, so we can move the Z up before homing. +set_position_z: 0 gcode: - # Home X - G28 X - M400 - - # Move away - G91 - G1 X-20 F4800 + BED_MESH_CLEAR G90 + G0 Z5 F1200 ; 5 up zhop + {% if not rawparams %} + G28 X + G28 Y + G28 X + G0 X128 Y128 F4800 + G28 Z + {% else %} + {% if 'X' in rawparams %} + G28 X + {% endif %} + {% if 'Y' in rawparams %} + G28 Y + {% endif %} + {% if 'Z' in rawparams %} + G28 Z + {% endif %} + {% endif %} -[gcode_macro _HOME_Y] -gcode: - # Home Y - G28 Y - M400 - - # Move away - G91 - G1 Y30 F4800 - G90 + {% if "default" in printer.bed_mesh.profiles %} + BED_MESH_PROFILE LOAD=default + {% endif %} -[delayed_gcode startup] -initial_duration: 1 +[gcode_macro LOADCELL_Z_HOME] gcode: - {% set settings = printer["gcode_macro _COSMOS_SETTINGS"]|default({}) %} - {% set camera_led_on = settings.camera_led_default_on|default(false)|lower == 'true' %} - - {% if camera_led_on %} - RUN_SHELL_COMMAND CMD=CAMERA_LIGHT_ON - {% endif %} + {% set svar = printer['gcode_macro _global_var'] %} + + M104 S{svar.extruder_temp.probing} + {% if "xyz" not in printer.toolhead.homed_axes %} + G28 ; Home if necessary + {% endif %} + BED_MESH_CLEAR + # Move down a Z to get some clearance + G91 ; Relative positioning + G1 Z5 F600 + G90 + G0 X128 Y128 F9000 ; Move up 2mm + M109 S{svar.extruder_temp.probing} + PROBE ; Probe with strain gauge + M400 ; Wait for moves to finish - BED_MESH_PROFILE LOAD=default + # Store the end position as new Z=0 + SET_KINEMATIC_POSITION Z=0 SET_HOMED=Z ; Set current Z as 0 + # Move up 2mm from the probed position + M104 S0 + G91 ; Relative positioning + G1 Z5 F600 ; Move up 2mm + G90 ; Absolute positioning -[homing_override] -axes: yxz +[gcode_macro BED_MESH_CALIBRATE] +rename_existing: BED_MESH_CALIBRATE_BASE gcode: - {% set bed_mesh = printer.bed_mesh.profile_name %} - {% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %} - # On the Centauri Carbon 1, 8mm is the requested minimum Z clearance before XY homing. - {% set safe_z = 8.0 %} - {% set safe_z_feedrate = 1500 %} - {% set RUN_CURRENT_X = printer.configfile.settings['tmc2209 stepper_x'].run_current|float %} - {% set RUN_CURRENT_Y = printer.configfile.settings['tmc2209 stepper_y'].run_current|float %} - {% set HOME_CURRENT_X = printer.configfile.settings['tmc2209 stepper_x'].home_current|float %} - {% set HOME_CURRENT_Y = printer.configfile.settings['tmc2209 stepper_y'].home_current|float %} + {% set svar = printer['gcode_macro _global_var'] %} + {% set bed_temp = params.BED_TEMP|default(60)|float %} + M140 S{bed_temp} + G28 + CLEAN_NOZZLE + M190 S{bed_temp} + M104 S{svar.extruder_temp.probing} + G4 P60000 + LOADCELL_Z_HOME + M109 S{svar.extruder_temp.probing} + TURN_OFF_FANS + BED_MESH_CALIBRATE_BASE + +[gcode_macro SCREWS_TILT_CALCULATE] +rename_existing: SCREWS_TILT_CALCULATE_BASE +gcode: + {% set svar = printer['gcode_macro _global_var'] %} + {% set bed_temp = params.BED_TEMP|default(60)|int %} + {% if "xyz" not in printer.toolhead.homed_axes %} + G28 ; Home if necessary + {% endif %} + BED_MESH_CLEAR + M190 S{bed_temp} + M109 S{svar.extruder_temp.probing} + M400 + G28 + CLEAN_NOZZLE + SCREWS_TILT_CALCULATE_BASE - # Set lower current for homing - SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CURRENT_X} - SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CURRENT_Y} - - # Pause to ensure driver stall flag is clear - G4 P500 - - # Ensure Z clearance before XY homing when Z homing is requested - {% if home_all or 'Z' in params %} - {% if 'z' in printer.toolhead.homed_axes %} - {% if printer.gcode_move.gcode_position.z|float < safe_z %} - G90 - G0 Z{safe_z} F{safe_z_feedrate} - {% endif %} - {% else %} - # When Z is unhomed, normal G0/G1 moves are unavailable, so use a short - # positive force move to create the requested minimum clearance first. - # WARNING: This intentionally assumes the printer is in a state where a - # +8mm Z move is safe and that Z is not already at its positive travel limit - # before continuing with the requested Z homing sequence. - FORCE_MOVE STEPPER=stepper_z DISTANCE={safe_z} VELOCITY={safe_z_feedrate / 60} - {% endif %} - # Wait for the Z clearance move to finish before starting XY homing moves. - M400 - {% endif %} - # First X home. Note this may crash into the back steppers. - {% if home_all or 'X' in params %} - _HOME_X +[gcode_macro _IDLE_TIMEOUT] +gcode: + {% if printer.print_stats.state == "paused" %} + RESPOND MSG="PAUSED" + {% else %} + M84 + TURN_OFF_HEATERS + TURN_OFF_FANS + RESPOND MSG="Idle timeout reached, turning off heaters and fans!" + {% endif %} {% endif %} - # First Y Home. - {% if home_all or 'Y' in params %} - _HOME_Y - {% endif %} - - # Second X home (if homing both X and Y) to home x at a known good position for sensorless homing - {% if home_all or ('X' in params and 'Y' in params) %} - _HOME_X - {% endif %} +[gcode_macro TURN_OFF_FANS] +gcode: + M107 + SET_FAN_SPEED FAN=aux_fan SPEED=0 + SET_FAN_SPEED FAN=case_fan SPEED=0 + SET_TEMPERATURE_FAN_TARGET temperature_fan=mainboard + RESPOND MSG="ALL FANS OFF!" - # Second Y home just in case the X home caused a jump in Y - {% if home_all or ('X' in params and 'Y' in params) %} - _HOME_Y - {% endif %} +[gcode_macro M600] +gcode: + PAUSE STATE=filament_change - # Restore running current after homing - SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT_X} - SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT_Y} - - {% if home_all or 'Z' in params %} - G90 # Absolute positioning - G1 X125 Y125 F15000 # Move to center of the bed for Z homing - G28 Z # Home Z - G0 Z10 F1500 # Move down after homing - {% endif %} - {% if bed_mesh != "" %} - BED_MESH_PROFILE LOAD="{bed_mesh}" - {% endif %} - [gcode_macro _SHOW_PROMPT] gcode: {% set title = params.TITLE|default('Please wait') %} @@ -432,19 +563,13 @@ gcode: SET_DISPLAY_TEXT_BASE MSG="{message}" -[gcode_macro _CLIENT_VARIABLE] -variable_use_custom_pos: True -variable_custom_park_x: 202 -variable_custom_park_y: 264.5 + +[gcode_macro M729] gcode: + SET_DISPLAY_TEXT MSG="Use COSMOS start/end machine gcode" + M112 -[gcode_macro Bed_Level_Screws_Tune] +[gcode_macro M8213] gcode: - {% set bed_temp = params.BED_TEMP|default(60)|float %} - BED_MESH_CLEAR - M104 S140 - M400 - G28 - M109 S140 - M729 - SCREWS_TILT_CALCULATE \ No newline at end of file + SET_DISPLAY_TEXT MSG="Use COSMOS start/end machine gcode" + M112 \ No newline at end of file diff --git a/meta-opencentauri/recipes-apps/klipper/kalico_2026.02.00.bb b/meta-opencentauri/recipes-apps/klipper/kalico_2026.02.00.bb index 895dc27c..11dc9921 100644 --- a/meta-opencentauri/recipes-apps/klipper/kalico_2026.02.00.bb +++ b/meta-opencentauri/recipes-apps/klipper/kalico_2026.02.00.bb @@ -13,6 +13,7 @@ SRC_URI += " \ file://shell.cfg \ file://screen.cfg \ file://calibration.cfg \ + file://kamp.cfg \ " inherit python3-dir update-rc.d @@ -96,7 +97,7 @@ do_install() { # Copy non-printer .cfg files to readonly folder install -d ${D}${sysconfdir}/klipper/config/klipper-readonly - install -m 0644 ${WORKDIR}/machine.cfg ${WORKDIR}/shell.cfg ${WORKDIR}/macros.cfg ${WORKDIR}/calibration.cfg ${WORKDIR}/screen.cfg ${D}${sysconfdir}/klipper/config/klipper-readonly + install -m 0644 ${WORKDIR}/machine.cfg ${WORKDIR}/shell.cfg ${WORKDIR}/macros.cfg ${WORKDIR}/calibration.cfg ${WORKDIR}/screen.cfg ${WORKDIR}/kamp.cfg ${D}${sysconfdir}/klipper/config/klipper-readonly # Install SysVinit script install -d ${D}${sysconfdir}/init.d @@ -116,4 +117,5 @@ CONFFILES:${PN} = " \ ${sysconfdir}/klipper/config/klipper-readonly/shell.cfg \ ${sysconfdir}/klipper/config/klipper-readonly/screen.cfg \ ${sysconfdir}/klipper/config/klipper-readonly/calibration.cfg \ + ${sysconfdir}/klipper/config/klipper-readonly/kamp.cfg \ "