Compare commits

...

35 Commits
main ... dev

Author SHA1 Message Date
Zach Schimke b104ad9625 Feat: Add Andrew Ellis' TEST_SPEED macro 2023-01-09 00:44:27 -07:00
Zach Schimke 39a419abbc Feat: Add klicky probe for bed leveling 2023-01-09 00:44:27 -07:00
Zach Schimke bd93ea3324 Feat: Add object_exclusion 2023-01-09 00:44:27 -07:00
Zach Schimke 7226077419 Feat: Add mcu built-in core temp sensor 2023-01-09 00:44:27 -07:00
Zach Schimke 13c614b042 Fix: Migrate extra temp sensors to TFT header
Using Timmit's temp board.
2023-01-09 00:44:27 -07:00
Zach Schimke 942b8e9c4b Fix: Remove old ADXL def from raspi 2023-01-09 00:44:27 -07:00
Zach Schimke a169e52600 Feat: Add input shaper and ADXL 2023-01-09 00:44:27 -07:00
Zach Schimke d5b23af77a Feat: Add axdl to pi config 2023-01-09 00:44:27 -07:00
Zach Schimke d30c5500aa BREAKING CHANGE: Migrate to SKR Mini E3 V3.0 2023-01-09 00:44:27 -07:00
Zach Schimke 219f08251f typo: Add missing comma to pinout alias 2023-01-09 00:44:27 -07:00
Zach Schimke c6f1e14136 feat: Add crowsnest for webcam 2023-01-09 00:44:27 -07:00
Zach Schimke 4fb07e6b7e typo: Correct RasPi type to PI4b 2023-01-09 00:44:27 -07:00
Zach Schimke cdeb1f0dfb Feat: add processing and log path to moonraker 2023-01-09 00:44:27 -07:00
Zach Schimke cd3fa4449c chore: Update start gcode parameters
due to Klipper upstream change
2023-01-09 00:44:27 -07:00
Zach Schimke 3c6e4cc0ee chore: resync gitignore with other printers 2023-01-09 00:44:27 -07:00
Zach Schimke 37c9b7b3b3 feat: added crowsnest addon for chamber camera 2023-01-09 00:44:27 -07:00
Zach Schimke 2d8286c027 Retool of macros to remove default_parameters
Due to Klipper deprecating this function
2023-01-09 00:44:27 -07:00
Zach Schimke 325a1958a1 Retool of macros to remove default_parameters
Due to Klipper deprecating this function
2023-01-09 00:44:27 -07:00
Zach Schimke dd6fda191a Ignore any old printer-* definitions 2023-01-09 00:44:27 -07:00
Zach Schimke 215c070950 Retool of macros to remove default_parameters
Due to Klipper deprecating this function
2023-01-09 00:44:27 -07:00
Zach Schimke 58fadabec5 Convert rpi_temperature to temperature_host 2023-01-09 00:44:27 -07:00
Zach Schimke 04afdd34b8 Swap all "NTC 100k beta 3950" defs to the generic 2023-01-09 00:44:27 -07:00
Zach Schimke b5a8751c55 Add Pretty G-Code Support 2023-01-09 00:44:27 -07:00
Zach Schimke af78ebff78 Update config for newer Moonraker 2023-01-09 00:44:27 -07:00
Zach Schimke 6fde396c99 Resync z endstop offset w/ working machine 2023-01-09 00:44:27 -07:00
Zach Schimke bcb280bf9f Add pinout for new BTT SKR Mini E3 V3.0 2023-01-09 00:44:27 -07:00
Zach Schimke 6d1674fa64 Remove fake service script from moonraker update. 2023-01-09 00:44:27 -07:00
Zach Schimke a0f81a989c Keep toolhead away from bed while heating up (no dimples) 2023-01-09 00:44:27 -07:00
Zach Schimke 785e6712e2 Move toolhead to center always before bed heating 2023-01-09 00:44:27 -07:00
Zach Schimke f94785de99 Add temp sensor for z frame expansion 2023-01-09 00:44:27 -07:00
Zach Schimke b1507608b2 Also fix pause 2023-01-09 00:44:27 -07:00
Zach Schimke 31c79a3c1d Added G90/G91 wrapping G2 to avoid error. 2023-01-09 00:44:27 -07:00
Zach Schimke 26700873f6 Updated to latest moonraker 2023-01-09 00:44:27 -07:00
Zach Schimke bf9398472d Fixed STATUS_LED macros 2023-01-09 00:44:27 -07:00
Zach Schimke 6b78219c57 Attempt to revert/correct status LED based on old display code 2023-01-09 00:44:27 -07:00
21 changed files with 1293 additions and 198 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
*.log
.fluidd.json
.mainsail.json
.variables.stb
printer-*.cfg

View File

