Skip to content

Commit

Permalink
WIP klicky support
Browse files Browse the repository at this point in the history
  • Loading branch information
pellcorp committed Jan 11, 2025
1 parent a51c6a7 commit 1d006dd
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 2 deletions.
47 changes: 45 additions & 2 deletions k1/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,7 @@ function setup_bltouch() {
cleanup_probe btteddy
cleanup_probe cartotouch
cleanup_probe beacon
cleanup_probe klicky

# we merge bltouch.cfg into printer.cfg so that z_offset can be set
if [ -f /usr/data/printer_data/config/bltouch.cfg ]; then
Expand Down Expand Up @@ -1050,6 +1051,7 @@ function setup_microprobe() {
cleanup_probe btteddy
cleanup_probe cartotouch
cleanup_probe beacon
cleanup_probe klicky

# we merge microprobe.cfg into printer.cfg so that z_offset can be set
if [ -f /usr/data/printer_data/config/microprobe.cfg ]; then
Expand All @@ -1073,6 +1075,39 @@ function setup_microprobe() {
return 0
}

function setup_klicky() {
grep -q "klicky-probe" /usr/data/pellcorp.done
if [ $? -ne 0 ]; then
echo
echo "INFO: Setting up klicky ..."

cleanup_probe bltouch
cleanup_probe btteddy
cleanup_probe cartotouch
cleanup_probe beacon
cleanup_probe microprobe

cp /usr/data/pellcorp/k1/klicky.cfg /usr/data/printer_data/config/ || exit $?
$CONFIG_HELPER --add-include "klicky.cfg" || exit $?

# need to add a empty probe section for baby stepping to work
$CONFIG_HELPER --add-section "probe" || exit $?

cp /usr/data/pellcorp/k1/klicky_macro.cfg /usr/data/printer_data/config/ || exit $?
$CONFIG_HELPER --add-include "klicky_macro.cfg" || exit $?

cp /usr/data/pellcorp/k1/klicky-${model}.cfg /usr/data/printer_data/config/ || exit $?
$CONFIG_HELPER --add-include "klicky-${model}.cfg" || exit $?

echo "klicky-probe" >> /usr/data/pellcorp.done
sync

# means klipper needs to be restarted
return 1
fi
return 0
}

function set_serial_cartotouch() {
local SERIAL_ID=$(ls /dev/serial/by-id/usb-Cartographer* | head -1)
if [ -n "$SERIAL_ID" ]; then
Expand Down Expand Up @@ -1100,6 +1135,7 @@ function setup_cartotouch() {
cleanup_probe microprobe
cleanup_probe btteddy
cleanup_probe beacon
cleanup_probe klicky

cp /usr/data/pellcorp/k1/cartographer.conf /usr/data/printer_data/config/ || exit $?
$CONFIG_HELPER --file moonraker.conf --add-include "cartographer.conf" || exit $?
Expand Down Expand Up @@ -1181,6 +1217,7 @@ function setup_beacon() {
cleanup_probe microprobe
cleanup_probe btteddy
cleanup_probe cartotouch
cleanup_probe klicky

cp /usr/data/pellcorp/k1/beacon.conf /usr/data/printer_data/config/ || exit $?
$CONFIG_HELPER --file moonraker.conf --add-include "beacon.conf" || exit $?
Expand Down Expand Up @@ -1269,6 +1306,7 @@ function setup_btteddy() {
cleanup_probe microprobe
cleanup_probe cartotouch
cleanup_probe beacon
cleanup_probe klicky

cp /usr/data/pellcorp/k1/btteddy.cfg /usr/data/printer_data/config/ || exit $?
$CONFIG_HELPER --add-include "btteddy.cfg" || exit $?
Expand Down Expand Up @@ -1418,6 +1456,8 @@ LOG_FILE=/usr/data/printer_data/logs/installer-$TIMESTAMP.log
probe=cartotouch
elif [ -f /usr/data/printer_data/config/beacon.cfg ]; then
probe=beacon
elif [ -f /usr/data/printer_data/config/klicky.cfg ]; then
probe=klicky
elif grep -q "\[scanner\]" /usr/data/printer_data/config/printer.cfg; then
probe=cartotouch
elif [ -f /usr/data/printer_data/config/microprobe-k1.cfg ] || [ -f /usr/data/printer_data/config/microprobe-k1m.cfg ]; then
Expand Down Expand Up @@ -1453,7 +1493,7 @@ LOG_FILE=/usr/data/printer_data/logs/installer-$TIMESTAMP.log
shift
client=$1
shift
elif [ "$1" = "microprobe" ] || [ "$1" = "bltouch" ] || [ "$1" = "beacon" ] || [ "$1" = "cartographer" ] || [ "$1" = "cartotouch" ] || [ "$1" = "btteddy" ]; then
elif [ "$1" = "microprobe" ] || [ "$1" = "bltouch" ] || [ "$1" = "beacon" ] || [ "$1" = "klicky" ] || [ "$1" = "cartographer" ] || [ "$1" = "cartotouch" ] || [ "$1" = "btteddy" ]; then
if [ "$mode" = "fix-serial" ]; then
echo "ERROR: Switching probes is not supported while trying to fix serial!"
exit 1
Expand All @@ -1472,7 +1512,7 @@ LOG_FILE=/usr/data/printer_data/logs/installer-$TIMESTAMP.log

if [ -z "$probe" ]; then
echo "ERROR: You must specify a probe you want to configure"
echo "One of: [microprobe, bltouch, cartotouch, btteddy, beacon]"
echo "One of: [microprobe, bltouch, cartotouch, btteddy, beacon, klicky]"
exit 1
fi

Expand Down Expand Up @@ -1682,6 +1722,9 @@ LOG_FILE=/usr/data/printer_data/logs/installer-$TIMESTAMP.log
elif [ "$probe" = "beacon" ]; then
setup_beacon
setup_probe_specific=$?
elif [ "$probe" = "klicky" ]; then
setup_klicky
setup_probe_specific=$?
else
echo "ERROR: Probe $probe not supported"
exit 1
Expand Down
10 changes: 10 additions & 0 deletions k1/klicky-k1.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[bed_mesh]
speed: 100
horizontal_move_z: 8
mesh_min: -3,3
mesh_max: 192,215
probe_count: 12,12
fade_start: 1.0
fade_end: 10.0
algorithm: bicubic
bicubic_tension: 0.1
10 changes: 10 additions & 0 deletions k1/klicky-k1m.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[bed_mesh]
speed: 100
horizontal_move_z: 8
mesh_min: 1.2,21.1
mesh_max: 290.2,287.1
probe_count: 10,10
fade_start: 1.0
fade_end: 10.0
algorithm: bicubic
bicubic_tension: 0.1
11 changes: 11 additions & 0 deletions k1/klicky.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[probe]
pin: ^nozzle_mcu: PA8
deactivate_on_each_sample: False
x_offset: 0.2
y_offset: 16.1
z_offset: 2
samples: 3
speed: 5
lift_speed: 20
samples_tolerance: 0.05
samples_tolerance_retries: 3
12 changes: 12 additions & 0 deletions k1/klicky_macro.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[gcode_macro BED_MESH_CALIBRATE]
rename_existing: _BED_MESH_CALIBRATE
gcode:
{% if printer["gcode_macro _SAF_BED_MESH_START"] != null %}
_SAF_BED_MESH_START
{% endif %}

_BED_MESH_CALIBRATE {rawparams}

{% if printer["gcode_macro _SAF_BED_MESH_END"] != null %}
_SAF_BED_MESH_END
{% endif %}
25 changes: 25 additions & 0 deletions k1/mounts/klicky/Default.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# TODO

-- klicky.cfg
[probe]
x_offset: 0.2
y_offset: 16.1
z_offset: 2

-- klicky-k1.cfg
[bed_mesh]
mesh_min: 1.2,21.1
mesh_max: 212.7,207.1

-- klicky-k1m.cfg
[bed_mesh]
mesh_min: 1.2,21.1
mesh_max: 290.2,287.1

-- printer-k1.cfg
[stepper_y]
position_max: 222

-- printer-k1m.cfg
[stepper_y]
position_max: 302

0 comments on commit 1d006dd

Please sign in to comment.