Skip to content
Closed
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
1 change: 1 addition & 0 deletions meta-opencentauri/images/opencentauri-image-base.bb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CORE_IMAGE_EXTRA_INSTALL += "\
wpa-supplicant \
iw \
kalico \
klipper-extras-canvas \
moonraker \
mainsail \
fluidd \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
# Elegoo CANVAS Lite — Klipper configuration
#
# Copy this into your printer.cfg or use: [include elegoo_canvas.cfg]
#
# =====================================================================
# CONNECTION NOTES
#
# The CANVAS Lite has TWO serial interfaces:
#
# 1. USART2 (Modbus RTU) — the proper control protocol.
# This is the connector that normally goes to the Elegoo printer.
# To use with Klipper, wire a USB-to-UART adapter (FTDI/CH340/CP2102)
# to the USART2 TX/RX pins on the CANVAS PCB or its printer connector.
# Use mode: modbus (recommended).
#
# 2. USB CDC (debug CLI) — the STM32's own USB port (VID 0483:5740).
# Appears as /dev/ttyACMx when plugged in. Provides a limited
# debug console with feed_cmd / unload_cmd commands.
# Use mode: cli (fallback if you only have the USB cable).
#
# Find your serial port:
# ls /dev/serial/by-id/
# ls /dev/ttyACM* /dev/ttyUSB*
# =====================================================================

#[canvas]
#serial: /dev/serial/by-id/REPLACE_ME
# Serial device path. Use /dev/serial/by-id/... for a stable name.

#mode: modbus
# 'modbus' — Modbus RTU over UART (recommended, full control)
# 'cli' — USB CDC debug CLI (limited, fallback only)

#baud: 115200
# Baud rate. 115200 for Modbus. Ignored for USB CDC but harmless.

#slave_address: 2
# Modbus slave address. The CANVAS Lite defaults to 2.

#serial_timeout: 0.5
# Seconds to wait for a Modbus response frame.

#retries: 2
# Modbus transaction retry count on CRC/timeout errors.

#load_timeout: 45
# Max seconds to wait for a filament load operation.

#unload_timeout: 45
# Max seconds to wait for a filament unload operation.

#poll_interval: 0.5
# Seconds between state polls during load/unload.

#min_operation_wait: 3.0
# Minimum seconds to wait before polling for completion.

#cli_command_wait: 15
# Fixed wait (seconds) after a CLI command (cli mode only).


# =====================================================================
# TOOL CHANGE MACRO
#
# Adjust the variables below for your physical setup.
# The macro handles: tip forming, bowden retract, CANVAS switch,
# bowden feed, purge, and position restore.
#
# Set bowden_length to the distance (mm) from the CANVAS output port
# to your extruder gears. Leave at 0 to skip bowden moves (if the
# CANVAS output connects directly to your extruder or you handle it
# elsewhere).
# =====================================================================

[gcode_macro _CANVAS_TOOLCHANGE]
description: Internal: Elegoo CANVAS filament change sequence
variable_active_tool: -1
# Distance from CANVAS output to extruder gears (mm). 0 = skip.
variable_bowden_length: 0
# Tip-forming retraction distance (mm)
variable_tip_retract: 2.0
# Extra purge after loading new filament (mm)
variable_purge_length: 30
# Speeds (mm/s)
variable_retract_speed: 30
variable_bowden_speed: 60
variable_purge_speed: 3
# Park position for tool changes. Both must be >= 0 to enable.
variable_park_x: -1
variable_park_y: -1
variable_park_speed: 150
gcode:
{% set new = params.T | int %}
{% set cur = printer["gcode_macro _CANVAS_TOOLCHANGE"].active_tool | int %}

{% if cur != new %}
{% set bowden = printer["gcode_macro _CANVAS_TOOLCHANGE"].bowden_length | float %}
{% set tip = printer["gcode_macro _CANVAS_TOOLCHANGE"].tip_retract | float %}
{% set purge = printer["gcode_macro _CANVAS_TOOLCHANGE"].purge_length | float %}
{% set ret_spd = (printer["gcode_macro _CANVAS_TOOLCHANGE"].retract_speed | float * 60) | int %}
{% set bow_spd = (printer["gcode_macro _CANVAS_TOOLCHANGE"].bowden_speed | float * 60) | int %}
{% set pur_spd = (printer["gcode_macro _CANVAS_TOOLCHANGE"].purge_speed | float * 60) | int %}
{% set pk_x = printer["gcode_macro _CANVAS_TOOLCHANGE"].park_x | float %}
{% set pk_y = printer["gcode_macro _CANVAS_TOOLCHANGE"].park_y | float %}
{% set pk_spd = (printer["gcode_macro _CANVAS_TOOLCHANGE"].park_speed | float * 60) | int %}

SAVE_GCODE_STATE NAME=canvas_tc

; --- park (optional) ---
{% if pk_x >= 0 and pk_y >= 0 %}
G90
G1 X{pk_x} Y{pk_y} F{pk_spd}
{% endif %}

; --- unload current filament ---
{% if cur >= 0 %}
; tip forming: retract, partial push, longer retract
M83
G1 E-{tip} F{ret_spd}
G1 E{tip * 0.5} F{ret_spd}
G1 E-{tip * 1.5} F{ret_spd}

; pull filament out of bowden tube
{% if bowden > 0 %}
G1 E-{bowden} F{bow_spd}
{% endif %}

; CANVAS: retract filament back into spool slot
CANVAS_UNLOAD CHANNEL={cur}
{% endif %}

; --- load new filament ---
CANVAS_SELECT CHANNEL={new}
CANVAS_LOAD CHANNEL={new}

; push filament through bowden tube to hotend
{% if bowden > 0 %}
M83
G1 E{bowden} F{bow_spd}
{% endif %}

; purge to clear old material
{% if purge > 0 %}
M83
G1 E{purge} F{pur_spd}
{% endif %}

; small retract to reduce ooze
M83
G1 E-{tip} F{ret_spd}

RESTORE_GCODE_STATE NAME=canvas_tc MOVE=1 MOVE_SPEED={pk_spd / 60}

SET_GCODE_VARIABLE MACRO=_CANVAS_TOOLCHANGE VARIABLE=active_tool VALUE={new}
{% endif %}


# =====================================================================
# T0 – T3 MACROS
#
# These are called by the slicer (or manually) to switch filament.
# =====================================================================

[gcode_macro T0]
description: Select filament channel 0
gcode:
_CANVAS_TOOLCHANGE T=0

[gcode_macro T1]
description: Select filament channel 1
gcode:
_CANVAS_TOOLCHANGE T=1

[gcode_macro T2]
description: Select filament channel 2
gcode:
_CANVAS_TOOLCHANGE T=2

[gcode_macro T3]
description: Select filament channel 3
gcode:
_CANVAS_TOOLCHANGE T=3


# =====================================================================
# OPTIONAL: set the initial tool at print start so the first T command
# knows whether an unload is needed. Call from your START_PRINT macro:
#
# CANVAS_INIT_TOOL T=0
# =====================================================================

[gcode_macro CANVAS_INIT_TOOL]
description: Set the initial tool without performing a full change
gcode:
{% set t = params.T | default(0) | int %}
SET_GCODE_VARIABLE MACRO=_CANVAS_TOOLCHANGE VARIABLE=active_tool VALUE={t}
CANVAS_SELECT CHANNEL={t}
CANVAS_LOAD CHANNEL={t}
Loading
Loading