@ -5,9 +5,11 @@ Software:
- [Klipper](https://github.com/KevinOConnor/klipper)
- [Moonraker](https://github.com/Arksine/moonraker)
- [Mainsail](https://github.com/meteyou/mainsail)
- [Crowsnest](https://github.com/mainsail-crew/crowsnest)
- [PrettyGCode](https://github.com/Kragrathea/pgcode)
Hardware:
- Raspberry Pi Zero W
- Raspberry Pi 4B
- BigTreeTech SKR mini E3 V2.0 Controller
Mods/Deviations (W.R.T. Stock V0.1):
@ -18,10 +20,12 @@ Mods/Deviations (W.R.T. Stock V0.1):
- Andre's [Neopixel Front Bed Mount](https://github.com/VoronDesign/VoronUsers/tree/master/printer_mods/Andre/V0_Neopixel_Front_Bed_Mount)
- Andre's [Mini AB ADXL345 Mount](https://github.com/VoronDesign/VoronUsers/tree/master/printer_mods/Andre/Mini_Afterburner_ADXL345_Mount)
- Thiagolocatelli's [V0 Utility Belt](https://github.com/thiagolocatelli/VoronUsers/tree/master/printer_mods/DoubleT/v0_utility_belt)
- Timmit99's [V0 Ubilical](https://github.com/timmit99/Voron-Hardware/tree/V0-Umbilical/V0-Umbilical)
- Skuep's [V0 Umbilical Plus](https://github.com/skuep/V0-Umbilical-Plus) update to Timmit99's [V0 Ubilical](https://github.com/timmit99/Voron-Hardware/tree/V0-Umbilical/V0-Umbilical)
- 0ndsk4's [Nevermore Micro V4](https://github.com/0ndsk4/VoronUsers/tree/0ndsk4/printer_mods/0ndsk4/Nevermore_Air_Filter)
- Johannchung's [Raspberry Pi Camera Mount](https://github.com/VoronDesign/VoronUsers/tree/master/printer_mods/johanncc/Raspberry_Pi_Camera_Mount)
Updates:
- Added rear chamber webcam
- Serialized!
- Motion testing complete. Serial requested.
- Inital config. Build in progress.

178
bed_mesh.cfg Normal file
View File

@ -0,0 +1,178 @@
#####################################################################
# Bed Mesh Definition
#####################################################################
[bed_mesh]
speed: 100
horizontal_move_z: 20
mesh_min: 15,15
mesh_max: 105,105
algorithm: lagrange
## relative_reference_index should be the location where the
## For the center of the bed: [(7x7)-1] / 2 = position 24
probe_count: 3,3
relative_reference_index: 4
#fade_start: 1
#fade_end: 10
#fade_target: 0
move_check_distance: 3
split_delta_z: 0.0125
mesh_pps: 2,2
#bicubic_tension: 0.2
#####################################################################
# Macros
#####################################################################
[gcode_macro BED_MESH_CALIBRATE]
rename_existing: _BED_MESH_CALIBRATE
description: Perform Mesh Bed Leveling with klicky automount
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 : 2
; minimum probe count
variable_min_probe_count : 3
; scale up the probe count, should be 1.0 ~ < variable_max_probe_count/variable_min_probe_count
variable_probe_count_scale_factor : 1.0
gcode:
{% set V = printer["gcode_macro _User_Variables"].verbose %}
{% if V %}
{ action_respond_info("Bed Mesh Calibrate") }
{% endif %}
BED_MESH_CLEAR
SMARTHOME
_CheckProbe action=query
G90
Attach_Probe_Lock
SMARTQGL
{% 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 %}
{% if bedMeshConfig.probe_count.split(",")|length == 2 %}
{% set meshPointX = bedMeshConfig.probe_count.split(",")[0]|int %}
{% set meshPointY = bedMeshConfig.probe_count.split(",")[1]|int %}
{% else %}
{% set meshPointX = bedMeshConfig.probe_count.split(",")[0]|int %}
{% set meshPointY = bedMeshConfig.probe_count.split(",")[0]|int %}
{% endif %}
{% set meshMaxPointX = meshPointX %}
{% set meshMaxPointY = meshPointY %}
{% 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) * probe_count_scale_factor)|round(0)|int %}
{% if meshPointX < min_probe_count %}
{% set meshPointX = min_probe_count %}
{% endif %}
{% if meshPointX > meshMaxPointX %}
{% set meshPointX = meshMaxPointX %}
{% endif %}
{% set meshPointY = (meshPointY * (area_max_y -area_min_y ) / (safe_max_y - safe_min_y) * probe_count_scale_factor )|round(0)|int %}
{% if meshPointY < min_probe_count %}
{% set meshPointY = min_probe_count %}
{% endif %}
{% if meshPointY > meshMaxPointY %}
{% set meshPointY = meshMaxPointY %}
{% 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 %}
Dock_Probe_Unlock
## use MESH_STORE -> generate MESH and save immediately
## use MESH_STORE SAVE=false -> generate MESH and save it later
[gcode_macro MESH_STORE]
variable_save_at_end: 'false'
gcode:
# set default parameter value
{% set save = params.SAVE|default('true') %}
BED_MESH_CALIBRATE
BED_MESH_PROFILE SAVE=Voron-Bed_Temp-{printer.heater_bed.target|int}C
BED_MESH_PROFILE REMOVE=default
# Move to Middle
G90 ; set absolute
G0 Z7.5 F900 ; lift nozzle
G0 X175 Y175 Z30 F7200 ; move to middle
{% if save|lower == 'true' %}
_PRINT_AR T="MESH: Save Config!"
SAVE_CONFIG
{% else %}
_PRINT_AR T="MESH: Save Config after print done"
SET_GCODE_VARIABLE MACRO=MESH_STORE VARIABLE=save_at_end VALUE='"true"'
{% endif %}
## use MESH_LOAD -> load an existing MESH
## use MESH_LOAD AUTO=true -> load an existing MESH or generate a new one and prepare it to be saved after print end
[gcode_macro MESH_LOAD]
# set that to true to enable autogeneration of a missing mesh
gcode:
# set default parameter value
{% set auto = params.AUTO|default('false') %}
{% set bed_temp = printer.heater_bed.target|int %}
{% if printer.configfile.config["bed_mesh Voron-Bed_Temp-" + bed_temp|string + "C"] is defined %}
BED_MESH_CLEAR
BED_MESH_PROFILE LOAD=Voron-Bed_Temp-{printer.heater_bed.target|int}C
_PRINT_AR T="{"MESH: Voron-Bed_Temp-" + bed_temp|string + "C loaded"}"
{% else %}
{% if auto|lower == 'true' %}
_PRINT_AR T="{"MESH: Voron-Bed_Temp-" + bed_temp|string + "C needs to be generated"}"
MESH_STORE SAVE=false
{% else %}
_PRINT_AR T="{"MESH ERROR: Voron-Bed_Temp-" + bed_temp|string + "C not defined"}"
{% endif %}
{% endif %}
## add this to your PRINT_END to save a mesh if needed 10 seconds after print ended
## UPDATE_DELAYED_GCODE ID=_MESH_SAVE DURATION=10
[delayed_gcode _MESH_SAVE]
gcode:
{% if printer["gcode_macro MESH_STORE"].save_at_end == 'true' %}
_PRINT_AR T="MESH: Save Config!"
SAVE_CONFIG
{% endif %}

View File

@ -1,7 +1,10 @@
[bed_screws]
[screws_tilt_adjust]
screw1: 60,5
screw1_name: front screw
screw2: 5,115
screw2: 0,115
screw2_name: back left
screw3: 115,115
screw3: 100,115
screw3_name: back right
horizontal_move_z: 20
speed: 100
screw_thread: CW-M3

View File

@ -17,7 +17,6 @@ initial_WHITE: 0.1
#####################################################################
[gcode_macro _CASELIGHT]
default_parameter_COLOR: 'white'
variable_colors: { 'red': (1.0, 0.0, 0.0, 0.0),
'orange': (1.0, 0.5, 0.0, 0.0),
'yellow': (1.0, 1.0, 0.0, 0.0),
@ -39,11 +38,11 @@ variable_colors: { 'red': (1.0, 0.0, 0.0, 0.0),
variable_leds: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
gcode:
# Grab the color values
{% set tuple = colors.get(COLOR|lower, (0.0, 0.0, 0.0, 0.7)) %}
{% set R = tuple[0] %}
{% set G = tuple[1] %}
{% set B = tuple[2] %}
{% set W = tuple[3] %}
{% set RGBW = colors.get(COLOR|default('white')|lower, (0.0, 0.0, 0.0, 0.7)) %}
{% set R = RGBW[0] %}
{% set G = RGBW[1] %}
{% set B = RGBW[2] %}
{% set W = RGBW[3] %}
{action_respond_info("LED Tuple: {0}".format(tuple))}
@ -82,35 +81,53 @@ gcode:
_STATUS_LED COLOR=BLUE
[gcode_macro _STATUS_LED]
default_parameter_BLINK: 0
variable_color: 'ORANGE'
variable_color: 'GREEN'
variable_restore: 'GREEN'
variable_index: 17
variable_blink: 0
variable_blinkNext: 0
variable_blank: 1
gcode:
{% set var_color=printer["gcode_macro _STATUS_LED"].color %}
{% set var_color=printer["gcode_macro _STATUS_LED"].color %}
{% set var_restore=printer["gcode_macro _STATUS_LED"].restore %}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=blink VALUE={BLINK}
UPDATE_DELAYED_GCODE ID=_STATUS_LED_BLINK_DELAY DURATION={BLINK|float}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=blink VALUE={BLINK|default(0)}
UPDATE_DELAYED_GCODE ID=_STATUS_LED_BLINK_DELAY DURATION={BLINK|default(0)|float}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=restore VALUE='"{var_color}"'
{% if params.COLOR %}
#_SET_LEDS color={COLOR} index={var_index}
{% if params.COLOR == 'GREEN'%}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=color VALUE='"GREEN"'
SET_LED LED=neo_leds RED=0 GREEN=0.3 BLUE=0 INDEX=17 TRANSMIT=1 SYNC=0
{% elif params.COLOR == 'RED'%}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=color VALUE='"RED"'
SET_LED LED=neo_leds RED=0.5 GREEN=0 BLUE=0 INDEX=17 TRANSMIT=1 SYNC=0
{% elif params.COLOR == 'BLUE'%}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=color VALUE='"BLUE"'
SET_LED LED=neo_leds RED=0 GREEN=0 BLUE=0.5 INDEX=17 TRANSMIT=1 SYNC=0
{% else %}
#_SET_LEDS color={var_restore} index={var_index}
{% if var_restore == 'GREEN'%}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=color VALUE='"GREEN"'
SET_LED LED=neo_leds RED=0 GREEN=0.3 BLUE=0 INDEX=17 TRANSMIT=1 SYNC=0
{% elif var_restore == 'RED'%}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=color VALUE='"RED"'
SET_LED LED=neo_leds RED=0.5 GREEN=0 BLUE=0 INDEX=17 TRANSMIT=1 SYNC=0
{% elif var_restore == 'BLUE'%}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=color VALUE='"BLUE"'
SET_LED LED=neo_leds RED=0 GREEN=0 BLUE=0.5 INDEX=17 TRANSMIT=1 SYNC=0
{% endif %}
{% endif %}
[delayed_gcode _STATUS_LED_BLINK_DELAY]
gcode:
{% set var_color=printer["gcode_macro _STATUS_LED"].color %}
{% if printer["gcode_macro _STATUS_LED"].blinkNext|int == 0 %}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=blinkNext VALUE=1
STATUS_LED color={COLOR}
{% if printer["gcode_macro _STATUS_LED_BLINK_DELAY"].blank == 1 %}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=blank VALUE=0
SET_LED LED=neo_leds RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=17 TRANSMIT=1 SYNC=0
{% else %}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=blinkNext VALUE=0
_STATUS_LED color='off'
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=blank VALUE=1
{% if var_color == 'GREEN'%}
SET_LED LED=neo_leds RED=0.0 GREEN=0.3 BLUE=0.0 INDEX=17 TRANSMIT=1 SYNC=0
{% elif var_color == 'RED'%}
SET_LED LED=neo_leds RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=17 TRANSMIT=1 SYNC=0
{% elif var_color == 'BLUE'%}
SET_LED LED=neo_leds RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=17 TRANSMIT=1 SYNC=0
{% endif %}
{% endif %}
UPDATE_DELAYED_GCODE ID=_BLINK_DELAY DURATION={printer["gcode_macro _STATUS_LED"].blink|float}
UPDATE_DELAYED_GCODE ID=_STATUS_LED_BLINK_DELAY DURATION={printer["gcode_macro _STATUS_LED"].blink|float}

34
crowsnest.conf Normal file
View File

@ -0,0 +1,34 @@
#### crowsnest.conf
#### This is mainsail / MainsailOS default config.
#### See:
#### https://github.com/mainsail-crew/crowsnest/blob/master/README.md
#### for details to configure to your needs.
#####################################################################
#### #####
#### Information about ports and according URL's #####
#### #####
#####################################################################
#### #####
#### Port 8080 equals /webcam/?action=[stream/snapshot] #####
#### Port 8081 equals /webcam2/?action=[stream/snapshot] #####
#### Port 8082 equals /webcam3/?action=[stream/snapshot] #####
#### Port 8083 equals /webcam4/?action=[stream/snapshot] #####
#### #####
#####################################################################
[crowsnest]
log_path: /tmp/crowsnest.log # Default logfile in ~/klipper_logs/crowsnest.log
log_level: quiet # Valid Options are quiet/verbose/debug
delete_log: false # Deletes log on every restart, if set to true
[cam raspicam]
mode: mjpg # mjpg/rtsp
port: 8080 # Port
device: /dev/video0 # See Log for available ...
resolution:1920x1080 # widthxheight format
max_fps: 30 # If Hardware Supports this it will be forced, ohterwise ignored/coerced.
#custom_flags: # You can run the Stream Services with custom flags.
#v4l2ctl: # Add v4l2-ctl parameters to setup your camera, see Log what your cam is capable of.

51
exclude_object.cfg Normal file
View File

@ -0,0 +1,51 @@
# Cancel object (aka Marlin/RRF M486 commands) support
#
# Enable object exclusion
[exclude_object]
[gcode_macro M486]
gcode:
# Parameters known to M486 are as follows:
# [C<flag>] Cancel the current object
# [P<index>] Cancel the object with the given index
# [S<index>] Set the index of the current object.
# If the object with the given index has been canceled, this will cause
# the firmware to skip to the next object. The value -1 is used to
# indicate something that isnt an object and shouldnt be skipped.
# [T<count>] Reset the state and set the number of objects
# [U<index>] Un-cancel the object with the given index. This command will be
# ignored if the object has already been skipped
{% if 'exclude_object' not in printer %}
{action_raise_error("[exclude_object] is not enabled")}
{% endif %}
{% if 'T' in params %}
EXCLUDE_OBJECT RESET=1
{% for i in range(params.T | int) %}
EXCLUDE_OBJECT_DEFINE NAME={i}
{% endfor %}
{% endif %}
{% if 'C' in params %}
EXCLUDE_OBJECT CURRENT=1
{% endif %}
{% if 'P' in params %}
EXCLUDE_OBJECT NAME={params.P}
{% endif %}
{% if 'S' in params %}
{% if params.S == '-1' %}
{% if printer.exclude_object.current_object %}
EXCLUDE_OBJECT_END NAME={printer.exclude_object.current_object}
{% endif %}
{% else %}
EXCLUDE_OBJECT_START NAME={params.S}
{% endif %}
{% endif %}
{% if 'U' in params %}
EXCLUDE_OBJECT RESET=1 NAME={params.U}
{% endif %}

View File

@ -18,8 +18,6 @@ gcode:
{% endif %}
[gcode_macro _SET_ACC]
default_parameter_VAL: RUN
default_parameter_HOMING_ACCEL: 500
variable_accel: 0
variable_accel_to_decel: 0
variable_last_val: 'RUN'
@ -28,7 +26,7 @@ gcode:
# store old values and apply home value
SET_GCODE_VARIABLE MACRO=_SET_ACC VARIABLE=accel VALUE={printer.toolhead.max_accel}
SET_GCODE_VARIABLE MACRO=_SET_ACC VARIABLE=accel_to_decel VALUE={printer.toolhead.max_accel_to_decel}
{% set accel = HOMING_ACCEL %}
{% set accel = HOMING_ACCEL|default(500) %}
{% set accel_to_decel = HOMING_ACCEL %}
{% elif VAL == 'CONFIG' %}
# set all to config values

View File

@ -1,26 +1,21 @@
## Input Shaping
[input_shaper]
shaper_freq_x: 35
shaper_freq_y: 149.8
shaper_type_x: zv
shaper_type_y: zv
#[input_shaper]
#shaper_freq_x: 35
#shaper_freq_y: 149.8
#shaper_type_x: zv
#shaper_type_y: zv
[adxl345]
cs_pin: rpi:None
axes_map: z,y,x
spi_bus: spi1
#spi_software_sclk_pin: SPI1-SCK
#spi_software_mosi_pin: SPI1-MOSI
#spi_software_miso_pin: SPI1-MISO
cs_pin: PD9 #SPI1-CS
[resonance_tester]
accel_chip: adxl345
probe_points:
50,50,20
50,300,20
300 ,50,20
300,300,20
175,175,20 # Dead Center
min_freq: 5
max_freq: 120
accel_per_hz: 75
hz_per_sec: 1
60,60,20 # Dead Center
#####################################################################
@ -54,41 +49,41 @@ gcode:
G1 X{ midx - 25 } Y{ midy } Z20
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=3200 OUTPUT=/tmp/accel-x-input-shaper.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=3200 OUTPUT=/tmp/accel-x-input-shaper.csv
G1 X{ midx + 25 } Y{ midy } F6000
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=0 OUTPUT=/tmp/accel-x-input-shaper.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=0 OUTPUT=/tmp/accel-x-input-shaper.csv
#Y Vibration - With Input Shaper
G1 X{ midx } Y{ midy - 25 } Z20
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=3200 OUTPUT=/tmp/accel-y-input-shaper.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=3200 OUTPUT=/tmp/accel-y-input-shaper.csv
G1 X{ midx } Y{ midy + 25 } F6000
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=0 OUTPUT=/tmp/accel-y-input-shaper.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=0 OUTPUT=/tmp/accel-y-input-shaper.csv
#B Vibration - With Input Shaper
G1 X{ midx - 25 } Y{ midy - 25 } Z20
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=3200 OUTPUT=/tmp/accel-b-input-shaper.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=3200 OUTPUT=/tmp/accel-b-input-shaper.csv
G1 X{ midx + 25 } Y{ midy + 25 } F6000
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=0 OUTPUT=/tmp/accel-b-input-shaper.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=0 OUTPUT=/tmp/accel-b-input-shaper.csv
#A Vibration - With Input Shaper
G1 X{ midx + 25 } Y{ midy - 25 } Z20
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=3200 OUTPUT=/tmp/accel-a-input-shaper.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=3200 OUTPUT=/tmp/accel-a-input-shaper.csv
G1 X{ midx - 25 } Y{ midy + 25 } F6000
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=0 OUTPUT=/tmp/accel-a-input-shaper.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=0 OUTPUT=/tmp/accel-a-input-shaper.csv
SET_INPUT_SHAPER SHAPER_FREQ_X=0 SHAPER_FREQ_Y=0
@ -96,41 +91,41 @@ gcode:
G1 X{ midx - 25 } Y{ midy } Z20
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=3200 OUTPUT=/tmp/accel-x-stock.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=3200 OUTPUT=/tmp/accel-x-stock.csv
G1 X{ midx + 25 } Y{ midy } F6000
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=0 OUTPUT=/tmp/accel-x-stock.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=0 OUTPUT=/tmp/accel-x-stock.csv
#Y Vibration - Stock
G1 X{ midx } Y{ midy - 25 } Z20
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=3200 OUTPUT=/tmp/accel-y-stock.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=3200 OUTPUT=/tmp/accel-y-stock.csv
G1 X{ midx } Y{ midy + 25 } F6000
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=0 OUTPUT=/tmp/accel-y-stock.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=0 OUTPUT=/tmp/accel-y-stock.csv
#B Vibration - Stock
G1 X{ midx - 25 } Y{ midy - 25 } Z20
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=3200 OUTPUT=/tmp/accel-b-stock.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=3200 OUTPUT=/tmp/accel-b-stock.csv
G1 X{ midx + 25 } Y{ midy + 25 } F6000
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=0 OUTPUT=/tmp/accel-b-stock.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=0 OUTPUT=/tmp/accel-b-stock.csv
#A Vibration - Stock
G1 X{ midx + 25 } Y{ midy - 25 } Z20
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=3200 OUTPUT=/tmp/accel-a-stock.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=3200 OUTPUT=/tmp/accel-a-stock.csv
G1 X{ midx - 25 } Y{ midy + 25 } F6000
M400
G4 P300
ACCELEROMETER_MEASURE CHIP=rpiaccel RATE=0 OUTPUT=/tmp/accel-a-stock.csv
ACCELEROMETER_MEASURE CHIP=adxl345 RATE=0 OUTPUT=/tmp/accel-a-stock.csv
# Restore user's input shaper frequency parameters
SET_INPUT_SHAPER SHAPER_FREQ_X={ initShapeX } SHAPER_FREQ_Y={ initShapeY }

View File

@ -3,7 +3,7 @@
## SKR Minie E3 V2.0 Controller
## TMC2209 (UART mode) Drivers
[include pinouts.d/btt-skr-mini-e3-v2.0.cfg]
[include pinouts.d/btt-skr-mini-e3-v3.0.cfg]
[printer]
kinematics: corexy
@ -23,7 +23,7 @@ square_corner_velocity: 6.0
#####################################################################
[mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32f103xe_38FFD6055641343425641143-if00
serial: /dev/serial/by-id/usb-Klipper_stm32g0b1xx_28000D000D50345033313820-if00
restart_method: command
@ -97,7 +97,7 @@ rotation_distance: 40
gear_ratio: 80:20
microsteps: 16
endstop_pin: E0_STOP
endstop_pin: Z_STOP
#position_endstop: -0.10
position_max: 117
position_min: -1.5
@ -205,20 +205,38 @@ kick_start_time: 0.5
off_below: 0.13
cycle_time: 0.010
## Nevermore Micro filter
[fan_generic filter]
pin: FAN2
max_power: 1.0
kick_start_time: 0.5
off_below: 0.10
#####################################################################
# Other Sensors
#####################################################################
## Chamber Temp Sensor - TFT RX
[temperature_sensor chamber]
sensor_type: NTC 100K beta 3950
sensor_pin: Z_STOP
pullup_resistor: 10000
inline_resistor: 100
sensor_type: Generic 3950
sensor_pin: PA3
min_temp: 0
max_temp: 100
gcode_id: C
## Z Extrusion Expansion Sensor - TFT TX
[temperature_sensor frame]
sensor_type: Generic 3950
sensor_pin: PA2
min_temp: 0
max_temp: 100
## MCU Core Temp Sensor - Built-in
[temperature_sensor mcu]
sensor_type: temperature_mcu
sensor_mcu: mcu
#####################################################################
# Advanced Features

107
macros.d/TEST_SPEED.cfg Normal file
View File

@ -0,0 +1,107 @@
# Home, get position, throw around toolhead, home again.
# If MCU stepper positions (first line in GET_POSITION) are greater than a full step different (your number of microsteps), then skipping occured.
# We only measure to a full step to accomodate for endstop variance.
# Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10
[gcode_macro TEST_SPEED]
gcode:
# Speed
{% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %}
# Iterations
{% set iterations = params.ITERATIONS|default(5)|int %}
# Acceleration
{% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %}
# Bounding inset for large pattern (helps prevent slamming the toolhead into the sides after small skips, and helps to account for machines with imperfectly set dimensions)
{% set bound = params.BOUND|default(20)|int %}
# Size for small pattern box
{% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %}
# Large pattern
# Max positions, inset by BOUND
{% set x_min = printer.toolhead.axis_minimum.x + bound %}
{% set x_max = printer.toolhead.axis_maximum.x - bound %}
{% set y_min = printer.toolhead.axis_minimum.y + bound %}
{% set y_max = printer.toolhead.axis_maximum.y - bound %}
# Small pattern at center
# Find X/Y center point
{% set x_center = (printer.toolhead.axis_minimum.x|float + printer.toolhead.axis_maximum.x|float ) / 2 %}
{% set y_center = (printer.toolhead.axis_minimum.y|float + printer.toolhead.axis_maximum.y|float ) / 2 %}
# Set small pattern box around center point
{% set x_center_min = x_center - (smallpatternsize/2) %}
{% set x_center_max = x_center + (smallpatternsize/2) %}
{% set y_center_min = y_center - (smallpatternsize/2) %}
{% set y_center_max = y_center + (smallpatternsize/2) %}
# Save current gcode state (absolute/relative, etc)
SAVE_GCODE_STATE NAME=TEST_SPEED
# Output parameters to g-code terminal
{ action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) }
# Home and get position for comparison later:
G28
# QGL if not already QGLd (only if QGL section exists in config)
{% if printer.configfile.settings.quad_gantry_level %}
{% if printer.quad_gantry_level.applied == False %}
QUAD_GANTRY_LEVEL
G28 Z
{% endif %}
{% endif %}
G90
G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60}
G4 P1000
GET_POSITION
# Go to starting position
G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60}
# Set new limits
SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2}
{% for i in range(iterations) %}
# Large pattern
# Diagonals
G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_max} Y{y_max} F{speed*60}
G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}
G0 X{x_min} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}
# Box
G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_min} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}
# Small pattern
# Small diagonals
G0 X{x_center_min} Y{y_center_min} F{speed*60}
G0 X{x_center_max} Y{y_center_max} F{speed*60}
G0 X{x_center_min} Y{y_center_min} F{speed*60}
G0 X{x_center_max} 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_min} F{speed*60}
# Small box
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}
G0 X{x_center_max} Y{y_center_min} F{speed*60}
{% endfor %}
# Restore max speed/accel/accel_to_decel to their configured values
SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel}
# Re-home and get position again for comparison:
G28
# Go to XY home positions (in case your homing override leaves it elsewhere)
G90
G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60}
G4 P1000
GET_POSITION
# Restore previous gcode state (absolute/relative, etc)
RESTORE_GCODE_STATE NAME=TEST_SPEED

