Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -359,4 +359,19 @@ press_gcode: # CANVAS board detected.
{% set pulldown_resistor_value = printer.configfile.settings.extruder.pulldown_resistor %}
{% if pulldown_resistor_value != 100000 %}
{ action_emergency_stop("Fire hazard detected: CANVAS board detected without the pulldown resistor being configured. Please set elegoo_canvas to True in cosmos.conf or manually configure the pulldown_resistor value on the extruder!") }
{% endif %}
{% endif %}

# Motion geometry consumed by macros.cfg (defaults there match these values;
# this section is the documented canonical list)
[gcode_macro _MACHINE_VARS]
variable_tray_x: 202
variable_wipe_x_start: 187
# CC1 cutter is the front-right corner: vendor does Y30 -> X255 -> seat Y3
# (change_filament.cpp). kick_x == park_x makes the ram a no-op; the cut is
# the corner seat.
variable_kick_x: 255
variable_kick_f: 4500
variable_kick_park_x: 255
variable_kick_park_y: 30
variable_kick_corner_y: 3
gcode:
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,15 @@ runout_gcode:
white_pin: PB5
initial_WHITE: 1

[temperature_sensor chamber]
sensor_pin: PB13
sensor_type: NTC 100K beta 3950
pullup_resistor: 22000
min_temp: 0
max_temp: 125
# Disabled: CC2 box NTC is PH0 (SoC GPADC0) per vendor printer_dsp_new.cfg, but
# the kalico DSP-mcu firmware shuts down when ADC sampling starts on PH0.
# Needs GPADC support in kalico-firmware-dsp before enabling.
# [temperature_sensor chamber]
# sensor_pin: PH0
# sensor_type: NTC 100K beta 3950
# pullup_resistor: 22000
# min_temp: 0
# max_temp: 125

[fan_generic aux_fan]
pin: PD15
Expand Down Expand Up @@ -427,3 +430,19 @@ press_gcode:
{% endif %}
release_gcode:
RESPOND TYPE=echo MSG="Front cover has been re-attached"

# Motion geometry consumed by macros.cfg (defaults there match the CC1 values)
# CC2 DSP-board values from vendor printer_dsp_new.cfg: tray/wiper on the LEFT,
# cutter front-right. (Base printer.cfg is the old board rev; do not use it.)
[gcode_macro _MACHINE_VARS]
variable_tray_x: 52
variable_wipe_x_start: 80
variable_kick_x: 254.5
variable_kick_f: 3000
variable_kick_park_x: 245
variable_kick_park_y: 25
variable_kick_corner_y: 2.5
# Vendor shake_gcode (printer_dsp_new.cfg): Z-hop then 20x +-0.5mm to fling the
# severed nub off the nozzle after the cut
variable_kick_shake_times: 20
gcode:
68 changes: 56 additions & 12 deletions meta-opencentauri/recipes-apps/klipper/files/macros.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ gcode:
[gcode_macro CLEAN_NOZZLE]
gcode:
{% set global = printer['gcode_macro _global_var'] %}
{% set mv = printer['gcode_macro _MACHINE_VARS']|default({}) %}
{% set pre_toolhead_target = printer.extruder.target|int %}
{% set target = params.TARGET|default(global.extruder_temp.cleaning if pre_toolhead_target < global.extruder_temp.cleaning else pre_toolhead_target)|int %}
M104 S{target}
Expand All @@ -333,13 +334,14 @@ gcode:
M106 S255
# Wipe
G1 F9000
{% set wipe_x = mv.wipe_x_start|default(187)|int %}
{% for wipes in range(4) %}
{% for i in range(8) %}
{% set x = 187 - (i * 2) %}
{% set x = wipe_x - (i * 2) %}
{% set y = 264 if i % 2 == 0 else 262 %}
G1 X{x} Y{y}
{% endfor %}
G1 X187
G1 X{wipe_x}
{% endfor %}
G1 Y250
# Clear command queue
Expand All @@ -349,14 +351,16 @@ gcode:

[gcode_macro MOVE_TO_TRAY]
gcode:
{% set mv = printer['gcode_macro _MACHINE_VARS']|default({}) %}
{% set tray_x = mv.tray_x|default(202) %}
_CG28 AXIS=XY

{% if printer.gcode_move.position.x > 201.5 and printer.gcode_move.position.x < 202.5 and printer.gcode_move.position.y > 263.5 and printer.gcode_move.position.y < 264.5 and "xy" in printer.toolhead.homed_axes %}
{% if printer.gcode_move.position.x > tray_x-0.5 and printer.gcode_move.position.x < tray_x+0.5 and printer.gcode_move.position.y > 263.5 and printer.gcode_move.position.y < 264.5 and "xy" in printer.toolhead.homed_axes %}
RETURN ; Already at the tray
{% endif %}