View File

@ -23,35 +23,19 @@ gcode:
[gcode_macro _SET_Z_CURRENT]
default_parameter_VAL: RUN
variable_last_val: 'RUN'
gcode:
{% if VAL == 'HOME' %}
{% set z_run = 0.3 %}
{% set z1_run = 0.3 %}
{% set z2_run = 0.3 %}
{% set z3_run = 0.3 %}
{% set z_hold = 0.3 %}
{% set z1_hold = 0.3 %}
{% set z2_hold = 0.3 %}
{% set z3_hold = 0.3 %}
{% else %}
{% set z_run = printer.configfile.settings["tmc2209 stepper_z"]["run_current"] %}
{% set z1_run = printer.configfile.settings["tmc2209 stepper_z1"]["run_current"] %}
{% set z2_run = printer.configfile.settings["tmc2209 stepper_z2"]["run_current"] %}
{% set z3_run = printer.configfile.settings["tmc2209 stepper_z3"]["run_current"] %}
{% set z_hold = printer.configfile.settings["tmc2209 stepper_z"]["hold_current"] %}
{% set z1_hold = printer.configfile.settings["tmc2209 stepper_z1"]["hold_current"] %}
{% set z2_hold = printer.configfile.settings["tmc2209 stepper_z2"]["hold_current"] %}
{% set z3_hold = printer.configfile.settings["tmc2209 stepper_z3"]["hold_current"] %}
{% endif %}
{% if VAL != printer["gcode_macro _SET_Z_CURRENT"].last_val|string %}
SET_GCODE_VARIABLE MACRO=_SET_Z_CURRENT VARIABLE=last_val VALUE='"{VAL}"'
{action_respond_info("Home&Probe: RunCur %.2f HoldCur %.2f" % (z_run|float, z_hold|float))}
SET_TMC_CURRENT STEPPER=stepper_z CURRENT={z_run} HOLDCURRENT={z_hold}
SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={z1_run} HOLDCURRENT={z1_hold}
SET_TMC_CURRENT STEPPER=stepper_z2 CURRENT={z2_run} HOLDCURRENT={z2_hold}
SET_TMC_CURRENT STEPPER=stepper_z3 CURRENT={z3_run} HOLDCURRENT={z3_hold}
M400
{% endif %}

View File

@ -55,20 +55,8 @@ gcode:
## Filament Change
[gcode_macro M600]
default_parameter_X: 50
default_parameter_Y: 0
default_parameter_Z: 10
gcode:
M117 Filament Change
SAVE_GCODE_STATE NAME=filament_change
PAUSE
G91 # relative
G1 E-1 F300 # retract 1
M125 # park
M702 # unload
M0 Click when filament inserted
M701 # load
RESTORE_GCODE_STATE NAME=filament_change
## TMC Debugging
@ -104,10 +92,9 @@ gcode:
## Wait for Chamber Temperature
[gcode_macro M191]
default_parameter_R: 30
default_parameter_S: 30
gcode:
TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={S}
{% set MIN = params.S|default(30) %}
TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={MIN}
# M201 - Set Print Max Acceleration
[gcode_macro M201]

View File

@ -24,15 +24,16 @@ gcode:
# Start preheating the bed
M117 Heating bed
_STATUS_LED COLOR=RED BLINK=1
M140 S{T_BED}
M140 S{params.T_BED}
# Perform a G28 'home' (if needed)
SMARTHOME
G0 X{mid_x} Y{mid_y} Z10 F20000
# Check to see if we need more time preheating the bed, if so
{% if printer.heater_bed.temperature < params.T_BED|float*0.85 %}
M117 Heating bed to 85%
G0 X{mid_x} Y{mid_y} Z10 F20000
M106
M190 S{params.T_BED|float*0.85}
{% endif %}
@ -41,15 +42,14 @@ gcode:
{% if printer.extruder.temperature < params.T_EXTRUDER|float*0.75 %}
M104 S{params.T_EXTRUDER|float*0.75}
{% endif %}
M190 S{T_BED}
M190 S{params.T_BED}
M107
# Move the nozzle near the bed
G0 X0 Y{max_y} Z2.0 F20000
G0 Z0.2 F20000
M117 Heating toolhead
M109 S{T_EXTRUDER}
M109 S{params.T_EXTRUDER}
# Prime line
_STATUS_LED COLOR=GREEN BLINK=1
@ -75,7 +75,9 @@ gcode:
G1 E-2.0 F3600 ; retract 2mm of filament at 60mm/s
G91 ; relative positioning
G1 X1 F20000 ; move 1mm to the side at 333mm/sec
G90 ; absolute positioning (avoid G2 in rel mode erroring out)
G2 E0 I-1 ; do a no extrusion circle move with a 0.5mm radius centered on orig
G91 ; relative positioning (avoid G2 in rel mode erroring out)
G1 Z5.00 F3000 ; move up by 5mm @ 50mm/sec to clear the print
G90 ; absolute positioning

View File

@ -1,9 +1,12 @@
[server]
host: 0.0.0.0
[file_manager]
config_path: ~/config
log_path: /tmp
enable_object_processing: True
[authorization]
enabled: true
trusted_clients:
10.10.10.0/24
10.10.9.0/24
@ -14,7 +17,6 @@ trusted_clients:
[octoprint_compat]
[update_manager]
distro: debian
enable_auto_refresh: True
[update_manager client mainsail]
@ -28,4 +30,16 @@ type: git_repo
path: ~/config
origin: https://github.com/retsamedoc/VoronV0_klipper.git
primary_branch:main
install_script: scripts/install.sh
is_system_service: False
[update_manager crowsnest]
type: git_repo
path: ~/crowsnest
origin: https://github.com/mainsail-crew/crowsnest.git
[update_manager client PrettyGCode]
type: git_repo
path: ~/pgcode
origin: https://github.com/Kragrathea/pgcode.git
primary_branch: main
is_system_service: False

2
pi.cfg
View File

@ -3,6 +3,6 @@ serial: /tmp/klipper_host_mcu
## Rasberry Pi CPU Temperature
[temperature_sensor cpu]
sensor_type: rpi_temperature
sensor_type: temperature_host
min_temp: 0
max_temp: 85

View File