G90 ; Absolute positioning
G0 X202 F12000
G0 X{tray_x} F12000
G0 Y250 F12000 ; Move near to the try
G0 Y264 F1200 ; Move slowly back to the tray

Expand All @@ -367,7 +371,9 @@ variable_end_kick_x: 186
gcode:
{% set global = printer['gcode_macro _global_var'] %}
{% set self = printer["gcode_macro KICK"] %}
{% set end_kick_x = self.end_kick_x|float %}
{% set mv = printer['gcode_macro _MACHINE_VARS']|default({}) %}
{% set end_kick_x = mv.kick_x|default(self.end_kick_x) %}
{% set kick_f = mv.kick_f|default(8000)|int %}
{% set retract_amount = global.retract_amount|float %}

{% if "xy" not in printer.toolhead.homed_axes %}
Expand All @@ -378,23 +384,60 @@ gcode:
{action_raise_error("Extruder not hot enough to kick")}
{% endif %}

{% if mv.kick_park_x is defined %}
{% set kick_park_x = mv.kick_park_x %}
{% set kick_park_y = mv.kick_park_y %}
{% else %}
{% set kick_park_x = 202 %}
{% set kick_park_y = 264 %}
{% endif %}

G90 ; Absolute positioning
M83 ; E relative

MOVE_TO_TRAY ; Move to the tray
_CG28 AXIS=XY
G0 X{kick_park_x} F12000 ; Park at the cutter (X first to avoid clipping the tray)
{% set approach_y = kick_park_y - 14 if kick_park_y > 128 else kick_park_y + 14 %}
G0 Y{approach_y} F12000
G0 Y{kick_park_y} F1200 ; Slow final approach into the tray/cutter
M400
G1 E-{retract_amount} F300 ; Retract slightly to reduce pressure during kick
M106 S255 ; Full blast fan to solidify plastic
G4 P2000 ; Wait 2 seconds for fan to do its work
G1 F8000 ; Set feedrate
G1 X{self.end_kick_x} ; Swipe over the v-slot (into)
G1 X193 ; Swipe over the v-slot (out of)
G1 X{self.end_kick_x} ; Swipe over the v-slot (into)
M107 ; Turn off fan
G4 P3000 ; Wait 3 seconds for fan to do its work
G1 X{end_kick_x} F{kick_f} ; Kick toward the cutter
{% if mv.kick_corner_y is defined %}
G1 Y{mv.kick_corner_y} F600 ; Seat into the cutter corner
{% endif %}
M106 S0 ; Turn off fan

{% if mv.kick_shake_times is defined %}
G91 ; Relative positioning for the shake
G1 Z2 F1200 ; Hop off
{% for i in range(mv.kick_shake_times|int) %}
G1 Z0.5 F1200
G1 Z-0.5 F1200
{% endfor %}
G90 ; Back to absolute
{% endif %}

G1 Y250 F6000 ; Exit

M400 ; Wait for movements to complete

# The active KICK above follows the stock vendor cut: park at the cutter
# corner, press in, seat (Elegoo app change_filament.cpp: Y30 -> X255 -> Y3 on
# CC1; (245,25) -> X254.5 -> Y2.5 on CC2). James replaced the cut with a
# v-slot swipe in 4025623 (2026-09-18, "Wipe after print; reconcile KICK and
# CLEAN_NOZZLE; Don't unload after cancel", PR #329); his version, commented
# out, was:
#
# G4 P2000 ; Wait 2 seconds for fan to do its work
# G1 F8000 ; Set feedrate
# G1 X{self.end_kick_x} ; Swipe over the v-slot (into)
# G1 X193 ; Swipe over the v-slot (out of)
# G1 X{self.end_kick_x} ; Swipe over the v-slot (into)
# M107 ; Turn off fan

[gcode_macro _LOAD_FILAMENT_STEP_PUSH]
gcode:
RESPOND TYPE=command MSG="action:prompt_begin Load Filament"
Expand Down Expand Up @@ -922,6 +965,7 @@ gcode:

[gcode_macro PURGE]
gcode:
{% set global = printer['gcode_macro _global_var'] %}
{% set purge_length = params.PURGE_LENGTH|default(200, true)|float %}

{% if printer.extruder.target < 180 or not printer.extruder.can_extrude %}
Expand Down
Loading