@ -0,0 +1,49 @@
#This file contains common pin mappings for the BigTreeTech SKR 2.
# To use this config, the firmware should be compiled for the
# STM32F407 with a "32KiB bootloader".
# The "make flash" command does not work on the SKR 2. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a
# file named "firmware.bin" on an SD card and then restart the SKR 2
# with that SD card.
# See docs/Config_Reference.md for a description of parameters.
[board_pins]
aliases:
# BLTouch (Servo/Probe)
SERVO0=PA1,
PROBE=PC14,
# Power Controls
PS_ON=PC13,
PWE_DCT=PC12,
# RGB
RGB=PA8,
# Limit Switches
X_STOP=PC0,
Y_STOP=PC1,
Z_STOP=PC2,
E0_STOP=PC15,
# Steppers
RX=PC11, TX=PC10,
X_STEP=PB13, X_DIR=PB12, X_ENABLE=PB14,
Y_STEP=PB10, Y_DIR=PB2, Y_ENABLE=PB11,
Z_STEP=PB0, Z_DIR=PC5, Z_ENABLE=PB1,
E0_STEP=PB3, E0_DIR=PB4, E0_ENABLE=PD1,
TEMP_0=PA0,
TEMP_BED=PC4,
FAN=PC6,
FAN1=PC7,
FAN2=PB15,
HEAT_0=PC8,
HEAT_BED=PC9,
# EXP1 header
EXP1_1=PB5, EXP1_3=PA9, EXP1_5=PA10, EXP1_7=PB8, EXP1_9=<GND>,
EXP1_2=PA15, EXP1_4=<RST>, EXP1_6=PB9, EXP1_8=PD6, EXP1_10=<5V>

View File

@ -8,6 +8,11 @@
[include machine.cfg]
[include pi.cfg]
#####################################################################
# Bed/Gantry Leveling Probe
#####################################################################
[include probe.cfg]
#####################################################################
# Macros
#####################################################################
@ -23,11 +28,16 @@
#####################################################################
[include homing.cfg]
#####################################################################
# Bed Mesh
#####################################################################
[include bed_mesh.cfg]
#####################################################################
# Calibration
#####################################################################
[include bed_screws.cfg]
#[include input_shaper.cfg]
[include input_shaper.cfg]
#####################################################################
# Display
@ -48,13 +58,13 @@
# Other
#####################################################################
[include other.cfg]
[include exclude_object.cfg]
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [stepper_z]
#*# position_endstop = -0.250
#*# position_endstop = 0.300
#*#
#*# [extruder]
#*# control = pid

717
probe.cfg Normal file
View File

@ -0,0 +1,717 @@
####################################################################
# Probe
#####################################################################
[probe]
## Klicky Probe
## This probe is not used for Z height, only bed leveling
pin: PWE_DCT
x_offset: 9.5
y_offset: 0
z_offset: 14.5
speed: 4
lift_speed: 15
samples: 3
samples_result: median
sample_retract_dist: 2
samples_tolerance: 0.01
samples_tolerance_retries: 10
drop_first_result: true
#####################################################################
# Menu
#####################################################################
#####################################################################
# Macros
#####################################################################
# This macro was provided by discord user Garrettwp to whom i give my thanks for sharing it with me.
# I have tweaked it a lot.
#
# this macro is based on the great Annex magprobe dockable probe macros "#Originally developed by Mental, modified for better use on K-series printers by RyanG and Trails"
# that macro can be found here https://github.com/Annex-Engineering/Annex-Engineering_Other_Printer_Mods/blob/master/All_Printers/Microswitch_Probe/Klipper_Macros/dockable_probe_macros.cfg
#
# by standing on the shoulders of giants, lets see if we can see further
# Klicky-probe.cfg version 16-11-2021 01
[gcode_macro _User_Variables]
variable_verbose: True # Enable verbose output
variable_debug: False # Enable Debug output
variable_travel_speed: 100 # how fast all other travel moves will be performed when running these macros
variable_move_accel: 1000 # how fast should the toolhead accelerate when moving
variable_dock_speed: 50 # how fast should the toolhead move when docking the probe for the final movement
variable_release_speed: 55 # how fast should the toolhead move to release the hold of the magnets after docking
variable_z_drop_speed: 20 # how fast the z will lower when moving to the z location to clear the probe
variable_safe_z: 20 # Minimum Z for attach/dock and homing functions
# if true it will move the bed away from the nozzle when Z is not homed
variable_enable_z_hop: True # set this to false for beds that fall significantly under gravity (almost to Z max)
variable_max_bed_y: 120 # maximum Bed size avoids doing a probe_accuracy outside the bed
variable_max_bed_x: 120 # maximum Bed size avoids doing a probe_accuracy outside the bed
# if a separate Z endstop switch is in
# use, specify the coordinates of the switch here (Voron).
# Set to 0 to have the probe move to center of bed
variable_z_endstop_x: 0
variable_z_endstop_y: 0
#Check the printer specific documentation on klipper Dock/Undock configuration, these are dummy values
#dock location
variable_docklocation_x: 120 # X Dock position
variable_docklocation_y: 0 # Y Dock position
variable_docklocation_z: 10 # Z dock position, (-128 for a gantry mount)
#The following variables are used if the dock is deployed and retracted via a servo motor
variable_enable_dock_servo: False # Set to true if your klicky dock is servo-controlled
variable_servo_name: 'NAME' # The name of the dock servo defined in printer.cfg under [servo]
variable_servo_deploy: 10 # This EXAMPLE is the value used to deploy the servo fully
variable_servo_retract: 11 # This EXAMPLE is the value used to retract the servo fully (initial_angle in [servo] config)
variable_servo_delay: 1000 # This is a delay to wait the servo to reach the requested position, be carefull with high values
#Dock move, final toolhead movement to release the probe on the dock
#it's a relative move
Variable_dockmove_x: 0
Variable_dockmove_y: 40
Variable_dockmove_z: 0
#Attach move. final toolhead movement to attach the probe on the mount
#it's a relative move
Variable_attachmove_x: 30 # Toolhead movement necessary to clear the dock arms
Variable_attachmove_y: 0
Variable_attachmove_z: 0
#Umbilical to help untangle the umbilical in difficult situations
variable_umbilical: False # should we untangle the umbilical
variable_umbilical_x: 15 # X umbilical position
variable_umbilical_y: 15 # Y umbilical position
# location to park the toolhead
variable_park_toolhead: False # Enable toolhead parking
variable_parkposition_x: 125
variable_parkposition_y: 125
variable_parkposition_z: 30
variable_version: 1 # Helps users to update the necessary variables, do not update if the variables above are not updated
#Below this remark, you normally do not need to configure
#Attach move2
Variable_attachmove2_x: 0 # intermediate toolhead movement to attach
Variable_attachmove2_y: 0 # the probe on the dock
Variable_attachmove2_z: 0 # (can be negative)
variable_home_backoff: 10 # how many mm to move away from the endstop after homing
variable_override_homing: '' # configures what axis to home first
# '' = default klicky behavior (tries to avoid the hitting the dock
# 'X' = forces X to home first
# 'Y' = forces Y to home first
# Do not modify below
gcode:
{% set Mx = printer['configfile'].config["stepper_x"]["position_max"]|float %}
{% set My = printer['configfile'].config["stepper_y"]["position_max"]|float %}
{% set Ox = printer['configfile'].config["probe"]["x_offset"]|float %}
{% set Oy = printer['configfile'].config["probe"]["y_offset"]|float %}
{% set Oz = printer['configfile'].config["probe"]["z_offset"]|float %}
# If x, y coordinates are set for z endstop, assign them
{% if z_endstop_x != 0 or z_endstop_y != 0 %}
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_x VALUE={ z_endstop_x }
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_y VALUE={ z_endstop_y }
# if no x, y coordinates for z endstop, assume probe is endstop and move toolhead to center of bed
{% else %}
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_x VALUE={ (Mx * 0.5) - Ox }
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_y VALUE={ (My * 0.5) - Oy }
{% endif %}
[gcode_macro _Probe_Variables]
variable_probe_attached: False
variable_probe_state: False
variable_probe_lock: False
variable_z_endstop_x: 0
variable_z_endstop_y: 0
gcode:
#checks if the variable definitions are up to date
[gcode_macro _klicky_check_variables_version]
gcode:
{% set version = printer["gcode_macro _User_Variables"].version|default(0) %}
{% if version != 1 %}
{ action_raise_error("Please update your klicky variables, there are some functionality changes") }
{% endif %}
[gcode_macro _KlickyDebug]
gcode:
{% set message = params.MSG %}
{% set debug = printer["gcode_macro _User_Variables"].debug|default(False) %}
{% if debug %}
{ action_respond_info(message) }
{% endif %}
[gcode_macro _exit_point]
gcode:
{% set function = 'pre_' ~ params.FUNCTION %}
{% set move = params.MOVE|default(0) %}i
{% set speed = printer["gcode_macro _User_Variables"].travel_speed %}
# mandatory to save the new safe position
M400
RESTORE_GCODE_STATE NAME={function} MOVE={move}
SET_VELOCITY_LIMIT ACCEL={printer.configfile.settings.printer.max_accel}
SET_VELOCITY_LIMIT ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel}
RESTORE_GCODE_STATE NAME={function} MOVE={move} MOVE_SPEED={speed}
[gcode_macro _entry_point]
gcode:
{% set function = 'pre_' ~ params.FUNCTION %}
{% set move_accel = printer["gcode_macro _User_Variables"].move_accel|default(1000) %}
# mandatory to save the new safe position
M400
SAVE_GCODE_STATE NAME={function}
# removes the Z offset for better bed based docking
SET_GCODE_OFFSET Z=0
# all the macros initially assume absolute positioning
G90
# set a safe(sane) Acceleration
SET_VELOCITY_LIMIT ACCEL={move_accel}
[gcode_macro _Homing_Variables]
gcode:
{% set reset = params.RESET|default(0) %}
{% if reset %}
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ False }
{% endif %}
# Attach probe and lock it
[gcode_macro Attach_Probe_Lock]
description: Attaches Klicky Probe, can only be docked after unlocking
gcode:
Attach_Probe
_Probe_Lock
# Dock probe and lock it
[gcode_macro Dock_Probe_Unlock]
description: Docks Klicky Probe even if it was locked
gcode:
_Probe_Unlock
Dock_Probe
# Unlock Probe
[gcode_macro Probe_Unlock]
description: Unlocks Klicky Probe state
gcode:
_KlickyDebug msg="_Probe_Lock setting probe_lock variable to False"
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ False }
# Lock Probe
[gcode_macro Probe_Lock]
description: Locks Klicky Probe state
gcode:
_KlickyDebug msg="_Probe_Lock setting probe_lock variable to True"
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ True }
# Klicky Dock Servo Deploy
[gcode_macro _DeployKlickyDock]
description: Deploys Klicky servo-controlled dock
gcode:
{% set enable_dock_servo = printer["gcode_macro _User_Variables"].enable_dock_servo|default(False) %}
{% set servo_delay = printer["gcode_macro _User_Variables"].servo_delay|default(1000) %}
{% set servo_name = printer["gcode_macro _User_Variables"].servo_name %}
{% set servo_deploy = printer["gcode_macro _User_Variables"].servo_deploy|default(360) %}
#wait for all the moves to complete
M400
{% if enable_dock_servo != False %}
_KlickyDebug msg="_DeployKlickyDock Klicky servo configuration enabled"
{% if servo_deploy == 360 %}
{ action_raise_error("Klicky: servo active on klicky-variables, but no servo deploy angle specified") }
{% endif %}
_KlickyDebug msg="_DeployKlickyDock SET_SERVO SERVO={servo_name|string} ANGLE={servo_deploy|int}"
SET_SERVO SERVO={servo_name|string} ANGLE={servo_deploy|int}
M400
G4 P{servo_delay|int}
_KlickyDebug msg="_DeployKlickyDock SET_SERVO SERVO={servo_name|string} WIDTH=0"
SET_SERVO SERVO={servo_name|string} WIDTH=0
{% elif printer["gcode_macro _DeployDock"] is defined %}
_KlickyDebug msg="_DeployKlickyDock calling _DeployDock"
_DeployDock
{% endif %}
# Dock Servo Retract
[gcode_macro _RetractKlickyDock]
description: Retracts Klicky servo-controlled dock
gcode:
{% set enable_dock_servo = printer["gcode_macro _User_Variables"].enable_dock_servo|default(False) %}
{% set servo_delay = printer["gcode_macro _User_Variables"].servo_delay|default(1000) %}
{% set servo_name = printer["gcode_macro _User_Variables"].servo_name %}
{% set servo_retract = printer["gcode_macro _User_Variables"].servo_retract|default(360) %}
#wait for all the moves to complete
M400
{% if enable_dock_servo != False %}
_KlickyDebug msg="_RetractKlickyDock Klicky servo configuration enabled"
{% if servo_retract == 360 %}
{ action_raise_error("Klicky: servo active on klicky-variables, but no servo retract angle specified") }
{% endif %}
_KlickyDebug msg="_RetractKlickyDock SET_SERVO SERVO={servo_name|string} ANGLE={servo_retract|int}"
SET_SERVO SERVO={servo_name|string} ANGLE={servo_retract|int}
M400
G4 P{servo_delay|int}
_KlickyDebug msg="_RetractKlickyDock SET_SERVO SERVO={servo_name|string} WIDTH=0"
SET_SERVO SERVO={servo_name|string} WIDTH=0
{% elif printer["gcode_macro _RetractDock"] is defined %}
_KlickyDebug msg="_RetractKlickyDock calling _RetractDock"
_RetractDock
{% endif %}
# Attach Probe Routine
[gcode_macro Attach_Probe]
description: Attaches Klicky Probe
gcode:
# See if the position should be restored after the attach
{% set goback = params.BACK|default(0) %}
# Get probe attach status
{% set probe_attached = printer["gcode_macro _Probe_Variables"].probe_attached %}
{% set probe_lock = printer["gcode_macro _Probe_Variables"].probe_lock %}
{% set verbose = printer["gcode_macro _User_Variables"].verbose %}
# Get Docking location
{% set dockmove_x = printer["gcode_macro _User_Variables"].dockmove_x|default(0) %}
{% set dockmove_y = printer["gcode_macro _User_Variables"].dockmove_y|default(0) %}
{% set dockmove_z = printer["gcode_macro _User_Variables"].dockmove_z|default(0) %}
{% set docklocation_x = printer["gcode_macro _User_Variables"].docklocation_x %}
{% set docklocation_y = printer["gcode_macro _User_Variables"].docklocation_y %}
{% set docklocation_z = printer["gcode_macro _User_Variables"].docklocation_z %}
{% set attachmove_x = printer["gcode_macro _User_Variables"].attachmove_x|default(0) %}
{% set attachmove_y = printer["gcode_macro _User_Variables"].attachmove_y|default(0) %}
{% set attachmove_z = printer["gcode_macro _User_Variables"].attachmove_z|default(0) %}
{% set attachmove2_x = printer["gcode_macro _User_Variables"].attachmove2_x|default(0) %}
{% set attachmove2_y = printer["gcode_macro _User_Variables"].attachmove2_y|default(0) %}
{% set attachmove2_z = printer["gcode_macro _User_Variables"].attachmove2_z|default(0) %}
# Safe Z for travel
{% set safe_z = printer["gcode_macro _User_Variables"].safe_z %}
{% set enable_z_hop = printer["gcode_macro _User_Variables"].enable_z_hop %}
# Set speed
{% set travel_feedrate = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
{% set dock_feedrate = printer["gcode_macro _User_Variables"].dock_speed * 60 %}
{% set release_feedrate = printer["gcode_macro _User_Variables"].release_speed * 60 %}
{% set z_drop_feedrate = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
_entry_point function=Attach_Probe
# If x and y are not homed
{% if not 'xy' in printer.toolhead.homed_axes %}
{ action_raise_error("Must Home X and Y Axis First!") }
_KlickyDebug msg="Attach_Probe Axis homed"
# If probe not attached and locked
{% elif not probe_attached and not probe_lock %}
_KlickyDebug msg="Attach_Probe going to attach probe"
{% if verbose %}
{ action_respond_info("Attaching Probe") }
{% endif %}
_KLICKY_STATUS_BUSY
{% if not 'z' in printer.toolhead.homed_axes %}
{% if verbose %}
{ action_respond_info("Resetting Z position to zero") }
{% endif %}
_KlickyDebug msg="Attach_Probe Z not homed, setting position as X=Y=Z=0"
SET_KINEMATIC_POSITION Z=0
{% if not enable_z_hop %} # Disables safe_z
_KlickyDebug msg="Attach_Probe z_hop disabled"
{% set safe_z = 0 %}
{% endif %}
{% endif %}
# Prior to saving actual position, check if its necessary to move to a safe Z
# that has enought overhead for the attached probe
{% if printer.toolhead.position.z < safe_z %}
_KlickyDebug msg="Attach_Probe toolhead too low, raising it by {safe_z}mm"
{% if verbose %}
{ action_respond_info("moving to a safe Z distance") }
{% endif %}
G0 Z{safe_z} F{z_drop_feedrate}
{% endif %}
{% if not 'z' in printer.toolhead.homed_axes %} #duplicate??
{% if verbose %}
{ action_respond_info("Resetting Z position to zero, duplicate?") }
{% endif %}
_KlickyDebug msg="Attach_Probe Z not homed, setting position as X=Y=Z=0"
SET_KINEMATIC_POSITION Z=0
{% endif %}
{% if printer.toolhead.position.z < safe_z %} #duplicate??
_KlickyDebug msg="Attach_Probe toolhead too low, raising it by {safe_z}mm, duplicate?"
G0 Z{safe_z} F{z_drop_feedrate}
{% endif %}
_Umbilical_Path
_entry_point function=Attach_Probe_intern
# Probe entry location
_KlickyDebug msg="Attach_Probe moving near the dock with G0 X{docklocation_x|int - attachmove_x|int - attachmove2_x|int} Y{docklocation_y|int - attachmove_y|int - attachmove2_y} F{travel_feedrate}"
G0 X{docklocation_x|int - attachmove_x|int - attachmove2_x|int} Y{docklocation_y|int - attachmove_y|int - attachmove2_y} F{travel_feedrate}
{% if docklocation_z != -128 %}
_KlickyDebug msg="Attach_Probe moving near the dock with G0 Z{docklocation_z|int - attachmove_z|int - attachmove2_z|int} F{dock_feedrate}"
G0 Z{docklocation_z|int - attachmove_z|int - attachmove2_z|int} F{dock_feedrate}
_KlickyDebug msg="Attach_Probe moving near the dock with G0 Z{docklocation_z|int - attachmove_z|int} F{dock_feedrate}"
G0 Z{docklocation_z|int - attachmove_z|int} F{dock_feedrate}
{% endif %}
# if necessary do some actions before moving the toolhead to dock
_DeployKlickyDock
# Drop Probe to Probe location
{% if docklocation_z != -128 %}
_KlickyDebug msg="Attach_Probe moving to the dock with G0 Z{docklocation_z} F{dock_feedrate}"
G0 Z{docklocation_z} F{dock_feedrate}
{% endif %}
_KlickyDebug msg="Attach_Probe moving to the dock with G0 X{docklocation_x|int - attachmove2_x|int} Y{docklocation_y|int - attachmove2_y} F{dock_feedrate}"
G0 X{docklocation_x|int - attachmove2_x|int} Y{docklocation_y|int - attachmove2_y} F{dock_feedrate}
_KlickyDebug msg="Attach_Probe moving to the dock with G0 X{docklocation_x} Y{docklocation_y} F{dock_feedrate}"
G0 X{docklocation_x} Y{docklocation_y} F{dock_feedrate}
# Probe Attached
{% if docklocation_z != -128 %}
_KlickyDebug msg="Attach_Probe moving from the dock to G0 Z{docklocation_z|int - attachmove_z|int} F{z_drop_feedrate}"
G0 Z{docklocation_z|int - attachmove_z|int} F{z_drop_feedrate}
{% endif %}
_KlickyDebug msg="Attach_Probe moving from the dock to G0 X{docklocation_x|int - attachmove_x|int} Y{docklocation_y|int - attachmove_y|int} F{release_feedrate}"
G0 X{docklocation_x|int - attachmove_x|int} Y{docklocation_y|int - attachmove_y|int} F{release_feedrate}
# if necessary do some actions after attaching the probe
_RetractKlickyDock
# Go to Z safe distance
{% if printer.toolhead.position.z < safe_z %}
_KlickyDebug msg="Attach_Probe moving to a safe Z position: G0 Z{safe_z} F{z_drop_feedrate}"
G0 Z{safe_z} F{z_drop_feedrate}
{% endif %}
_Park_Toolhead
_CheckProbe action=attach
_exit_point function=Attach_Probe_intern move={goback}
_KLICKY_STATUS_READY
{% elif probe_lock %}
{% if verbose %}
{ action_respond_info("Probe locked!") }
{% endif %}
# Probe attached, do nothing
_KlickyDebug msg="Attach_Probe probe locked not attaching probe"
_CheckProbe action=query
{% else %}
{% if verbose %}
{ action_respond_info("Probe already attached!") }
{% endif %}
# Probe attached, do nothing
_KlickyDebug msg="Attach_Probe probe already attached, doing nothing"
_CheckProbe action=query
{% endif %}
_exit_point function=Attach_Probe
# Dock Probe Routine
[gcode_macro Dock_Probe]
description: Docks Klicky Probe
gcode:
# See if the position should be restored after the dock
{% set goback = params.back|default(0) %}
# Get probe attach status
{% set probe_attached = printer["gcode_macro _Probe_Variables"].probe_attached %}
{% set probe_lock = printer["gcode_macro _Probe_Variables"].probe_lock %}
{% set verbose = printer["gcode_macro _User_Variables"].verbose %}
# Get Docking location
{% set dockmove_x = printer["gcode_macro _User_Variables"].dockmove_x|default(0) %}
{% set dockmove_y = printer["gcode_macro _User_Variables"].dockmove_y|default(0) %}
{% set dockmove_z = printer["gcode_macro _User_Variables"].dockmove_z|default(0) %}
{% set docklocation_x = printer["gcode_macro _User_Variables"].docklocation_x %}
{% set docklocation_y = printer["gcode_macro _User_Variables"].docklocation_y %}
{% set docklocation_z = printer["gcode_macro _User_Variables"].docklocation_z %}
{% set attachmove_x = printer["gcode_macro _User_Variables"].attachmove_x|default(0) %}
{% set attachmove_y = printer["gcode_macro _User_Variables"].attachmove_y|default(0) %}
{% set attachmove_z = printer["gcode_macro _User_Variables"].attachmove_z|default(0) %}
# Safe Z for travel
{% set safe_z = printer["gcode_macro _User_Variables"].safe_z|float %}
# Set feedrates
{% set travel_feedrate = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
{% set dock_feedrate = printer["gcode_macro _User_Variables"].dock_speed * 60 %}
{% set release_feedrate = printer["gcode_macro _User_Variables"].release_speed * 60 %}
{% set z_drop_feedrate = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
# If axis aren't homed, fail
{% if not 'xyz' in printer.toolhead.homed_axes %}
{ action_raise_error("Must Home X, Y and Z Axis First!") }
{% endif %}
_KlickyDebug msg="Dock_Probe Axis homed"
_entry_point function=Dock_Probe
# If probe not attached and not locked
{% if probe_attached and not probe_lock %}
_KlickyDebug msg="Dock_Probe going to dock probe"
{% if verbose %}
{ action_respond_info("Docking Probe") }
{% endif %}
_KLICKY_STATUS_BUSY
{% if printer.toolhead.position.z < safe_z %}
_KlickyDebug msg="Dock_Probe toolhead too low, raising it to {safe_z}mm"
G0 Z{safe_z} F{z_drop_feedrate}
{% endif %}
_Umbilical_Path
# Probe entry location
_KlickyDebug msg="Dock_Probe moving near the dock with G0 X{docklocation_x|int - attachmove_x|int} Y{docklocation_y|int - attachmove_y|int} F{travel_feedrate}"
G0 X{docklocation_x|int - attachmove_x|int} Y{docklocation_y|int - attachmove_y|int} F{travel_feedrate}
{% if docklocation_z != -128 %}
_KlickyDebug msg="Dock_Probe moving near the dock with G0 Z{docklocation_z|int - attachmove_z|int} F{dock_feedrate}"
G0 Z{docklocation_z|int - attachmove_z|int} F{dock_feedrate}
{% endif %}
# if necessary do some actions before moving the toolhead to dock
_DeployKlickyDock
# Drop Probe to Probe location
_KlickyDebug msg="Dock_Probe moving to the dock with G0 X{docklocation_x} Y{docklocation_y} F{dock_feedrate}"
G0 X{docklocation_x} Y{docklocation_y} F{dock_feedrate}
{% if docklocation_z != -128 %}
_KlickyDebug msg="Attach_Probe moving to the dock with G0 Z{docklocation_z} F{dock_feedrate}"
G0 Z{docklocation_z} F{dock_feedrate}
{% endif %}
# Probe decoupling
{% if docklocation_z != -128 %}
_KlickyDebug msg="Dock_Probe moving from the dock to G0 Z{docklocation_z|int + dockmove_z|int} F{release_feedrate}"
G0 Z{docklocation_z|int + dockmove_z|int} F{release_feedrate}
{% endif %}
_KlickyDebug msg="Dock_Probe moving from the dock to G0 X{docklocation_x|int + dockmove_x|int} Y{docklocation_y|int + dockmove_y|int} F{release_feedrate}"
G0 X{docklocation_x|int + dockmove_x|int} Y{docklocation_y|int + dockmove_y|int} F{release_feedrate}
# if necessary do some actions after attaching the probe
_RetractKlickyDock
#Do an extra move away
_KlickyDebug msg="Dock_Probe moving away from the dock to G0 X{docklocation_x|int + dockmove_x|int - attachmove_x|int} Y{docklocation_y|int + dockmove_y|int - attachmove_y|int} F{release_feedrate}"
G0 X{docklocation_x|int + dockmove_x|int - attachmove_x|int} Y{docklocation_y|int + dockmove_y|int - attachmove_y|int} F{release_feedrate}
# Go to Z safe distance
{% if printer.toolhead.position.z < safe_z %}
_KlickyDebug msg="Dock_Probe toolhead too low, raising it to {safe_z}mm"
G0 Z{safe_z} F{z_drop_feedrate}
{% endif %}
_Park_Toolhead
G4 P1000
_CheckProbe action=dock
_KLICKY_STATUS_READY
{% elif probe_lock %}
{% if verbose %}
{ action_respond_info("Probe locked") }
{% endif %}
# Probe docked, do nothing
_KlickyDebug msg="Dock_Probe probe locked not docking probe"
_CheckProbe action=query
{% else %}
{% if verbose %}
{ action_respond_info("Probe already docked") }
{% endif %}
# Probe docked, do nothing
_KlickyDebug msg="Dock_Probe probe already docked, doing nothing"
_CheckProbe action=query
{% endif %}
_exit_point function=Dock_Probe move={goback}
# Probe Calibrate
[gcode_macro PROBE_CALIBRATE]
rename_existing: _PROBE_CALIBRATE
description:Calibrate the probe's z_offset with klicky automount
gcode:
{% set safe_z = printer["gcode_macro _User_Variables"].safe_z|float %}
{% set z_drop_feedrate = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
{% set max_x = printer["gcode_macro _User_Variables"].max_bed_x|float %}
{% set max_y = printer["gcode_macro _User_Variables"].max_bed_y|float %}
{% set probe_offset_x = printer['configfile'].config["probe"]["x_offset"]|float %}
{% set probe_offset_y = printer['configfile'].config["probe"]["y_offset"]|float %}
{% if not 'xyz' in printer.toolhead.homed_axes %}
{ action_raise_error("Must Home X, Y and Z Axis First!") }
{% endif %}
_KlickyDebug msg="probe_calibrate Axis homed"
_KlickyDebug msg="probe_calibrate Variables max_x={max_x},max_y={max_y},probe_offset_x={probe_offset_x},probe_offset_y={probe_offset_y}"
# Protect against PROBE CALIBRATE performed from outside the bed
{% if printer['gcode_move'].position.y > (max_y - probe_offset_y)
or printer['gcode_move'].position.y < - probe_offset_y
or printer['gcode_move'].position.x > (max_x - probe_offset_x)
or printer['gcode_move'].position.x < - probe_offset_x %}
{ action_raise_error("Must perform PROBE_CALIBRATE with the probe above the BED, check klicky_variables bed size!") }
{% endif%}
_CheckProbe action=query
G90
Attach_Probe back=1
_KLICKY_STATUS_CALIBRATING_Z
_KlickyDebug msg="probe_calibrate calling klipper probe_calibrate"
_PROBE_CALIBRATE {% for p in params
%}{'%s=%s ' % (p, params[p])}{%
endfor %}
M118 moving the toolhead 20 mm from the bed
_KlickyDebug msg="probe_calibrate Moving Z up by 20mm"
TESTZ Z=20
M118 remove manually the probe and continue calibration
_KLICKY_STATUS_READY
# Probe Accuracy
[gcode_macro PROBE_ACCURACY]
rename_existing: _PROBE_ACCURACY
description:Probe Z-height accuracy at current XY position with klicky automount
gcode:
{% set safe_z = printer["gcode_macro _User_Variables"].safe_z|float %}
{% set z_drop_feedrate = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
{% set max_x = printer["gcode_macro _User_Variables"].max_bed_x|float %}
{% set max_y = printer["gcode_macro _User_Variables"].max_bed_y|float %}
{% set probe_offset_x = printer['configfile'].config["probe"]["x_offset"]|float %}
{% set probe_offset_y = printer['configfile'].config["probe"]["y_offset"]|float %}
{% if not 'xyz' in printer.toolhead.homed_axes %}
{ action_raise_error("Must Home X, Y and Z Axis First!") }
{% endif %}
_KlickyDebug msg="probe_accuracy Axis homed"
_KlickyDebug msg="probe_accuracy Variables max_x={max_x},max_y={max_y},probe_offset_x={probe_offset_x},probe_offset_y={probe_offset_y}"
_entry_point function=PROBE_ACCURACY
# Protect against PROBE_ACCURACY performed from outside the bed
{% if printer['gcode_move'].position.y > (max_y - probe_offset_y)
or printer['gcode_move'].position.y < - probe_offset_y
or printer['gcode_move'].position.x > (max_x - probe_offset_x)
or printer['gcode_move'].position.x < - probe_offset_x %}
{ action_raise_error("Must perform PROBE_ACCURACY with the probe above the BED, check klicky_variables bed size!") }
{% endif%}
_CheckProbe action=query
Attach_Probe back=1
_KlickyDebug msg="probe_accuracy calling klipper probe accuracy"
_PROBE_ACCURACY {% for p in params
%}{'%s=%s ' % (p, params[p])}{%
endfor %}
Dock_Probe back=1
_exit_point function=PROBE_ACCURACY move=1
# Umbilical path setup
[gcode_macro _Umbilical_Path]
gcode:
{% set umbilical = printer["gcode_macro _User_Variables"].umbilical %}
{% set umbilical_x = printer["gcode_macro _User_Variables"].umbilical_x %}
{% set umbilical_y = printer["gcode_macro _User_Variables"].umbilical_y %}
{% set safe_z = printer["gcode_macro _User_Variables"].safe_z|float %}
{% set travel_feedrate = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
{% if umbilical %}
# Used to give the umbilical a better path to follow and coil properly if dock is tight in space
_entry_point function=Umbilical_Path
_KlickyDebug msg="_Umbilical_Path moving to G0 X{umbilical_x} Y{umbilical_y} Z{safe_z} F{travel_feedrate}"
G0 X{umbilical_x} Y{umbilical_y} Z{safe_z} F{travel_feedrate}
_exit_point function=Umbilical_Path
{% endif %}
# check to see if probe is where it is supposed to be after
# attaching/docking maneuver and set homing error or shutdown
[gcode_macro _CheckProbe]
variable_probe_state: 0
gcode:
Query_Probe
_SetProbeState action={ params.ACTION }
# due to how templates are evaluated, we have query endstops in one
# macro and call another macro to make decisions based on the result
[gcode_macro _SetProbeState]
gcode:
{% set query_probe_triggered = printer.probe.last_query %}
{% set action = params.ACTION|default('') %}
# If triggered (true), probe not attached
{% if query_probe_triggered %}
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_attached VALUE={ False }
{% else %}
# If not triggered (false), probe attached
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_attached VALUE={ True }
{% endif %}
{% if action == 'query' %}
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_state VALUE={ query_probe_triggered }
{% endif %}
# If probe fails to attach/detach
# If not docked
{% if not query_probe_triggered and action == 'dock' %}
{ action_raise_error("Probe dock failed!") }
{% endif %}
# If not attached
{% if query_probe_triggered and action == 'attach' %}
{ action_raise_error("Probe attach failed!") }
{% endif %}
# Park Toolhead Routine
[gcode_macro _Park_Toolhead]
gcode:
{% set park_toolhead = printer["gcode_macro _User_Variables"].park_toolhead %}
{% set parkposition_x = printer["gcode_macro _User_Variables"].parkposition_x %}
{% set parkposition_y = printer["gcode_macro _User_Variables"].parkposition_y %}
{% set parkposition_z = printer["gcode_macro _User_Variables"].parkposition_z %}
{% set travel_feedrate = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
{% set verbose = printer["gcode_macro _User_Variables"].verbose %}
_entry_point function=Park_Toolhead
{% if park_toolhead and 'xyz' in printer.toolhead.homed_axes %}
{% if verbose %}
{ action_respond_info("Parking Toolhead") }
{% endif %}
_KlickyDebug msg="_Park_Toolhead moving to G0 X{parkposition_x} Y{parkposition_y} Z{parkposition_z} F{travel_feedrate}"
G0 X{parkposition_x} Y{parkposition_y} Z{parkposition_z} F{travel_feedrate}
{% endif %}
_exit_point function=Park_Toolhead

View File

@ -1,72 +0,0 @@
#!/bin/bash
KLIPPER_PATH="${HOME}/klipper"
SYSTEMDDIR="/etc/systemd/system"
# Step 1: Verify Klipper has been installed
check_klipper()
{
if [ "$(sudo systemctl list-units --full -all -t service --no-legend | grep -F "klipper.service")" ]; then
echo "Klipper service found!"
else
echo "Klipper service not found, please install Klipper first"
exit -1
fi
}
# Step 2: Install startup script
install_script()
{
# Create systemd service file
SERVICE_FILE="${SYSTEMDDIR}/klipper_config.service"
[ -f $SERVICE_FILE ] && return
echo "Installing system start script..."
sudo /bin/sh -c "cat > ${SERVICE_FILE}" << EOF
[Unit]
Description=Dummy Service for klipper-config
After=klipper.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/bash -c 'exec -a klipper-config sleep 1'
[Install]
WantedBy=multi-user.target
EOF
# Use systemctl to enable the systemd service script
sudo systemctl daemon-reload
sudo systemctl enable klipper-config.service
}
# Step 3: restarting Klipper
restart_klipper()
{
echo "Restarting Klipper..."
sudo systemctl restart klipper
}
# Helper functions
verify_ready()
{
if [ "$EUID" -eq 0 ]; then
echo "This script must not run as root"
exit -1
fi
}
# Force script to exit if an error occurs
set -e
# Find SRCDIR from the pathname of this script
SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/ && pwd )"
# Parse command line arguments
while getopts "k:" arg; do
case $arg in
k) KLIPPER_PATH=$OPTARG;;
esac
done
# Run steps
verify_ready
install_script
restart_klipper

View File

@ -90,31 +90,28 @@ gcode:
#####################################################################
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
default_parameter_X: 60 #edit to your park position
default_parameter_Y: 0 #edit to your park position
default_parameter_Z: 5 #edit to your park position
default_parameter_E: 0.2 #edit to your retract length
gcode:
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
# Anti-Stringing
G91 ; relative positioning
G1 E-{E} F2100 ; retract filament
G1 E-{E|default(0.2)} F2100 ; retract filament
G1 X1 F20000 ; move 1mm to the side at 333mm/sec
G90 ; absolute positioning (avoid G2 in rel mode erroring out)
G2 E0 I-1 ; do a no extrusion circle move with a 0.5mm radius centered on orig
G1 Z{Z} F3000 ; move up by 5mm @ 50mm/sec to clear the print
G91 ; relative positioning (avoid G2 in rel mode erroring out)
G1 Z{Z|default(5)} F3000 ; move up by 5mm @ 50mm/sec to clear the print
G90 ; absolute positioning
G1 X{X} Y{Y} F6000 ; Move toolhead to park location
G1 X{X|default(60)} Y{Y|default(0)} F6000 ; Move toolhead to park location
[gcode_macro RESUME]
rename_existing: BASE_RESUME
default_parameter_E: 0.2 #edit to your retract length
gcode:
G91
G1 E{E} F2100
G1 E{E|default(0.2)} F2100
G90
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME
@ -122,9 +119,6 @@ gcode:
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
default_parameter_X: 0 #edit to your park position
default_parameter_Y: 0 #edit to your park position
default_parameter_Z: 117 #edit to your park position
gcode:
M104 S0
M140 S0