add orca slicer
add klipper files
This commit is contained in:
parent
ca6181cba4
commit
a78df4aec1
@ -115,13 +115,13 @@
|
|||||||
sbctl
|
sbctl
|
||||||
ausweisapp
|
ausweisapp
|
||||||
e2fsprogs
|
e2fsprogs
|
||||||
|
])
|
||||||
|
|
||||||
|
++
|
||||||
|
|
||||||
|
(with pkgs-stable; [
|
||||||
|
orca-slicer
|
||||||
]);
|
]);
|
||||||
|
|
||||||
##++
|
|
||||||
|
|
||||||
#(with pkgs-stable; [
|
|
||||||
# orca-slicer
|
|
||||||
#]);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
50
modules/services/printer/cfgs/CALIBRATION.cfg
Normal file
50
modules/services/printer/cfgs/CALIBRATION.cfg
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
[gcode_macro PID_TEST_BED]
|
||||||
|
gcode:
|
||||||
|
# Parameters
|
||||||
|
{% set TARGETTEMP = params.TEMP|default(70)|int %}
|
||||||
|
|
||||||
|
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
|
||||||
|
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
|
||||||
|
G28
|
||||||
|
G90
|
||||||
|
G1 X{max_x/2} Y{max_y/2} Z40 F6000
|
||||||
|
PID_CALIBRATE HEATER=heater_bed TARGET={TARGETTEMP}
|
||||||
|
|
||||||
|
[gcode_macro PID_TEST_HOTEND]
|
||||||
|
gcode:
|
||||||
|
# Parameters
|
||||||
|
{% set TARGETTEMP = params.TEMP|default(245)|int %}
|
||||||
|
|
||||||
|
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
|
||||||
|
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
|
||||||
|
G28
|
||||||
|
G90
|
||||||
|
G1 X{max_x/2} Y{max_y/2} Z10 F6000
|
||||||
|
M106 S64
|
||||||
|
PID_CALIBRATE HEATER=extruder TARGET={TARGETTEMP}
|
||||||
|
M107 ; Turn off print cooling fan
|
||||||
|
|
||||||
|
# TODO test this
|
||||||
|
[gcode_macro PID_TEST_ALL]
|
||||||
|
gcode:
|
||||||
|
PID_TEST_BED
|
||||||
|
PID_TEST_HOTEND
|
||||||
|
SAVE_CONFIG
|
||||||
|
|
||||||
|
[gcode_macro DO_PROBE_CALIBRATE]
|
||||||
|
gcode:
|
||||||
|
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET=60
|
||||||
|
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=180
|
||||||
|
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM=60
|
||||||
|
TEMPERATURE_WAIT SENSOR=extruder MINIMUM=180
|
||||||
|
G28
|
||||||
|
PROBE_CALIBRATE
|
||||||
|
|
||||||
|
[gcode_macro DO_CREATE_MESH]
|
||||||
|
gcode:
|
||||||
|
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET=60
|
||||||
|
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=180
|
||||||
|
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM=60
|
||||||
|
TEMPERATURE_WAIT SENSOR=extruder MINIMUM=180
|
||||||
|
G28
|
||||||
|
_BED_MESH_CALIBRATE
|
110
modules/services/printer/cfgs/MECHANICAL_GANTRY_CALIBRATION.cfg
Normal file
110
modules/services/printer/cfgs/MECHANICAL_GANTRY_CALIBRATION.cfg
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
###############################################################################
|
||||||
|
# Source https://github.com/strayr/strayr-k-macros/blob/e0807570a66d28735cf05143b105ab4ea6d9798f/mechanical_level_tmc2209.cfg
|
||||||
|
#
|
||||||
|
# Mechanical Gantry Calibration
|
||||||
|
#
|
||||||
|
# Requires TMC2209 drivers with UART control, some tuning and perhaps
|
||||||
|
# some printed endstops.
|
||||||
|
#
|
||||||
|
# Based on on (depricated) M915 and now alternate G34 from Marlin
|
||||||
|
# I beleive Prusa use this, certainly there's older videos advising to just
|
||||||
|
# ram the gantry at full current into the the z-max stops.
|
||||||
|
#
|
||||||
|
# It moves the gantry to the top of the travel, drops the current and then
|
||||||
|
# does a force move to force the steppers to stall against the physical end
|
||||||
|
# stops, transfering the level of the frame to the gantry.
|
||||||
|
#
|
||||||
|
# This is the only way to programatically level a multi-stepper single-driver
|
||||||
|
# gantry. It may also help with a dual-driver gantry on a bed-slinger design
|
||||||
|
# or where the plane of the bed is less trustworthy than the frame.
|
||||||
|
#
|
||||||
|
# It's particularly risky doing Z_TILT_ADJUST and SCREWS_TILT_CALCULATE
|
||||||
|
# without a mechanical reference as if one side of the gantry or bed is prone
|
||||||
|
# to droop, over time both bed and gantry will skew excessively but still read
|
||||||
|
# as level, so this can help transfer "level" from the frame to the gantry and
|
||||||
|
# then to the bed.
|
||||||
|
#
|
||||||
|
# I don't recommend doing this in a START_PRINT, I call this if a
|
||||||
|
# SCREWS_TILT_CALCULATE shows some drift, althoughon an Ender 3 type printer
|
||||||
|
# it's prudent to check the v-slot rollers for correct adjustment if drift is
|
||||||
|
# observed.
|
||||||
|
#
|
||||||
|
# It's probably best to run this and then do SCREWS_TILT_CALCULATE
|
||||||
|
# until the bed is really level. IF you have dual Z steppers you can then
|
||||||
|
# use Z_TILT_ADJUST for subsequent leveling of the gantry but make sure you
|
||||||
|
# use the same points for gantry level as you use in SCREWS_TILT_CALCULATE
|
||||||
|
#
|
||||||
|
# It may damage your printer if you do this at too high a current, or don't
|
||||||
|
# have proper endstops.
|
||||||
|
#
|
||||||
|
# HERE BE DRAGONS!
|
||||||
|
# YOU WERE WARNED!
|
||||||
|
#
|
||||||
|
# Here's a video of this in action
|
||||||
|
# https://www.youtube.com/watch?v=aVdIeIIpUAk
|
||||||
|
# and the endstops for 2020 v-slot
|
||||||
|
# https://www.thingiverse.com/thing:4848479
|
||||||
|
|
||||||
|
[gcode_macro MECHANICAL_GANTRY_CALIBRATION]
|
||||||
|
gcode:
|
||||||
|
### SET THIS DEFAULT CARFULLY - start really low
|
||||||
|
{% set my_current = params.CURRENT|default(0.20)|float %} ; adjust crash current on the fly :D
|
||||||
|
###
|
||||||
|
{% set oldcurrent = printer.configfile.settings["tmc2209 stepper_z"].run_current %}
|
||||||
|
{% set oldhold = printer.configfile.settings["tmc2209 stepper_z"].hold_current %}
|
||||||
|
{% set x_max = printer.toolhead.axis_maximum.x %}
|
||||||
|
{% set y_max = printer.toolhead.axis_maximum.y %}
|
||||||
|
{% set z_max = printer.toolhead.axis_maximum.z %}
|
||||||
|
{% set fast_move_z = printer.configfile.settings["printer"].max_z_velocity %}
|
||||||
|
{% set fast_move = printer.configfile.settings["printer"].max_velocity %}
|
||||||
|
M117 {printer.homed_axes}
|
||||||
|
{% if printer.homed_axes != 'xyz' %}
|
||||||
|
G28 ; Home All Axes
|
||||||
|
{% endif %}
|
||||||
|
G90 ; absolute
|
||||||
|
G0 X{x_max / 2} Y{y_max / 2} F{fast_move * 30 } ;put toolhead in the center of the gantry
|
||||||
|
|
||||||
|
G0 Z{z_max -5} F{fast_move_z * 60 } ; go to the Z-max - 5 at speed max z speed ; CHANGED
|
||||||
|
|
||||||
|
SET_TMC_CURRENT STEPPER=stepper_z CURRENT={my_current} ; drop current on Z stepper
|
||||||
|
|
||||||
|
{% if printer.configfile.settings["stepper_z1"] %} ; test for dual Z
|
||||||
|
SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={my_current} ; drop current
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
CONDITIONAL_BEEP I=1
|
||||||
|
G4 P200 ; Probably not necessary, it is here just for sure
|
||||||
|
|
||||||
|
SET_KINEMATIC_POSITION Z={z_max - 25} ; Trick printer into beleiving the gantry is 25mm lower than it is ; CHANGED
|
||||||
|
|
||||||
|
G1 Z{z_max} F{6 * 60} ; based on above figures, there will be 20mm worth of grinding ; CHANGED
|
||||||
|
CONDITIONAL_BEEP I=2
|
||||||
|
G4 P10000 ; wait 10 seconds
|
||||||
|
G1 Z{z_max -6} F{6 * 60} ; move 4mm down
|
||||||
|
CONDITIONAL_BEEP I=3
|
||||||
|
G4 P200 ; same as the first one
|
||||||
|
|
||||||
|
SET_TMC_CURRENT STEPPER=stepper_z CURRENT={oldcurrent} HOLDCURRENT={oldhold}
|
||||||
|
|
||||||
|
{% if printer.configfile.settings["stepper_z1"] %} ; test for dual Z
|
||||||
|
SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={oldcurrent} HOLDCURRENT={oldhold} ; reset current
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
G1 Z{z_max -30} F{6 * 60} ; move to 30mm below z-max to allow homing movement
|
||||||
|
|
||||||
|
G4 P200 ; same as the first one
|
||||||
|
G28 Z ; we MUST home again as the ganty is really in the wrong place.
|
||||||
|
|
||||||
|
[gcode_macro G34]
|
||||||
|
gcode:
|
||||||
|
MECHANICAL_GANTRY_CALIBRATION
|
||||||
|
|
||||||
|
[menu __main __setup __calib __mech_gantry_calibrate]
|
||||||
|
type: command
|
||||||
|
enable: {not printer.idle_timeout.state == "Printing"}
|
||||||
|
name: G34 Gantry Level
|
||||||
|
gcode:
|
||||||
|
G34
|
||||||
|
|
||||||
|
[force_move]
|
||||||
|
enable_force_move: true ; enable FORCE_MOVE and SET_KINEMATIC_POSITION
|
54
modules/services/printer/cfgs/PARKING.cfg
Normal file
54
modules/services/printer/cfgs/PARKING.cfg
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# Park front center
|
||||||
|
[gcode_macro PARKFRONT]
|
||||||
|
gcode:
|
||||||
|
{% if "xyz" not in printer.toolhead.homed_axes %}
|
||||||
|
G28 ; home if not already homed
|
||||||
|
{% endif %}
|
||||||
|
SAVE_GCODE_STATE NAME=PARKFRONT
|
||||||
|
G90 ; absolute positioning
|
||||||
|
G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} Z{printer.toolhead.axis_maximum.z/2} F6000
|
||||||
|
RESTORE_GCODE_STATE NAME=PARKFRONT
|
||||||
|
|
||||||
|
# Park front center, but low down.
|
||||||
|
[gcode_macro PARKFRONTLOW]
|
||||||
|
gcode:
|
||||||
|
{% if "xyz" not in printer.toolhead.homed_axes %}
|
||||||
|
G28 ; home if not already homed
|
||||||
|
{% endif %}
|
||||||
|
SAVE_GCODE_STATE NAME=PARKFRONT
|
||||||
|
G90 ; absolute positioning
|
||||||
|
G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} Z20 F6000
|
||||||
|
RESTORE_GCODE_STATE NAME=PARKFRONT
|
||||||
|
|
||||||
|
# Park top rear left
|
||||||
|
[gcode_macro PARKREAR]
|
||||||
|
gcode:
|
||||||
|
{% if "xyz" not in printer.toolhead.homed_axes %}
|
||||||
|
G28 ; home if not already homed
|
||||||
|
{% endif %}
|
||||||
|
SAVE_GCODE_STATE NAME=PARKREAR
|
||||||
|
G90 ; absolute positioning
|
||||||
|
G0 X{printer.toolhead.axis_minimum.x+10} Y{printer.toolhead.axis_maximum.y-10} Z{printer.toolhead.axis_maximum.z-50} F6000
|
||||||
|
RESTORE_GCODE_STATE NAME=PARKREAR
|
||||||
|
|
||||||
|
# Park at center of build volume
|
||||||
|
[gcode_macro PARKCENTER]
|
||||||
|
gcode:
|
||||||
|
{% if "xyz" not in printer.toolhead.homed_axes %}
|
||||||
|
G28 ; home if not already homed
|
||||||
|
{% endif %}
|
||||||
|
SAVE_GCODE_STATE NAME=PARKCENTER
|
||||||
|
G90 ; absolute positioning
|
||||||
|
G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_maximum.y/2} Z{printer.toolhead.axis_maximum.z/2} F6000
|
||||||
|
RESTORE_GCODE_STATE NAME=PARKCENTER
|
||||||
|
|
||||||
|
# Park 15mm above center of bed
|
||||||
|
[gcode_macro PARKBED]
|
||||||
|
gcode:
|
||||||
|
{% if "xyz" not in printer.toolhead.homed_axes %}
|
||||||
|
G28 ; home if not already homed
|
||||||
|
{% endif %}
|
||||||
|
SAVE_GCODE_STATE NAME=PARKBED
|
||||||
|
G90 ; absolute positioning
|
||||||
|
G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_maximum.y/2} Z15 F6000
|
||||||
|
RESTORE_GCODE_STATE NAME=PARKBED
|
124
modules/services/printer/cfgs/TEST_SPEED.cfg
Normal file
124
modules/services/printer/cfgs/TEST_SPEED.cfg
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
[gcode_macro TEST_SPEED]
|
||||||
|
# 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
|
||||||
|
|
||||||
|
description: Test for max speed and acceleration parameters for the printer. Procedure: Home -> ReadPositionFromMCU -> MovesToolhead@Vel&Accel -> Home -> ReadPositionfromMCU
|
||||||
|
|
||||||
|
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 %}
|
||||||
|
# Minimum Cruise Ratio
|
||||||
|
{% set min_cruise_ratio = params.MIN_CRUISE_RATIO|default(0.5)|float %}
|
||||||
|
# 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:
|
||||||
|
M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66
|
||||||
|
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 %}
|
||||||
|
# Move 50mm away from max position and home again (to help with hall effect endstop accuracy - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/24)
|
||||||
|
G90
|
||||||
|
G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{30*60}
|
||||||
|
M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66
|
||||||
|
G28 X Y
|
||||||
|
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
|
||||||
|
{% if printer.configfile.settings.printer.minimum_cruise_ratio is defined %}
|
||||||
|
SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} MINIMUM_CRUISE_RATIO={min_cruise_ratio}
|
||||||
|
{% else %}
|
||||||
|
SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% 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}
|
||||||
|
|
||||||
|
# Large pattern 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 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 pattern 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
|
||||||
|
{% if printer.configfile.settings.printer.minimum_cruise_ratio is defined %}
|
||||||
|
SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} MINIMUM_CRUISE_RATIO={printer.configfile.settings.printer.minimum_cruise_ratio}
|
||||||
|
{% else %}
|
||||||
|
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}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
# Re-home and get position again for comparison:
|
||||||
|
M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66
|
||||||
|
G28 # This is a full G28 to fix an issue with CoreXZ - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/12
|
||||||
|
# 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
|
||||||
|
|
13
modules/services/printer/cfgs/adxl-direct.cfg
Normal file
13
modules/services/printer/cfgs/adxl-direct.cfg
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Documentation https://www.klipper3d.org/Measuring_Resonances.html?h=adxl#configure-adxl345-with-rpi
|
||||||
|
# Documentation https://www.klipper3d.org/RPi_microcontroller.html
|
||||||
|
|
||||||
|
[mcu rpi]
|
||||||
|
serial: /tmp/klipper_host_mcu
|
||||||
|
|
||||||
|
[adxl345]
|
||||||
|
cs_pin: rpi:None
|
||||||
|
|
||||||
|
[resonance_tester]
|
||||||
|
accel_chip: adxl345
|
||||||
|
probe_points: 111.5, 111.5, 20
|
||||||
|
max_smoothing: 0.13
|
29
modules/services/printer/cfgs/adxl-rp2040.cfg
Normal file
29
modules/services/printer/cfgs/adxl-rp2040.cfg
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#####################################################################
|
||||||
|
# Find my instructions here:
|
||||||
|
# https://github.com/bassamanator/rp2040-zero-adxl345-klipper
|
||||||
|
# ADXL345 related Settings
|
||||||
|
# https://www.klipper3d.org/Measuring_Resonances.html#adxl345
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
[mcu RP2040]
|
||||||
|
baud: 115200 # 250000
|
||||||
|
restart_method: command
|
||||||
|
# Obtain definition by "ls -l /dev/serial/by-id/"
|
||||||
|
serial: /dev/serial/by-id/usb-Klipper_rp2040_E6614C311B773B36-if00
|
||||||
|
|
||||||
|
[adxl345]
|
||||||
|
cs_pin: RP2040:gpio1
|
||||||
|
spi_bus: spi0a
|
||||||
|
axes_map: x,z,y
|
||||||
|
|
||||||
|
[resonance_tester]
|
||||||
|
accel_chip: adxl345
|
||||||
|
probe_points: 111.5, 111.5, 20
|
||||||
|
|
||||||
|
[output_pin power_mode] # Improve power stability
|
||||||
|
pin: RP2040:gpio23
|
||||||
|
|
||||||
|
[gcode_macro ADX]
|
||||||
|
description: Shortcut to ACCELEROMETER_QUERY
|
||||||
|
gcode:
|
||||||
|
ACCELEROMETER_QUERY
|
43
modules/services/printer/cfgs/adxl-rpi-pico-2x.cfg
Normal file
43
modules/services/printer/cfgs/adxl-rpi-pico-2x.cfg
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#####################################################################
|
||||||
|
# Config that supports a print head and a bed sensor at the same time
|
||||||
|
# This requires a Raspberry Pi Pico.
|
||||||
|
# Instructions: https://klipper.discourse.group/t/raspberry-pi-pico-adxl345-portable-resonance-measurement/1757/9
|
||||||
|
# TLDR Instructions: The two sensors should use the spi0a (GPIO 0-3) and spi1a (GPIO 9-12) buses, respectively.
|
||||||
|
#
|
||||||
|
# Recommended mounts:
|
||||||
|
# https://www.printables.com/model/385334-sovol-sv06-adxl345-mount-printhead-and-bed
|
||||||
|
#
|
||||||
|
# ADXL345 related Settings
|
||||||
|
# https://www.klipper3d.org/Measuring_Resonances.html#adxl345
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
[mcu RP2040]
|
||||||
|
baud: 115200
|
||||||
|
restart_method: command
|
||||||
|
# Obtain definition by "ls -l /dev/serial/by-id/"
|
||||||
|
serial: /dev/serial/by-id/usb-Klipper_rp2040_E66138935F154C28-if00
|
||||||
|
|
||||||
|
[adxl345 head]
|
||||||
|
cs_pin: RP2040:gpio1
|
||||||
|
spi_bus: spi0a
|
||||||
|
# update axes_map if your sensor is oriented differently. Note the print on your sensor.
|
||||||
|
# -y, -z, x means that
|
||||||
|
# - the x axis of your printer corresponds to the sensor's negative y axis
|
||||||
|
# - the y axis of your printer corresponds to the sensor's negative z axis
|
||||||
|
# - the z axis of your printer corresponds to the sensor's x axis
|
||||||
|
axes_map: -y, -z, x
|
||||||
|
|
||||||
|
[adxl345 bed]
|
||||||
|
cs_pin: RP2040:gpio9
|
||||||
|
spi_bus: spi1a
|
||||||
|
|
||||||
|
[resonance_tester]
|
||||||
|
accel_chip_x: adxl345 head
|
||||||
|
accel_chip_y: adxl345 bed
|
||||||
|
probe_points: 111.5, 111.5, 20
|
||||||
|
|
||||||
|
[gcode_macro ADX]
|
||||||
|
description: Shortcut to ACCELEROMETER_QUERY for both sensors
|
||||||
|
gcode:
|
||||||
|
ACCELEROMETER_QUERY CHIP=head
|
||||||
|
ACCELEROMETER_QUERY CHIP=bed
|
120
modules/services/printer/cfgs/kamp/Adaptive_Meshing.cfg
Normal file
120
modules/services/printer/cfgs/kamp/Adaptive_Meshing.cfg
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
# # # Klipper Adaptive Meshing # # #
|
||||||
|
|
||||||
|
# Heads up! If you have any other BED_MESH_CALIBRATE macros defined elsewhere in your config, you will need to comment out / remove them for this to work. (Klicky/Euclid Probe)
|
||||||
|
# You will also need to be sure that [exclude_object] is defined in printer.cfg, and your slicer is labeling objects.
|
||||||
|
# This macro will parse information from objects in your gcode to define a min and max mesh area to probe, creating an adaptive mesh!
|
||||||
|
# This macro will not increase probe_count values in your [bed_mesh] config. If you want richer meshes, be sure to increase probe_count. We recommend at least 5,5.
|
||||||
|
|
||||||
|
[gcode_macro BED_MESH_CALIBRATE]
|
||||||
|
rename_existing: _BED_MESH_CALIBRATE
|
||||||
|
gcode:
|
||||||
|
|
||||||
|
{% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Gather all object points
|
||||||
|
{% set bed_mesh_min = printer.configfile.settings.bed_mesh.mesh_min %} # Get bed mesh min from printer.cfg
|
||||||
|
{% set bed_mesh_max = printer.configfile.settings.bed_mesh.mesh_max %} # Get bed mesh max from printer.cfg
|
||||||
|
{% set probe_count = printer.configfile.settings.bed_mesh.probe_count %} # Get probe count from printer.cfg
|
||||||
|
{% set kamp_settings = printer["gcode_macro _KAMP_Settings"] %} # Pull variables from _KAMP_Settings
|
||||||
|
{% set verbose_enable = kamp_settings.verbose_enable | abs %} # Pull verbose setting from _KAMP_Settings
|
||||||
|
{% set probe_dock_enable = kamp_settings.probe_dock_enable | abs %} # Pull probe dockable probe settings from _KAMP_Settings
|
||||||
|
{% set attach_macro = kamp_settings.attach_macro | string %} # Pull attach probe command from _KAMP_Settings
|
||||||
|
{% set detach_macro = kamp_settings.detach_macro | string %} # Pull detach probe command from _KAMP_Settings
|
||||||
|
{% set mesh_margin = kamp_settings.mesh_margin | float %} # Pull mesh margin setting from _KAMP_Settings
|
||||||
|
{% set fuzz_amount = kamp_settings.fuzz_amount | float %} # Pull fuzz amount setting from _KAMP_Settings
|
||||||
|
{% set probe_count = probe_count if probe_count|length > 1 else probe_count * 2 %} # If probe count is only a single number, convert it to 2. E.g. probe_count:7 = 7,7
|
||||||
|
{% set max_probe_point_distance_x = ( bed_mesh_max[0] - bed_mesh_min[0] ) / (probe_count[0] - 1) %} # Determine max probe point distance
|
||||||
|
{% set max_probe_point_distance_y = ( bed_mesh_max[1] - bed_mesh_min[1] ) / (probe_count[1] - 1) %} # Determine max probe point distance
|
||||||
|
{% set x_min = all_points | map(attribute=0) | min | default(bed_mesh_min[0]) %} # Set x_min from smallest object x point
|
||||||
|
{% set y_min = all_points | map(attribute=1) | min | default(bed_mesh_min[1]) %} # Set y_min from smallest object y point
|
||||||
|
{% set x_max = all_points | map(attribute=0) | max | default(bed_mesh_max[0]) %} # Set x_max from largest object x point
|
||||||
|
{% set y_max = all_points | map(attribute=1) | max | default(bed_mesh_max[1]) %} # Set y_max from largest object y point
|
||||||
|
|
||||||
|
{% set fuzz_range = range((0) | int, (fuzz_amount * 100) | int + 1) %} # Set fuzz_range between 0 and fuzz_amount
|
||||||
|
{% set adapted_x_min = x_min - mesh_margin - (fuzz_range | random / 100.0) %} # Adapt x_min to margin and fuzz constraints
|
||||||
|
{% set adapted_y_min = y_min - mesh_margin - (fuzz_range | random / 100.0) %} # Adapt y_min to margin and fuzz constraints
|
||||||
|
{% set adapted_x_max = x_max + mesh_margin + (fuzz_range | random / 100.0) %} # Adapt x_max to margin and fuzz constraints
|
||||||
|
{% set adapted_y_max = y_max + mesh_margin + (fuzz_range | random / 100.0) %} # Adapt y_max to margin and fuzz constraints
|
||||||
|
|
||||||
|
{% set adapted_x_min = [adapted_x_min , bed_mesh_min[0]] | max %} # Compare adjustments to defaults and choose max
|
||||||
|
{% set adapted_y_min = [adapted_y_min , bed_mesh_min[1]] | max %} # Compare adjustments to defaults and choose max
|
||||||
|
{% set adapted_x_max = [adapted_x_max , bed_mesh_max[0]] | min %} # Compare adjustments to defaults and choose min
|
||||||
|
{% set adapted_y_max = [adapted_y_max , bed_mesh_max[1]] | min %} # Compare adjustments to defaults and choose min
|
||||||
|
|
||||||
|
{% set points_x = (((adapted_x_max - adapted_x_min) / max_probe_point_distance_x) | round(method='ceil') | int) + 1 %} # Define probe_count's x point count and round up
|
||||||
|
{% set points_y = (((adapted_y_max - adapted_y_min) / max_probe_point_distance_y) | round(method='ceil') | int) + 1 %} # Define probe_count's y point count and round up
|
||||||
|
|
||||||
|
{% if (([points_x, points_y]|max) > 6) %} #
|
||||||
|
{% set algorithm = "bicubic" %} #
|
||||||
|
{% set min_points = 4 %} #
|
||||||
|
{% else %} # Calculate if algorithm should be bicubic or lagrange
|
||||||
|
{% set algorithm = "lagrange" %} #
|
||||||
|
{% set min_points = 3 %} #
|
||||||
|
{% endif %} #
|
||||||
|
|
||||||
|
{% set points_x = [points_x , min_points]|max %} # Set probe_count's x points to fit the calculated algorithm
|
||||||
|
{% set points_y = [points_y , min_points]|max %} # Set probe_count's y points to fit the calculated algorithm
|
||||||
|
{% set points_x = [points_x , probe_count[0]]|min %}
|
||||||
|
{% set points_y = [points_y , probe_count[1]]|min %}
|
||||||
|
|
||||||
|
{% if verbose_enable == True %} # If verbose is enabled, print information about KAMP's calculations
|
||||||
|
{% if printer.exclude_object.objects != [] %}
|
||||||
|
|
||||||
|
{ action_respond_info( "Algorithm: {}.".format(
|
||||||
|
(algorithm),
|
||||||
|
)) }
|
||||||
|
|
||||||
|
{ action_respond_info("Default probe count: {},{}.".format(
|
||||||
|
(probe_count[0]),
|
||||||
|
(probe_count[1]),
|
||||||
|
)) }
|
||||||
|
|
||||||
|
{ action_respond_info("Adapted probe count: {},{}.".format(
|
||||||
|
(points_x),
|
||||||
|
(points_y),
|
||||||
|
)) }
|
||||||
|
|
||||||
|
{action_respond_info("Default mesh bounds: {}, {}.".format(
|
||||||
|
(bed_mesh_min[0],bed_mesh_min[1]),
|
||||||
|
(bed_mesh_max[0],bed_mesh_max[1]),
|
||||||
|
)) }
|
||||||
|
|
||||||
|
{% if mesh_margin > 0 %}
|
||||||
|
{action_respond_info("Mesh margin is {}, mesh bounds extended by {}mm.".format(
|
||||||
|
(mesh_margin),
|
||||||
|
(mesh_margin),
|
||||||
|
)) }
|
||||||
|
{% else %}
|
||||||
|
{action_respond_info("Mesh margin is 0, margin not increased.")}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if fuzz_amount > 0 %}
|
||||||
|
{action_respond_info("Mesh point fuzzing enabled, points fuzzed up to {}mm.".format(
|
||||||
|
(fuzz_amount),
|
||||||
|
)) }
|
||||||
|
{% else %}
|
||||||
|
{action_respond_info("Fuzz amount is 0, mesh points not fuzzed.")}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{ action_respond_info("Adapted mesh bounds: {}, {}.".format(
|
||||||
|
(adapted_x_min, adapted_y_min),
|
||||||
|
(adapted_x_max, adapted_y_max),
|
||||||
|
)) }
|
||||||
|
|
||||||
|
{action_respond_info("KAMP adjustments successful. Happy KAMPing!")}
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
{action_respond_info("No objects detected! Check your gcode and make sure that EXCLUDE_OBJECT_DEFINE is happening before BED_MESH_CALIBRATE is called. Defaulting to regular meshing.")}
|
||||||
|
G4 P5000 # Wait 5 seconds to make error more visible
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if probe_dock_enable == True %}
|
||||||
|
{attach_macro} # Attach/deploy a probe if the probe is stored somewhere outside of the print area
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
_BED_MESH_CALIBRATE mesh_min={adapted_x_min},{adapted_y_min} mesh_max={adapted_x_max},{adapted_y_max} ALGORITHM={algorithm} PROBE_COUNT={points_x},{points_y}
|
||||||
|
|
||||||
|
{% if probe_dock_enable == True %}
|
||||||
|
{detach_macro} # Detach/stow a probe if the probe is stored somewhere outside of the print area
|
||||||
|
{% endif %} # End of verbose
|
37
modules/services/printer/cfgs/kamp/KAMP_Settings.cfg
Normal file
37
modules/services/printer/cfgs/kamp/KAMP_Settings.cfg
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# Below you can include specific configuration files depending on what you want KAMP to do:
|
||||||
|
|
||||||
|
# NOTE bassamanator: uncomment the functionality that you want to use from KAMP
|
||||||
|
[include ./Adaptive_Meshing.cfg] # Include to enable adaptive meshing configuration.
|
||||||
|
[include ./Line_Purge.cfg] # Include to enable adaptive line purging configuration.
|
||||||
|
# [include ./Voron_Purge.cfg] # Include to enable adaptive Voron logo purging configuration.
|
||||||
|
# [include ./Smart_Park.cfg] # Include to enable the Smart Park function, which parks the printhead near the print area for final heating.
|
||||||
|
|
||||||
|
[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 mesh settings for KAMP.
|
||||||
|
variable_mesh_margin: 0 # Expands the mesh size in millimeters if desired. Leave at 0 to disable.
|
||||||
|
variable_fuzz_amount: 0 # Slightly randomizes mesh points to spread out wear from nozzle-based probes. Leave at 0 to disable.
|
||||||
|
|
||||||
|
# The following variables are for those with a dockable probe like Klicky, Euclid, etc. # ---------------- Attach Macro | Detach Macro
|
||||||
|
variable_probe_dock_enable: False # Set to True to enable the usage of a dockable probe. # ---------------------------------------------
|
||||||
|
variable_attach_macro: 'Attach_Probe' # The macro that is used to attach the probe. # Klicky Probe: 'Attach_Probe' | 'Dock_Probe'
|
||||||
|
variable_detach_macro: 'Dock_Probe' # The macro that is used to store the probe. # Euclid Probe: 'Deploy_Probe' | 'Stow_Probe'
|
||||||
|
# Legacy Gcode: 'M401' | 'M402'
|
||||||
|
|
||||||
|
# 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: 0 # 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: 10 # 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. ")}
|
119
modules/services/printer/cfgs/kamp/Line_Purge.cfg
Normal file
119
modules/services/printer/cfgs/kamp/Line_Purge.cfg
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
[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) * 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 %}
|
||||||
|
|
||||||
|
|
||||||
|
# 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 {}mm/s3.".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 {}mm/s3.".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 %}
|
38
modules/services/printer/cfgs/kamp/Smart_Park.cfg
Normal file
38
modules/services/printer/cfgs/kamp/Smart_Park.cfg
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
[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) * 60 | 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 %}
|
||||||
|
|
||||||
|
{% if verbose_enable == True %} # Verbose park location
|
||||||
|
|
||||||
|
{ action_respond_info("Smart Park location: {},{}.".format(
|
||||||
|
(x_min),
|
||||||
|
(y_min),
|
||||||
|
)) }
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% 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
|
91
modules/services/printer/cfgs/kamp/Voron_Purge.cfg
Normal file
91
modules/services/printer/cfgs/kamp/Voron_Purge.cfg
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
[gcode_macro VORON_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 kamp_settings = printer["gcode_macro _KAMP_Settings"] %}
|
||||||
|
{% set verbose_enable = kamp_settings.verbose_enable | abs %}
|
||||||
|
{% set purge_height = kamp_settings.purge_height | float %}
|
||||||
|
{% set tip_distance = kamp_settings.tip_distance | float %}
|
||||||
|
{% set purge_margin = kamp_settings.purge_margin | float %}
|
||||||
|
{% set purge_amount = kamp_settings.purge_amount | float %}
|
||||||
|
{% set flow_rate = 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) - (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 %}
|
||||||
|
|
||||||
|
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_origin} Y{purge_y_origin+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_origin+size*0.289} Y{purge_y_origin+size} E{purge_amount/4} F{purge_move_speed} # Purge first line of logo
|
||||||
|
{RETRACT} # Retract
|
||||||
|
G0 Z{purge_height*2} # Z hop
|
||||||
|
G0 X{purge_x_origin+size*0.789} Y{purge_y_origin+size} # Move to second purge line origin
|
||||||
|
G0 Z{purge_height} # Move to purge Z height
|
||||||
|
{UNRETRACT} # Recover
|
||||||
|
G1 X{purge_x_origin+size*0.211} Y{purge_y_origin} E{purge_amount/2} F{purge_move_speed} # Purge second line of logo
|
||||||
|
{RETRACT} # Retract
|
||||||
|
G0 Z{purge_height*2} # Z hop
|
||||||
|
G0 X{purge_x_origin+size*0.711} Y{purge_y_origin} # Move to third purge line origin
|
||||||
|
G0 Z{purge_height} # Move to purge Z height
|
||||||
|
{UNRETRACT} # Recover
|
||||||
|
G1 X{purge_x_origin+size} Y{purge_y_origin+size/2} E{purge_amount/4} F{purge_move_speed} # Purge third line of logo
|
||||||
|
{RETRACT} # Retract
|
||||||
|
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 %}
|
330
modules/services/printer/cfgs/misc-macros.cfg
Normal file
330
modules/services/printer/cfgs/misc-macros.cfg
Normal file
@ -0,0 +1,330 @@
|
|||||||
|
[force_move]
|
||||||
|
enable_force_move: True
|
||||||
|
|
||||||
|
# NOTE If you're using a Raspberry Pi, you can uncomment the next 2 lines, optionally.
|
||||||
|
[temperature_sensor raspberry_pi]
|
||||||
|
sensor_type: temperature_host
|
||||||
|
|
||||||
|
# NOTE If you're using a an Orange Pi, you can uncomment the next 3 lines, optionally.
|
||||||
|
# [temperature_sensor Orange_Pi]
|
||||||
|
# sensor_type: temperature_host
|
||||||
|
# sensor_path: /sys/class/thermal/thermal_zone0/temp
|
||||||
|
|
||||||
|
[virtual_sdcard]
|
||||||
|
path: /home/pi/printer_data/gcodes
|
||||||
|
|
||||||
|
# NOTE Cancel objects feature is enabled. If you're using a low powered device, comment out [exclude_object].
|
||||||
|
# Also see [file_manager] section in moonraker.conf.
|
||||||
|
[exclude_object]
|
||||||
|
|
||||||
|
[pause_resume]
|
||||||
|
[display_status]
|
||||||
|
|
||||||
|
[delayed_gcode DISABLEFILAMENTSENSOR]
|
||||||
|
initial_duration: 1
|
||||||
|
gcode:
|
||||||
|
SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0
|
||||||
|
|
||||||
|
[gcode_macro _globals]
|
||||||
|
variable_filament_sensor_enabled: 1 # NOTE Enable(1) or disable(0) the filament sensor, if one is connected
|
||||||
|
variable_beeping_enabled: 1 # NOTE Enable(1) or disable(0) beeping everywhere except during gantry calibration
|
||||||
|
variable_bed_temp_over: 10 # NOTE Start print if bed temperature is over by this amount, otherwise wait for temperature drop
|
||||||
|
variable_kamp_enable: 1 # NOTE Enable(1) or disable(0) KAMP (adaptive mesh)
|
||||||
|
variable_pre_purge_prime_length: 1.40
|
||||||
|
gcode:
|
||||||
|
# Don't delete this section
|
||||||
|
|
||||||
|
[gcode_macro CONDITIONAL_BEEP]
|
||||||
|
gcode:
|
||||||
|
# Parameters
|
||||||
|
{% set i = params.I|default(1)|int %} ; Iterations (number of times to beep).
|
||||||
|
{% set dur = params.DUR|default(100)|int %} ; Duration/wait of each beep in ms. Default 100ms.
|
||||||
|
{% set freq = params.FREQ|default(2000)|int %} ; Frequency in Hz. Default 2kHz.
|
||||||
|
|
||||||
|
{% set BEEPING_ENABLED=printer["gcode_macro _globals"].beeping_enabled|default(-1)|int %}
|
||||||
|
|
||||||
|
{% if BEEPING_ENABLED == 1 %}
|
||||||
|
BEEP I={i} DUR={dur} FREQ={freq}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
[gcode_macro ADJUST_FILAMENT_SENSOR_STATUS]
|
||||||
|
gcode:
|
||||||
|
# Parameters
|
||||||
|
{% set NEWSTATUS = params.ENABLE|default(-1)|int %}
|
||||||
|
|
||||||
|
{% set FILAMENT_SENSOR_ENABLED=printer["gcode_macro _globals"].filament_sensor_enabled|default(-1)|int %}
|
||||||
|
|
||||||
|
{% if FILAMENT_SENSOR_ENABLED == 1 and NEWSTATUS != -1 %}
|
||||||
|
SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE={NEWSTATUS}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
[gcode_macro M109]
|
||||||
|
rename_existing: M99109
|
||||||
|
gcode:
|
||||||
|
#Parameters
|
||||||
|
{% set s = params.S|float %}
|
||||||
|
|
||||||
|
M104 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %} ; Set hotend temp
|
||||||
|
{% if s != 0 %}
|
||||||
|
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={s} MAXIMUM={s+1} ; Wait for hotend temp (within 1 degree)
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
[gcode_macro M190]
|
||||||
|
rename_existing: M99190
|
||||||
|
gcode:
|
||||||
|
#Parameters
|
||||||
|
{% set s = params.S|float %}
|
||||||
|
|
||||||
|
M140 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %} ; Set bed temp
|
||||||
|
{% if s != 0 %}
|
||||||
|
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={s} MAXIMUM={s+1} ; Wait for bed temp (within 1 degree)
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
[gcode_macro PURGE_LINE]
|
||||||
|
gcode:
|
||||||
|
{% set PRE_PURGE_PRIME_LENGTH=printer["gcode_macro _globals"].pre_purge_prime_length|default(1.40)|float %}
|
||||||
|
ADJUST_FILAMENT_SENSOR_STATUS ENABLE=1
|
||||||
|
|
||||||
|
# Misc variables
|
||||||
|
{% set extrudeAmount = 26.6 %}
|
||||||
|
{% set movementLength = 100.0 %}
|
||||||
|
{% set movementSpeed = 15 * 60 %}
|
||||||
|
{% set xStart = 0.5 %}
|
||||||
|
{% set yStart = 0.5 %}
|
||||||
|
|
||||||
|
# Set safe speeds
|
||||||
|
{% set maxVelocity = printer.configfile.settings.printer.max_velocity|default(200)|int %}
|
||||||
|
{% set maxVelocityAdjusted = (0.95 * maxVelocity * 60)|int %}
|
||||||
|
|
||||||
|
G92 E0.0 ; reset extruder
|
||||||
|
G90 ; Absolute positioning
|
||||||
|
G0 X{xStart} Y{yStart} F{maxVelocityAdjusted} ; move to purge position
|
||||||
|
G1 Z0.4 F500.0 ; move to purge height
|
||||||
|
M83 ; Relative extrusion mode
|
||||||
|
G1 E{PRE_PURGE_PRIME_LENGTH} F500 ; pre-purge prime LENGTH SHOULD MATCH YOUR PRINT_END RETRACT
|
||||||
|
G1 X{xStart + movementLength} E{extrudeAmount} F{movementSpeed} ; intro line 1
|
||||||
|
|
||||||
|
G92 E0.0 ; reset extruder
|
||||||
|
M82 ; Absolute extrusion mode
|
||||||
|
G1 Z5.0 ; move nozzle to prevent scratch
|
||||||
|
|
||||||
|
[gcode_macro CANCEL_PRINT]
|
||||||
|
rename_existing: BASE_CANCEL_PRINT
|
||||||
|
gcode:
|
||||||
|
SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value
|
||||||
|
CLEAR_PAUSE
|
||||||
|
SDCARD_RESET_FILE
|
||||||
|
PRINT_END
|
||||||
|
BASE_CANCEL_PRINT
|
||||||
|
|
||||||
|
[gcode_macro PRINT_START]
|
||||||
|
gcode:
|
||||||
|
|
||||||
|
ADJUST_FILAMENT_SENSOR_STATUS ENABLE=1
|
||||||
|
# Parameters
|
||||||
|
{% set bedtemp = params.BED|int %}
|
||||||
|
{% set hotendtemp = params.HOTEND|int %}
|
||||||
|
{% set chambertemp = params.CHAMBER|default(0)|int %}
|
||||||
|
|
||||||
|
# Other variables
|
||||||
|
{% set bedtempSlicer = bedtemp %}
|
||||||
|
{% set bedtempOver = printer["gcode_macro _globals"].bed_temp_over|default(0)|int %}
|
||||||
|
{% set maxVelocity = printer.configfile.settings.printer.max_velocity|default(200)|int %}
|
||||||
|
{% set maxVelocityAdjusted = (0.90 * maxVelocity * 60)|int %}
|
||||||
|
{% set kampEnabled=printer["gcode_macro _globals"].kamp_enable|default(0)|int %}
|
||||||
|
|
||||||
|
{% if printer.configfile.settings.safe_z_home %}
|
||||||
|
{% set startX = printer.configfile.settings.safe_z_home.home_xy_position[0]|float %}
|
||||||
|
{% set startY = printer.configfile.settings.safe_z_home.home_xy_position[1]|float %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% set bedtempAlmost = ((bedtemp - 2, 0, printer.heater_bed.temperature|int)|max, bedtemp)|max %}
|
||||||
|
{% set hotendtempStepOne = ((hotendtemp, printer[printer.toolhead.extruder].temperature|int)|min, 150)|max %}
|
||||||
|
{% set hotendtempStepTwo = ((hotendtemp, printer[printer.toolhead.extruder].temperature|int)|min, 170)|max %}
|
||||||
|
|
||||||
|
# If bed-temp-almost is higher than bed-temp by a maximum of bed-temp-over
|
||||||
|
{% if bedtempAlmost > bedtemp %}
|
||||||
|
{% if (bedtempAlmost - bedtempOver) <= bedtemp %}
|
||||||
|
{% set bedtemp = bedtempAlmost %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
G90 ; absolute positioning
|
||||||
|
M140 S{bedtempAlmost} ; set & don't wait for bed temp
|
||||||
|
M104 S{hotendtempStepOne} ; set & don't wait for hotend temp
|
||||||
|
G28 X Y
|
||||||
|
{% if printer.configfile.settings.safe_z_home %}
|
||||||
|
G1 X{startX} Y{startY} F{maxVelocityAdjusted}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
M190 S{bedtempAlmost} ; set & wait for bed temp
|
||||||
|
{% if kampEnabled == 0 %}
|
||||||
|
M104 S{hotendtempStepTwo} ; set & don't wait for hotend temp
|
||||||
|
{% endif %}
|
||||||
|
M190 S{bedtemp} ; set & wait for bed temp
|
||||||
|
M140 S{bedtempSlicer} ; set & don't wait for bed temp ; set temp to sliced setting regardless
|
||||||
|
|
||||||
|
{% if kampEnabled == 0 %}
|
||||||
|
BED_MESH_PROFILE LOAD=default ; NOTE if not using a mesh, comment out this line
|
||||||
|
SKEW_PROFILE LOAD=CaliFlower
|
||||||
|
M104 S{hotendtemp} ; set & don't wait for hotend temp
|
||||||
|
G28 Z ; final z homing
|
||||||
|
{% else %}
|
||||||
|
G28 Z ; final z homing
|
||||||
|
BED_MESH_CALIBRATE ; KAMP mesh
|
||||||
|
M104 S{hotendtemp} ; set & don't wait for hotend temp
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
G1 X0 Y0 F{maxVelocityAdjusted}
|
||||||
|
M109 S{hotendtemp} ; set & wait for hotend temp
|
||||||
|
|
||||||
|
G1 Z20 F3000 ; move nozzle away from bed
|
||||||
|
|
||||||
|
[gcode_macro PRINT_END]
|
||||||
|
gcode:
|
||||||
|
SET_SKEW CLEAR=1
|
||||||
|
ADJUST_FILAMENT_SENSOR_STATUS ENABLE=0
|
||||||
|
CONDITIONAL_BEEP I=2 DUR=30 FREQ=8500
|
||||||
|
{% set PRE_PURGE_PRIME_LENGTH=printer["gcode_macro _globals"].pre_purge_prime_length|default(1.40)|float %}
|
||||||
|
|
||||||
|
M400 ; wait for buffer to clear
|
||||||
|
G92 E0 ; zero the extruder
|
||||||
|
G1 E-{PRE_PURGE_PRIME_LENGTH} F400 ; retract filament
|
||||||
|
G91 ; relative positioning
|
||||||
|
|
||||||
|
# Set safe speeds
|
||||||
|
{% set zVelocity = printer.configfile.settings.printer.max_z_velocity|default(15)|int %}
|
||||||
|
{% set maxVelocity = printer.configfile.settings.printer.max_velocity|default(200)|int %}
|
||||||
|
{% set zVelocityAdjusted = (0.95 * zVelocity * 60)|int %}
|
||||||
|
{% set maxVelocityAdjusted = (0.95 * maxVelocity * 60)|int %}
|
||||||
|
|
||||||
|
# Get Boundaries
|
||||||
|
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
|
||||||
|
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
|
||||||
|
{% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %}
|
||||||
|
|
||||||
|
# Check end position to determine safe direction to move
|
||||||
|
{% if printer.toolhead.position.x < (max_x - 20) %}
|
||||||
|
{% set x_safe = 20.0 %}
|
||||||
|
{% else %}
|
||||||
|
{% set x_safe = -20.0 %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if printer.toolhead.position.y < (max_y - 20) %}
|
||||||
|
{% set y_safe = 20.0 %}
|
||||||
|
{% else %}
|
||||||
|
{% set y_safe = -20.0 %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% set lift_height = 25.0 %}
|
||||||
|
{% if printer.toolhead.position.z < (max_z - lift_height) %}
|
||||||
|
{% set z_safe = lift_height %}
|
||||||
|
{% else %}
|
||||||
|
{% set z_safe = max_z - printer.toolhead.position.z %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
G0 Z{z_safe} F{zVelocityAdjusted} ; move nozzle up
|
||||||
|
G0 X{x_safe} Y{y_safe} F{maxVelocityAdjusted} ; move nozzle to remove stringing
|
||||||
|
TURN_OFF_HEATERS
|
||||||
|
M107 ; turn off fan
|
||||||
|
G90 ; absolute positioning
|
||||||
|
G0 X60 Y{max_y} F3600 ; park nozzle at rear
|
||||||
|
M84
|
||||||
|
|
||||||
|
[gcode_macro LOAD_FILAMENT]
|
||||||
|
gcode:
|
||||||
|
M83 ; set extruder to relative
|
||||||
|
G1 E30 F300 ; load
|
||||||
|
G1 E15 F150 ; prime nozzle with filament
|
||||||
|
M82 ; set extruder to absolute
|
||||||
|
|
||||||
|
[gcode_macro UNLOAD_FILAMENT]
|
||||||
|
gcode:
|
||||||
|
M83 ; set extruder to relative
|
||||||
|
G1 E10 F300 ; extrude a little to soften tip
|
||||||
|
G1 E-40 F1800 ; retract some, but not too much or it will jam
|
||||||
|
M82 ; set extruder to absolute
|
||||||
|
|
||||||
|
[gcode_macro M600]
|
||||||
|
gcode:
|
||||||
|
CONDITIONAL_BEEP i=1 dur=300
|
||||||
|
CONDITIONAL_BEEP i=1 dur=100
|
||||||
|
CONDITIONAL_BEEP i=1 dur=100
|
||||||
|
PAUSE ; Pause
|
||||||
|
|
||||||
|
[gcode_macro PAUSE]
|
||||||
|
rename_existing: BASE_PAUSE
|
||||||
|
gcode:
|
||||||
|
# Parameters
|
||||||
|
{% set z = params.Z|default(10)|int %} ; z hop amount
|
||||||
|
|
||||||
|
{% if printer['pause_resume'].is_paused|int == 0 %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE={z} ; set z hop variable for reference in resume macro
|
||||||
|
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=etemp VALUE={printer['extruder'].target} ; set hotend temp variable for reference in resume macro
|
||||||
|
|
||||||
|
ADJUST_FILAMENT_SENSOR_STATUS ENABLE=0
|
||||||
|
|
||||||
|
SAVE_GCODE_STATE NAME=PAUSE ; save current print position for resume
|
||||||
|
BASE_PAUSE ; pause print
|
||||||
|
{% if (printer.gcode_move.position.z + z) < printer.toolhead.axis_maximum.z %} ; check that zhop doesn't exceed z max
|
||||||
|
G91 ; relative positioning
|
||||||
|
G1 Z{z} F900 ; raise Z up by z hop amount
|
||||||
|
{% else %}
|
||||||
|
{ action_respond_info("Pause zhop exceeds maximum Z height.") } ; if z max is exceeded, show message and set zhop value for resume to 0
|
||||||
|
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE=0
|
||||||
|
{% endif %}
|
||||||
|
G90 ; absolute positioning
|
||||||
|
G1 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} F6000 ; park toolhead at front center
|
||||||
|
SAVE_GCODE_STATE NAME=PAUSEPARK ; save parked position in case toolhead is moved during the pause (otherwise the return zhop can error)
|
||||||
|
M104 S0 ; turn off hotend
|
||||||
|
SET_IDLE_TIMEOUT TIMEOUT=43200 ; set timeout to 12 hours
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
[gcode_macro RESUME]
|
||||||
|
rename_existing: BASE_RESUME
|
||||||
|
variable_zhop: 0
|
||||||
|
variable_etemp: 0
|
||||||
|
gcode:
|
||||||
|
# Parameters
|
||||||
|
{% set e = params.E|default(2.5)|int %} ; hotend prime amount (in mm)
|
||||||
|
|
||||||
|
{% if printer['pause_resume'].is_paused|int == 1 %}
|
||||||
|
ADJUST_FILAMENT_SENSOR_STATUS ENABLE=1
|
||||||
|
|
||||||
|
SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value
|
||||||
|
{% if etemp > 0 %}
|
||||||
|
M109 S{etemp|int} ; wait for hotend to heat back up
|
||||||
|
{% endif %}
|
||||||
|
RESTORE_GCODE_STATE NAME=PAUSEPARK MOVE=1 MOVE_SPEED=100 ; go back to parked position in case toolhead was moved during pause (otherwise the return zhop can error)
|
||||||
|
G91 ; relative positioning
|
||||||
|
M83 ; relative extruder positioning
|
||||||
|
{% if printer[printer.toolhead.extruder].temperature >= printer.configfile.settings.extruder.min_extrude_temp %}
|
||||||
|
G1 Z{zhop * -1} E{e} F900 ; prime nozzle by E, lower Z back down
|
||||||
|
{% else %}
|
||||||
|
G1 Z{zhop * -1} F900 ; lower Z back down without priming (just in case we are testing the macro with cold hotend)
|
||||||
|
{% endif %}
|
||||||
|
RESTORE_GCODE_STATE NAME=PAUSE MOVE=1 MOVE_SPEED=60 ; restore position
|
||||||
|
BASE_RESUME ; resume print
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
[gcode_macro _CG28]
|
||||||
|
# Conditional homing
|
||||||
|
gcode:
|
||||||
|
{% if "xyz" not in printer.toolhead.homed_axes %}
|
||||||
|
G28
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
[gcode_macro BEEP]
|
||||||
|
description: BEEP I=3 DUR=200 FREQ=2000: Beep 3 times, for 200ms each, at 2kHz frequency.
|
||||||
|
gcode:
|
||||||
|
# Parameters
|
||||||
|
{% set i = params.I|default(1)|int %} ; Iterations (number of times to beep).
|
||||||
|
{% set dur = params.DUR|default(100)|int %} ; Duration/wait of each beep in ms. Default 100ms.
|
||||||
|
{% set freq = params.FREQ|default(2000)|int %} ; Frequency in Hz. Default 2kHz.
|
||||||
|
|
||||||
|
{% for iteration in range(i|int) %}
|
||||||
|
SET_PIN PIN=beeper VALUE=0.8 CYCLE_TIME={ 1.0/freq if freq > 0 else 1 }
|
||||||
|
G4 P{dur}
|
||||||
|
SET_PIN PIN=beeper VALUE=0
|
||||||
|
G4 P{dur}
|
||||||
|
{% endfor %}
|
18
modules/services/printer/default.nix
Normal file
18
modules/services/printer/default.nix
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#
|
||||||
|
# Services
|
||||||
|
#
|
||||||
|
# flake.nix
|
||||||
|
# ├─ ./hosts
|
||||||
|
# │ └─ home.nix
|
||||||
|
# └─ ./modules
|
||||||
|
# └─ ./services
|
||||||
|
# └─ default.nix *
|
||||||
|
# └─ ...
|
||||||
|
#
|
||||||
|
|
||||||
|
[
|
||||||
|
./klipper.nix
|
||||||
|
]
|
||||||
|
|
||||||
|
# picom, polybar and sxhkd are pulled from desktop module
|
||||||
|
# redshift temporarely disables
|
77
modules/services/printer/klipper.nix
Normal file
77
modules/services/printer/klipper.nix
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
{ lib, config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
environment = {
|
||||||
|
systemPackages = with pkgs; [
|
||||||
|
klipperscreen
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
klipper = {
|
||||||
|
enable = true;
|
||||||
|
configFile = "./printer.cfg";
|
||||||
|
#firmwares."sovol06" = {
|
||||||
|
# serial = "/dev/usb/by-id/123";
|
||||||
|
# enableKlipperFlash = true;
|
||||||
|
# enable = true;
|
||||||
|
# configFile = "./firmware.conf";
|
||||||
|
#};
|
||||||
|
};
|
||||||
|
|
||||||
|
mainsail = {
|
||||||
|
enable = true;
|
||||||
|
nginx = {
|
||||||
|
enableACME = true;
|
||||||
|
useACMEHost = "home.opel-online.de";
|
||||||
|
serverName = "sv06.home.opel-online.de";
|
||||||
|
onlySSL = true;
|
||||||
|
listenAddresses = [ "0.0.0.0" "::" ];
|
||||||
|
forceSSL = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
moonraker.enable = true;
|
||||||
|
|
||||||
|
# nginx = {
|
||||||
|
# enable = true;
|
||||||
|
# recommendedProxySettings = true;
|
||||||
|
# recommendedTlsSettings = true;
|
||||||
|
# recommendedGzipSettings = true;
|
||||||
|
# recommendedOptimisation = true;
|
||||||
|
# virtualHosts = {
|
||||||
|
# "ci.kabtop.de" = {
|
||||||
|
# enableACME = true;
|
||||||
|
# forceSSL = true;
|
||||||
|
# default = true;
|
||||||
|
# locations."/".return = "503";
|
||||||
|
# };
|
||||||
|
# "hydra.ci.kabtop.de" = {
|
||||||
|
# enableACME = true;
|
||||||
|
# forceSSL = true;
|
||||||
|
# locations."/" = {
|
||||||
|
# proxyPass = "http://localhost:3000";
|
||||||
|
# extraConfig = ''
|
||||||
|
# proxy_set_header X-Forwarded-Port 443;
|
||||||
|
# '';
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
# "cache.ci.kabtop.de" = {
|
||||||
|
# enableACME = true;
|
||||||
|
# forceSSL = true;
|
||||||
|
# locations."/".proxyPass = "http://${config.services.nix-serve.bindAddress}:${toString config.services.nix-serve.port}";
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
#
|
||||||
|
# security.acme = {
|
||||||
|
# acceptTerms = true;
|
||||||
|
# defaults = {
|
||||||
|
# email = "webmaster@kabtop.de";
|
||||||
|
# webroot = "/var/lib/acme/acme-challenge";
|
||||||
|
# #server = "https://acme-staging-v02.api.letsencrypt.org/directory";
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
313
modules/services/printer/mainsail.cfg
Normal file
313
modules/services/printer/mainsail.cfg
Normal file
@ -0,0 +1,313 @@
|
|||||||
|
## Client klipper macro definitions
|
||||||
|
##
|
||||||
|
## Copyright (C) 2022 Alex Zellner <alexander.zellner@googlemail.com>
|
||||||
|
##
|
||||||
|
## This file may be distributed under the terms of the GNU GPLv3 license
|
||||||
|
##
|
||||||
|
## !!! This file is read-only. Maybe the used editor indicates that. !!!
|
||||||
|
##
|
||||||
|
## Customization:
|
||||||
|
## 1) copy the gcode_macro _CLIENT_VARIABLE (see below) to your printer.cfg
|
||||||
|
## 2) remove the comment mark (#) from all lines
|
||||||
|
## 3) change any value in there to your needs
|
||||||
|
##
|
||||||
|
## Use the PAUSE macro direct in your M600:
|
||||||
|
## e.g. with a different park position front left and a minimal height of 50
|
||||||
|
## [gcode_macro M600]
|
||||||
|
## description: Filament change
|
||||||
|
## gcode: PAUSE X=10 Y=10 Z_MIN=50
|
||||||
|
## Z_MIN will park the toolhead at a minimum of 50 mm above to bed to make it easier for you to swap filament.
|
||||||
|
##
|
||||||
|
## Client variable macro for your printer.cfg
|
||||||
|
#[gcode_macro _CLIENT_VARIABLE]
|
||||||
|
#variable_use_custom_pos : False ; use custom park coordinates for x,y [True/False]
|
||||||
|
#variable_custom_park_x : 0.0 ; custom x position; value must be within your defined min and max of X
|
||||||
|
#variable_custom_park_y : 0.0 ; custom y position; value must be within your defined min and max of Y
|
||||||
|
#variable_custom_park_dz : 2.0 ; custom dz value; the value in mm to lift the nozzle when move to park position
|
||||||
|
#variable_retract : 1.0 ; the value to retract while PAUSE
|
||||||
|
#variable_cancel_retract : 5.0 ; the value to retract while CANCEL_PRINT
|
||||||
|
#variable_speed_retract : 35.0 ; retract speed in mm/s
|
||||||
|
#variable_unretract : 1.0 ; the value to unretract while RESUME
|
||||||
|
#variable_speed_unretract : 35.0 ; unretract speed in mm/s
|
||||||
|
#variable_speed_hop : 15.0 ; z move speed in mm/s
|
||||||
|
#variable_speed_move : 100.0 ; move speed in mm/s
|
||||||
|
#variable_park_at_cancel : False ; allow to move the toolhead to park while execute CANCEL_PRINT [True/False]
|
||||||
|
#variable_park_at_cancel_x : None ; different park position during CANCEL_PRINT [None/Position as Float]; park_at_cancel must be True
|
||||||
|
#variable_park_at_cancel_y : None ; different park position during CANCEL_PRINT [None/Position as Float]; park_at_cancel must be True
|
||||||
|
## !!! Caution [firmware_retraction] must be defined in the printer.cfg if you set use_fw_retract: True !!!
|
||||||
|
#variable_use_fw_retract : False ; use fw_retraction instead of the manual version [True/False]
|
||||||
|
#variable_idle_timeout : 0 ; time in sec until idle_timeout kicks in. Value 0 means that no value will be set or restored
|
||||||
|
#variable_runout_sensor : "" ; If a sensor is defined, it will be used to cancel the execution of RESUME in case no filament is detected.
|
||||||
|
## Specify the config name of the runout sensor e.g "filament_switch_sensor runout". Hint use the same as in your printer.cfg
|
||||||
|
## !!! Custom macros, please use with care and review the section of the corresponding macro.
|
||||||
|
## These macros are for simple operations like setting a status LED. Please make sure your macro does not interfere with the basic macro functions.
|
||||||
|
## Only single line commands are supported, please create a macro if you need more than one command.
|
||||||
|
#variable_user_pause_macro : "" ; Everything inside the "" will be executed after the klipper base pause (PAUSE_BASE) function
|
||||||
|
#variable_user_resume_macro: "" ; Everything inside the "" will be executed before the klipper base resume (RESUME_BASE) function
|
||||||
|
#variable_user_cancel_macro: "" ; Everything inside the "" will be executed before the klipper base cancel (CANCEL_PRINT_BASE) function
|
||||||
|
#gcode:
|
||||||
|
|
||||||
|
[virtual_sdcard]
|
||||||
|
path: ~/printer_data/gcodes
|
||||||
|
on_error_gcode: CANCEL_PRINT
|
||||||
|
|
||||||
|
[pause_resume]
|
||||||
|
#recover_velocity: 50.
|
||||||
|
# When capture/restore is enabled, the speed at which to return to
|
||||||
|
# the captured position (in mm/s). Default is 50.0 mm/s.
|
||||||
|
|
||||||
|
[display_status]
|
||||||
|
|
||||||
|
[respond]
|
||||||
|
|
||||||
|
[gcode_macro CANCEL_PRINT]
|
||||||
|
description: Cancel the actual running print
|
||||||
|
rename_existing: CANCEL_PRINT_BASE
|
||||||
|
gcode:
|
||||||
|
##### get user parameters or use default #####
|
||||||
|
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
|
||||||
|
{% set allow_park = client.park_at_cancel|default(false)|lower == 'true' %}
|
||||||
|
{% set retract = client.cancel_retract|default(5.0)|abs %}
|
||||||
|
##### define park position #####
|
||||||
|
{% set park_x = "" if (client.park_at_cancel_x|default(none) is none)
|
||||||
|
else "X=" ~ client.park_at_cancel_x %}
|
||||||
|
{% set park_y = "" if (client.park_at_cancel_y|default(none) is none)
|
||||||
|
else "Y=" ~ client.park_at_cancel_y %}
|
||||||
|
{% set custom_park = park_x|length > 0 or park_y|length > 0 %}
|
||||||
|
##### end of definitions #####
|
||||||
|
# restore idle_timeout time if needed
|
||||||
|
{% if printer['gcode_macro RESUME'].restore_idle_timeout > 0 %}
|
||||||
|
SET_IDLE_TIMEOUT TIMEOUT={printer['gcode_macro RESUME'].restore_idle_timeout}
|
||||||
|
{% endif %}
|
||||||
|
{% if (custom_park or not printer.pause_resume.is_paused) and allow_park %} _TOOLHEAD_PARK_PAUSE_CANCEL {park_x} {park_y} {% endif %}
|
||||||
|
_CLIENT_RETRACT LENGTH={retract}
|
||||||
|
TURN_OFF_HEATERS
|
||||||
|
M106 S0
|
||||||
|
{client.user_cancel_macro|default("")}
|
||||||
|
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=idle_state VALUE=False
|
||||||
|
# clear pause_next_layer and pause_at_layer as preparation for next print
|
||||||
|
SET_PAUSE_NEXT_LAYER ENABLE=0
|
||||||
|
SET_PAUSE_AT_LAYER ENABLE=0 LAYER=0
|
||||||
|
CANCEL_PRINT_BASE
|
||||||
|
|
||||||
|
[gcode_macro PAUSE]
|
||||||
|
description: Pause the actual running print
|
||||||
|
rename_existing: PAUSE_BASE
|
||||||
|
gcode:
|
||||||
|
##### get user parameters or use default #####
|
||||||
|
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
|
||||||
|
{% set idle_timeout = client.idle_timeout|default(0) %}
|
||||||
|
{% set temp = printer[printer.toolhead.extruder].target if printer.toolhead.extruder != '' else 0 %}
|
||||||
|
{% set restore = False if printer.toolhead.extruder == ''
|
||||||
|
else True if params.RESTORE|default(1)|int == 1 else False %}
|
||||||
|
##### end of definitions #####
|
||||||
|
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=last_extruder_temp VALUE="{{'restore': restore, 'temp': temp}}"
|
||||||
|
# set a new idle_timeout value
|
||||||
|
{% if idle_timeout > 0 %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=restore_idle_timeout VALUE={printer.configfile.settings.idle_timeout.timeout}
|
||||||
|
SET_IDLE_TIMEOUT TIMEOUT={idle_timeout}
|
||||||
|
{% endif %}
|
||||||
|
PAUSE_BASE
|
||||||
|
{client.user_pause_macro|default("")}
|
||||||
|
_TOOLHEAD_PARK_PAUSE_CANCEL {rawparams}
|
||||||
|
|
||||||
|
[gcode_macro RESUME]
|
||||||
|
description: Resume the actual running print
|
||||||
|
rename_existing: RESUME_BASE
|
||||||
|
variable_last_extruder_temp: {'restore': False, 'temp': 0}
|
||||||
|
variable_restore_idle_timeout: 0
|
||||||
|
variable_idle_state: False
|
||||||
|
gcode:
|
||||||
|
##### get user parameters or use default #####
|
||||||
|
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
|
||||||
|
{% set velocity = printer.configfile.settings.pause_resume.recover_velocity %}
|
||||||
|
{% set sp_move = client.speed_move|default(velocity) %}
|
||||||
|
{% set runout_resume = True if client.runout_sensor|default("") == "" # no runout
|
||||||
|
else True if not printer[client.runout_sensor].enabled # sensor is disabled
|
||||||
|
else printer[client.runout_sensor].filament_detected %} # sensor status
|
||||||
|
{% set can_extrude = True if printer.toolhead.extruder == '' # no extruder defined in config
|
||||||
|
else printer[printer.toolhead.extruder].can_extrude %} # status of active extruder
|
||||||
|
{% set do_resume = False %}
|
||||||
|
{% set prompt_txt = [] %}
|
||||||
|
##### end of definitions #####
|
||||||
|
#### Printer comming from timeout idle state ####
|
||||||
|
{% if printer.idle_timeout.state|upper == "IDLE" or idle_state %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=idle_state VALUE=False
|
||||||
|
{% if last_extruder_temp.restore %}
|
||||||
|
# we need to use the unicode (\u00B0) for the ° as py2 env's would throw an error otherwise
|
||||||
|
RESPOND TYPE=echo MSG='{"Restoring \"%s\" temperature to %3.1f\u00B0C, this may take some time" % (printer.toolhead.extruder, last_extruder_temp.temp) }'
|
||||||
|
M109 S{last_extruder_temp.temp}
|
||||||
|
{% set do_resume = True %}
|
||||||
|
{% elif can_extrude %}
|
||||||
|
{% set do_resume = True %}
|
||||||
|
{% else %}
|
||||||
|
RESPOND TYPE=error MSG='{"Resume aborted !!! \"%s\" not hot enough, please heat up again and press RESUME" % printer.toolhead.extruder}'
|
||||||
|
{% set _d = prompt_txt.append("\"%s\" not hot enough, please heat up again and press RESUME" % printer.toolhead.extruder) %}
|
||||||
|
{% endif %}
|
||||||
|
#### Printer comming out of regular PAUSE state ####
|
||||||
|
{% elif can_extrude %}
|
||||||
|
{% set do_resume = True %}
|
||||||
|
{% else %}
|
||||||
|
RESPOND TYPE=error MSG='{"Resume aborted !!! \"%s\" not hot enough, please heat up again and press RESUME" % printer.toolhead.extruder}'
|
||||||
|
{% set _d = prompt_txt.append("\"%s\" not hot enough, please heat up again and press RESUME" % printer.toolhead.extruder) %}
|
||||||
|
{% endif %}
|
||||||
|
{% if runout_resume %}
|
||||||
|
{% if do_resume %}
|
||||||
|
{% if restore_idle_timeout > 0 %} SET_IDLE_TIMEOUT TIMEOUT={restore_idle_timeout} {% endif %} # restore idle_timeout time
|
||||||
|
{client.user_resume_macro|default("")}
|
||||||
|
_CLIENT_EXTRUDE
|
||||||
|
RESUME_BASE VELOCITY={params.VELOCITY|default(sp_move)}
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
RESPOND TYPE=error MSG='{"Resume aborted !!! \"%s\" detects no filament, please load filament and press RESUME" % (client.runout_sensor.split(" "))[1]}'
|
||||||
|
{% set _d = prompt_txt.append("\"%s\" detects no filament, please load filament and press RESUME" % (client.runout_sensor.split(" "))[1]) %}
|
||||||
|
{% endif %}
|
||||||
|
##### Generate User Information box in case of abort #####
|
||||||
|
{% if not (runout_resume and do_resume) %}
|
||||||
|
RESPOND TYPE=command MSG="action:prompt_begin RESUME aborted !!!"
|
||||||
|
{% for element in prompt_txt %}
|
||||||
|
RESPOND TYPE=command MSG='{"action:prompt_text %s" % element}'
|
||||||
|
{% endfor %}
|
||||||
|
RESPOND TYPE=command MSG="action:prompt_footer_button Ok|RESPOND TYPE=command MSG=action:prompt_end|info"
|
||||||
|
RESPOND TYPE=command MSG="action:prompt_show"
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
# Usage: SET_PAUSE_NEXT_LAYER [ENABLE=[0|1]] [MACRO=<name>]
|
||||||
|
[gcode_macro SET_PAUSE_NEXT_LAYER]
|
||||||
|
description: Enable a pause if the next layer is reached
|
||||||
|
gcode:
|
||||||
|
{% set pause_next_layer = printer['gcode_macro SET_PRINT_STATS_INFO'].pause_next_layer %}
|
||||||
|
{% set ENABLE = params.ENABLE|default(1)|int != 0 %}
|
||||||
|
{% set MACRO = params.MACRO|default(pause_next_layer.call, True) %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_next_layer VALUE="{{ 'enable': ENABLE, 'call': MACRO }}"
|
||||||
|
|
||||||
|
# Usage: SET_PAUSE_AT_LAYER [ENABLE=[0|1]] [LAYER=<number>] [MACRO=<name>]
|
||||||
|
[gcode_macro SET_PAUSE_AT_LAYER]
|
||||||
|
description: Enable/disable a pause if a given layer number is reached
|
||||||
|
gcode:
|
||||||
|
{% set pause_at_layer = printer['gcode_macro SET_PRINT_STATS_INFO'].pause_at_layer %}
|
||||||
|
{% set ENABLE = params.ENABLE|int != 0 if params.ENABLE is defined
|
||||||
|
else params.LAYER is defined %}
|
||||||
|
{% set LAYER = params.LAYER|default(pause_at_layer.layer)|int %}
|
||||||
|
{% set MACRO = params.MACRO|default(pause_at_layer.call, True) %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{{ 'enable': ENABLE, 'layer': LAYER, 'call': MACRO }}"
|
||||||
|
|
||||||
|
# Usage: SET_PRINT_STATS_INFO [TOTAL_LAYER=<total_layer_count>] [CURRENT_LAYER= <current_layer>]
|
||||||
|
[gcode_macro SET_PRINT_STATS_INFO]
|
||||||
|
rename_existing: SET_PRINT_STATS_INFO_BASE
|
||||||
|
description: Overwrite, to get pause_next_layer and pause_at_layer feature
|
||||||
|
variable_pause_next_layer: { 'enable': False, 'call': "PAUSE" }
|
||||||
|
variable_pause_at_layer : { 'enable': False, 'layer': 0, 'call': "PAUSE" }
|
||||||
|
gcode:
|
||||||
|
{% if pause_next_layer.enable %}
|
||||||
|
RESPOND TYPE=echo MSG='{"%s, forced by pause_next_layer" % pause_next_layer.call}'
|
||||||
|
{pause_next_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE
|
||||||
|
SET_PAUSE_NEXT_LAYER ENABLE=0
|
||||||
|
{% elif pause_at_layer.enable and params.CURRENT_LAYER is defined and params.CURRENT_LAYER|int == pause_at_layer.layer %}
|
||||||
|
RESPOND TYPE=echo MSG='{"%s, forced by pause_at_layer [%d]" % (pause_at_layer.call, pause_at_layer.layer)}'
|
||||||
|
{pause_at_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE
|
||||||
|
SET_PAUSE_AT_LAYER ENABLE=0
|
||||||
|
{% endif %}
|
||||||
|
SET_PRINT_STATS_INFO_BASE {rawparams}
|
||||||
|
|
||||||
|
##### internal use #####
|
||||||
|
[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
|
||||||
|
description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
|
||||||
|
gcode:
|
||||||
|
##### get user parameters or use default #####
|
||||||
|
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
|
||||||
|
{% set velocity = printer.configfile.settings.pause_resume.recover_velocity %}
|
||||||
|
{% set use_custom = client.use_custom_pos|default(false)|lower == 'true' %}
|
||||||
|
{% set custom_park_x = client.custom_park_x|default(0.0) %}
|
||||||
|
{% set custom_park_y = client.custom_park_y|default(0.0) %}
|
||||||
|
{% set park_dz = client.custom_park_dz|default(2.0)|abs %}
|
||||||
|
{% set sp_hop = client.speed_hop|default(15) * 60 %}
|
||||||
|
{% set sp_move = client.speed_move|default(velocity) * 60 %}
|
||||||
|
##### get config and toolhead values #####
|
||||||
|
{% set origin = printer.gcode_move.homing_origin %}
|
||||||
|
{% set act = printer.gcode_move.gcode_position %}
|
||||||
|
{% set max = printer.toolhead.axis_maximum %}
|
||||||
|
{% set cone = printer.toolhead.cone_start_z|default(max.z) %} ; height as long the toolhead can reach max and min of an delta
|
||||||
|
{% set round_bed = True if printer.configfile.settings.printer.kinematics is in ['delta','polar','rotary_delta','winch']
|
||||||
|
else False %}
|
||||||
|
##### define park position #####
|
||||||
|
{% set z_min = params.Z_MIN|default(0)|float %}
|
||||||
|
{% set z_park = [[(act.z + park_dz), z_min]|max, (max.z - origin.z)]|min %}
|
||||||
|
{% set x_park = params.X if params.X is defined
|
||||||
|
else custom_park_x if use_custom
|
||||||
|
else 0.0 if round_bed
|
||||||
|
else (max.x - 5.0) %}
|
||||||
|
{% set y_park = params.Y if params.Y is defined
|
||||||
|
else custom_park_y if use_custom
|
||||||
|
else (max.y - 5.0) if round_bed and z_park < cone
|
||||||
|
else 0.0 if round_bed
|
||||||
|
else (max.y - 5.0) %}
|
||||||
|
##### end of definitions #####
|
||||||
|
_CLIENT_RETRACT
|
||||||
|
{% if "xyz" in printer.toolhead.homed_axes %}
|
||||||
|
G90
|
||||||
|
G1 Z{z_park} F{sp_hop}
|
||||||
|
G1 X{x_park} Y{y_park} F{sp_move}
|
||||||
|
{% if not printer.gcode_move.absolute_coordinates %} G91 {% endif %}
|
||||||
|
{% else %}
|
||||||
|
RESPOND TYPE=echo MSG='Printer not homed'
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
[gcode_macro _CLIENT_EXTRUDE]
|
||||||
|
description: Extrudes, if the extruder is hot enough
|
||||||
|
gcode:
|
||||||
|
##### get user parameters or use default #####
|
||||||
|
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
|
||||||
|
{% set use_fw_retract = (client.use_fw_retract|default(false)|lower == 'true') and (printer.firmware_retraction is defined) %}
|
||||||
|
{% set length = params.LENGTH|default(client.unretract)|default(1.0)|float %}
|
||||||
|
{% set speed = params.SPEED|default(client.speed_unretract)|default(35) %}
|
||||||
|
{% set absolute_extrude = printer.gcode_move.absolute_extrude %}
|
||||||
|
##### end of definitions #####
|
||||||
|
{% if printer.toolhead.extruder != '' %}
|
||||||
|
{% if printer[printer.toolhead.extruder].can_extrude %}
|
||||||
|
{% if use_fw_retract %}
|
||||||
|
{% if length < 0 %}
|
||||||
|
G10
|
||||||
|
{% else %}
|
||||||
|
G11
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
M83
|
||||||
|
G1 E{length} F{(speed|float|abs) * 60}
|
||||||
|
{% if absolute_extrude %}
|
||||||
|
M82
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
RESPOND TYPE=echo MSG='{"\"%s\" not hot enough" % printer.toolhead.extruder}'
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
[gcode_macro _CLIENT_RETRACT]
|
||||||
|
description: Retracts, if the extruder is hot enough
|
||||||
|
gcode:
|
||||||
|
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
|
||||||
|
{% set length = params.LENGTH|default(client.retract)|default(1.0)|float %}
|
||||||
|
{% set speed = params.SPEED|default(client.speed_retract)|default(35) %}
|
||||||
|
|
||||||
|
_CLIENT_EXTRUDE LENGTH=-{length|float|abs} SPEED={speed|float|abs}
|
||||||
|
|
||||||
|
[gcode_macro _CLIENT_LINEAR_MOVE]
|
||||||
|
description: Linear move with save and restore of the gcode state
|
||||||
|
gcode:
|
||||||
|
{% set x_move = "X" ~ params.X if params.X is defined else "" %}
|
||||||
|
{% set y_move = "Y" ~ params.Y if params.Y is defined else "" %}
|
||||||
|
{% set z_move = "Z" ~ params.Z if params.Z is defined else "" %}
|
||||||
|
{% set e_move = "E" ~ params.E if params.E is defined else "" %}
|
||||||
|
{% set rate = "F" ~ params.F if params.F is defined else "" %}
|
||||||
|
{% set ABSOLUTE = params.ABSOLUTE | default(0) | int != 0 %}
|
||||||
|
{% set ABSOLUTE_E = params.ABSOLUTE_E | default(0) | int != 0 %}
|
||||||
|
SAVE_GCODE_STATE NAME=_client_movement
|
||||||
|
{% if x_move or y_move or z_move %}
|
||||||
|
G9{ 0 if ABSOLUTE else 1 }
|
||||||
|
{% endif %}
|
||||||
|
{% if e_move %}
|
||||||
|
M8{ 2 if ABSOLUTE_E else 3 }
|
||||||
|
{% endif %}
|
||||||
|
G1 { x_move } { y_move } { z_move } { e_move } { rate }
|
||||||
|
RESTORE_GCODE_STATE NAME=_client_movement
|
53
modules/services/printer/nginx.nix
Normal file
53
modules/services/printer/nginx.nix
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#
|
||||||
|
# System notifications
|
||||||
|
#
|
||||||
|
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
recommendedProxySettings = true;
|
||||||
|
recommendedTlsSettings = true;
|
||||||
|
recommendedGzipSettings = true;
|
||||||
|
recommendedOptimisation = true;
|
||||||
|
virtualHosts = {
|
||||||
|
"home.opel-online.de" = {
|
||||||
|
enableACME = true;
|
||||||
|
forceSSL = true;
|
||||||
|
default = true;
|
||||||
|
locations."/".return = "503";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
security.acme = {
|
||||||
|
acceptTerms = true;
|
||||||
|
defaults = {
|
||||||
|
email = "webmaster@opel-online.de";
|
||||||
|
# server = "https://acme-staging-v02.api.letsencrypt.org/directory";
|
||||||
|
dnsResolver = "9.9.9.9:53";
|
||||||
|
};
|
||||||
|
certs = {
|
||||||
|
"home.opel-online.de" = {
|
||||||
|
domain = "*.home.opel-online.de";
|
||||||
|
dnsProvider = "netcup";
|
||||||
|
environmentFile = config.age.secrets."services/acme/opel-online".path;
|
||||||
|
webroot = null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall = {
|
||||||
|
enable = true;
|
||||||
|
allowedUDPPorts = [ ];
|
||||||
|
allowedTCPPorts = [ 80 443 ];
|
||||||
|
};
|
||||||
|
|
||||||
|
age.secrets."services/acme/opel-online" = {
|
||||||
|
file = ../../../secrets/services/acme/opel-online.age;
|
||||||
|
owner = "acme";
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
11
modules/services/printer/osskc.cfg
Normal file
11
modules/services/printer/osskc.cfg
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[include ./cfgs/misc-macros.cfg]
|
||||||
|
[include ./cfgs/PARKING.cfg]
|
||||||
|
[include ./cfgs/MECHANICAL_GANTRY_CALIBRATION.cfg]
|
||||||
|
[include ./cfgs/CALIBRATION.cfg]
|
||||||
|
[include ./cfgs/kamp/KAMP_Settings.cfg]
|
||||||
|
[include ./cfgs/TEST_SPEED.cfg]
|
||||||
|
|
||||||
|
# NOTE Uncomment the ONE of the following lines if you're using an adxl345
|
||||||
|
# [include ./cfgs/adxl-rp2040.cfg]
|
||||||
|
# [include ./cfgs/adxl-rpi-pico-2x.cfg]
|
||||||
|
# [include ./cfgs/adxl-direct.cfg]
|
284
modules/services/printer/printer.cfg
Normal file
284
modules/services/printer/printer.cfg
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
# This file contains pin mappings for the stock Sovol SV06.
|
||||||
|
#
|
||||||
|
# Find installation instructions at https://github.com/bassamanator/Sovol-SV06-firmware
|
||||||
|
#
|
||||||
|
# See https://www.klipper3d.org/Config_Reference.html for configuration reference.
|
||||||
|
|
||||||
|
[include ./osskc.cfg]
|
||||||
|
[include ./timelapse.cfg]
|
||||||
|
#[include ./cfgs/adxl-rp2040.cfg]
|
||||||
|
|
||||||
|
[mcu]
|
||||||
|
# NOTE Obtain definition by "ls -l /dev/serial/by-id/"
|
||||||
|
serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
|
||||||
|
restart_method: command
|
||||||
|
|
||||||
|
[printer]
|
||||||
|
kinematics: cartesian
|
||||||
|
max_velocity: 250
|
||||||
|
max_accel: 2800
|
||||||
|
max_z_velocity: 15
|
||||||
|
max_z_accel: 45
|
||||||
|
square_corner_velocity: 5.0
|
||||||
|
|
||||||
|
[input_shaper]
|
||||||
|
shaper_freq_x: 56.0
|
||||||
|
shaper_type_x: zv
|
||||||
|
shaper_freq_y: 55.4
|
||||||
|
shaper_type_y: 2hump_ei
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# X/Y/Z Stepper Settings
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
[stepper_x]
|
||||||
|
step_pin: PC2
|
||||||
|
dir_pin: !PB9
|
||||||
|
enable_pin: !PC3
|
||||||
|
microsteps: 128
|
||||||
|
rotation_distance: 40
|
||||||
|
endstop_pin: tmc2209_stepper_x:virtual_endstop
|
||||||
|
position_endstop: 0
|
||||||
|
position_max: 223 # NOTE You can adjust this if you have more room
|
||||||
|
homing_speed: 40
|
||||||
|
homing_retract_dist: 0
|
||||||
|
|
||||||
|
[tmc2209 stepper_x]
|
||||||
|
uart_pin: PC1
|
||||||
|
run_current: 0.860
|
||||||
|
stealthchop_threshold: 0
|
||||||
|
interpolate: False
|
||||||
|
sense_resistor: 0.150
|
||||||
|
uart_address: 3
|
||||||
|
driver_SGTHRS: 81
|
||||||
|
diag_pin: PA5
|
||||||
|
|
||||||
|
[stepper_y]
|
||||||
|
step_pin: PB8
|
||||||
|
dir_pin: PB7
|
||||||
|
enable_pin: !PC3
|
||||||
|
microsteps: 128
|
||||||
|
rotation_distance: 40
|
||||||
|
endstop_pin: tmc2209_stepper_y:virtual_endstop
|
||||||
|
position_endstop: 0
|
||||||
|
position_max: 223 # NOTE You can adjust this if you have more room
|
||||||
|
homing_speed: 40
|
||||||
|
homing_retract_dist: 0
|
||||||
|
|
||||||
|
[tmc2209 stepper_y]
|
||||||
|
uart_pin: PC0
|
||||||
|
run_current: 0.900
|
||||||
|
stealthchop_threshold: 0
|
||||||
|
interpolate: False
|
||||||
|
sense_resistor: 0.150
|
||||||
|
uart_address: 3
|
||||||
|
driver_SGTHRS: 81
|
||||||
|
diag_pin: PA6
|
||||||
|
|
||||||
|
[stepper_z]
|
||||||
|
step_pin: PB6
|
||||||
|
dir_pin: !PB5
|
||||||
|
enable_pin: !PC3
|
||||||
|
microsteps: 128
|
||||||
|
rotation_distance: 4
|
||||||
|
endstop_pin: probe:z_virtual_endstop
|
||||||
|
position_min: -4
|
||||||
|
position_max: 258 # NOTE You can adjust this if you have more room
|
||||||
|
homing_speed: 5
|
||||||
|
|
||||||
|
[tmc2209 stepper_z]
|
||||||
|
uart_pin: PA15
|
||||||
|
run_current: 1.000
|
||||||
|
stealthchop_threshold: 0
|
||||||
|
interpolate: False
|
||||||
|
sense_resistor: 0.150
|
||||||
|
uart_address: 3
|
||||||
|
diag_pin: PA7
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# Extruder
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
[extruder]
|
||||||
|
step_pin: PB4
|
||||||
|
dir_pin: !PB3
|
||||||
|
enable_pin: !PC3
|
||||||
|
microsteps: 128
|
||||||
|
rotation_distance: 4.65 # NOTE Calibrate e-steps https://www.klipper3d.org/Rotation_Distance.html#calibrating-rotation_distance-on-extruders, https://github.com/bassamanator/everything-sovol-sv06/blob/main/howto.md#calibrate-esteps
|
||||||
|
nozzle_diameter: 0.400
|
||||||
|
filament_diameter: 1.750
|
||||||
|
heater_pin: PA1
|
||||||
|
sensor_type: EPCOS 100K B57560G104F
|
||||||
|
sensor_pin: PC5
|
||||||
|
#control: pid
|
||||||
|
#pid_kd: 86.991
|
||||||
|
#pid_kp: 21.479
|
||||||
|
#pid_ki: 1.326
|
||||||
|
min_temp: 0
|
||||||
|
max_temp: 300
|
||||||
|
max_extrude_only_distance: 150.0
|
||||||
|
max_extrude_cross_section: 5 # NOTE Needed for KAMP purge
|
||||||
|
pressure_advance: 0.05
|
||||||
|
|
||||||
|
[tmc2209 extruder]
|
||||||
|
uart_pin: PC14
|
||||||
|
run_current: 0.550
|
||||||
|
stealthchop_threshold: 0
|
||||||
|
interpolate: False
|
||||||
|
sense_resistor: 0.150
|
||||||
|
uart_address: 3
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# Bed Heater
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
[heater_bed]
|
||||||
|
heater_pin: PA2
|
||||||
|
sensor_type: EPCOS 100K B57560G104F
|
||||||
|
sensor_pin: PC4
|
||||||
|
#control: pid
|
||||||
|
#pid_kp: 64.440
|
||||||
|
#pid_ki: 0.773
|
||||||
|
#pid_kd: 1343.571
|
||||||
|
min_temp: 0
|
||||||
|
max_temp: 110
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# Probe Related
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
[probe]
|
||||||
|
pin: PB1
|
||||||
|
x_offset: 27
|
||||||
|
y_offset: -20
|
||||||
|
#z_offset: 0
|
||||||
|
samples: 3
|
||||||
|
samples_result: median
|
||||||
|
samples_tolerance: 0.01
|
||||||
|
samples_tolerance_retries: 5
|
||||||
|
|
||||||
|
[safe_z_home]
|
||||||
|
home_xy_position: 84.50, 135 # NOTE The probe is at the center of the bed.
|
||||||
|
speed: 100.0
|
||||||
|
z_hop: 10
|
||||||
|
z_hop_speed: 15
|
||||||
|
|
||||||
|
[bed_mesh]
|
||||||
|
speed: 175
|
||||||
|
mesh_min: 27, 6 # probe as close to origin as possible while remaining fully on the bed
|
||||||
|
mesh_max: 222, 203 # (x.position_max - 1), (y.position_max - abs(y_offset)) ; probe as far as possible from the origin while remaining fully on the bed
|
||||||
|
probe_count: 5,5
|
||||||
|
algorithm: bicubic
|
||||||
|
fade_start: 1
|
||||||
|
fade_end: 10
|
||||||
|
fade_target: 0
|
||||||
|
|
||||||
|
[axis_twist_compensation]
|
||||||
|
calibrate_start_x: 27 # probe x coor at furthest left ; abs(x_offset)
|
||||||
|
calibrate_end_x: 195 # probe x coor at furthest right ; (x.position_max - abs(x_offset) - 1)
|
||||||
|
calibrate_y: 115
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# Fans
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
[fan]
|
||||||
|
pin: PA0
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# Misc
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
[display]
|
||||||
|
lcd_type: st7920
|
||||||
|
cs_pin: PB12
|
||||||
|
sclk_pin: PB13
|
||||||
|
sid_pin: PB15
|
||||||
|
encoder_pins: ^PB14, ^PB10
|
||||||
|
click_pin: ^!PB2
|
||||||
|
|
||||||
|
[bed_screws]
|
||||||
|
screw1_name: front left
|
||||||
|
screw1: 26.5, 31
|
||||||
|
screw2_name: front right
|
||||||
|
screw2: 196.75, 31
|
||||||
|
screw3_name: back right
|
||||||
|
screw3: 196.75, 201
|
||||||
|
screw4_name: back left
|
||||||
|
screw4: 26.5, 201
|
||||||
|
|
||||||
|
[screws_tilt_adjust]
|
||||||
|
screw1_name: center
|
||||||
|
screw1: 84.50, 135
|
||||||
|
screw2_name: front left
|
||||||
|
screw2: 0, 51
|
||||||
|
screw3_name: front right
|
||||||
|
screw3: 169.75, 51
|
||||||
|
screw4_name: back right
|
||||||
|
screw4: 169.75, 221
|
||||||
|
screw5_name: back left
|
||||||
|
screw5: 0, 221
|
||||||
|
horizontal_move_z: 10
|
||||||
|
screw_thread: CCW-M4
|
||||||
|
|
||||||
|
[output_pin beeper]
|
||||||
|
pin: PC6
|
||||||
|
value: 0
|
||||||
|
shutdown_value: 0
|
||||||
|
pwm: True
|
||||||
|
cycle_time: 0.0005 ; Default beeper tone in kHz. 1 / 0.0005 = 2000Hz (2kHz)
|
||||||
|
|
||||||
|
[filament_switch_sensor filament_sensor]
|
||||||
|
switch_pin: PA4 # "Pulled-high"
|
||||||
|
pause_on_runout: True
|
||||||
|
insert_gcode:
|
||||||
|
M117 Insert Detected
|
||||||
|
{ action_respond_info("Insert Detected") }
|
||||||
|
runout_gcode:
|
||||||
|
M117 Runout Detected
|
||||||
|
{ action_respond_info("Runout Detected") }
|
||||||
|
CONDITIONAL_BEEP i=3 dur=300 freq=400
|
||||||
|
|
||||||
|
[skew_correction]
|
||||||
|
|
||||||
|
#*# <---------------------- SAVE_CONFIG ---------------------->
|
||||||
|
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
|
||||||
|
#*#
|
||||||
|
#*# [heater_bed]
|
||||||
|
#*# control = pid
|
||||||
|
#*# pid_kp = 68.420
|
||||||
|
#*# pid_ki = 1.068
|
||||||
|
#*# pid_kd = 1095.581
|
||||||
|
#*#
|
||||||
|
#*# [extruder]
|
||||||
|
#*# control = pid
|
||||||
|
#*# pid_kp = 22.905
|
||||||
|
#*# pid_ki = 1.483
|
||||||
|
#*# pid_kd = 88.472
|
||||||
|
#*#
|
||||||
|
#*# [probe]
|
||||||
|
#*# z_offset = 1.410
|
||||||
|
#*#
|
||||||
|
#*# [bed_mesh default]
|
||||||
|
#*# version = 1
|
||||||
|
#*# points =
|
||||||
|
#*# -0.052344, -0.023750, -0.024063, -0.022500, -0.039219
|
||||||
|
#*# -0.029688, -0.011563, -0.011406, -0.013750, -0.048750
|
||||||
|
#*# -0.038750, -0.023281, -0.039375, -0.036875, -0.067188
|
||||||
|
#*# -0.035156, -0.035000, -0.035781, -0.034375, -0.065313
|
||||||
|
#*# -0.024688, -0.015781, -0.011406, -0.021094, -0.022500
|
||||||
|
#*# x_count = 5
|
||||||
|
#*# y_count = 5
|
||||||
|
#*# mesh_x_pps = 2
|
||||||
|
#*# mesh_y_pps = 2
|
||||||
|
#*# algo = lagrange
|
||||||
|
#*# tension = 0.2
|
||||||
|
#*# min_x = 27.0
|
||||||
|
#*# max_x = 222.0
|
||||||
|
#*# min_y = 6.0
|
||||||
|
#*# max_y = 203.0
|
||||||
|
#*#
|
||||||
|
#*# [skew_correction CaliFlower]
|
||||||
|
#*# xy_skew = -0.0001004783772044709
|
||||||
|
#*# xz_skew = 0.0
|
||||||
|
#*# yz_skew = 0.0
|
427
modules/services/printer/timelapse.cfg
Normal file
427
modules/services/printer/timelapse.cfg
Normal file
@ -0,0 +1,427 @@
|
|||||||
|
# Timelapse klipper macro definition
|
||||||
|
#
|
||||||
|
# Copyright (C) 2021 Christoph Frei <fryakatkop@gmail.com>
|
||||||
|
# Copyright (C) 2021 Alex Zellner <alexander.zellner@googlemail.com>
|
||||||
|
#
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license
|
||||||
|
#
|
||||||
|
# Macro version 1.15
|
||||||
|
#
|
||||||
|
|
||||||
|
##### DO NOT CHANGE ANY MACRO!!! #####
|
||||||
|
|
||||||
|
##########################################################################
|
||||||
|
# #
|
||||||
|
# GET_TIMELAPSE_SETUP: Print the Timelapse setup to console #
|
||||||
|
# #
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
[gcode_macro GET_TIMELAPSE_SETUP]
|
||||||
|
description: Print the Timelapse setup
|
||||||
|
gcode:
|
||||||
|
{% set tl = printer['gcode_macro TIMELAPSE_TAKE_FRAME'] %}
|
||||||
|
{% set output_txt = ["Timelapse Setup:"] %}
|
||||||
|
{% set _dummy = output_txt.append("enable: %s" % tl.enable) %}
|
||||||
|
{% set _dummy = output_txt.append("park: %s" % tl.park.enable) %}
|
||||||
|
{% if tl.park.enable %}
|
||||||
|
{% set _dummy = output_txt.append("park position: %s time: %s s" % (tl.park.pos, tl.park.time)) %}
|
||||||
|
{% set _dummy = output_txt.append("park cord x:%s y:%s dz:%s" % (tl.park.coord.x, tl.park.coord.y, tl.park.coord.dz)) %}
|
||||||
|
{% set _dummy = output_txt.append("travel speed: %s mm/s" % tl.speed.travel) %}
|
||||||
|
{% endif %}
|
||||||
|
{% set _dummy = output_txt.append("fw_retract: %s" % tl.extruder.fw_retract) %}
|
||||||
|
{% if not tl.extruder.fw_retract %}
|
||||||
|
{% set _dummy = output_txt.append("retract: %s mm speed: %s mm/s" % (tl.extruder.retract, tl.speed.retract)) %}
|
||||||
|
{% set _dummy = output_txt.append("extrude: %s mm speed: %s mm/s" % (tl.extruder.extrude, tl.speed.extrude)) %}
|
||||||
|
{% endif %}
|
||||||
|
{% set _dummy = output_txt.append("verbose: %s" % tl.verbose) %}
|
||||||
|
{action_respond_info(output_txt|join("\n"))}
|
||||||
|
|
||||||
|
################################################################################################
|
||||||
|
# #
|
||||||
|
# Use _SET_TIMELAPSE_SETUP [ENABLE=value] [VERBOSE=value] [PARK_ENABLE=value] [PARK_POS=value] #
|
||||||
|
# [PARK_TIME=value] [CUSTOM_POS_X=value] [CUSTOM_POS_Y=value] #
|
||||||
|
# [CUSTOM_POS_DZ=value][TRAVEL_SPEED=value] [RETRACT_SPEED=value] #
|
||||||
|
# [EXTRUDE_SPEED=value] [EXTRUDE_DISTANCE=value] #
|
||||||
|
# [RETRACT_DISTANCE=value] [FW_RETRACT=value] #
|
||||||
|
# #
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
|
[gcode_macro _SET_TIMELAPSE_SETUP]
|
||||||
|
description: Set user parameters for timelapse
|
||||||
|
gcode:
|
||||||
|
{% set tl = printer['gcode_macro TIMELAPSE_TAKE_FRAME'] %}
|
||||||
|
##### get min and max bed size #####
|
||||||
|
{% set min = printer.toolhead.axis_minimum %}
|
||||||
|
{% set max = printer.toolhead.axis_maximum %}
|
||||||
|
{% set round_bed = True if printer.configfile.settings.printer.kinematics is in ['delta','polar','rotary_delta','winch']
|
||||||
|
else False %}
|
||||||
|
{% set park = {'min' : {'x': (min.x / 1.42)|round(3) if round_bed else min.x|round(3),
|
||||||
|
'y': (min.y / 1.42)|round(3) if round_bed else min.y|round(3)},
|
||||||
|
'max' : {'x': (max.x / 1.42)|round(3) if round_bed else max.x|round(3),
|
||||||
|
'y': (max.y / 1.42)|round(3) if round_bed else max.y|round(3)},
|
||||||
|
'center': {'x': (max.x-(max.x-min.x)/2)|round(3),
|
||||||
|
'y': (max.y-(max.y-min.y)/2)|round(3)}} %}
|
||||||
|
##### set new values #####
|
||||||
|
{% if params.ENABLE %}
|
||||||
|
{% if params.ENABLE|lower is in ['true', 'false'] %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=enable VALUE={True if params.ENABLE|lower == 'true' else False}
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("ENABLE=%s not supported. Allowed values are [True, False]" % params.ENABLE|capitalize)}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if params.VERBOSE %}
|
||||||
|
{% if params.VERBOSE|lower is in ['true', 'false'] %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=verbose VALUE={True if params.VERBOSE|lower == 'true' else False}
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("VERBOSE=%s not supported. Allowed values are [True, False]" % params.VERBOSE|capitalize)}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if params.CUSTOM_POS_X %}
|
||||||
|
{% if params.CUSTOM_POS_X|float >= min.x and params.CUSTOM_POS_X|float <= max.x %}
|
||||||
|
{% set _dummy = tl.park.custom.update({'x':params.CUSTOM_POS_X|float|round(3)}) %}
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("CUSTOM_POS_X=%s must be within [%s - %s]" % (params.CUSTOM_POS_X, min.x, max.x))}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if params.CUSTOM_POS_Y %}
|
||||||
|
{% if params.CUSTOM_POS_Y|float >= min.y and params.CUSTOM_POS_Y|float <= max.y %}
|
||||||
|
{% set _dummy = tl.park.custom.update({'y':params.CUSTOM_POS_Y|float|round(3)}) %}
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("CUSTOM_POS_Y=%s must be within [%s - %s]" % (params.CUSTOM_POS_Y, min.y, max.y))}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if params.CUSTOM_POS_DZ %}
|
||||||
|
{% if params.CUSTOM_POS_DZ|float >= min.z and params.CUSTOM_POS_DZ|float <= max.z %}
|
||||||
|
{% set _dummy = tl.park.custom.update({'dz':params.CUSTOM_POS_DZ|float|round(3)}) %}
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("CUSTOM_POS_DZ=%s must be within [%s - %s]" % (params.CUSTOM_POS_DZ, min.z, max.z))}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if params.PARK_ENABLE %}
|
||||||
|
{% if params.PARK_ENABLE|lower is in ['true', 'false'] %}
|
||||||
|
{% set _dummy = tl.park.update({'enable':True if params.PARK_ENABLE|lower == 'true' else False}) %}
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("PARK_ENABLE=%s not supported. Allowed values are [True, False]" % params.PARK_ENABLE|capitalize)}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if params.PARK_POS %}
|
||||||
|
{% if params.PARK_POS|lower is in ['center','front_left','front_right','back_left','back_right','custom','x_only','y_only'] %}
|
||||||
|
{% set dic = {'center' : {'x': park.center.x , 'y': park.center.y , 'dz': 1 },
|
||||||
|
'front_left' : {'x': park.min.x , 'y': park.min.y , 'dz': 0 },
|
||||||
|
'front_right' : {'x': park.max.x , 'y': park.min.y , 'dz': 0 },
|
||||||
|
'back_left' : {'x': park.min.x , 'y': park.max.y , 'dz': 0 },
|
||||||
|
'back_right' : {'x': park.max.x , 'y': park.max.y , 'dz': 0 },
|
||||||
|
'custom' : {'x': tl.park.custom.x, 'y': tl.park.custom.y, 'dz': tl.park.custom.dz},
|
||||||
|
'x_only' : {'x': tl.park.custom.x, 'y': 'none' , 'dz': tl.park.custom.dz},
|
||||||
|
'y_only' : {'x': 'none' , 'y': tl.park.custom.y, 'dz': tl.park.custom.dz}} %}
|
||||||
|
{% set _dummy = tl.park.update({'pos':params.PARK_POS|lower}) %}
|
||||||
|
{% set _dummy = tl.park.update({'coord':dic[tl.park.pos]}) %}
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("PARK_POS=%s not supported. Allowed values are [CENTER, FRONT_LEFT, FRONT_RIGHT, BACK_LEFT, BACK_RIGHT, CUSTOM, X_ONLY, Y_ONLY]"
|
||||||
|
% params.PARK_POS|upper)}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if params.PARK_TIME %}
|
||||||
|
{% if params.PARK_TIME|float >= 0.0 %}
|
||||||
|
{% set _dummy = tl.park.update({'time':params.PARK_TIME|float|round(3)}) %}
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("PARK_TIME=%s must be a positive number" % params.PARK_TIME)}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=park VALUE="{tl.park}"
|
||||||
|
{% if params.TRAVEL_SPEED %}
|
||||||
|
{% if params.TRAVEL_SPEED|float > 0.0 %}
|
||||||
|
{% set _dummy = tl.speed.update({'travel':params.TRAVEL_SPEED|float|round(3)}) %}
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("TRAVEL_SPEED=%s must be larger than 0" % params.TRAVEL_SPEED)}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if params.RETRACT_SPEED %}
|
||||||
|
{% if params.RETRACT_SPEED|float > 0.0 %}
|
||||||
|
{% set _dummy = tl.speed.update({'retract':params.RETRACT_SPEED|float|round(3)}) %}
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("RETRACT_SPEED=%s must be larger than 0" % params.RETRACT_SPEED)}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if params.EXTRUDE_SPEED %}
|
||||||
|
{% if params.EXTRUDE_SPEED|float > 0.0 %}
|
||||||
|
{% set _dummy = tl.speed.update({'extrude':params.EXTRUDE_SPEED|float|round(3)}) %}
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("EXTRUDE_SPEED=%s must be larger than 0" % params.EXTRUDE_SPEED)}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=speed VALUE="{tl.speed}"
|
||||||
|
{% if params.EXTRUDE_DISTANCE %}
|
||||||
|
{% if params.EXTRUDE_DISTANCE|float >= 0.0 %}
|
||||||
|
{% set _dummy = tl.extruder.update({'extrude':params.EXTRUDE_DISTANCE|float|round(3)}) %}
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("EXTRUDE_DISTANCE=%s must be specified as positiv number" % params.EXTRUDE_DISTANCE)}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if params.RETRACT_DISTANCE %}
|
||||||
|
{% if params.RETRACT_DISTANCE|float >= 0.0 %}
|
||||||
|
{% set _dummy = tl.extruder.update({'retract':params.RETRACT_DISTANCE|float|round(3)}) %}
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("RETRACT_DISTANCE=%s must be specified as positiv number" % params.RETRACT_DISTANCE)}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if params.FW_RETRACT %}
|
||||||
|
{% if params.FW_RETRACT|lower is in ['true', 'false'] %}
|
||||||
|
{% if 'firmware_retraction' in printer.configfile.settings %}
|
||||||
|
{% set _dummy = tl.extruder.update({'fw_retract': True if params.FW_RETRACT|lower == 'true' else False}) %}
|
||||||
|
{% else %}
|
||||||
|
{% set _dummy = tl.extruder.update({'fw_retract':False}) %}
|
||||||
|
{% if params.FW_RETRACT|capitalize == 'True' %}
|
||||||
|
{action_raise_error("[firmware_retraction] not defined in printer.cfg. Can not enable fw_retract")}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("FW_RETRACT=%s not supported. Allowed values are [True, False]" % params.FW_RETRACT|capitalize)}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=extruder VALUE="{tl.extruder}"
|
||||||
|
{% if printer.configfile.settings['gcode_macro pause'] is defined %}
|
||||||
|
{% set _dummy = tl.macro.update({'pause': printer.configfile.settings['gcode_macro pause'].rename_existing}) %}
|
||||||
|
{% endif %}
|
||||||
|
{% if printer.configfile.settings['gcode_macro resume'] is defined %}
|
||||||
|
{% set _dummy = tl.macro.update({'resume': printer.configfile.settings['gcode_macro resume'].rename_existing}) %}
|
||||||
|
{% endif %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=macro VALUE="{tl.macro}"
|
||||||
|
|
||||||
|
##########################################################################
|
||||||
|
# #
|
||||||
|
# TIMELAPSE_TAKE_FRAME: take the next picture #
|
||||||
|
# #
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
######################### definition #########################
|
||||||
|
## enable: enable or disable the next frame. Valid inputs: [True, False]
|
||||||
|
## takingframe: internal use. Valid inputs: [True, False]
|
||||||
|
##
|
||||||
|
## park.enable: enable or disable to park the head while taking a picture. Valid inputs: [True, False]
|
||||||
|
## park.pos : used position for parking. Valid inputs: [center, front_left, front_right, back_left, back_right, custom, x_only, y_only]
|
||||||
|
## park.time : used for the debug macro. Time in s
|
||||||
|
## park.custom.x, park.custom.y: coordinates of the custom parkposition. Unit [mm]
|
||||||
|
## park.custom.dz : custom z hop for the picture. Unit [mm]
|
||||||
|
## park.coord : internal use
|
||||||
|
##
|
||||||
|
## extruder.fw_retract: enable disable fw retraction [True,False]
|
||||||
|
## extruder.extrude : filament extruded at the end of park. Unit [mm]
|
||||||
|
## extruder.retract : filament retract at the start of park. Unit [mm]
|
||||||
|
##
|
||||||
|
## speed.travel : used speed for travel from and to the park positon. Unit: [mm/min]
|
||||||
|
## speed.retract: used speed for retract [mm/min]
|
||||||
|
## speed.extrude: used speed for extrude [mm/min]
|
||||||
|
##
|
||||||
|
## verbose: Enable mesage output of TIMELAPSE_TAKE_FRAME
|
||||||
|
##
|
||||||
|
## check_time: time when the status of the taken picture is checked. Default 0.5 sec
|
||||||
|
##
|
||||||
|
## restore.absolute.coordinates: internal use
|
||||||
|
## restore.absolute.extrude : internal use
|
||||||
|
## restore.speed : internal use
|
||||||
|
## restore.e : internal use
|
||||||
|
## restore.factor.speed : internal use
|
||||||
|
## restore.factor.extrude : internal use
|
||||||
|
##
|
||||||
|
## macro.pause : internal use
|
||||||
|
## macro.resume : internal use
|
||||||
|
##
|
||||||
|
## is_paused: internal use
|
||||||
|
###############################################################
|
||||||
|
[gcode_macro TIMELAPSE_TAKE_FRAME]
|
||||||
|
description: Take Timelapse shoot
|
||||||
|
variable_enable: False
|
||||||
|
variable_takingframe: False
|
||||||
|
variable_park: {'enable': False,
|
||||||
|
'pos' : 'center',
|
||||||
|
'time' : 0.1,
|
||||||
|
'custom': {'x': 0, 'y': 0, 'dz': 0},
|
||||||
|
'coord' : {'x': 0, 'y': 0, 'dz': 0}}
|
||||||
|
variable_extruder: {'fw_retract': False,
|
||||||
|
'retract': 1.0,
|
||||||
|
'extrude': 1.0}
|
||||||
|
variable_speed: {'travel': 100,
|
||||||
|
'retract': 15,
|
||||||
|
'extrude': 15}
|
||||||
|
variable_verbose: True
|
||||||
|
variable_check_time: 0.5
|
||||||
|
variable_restore: {'absolute': {'coordinates': True, 'extrude': True}, 'speed': 1500, 'e':0, 'factor': {'speed': 1.0, 'extrude': 1.0}}
|
||||||
|
variable_macro: {'pause': 'PAUSE', 'resume': 'RESUME'}
|
||||||
|
variable_is_paused: False
|
||||||
|
gcode:
|
||||||
|
{% set hyperlapse = True if params.HYPERLAPSE and params.HYPERLAPSE|lower =='true' else False %}
|
||||||
|
{% if enable %}
|
||||||
|
{% if (hyperlapse and printer['gcode_macro HYPERLAPSE'].run) or
|
||||||
|
(not hyperlapse and not printer['gcode_macro HYPERLAPSE'].run) %}
|
||||||
|
{% if park.enable %}
|
||||||
|
{% set pos = {'x': 'X' + park.coord.x|string if park.pos != 'y_only' else '',
|
||||||
|
'y': 'Y' + park.coord.y|string if park.pos != 'x_only' else '',
|
||||||
|
'z': 'Z'+ [printer.gcode_move.gcode_position.z + park.coord.dz, printer.toolhead.axis_maximum.z]|min|string} %}
|
||||||
|
{% set restore = {'absolute': {'coordinates': printer.gcode_move.absolute_coordinates,
|
||||||
|
'extrude' : printer.gcode_move.absolute_extrude},
|
||||||
|
'speed' : printer.gcode_move.speed,
|
||||||
|
'e' : printer.gcode_move.gcode_position.e,
|
||||||
|
'factor' : {'speed' : printer.gcode_move.speed_factor,
|
||||||
|
'extrude': printer.gcode_move.extrude_factor}} %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=restore VALUE="{restore}"
|
||||||
|
{% if not printer[printer.toolhead.extruder].can_extrude %}
|
||||||
|
{% if verbose %}{action_respond_info("Timelapse: Warning, minimum extruder temperature not reached!")}{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{% if extruder.fw_retract %}
|
||||||
|
G10
|
||||||
|
{% else %}
|
||||||
|
M83 ; insure relative extrusion
|
||||||
|
G0 E-{extruder.retract} F{speed.retract * 60}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=is_paused VALUE=True
|
||||||
|
{macro.pause} ; execute the klipper PAUSE command
|
||||||
|
SET_GCODE_OFFSET X=0 Y=0 ; this will insure that the head parks always at the same position in a multi setup
|
||||||
|
G90 ; insure absolute move
|
||||||
|
{% if "xyz" not in printer.toolhead.homed_axes %}
|
||||||
|
{% if verbose %}{action_respond_info("Timelapse: Warning, axis not homed yet!")}{% endif %}
|
||||||
|
{% else %}
|
||||||
|
G0 {pos.x} {pos.y} {pos.z} F{speed.travel * 60}
|
||||||
|
{% endif %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=takingframe VALUE=True
|
||||||
|
UPDATE_DELAYED_GCODE ID=_WAIT_TIMELAPSE_TAKE_FRAME DURATION={check_time}
|
||||||
|
M400
|
||||||
|
{% endif %}
|
||||||
|
_TIMELAPSE_NEW_FRAME HYPERLAPSE={hyperlapse}
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{% if verbose %}{action_respond_info("Timelapse: disabled, take frame ignored")}{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
[gcode_macro _TIMELAPSE_NEW_FRAME]
|
||||||
|
description: action call for timelapse shoot. must be a seperate macro
|
||||||
|
gcode:
|
||||||
|
{action_call_remote_method("timelapse_newframe",
|
||||||
|
macropark=printer['gcode_macro TIMELAPSE_TAKE_FRAME'].park,
|
||||||
|
hyperlapse=params.HYPERLAPSE)}
|
||||||
|
|
||||||
|
[delayed_gcode _WAIT_TIMELAPSE_TAKE_FRAME]
|
||||||
|
gcode:
|
||||||
|
{% set tl = printer['gcode_macro TIMELAPSE_TAKE_FRAME'] %}
|
||||||
|
{% set factor = {'speed': printer.gcode_move.speed_factor, 'extrude': printer.gcode_move.extrude_factor} %}
|
||||||
|
{% if tl.takingframe %}
|
||||||
|
UPDATE_DELAYED_GCODE ID=_WAIT_TIMELAPSE_TAKE_FRAME DURATION={tl.check_time}
|
||||||
|
{% else %}
|
||||||
|
{tl.macro.resume} VELOCITY={tl.speed.travel} ; execute the klipper RESUME command
|
||||||
|
SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=is_paused VALUE=False
|
||||||
|
{% if not printer[printer.toolhead.extruder].can_extrude %}
|
||||||
|
{action_respond_info("Timelapse: Warning minimum extruder temperature not reached!")}
|
||||||
|
{% else %}
|
||||||
|
{% if tl.extruder.fw_retract %}
|
||||||
|
G11
|
||||||
|
{% else %}
|
||||||
|
G0 E{tl.extruder.extrude} F{tl.speed.extrude * 60}
|
||||||
|
G0 F{tl.restore.speed}
|
||||||
|
{% if tl.restore.absolute.extrude %}
|
||||||
|
M82
|
||||||
|
G92 E{tl.restore.e}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if tl.restore.factor.speed != factor.speed %} M220 S{(factor.speed*100)|round(0)} {% endif %}
|
||||||
|
{% if tl.restore.factor.extrude != factor.extrude %} M221 S{(factor.extrude*100)|round(0)} {% endif %}
|
||||||
|
{% if not tl.restore.absolute.coordinates %} G91 {% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# #
|
||||||
|
# HYPERLAPSE: Starts or stops a Hyperlapse video #
|
||||||
|
# Usage: HYPERLAPSE ACTION=START [CYCLE=time] starts a hyperlapse with cycle time (default 30 sec) #
|
||||||
|
# HYPERLAPSE ACTION=STOP stops the hyperlapse recording #
|
||||||
|
# #
|
||||||
|
####################################################################################################
|
||||||
|
|
||||||
|
######################### definition #########################
|
||||||
|
## cycle: cycle time in seconds
|
||||||
|
## run: internal use [True/False]
|
||||||
|
###############################################################
|
||||||
|
[gcode_macro HYPERLAPSE]
|
||||||
|
description: Start/Stop a hyperlapse recording
|
||||||
|
variable_cycle: 0
|
||||||
|
variable_run: False
|
||||||
|
gcode:
|
||||||
|
{% set cycle = params.CYCLE|default(30)|int %}
|
||||||
|
{% if params.ACTION and params.ACTION|lower == 'start' %}
|
||||||
|
{action_respond_info("Hyperlapse: frames started (Cycle %d sec)" % cycle)}
|
||||||
|
SET_GCODE_VARIABLE MACRO=HYPERLAPSE VARIABLE=run VALUE=True
|
||||||
|
SET_GCODE_VARIABLE MACRO=HYPERLAPSE VARIABLE=cycle VALUE={cycle}
|
||||||
|
UPDATE_DELAYED_GCODE ID=_HYPERLAPSE_LOOP DURATION={cycle}
|
||||||
|
TIMELAPSE_TAKE_FRAME HYPERLAPSE=True
|
||||||
|
{% elif params.ACTION and params.ACTION|lower == 'stop' %}
|
||||||
|
{% if run %}{action_respond_info("Hyperlapse: frames stopped")}{% endif %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=HYPERLAPSE VARIABLE=run VALUE=False
|
||||||
|
UPDATE_DELAYED_GCODE ID=_HYPERLAPSE_LOOP DURATION=0
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("Hyperlapse: No valid input parameter
|
||||||
|
Use:
|
||||||
|
- HYPERLAPSE ACTION=START [CYCLE=time]
|
||||||
|
- HYPERLAPSE ACTION=STOP")}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
[delayed_gcode _HYPERLAPSE_LOOP]
|
||||||
|
gcode:
|
||||||
|
UPDATE_DELAYED_GCODE ID=_HYPERLAPSE_LOOP DURATION={printer["gcode_macro HYPERLAPSE"].cycle}
|
||||||
|
TIMELAPSE_TAKE_FRAME HYPERLAPSE=True
|
||||||
|
|
||||||
|
##########################################################################
|
||||||
|
# #
|
||||||
|
# TIMELAPSE_RENDER: Render the video at print end #
|
||||||
|
# #
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
######################### definition #########################
|
||||||
|
## render: internal use. Valid inputs: [True, False]
|
||||||
|
## run_identifier: internal use. Valid input [0 .. 3]
|
||||||
|
###############################################################
|
||||||
|
[gcode_macro TIMELAPSE_RENDER]
|
||||||
|
description: Render Timelapse video and wait for the result
|
||||||
|
variable_render: False
|
||||||
|
variable_run_identifier: 0
|
||||||
|
gcode:
|
||||||
|
{action_respond_info("Timelapse: Rendering started")}
|
||||||
|
{action_call_remote_method("timelapse_render", byrendermacro="True")}
|
||||||
|
SET_GCODE_VARIABLE MACRO=TIMELAPSE_RENDER VARIABLE=render VALUE=True
|
||||||
|
{printer.configfile.settings['gcode_macro pause'].rename_existing} ; execute the klipper PAUSE command
|
||||||
|
UPDATE_DELAYED_GCODE ID=_WAIT_TIMELAPSE_RENDER DURATION=0.5
|
||||||
|
|
||||||
|
[delayed_gcode _WAIT_TIMELAPSE_RENDER]
|
||||||
|
gcode:
|
||||||
|
{% set ri = printer['gcode_macro TIMELAPSE_RENDER'].run_identifier % 4 %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=TIMELAPSE_RENDER VARIABLE=run_identifier VALUE={ri + 1}
|
||||||
|
{% if printer['gcode_macro TIMELAPSE_RENDER'].render %}
|
||||||
|
M117 Rendering {['-','\\','|','/'][ri]}
|
||||||
|
UPDATE_DELAYED_GCODE ID=_WAIT_TIMELAPSE_RENDER DURATION=0.5
|
||||||
|
{% else %}
|
||||||
|
{action_respond_info("Timelapse: Rendering finished")}
|
||||||
|
M117
|
||||||
|
{printer.configfile.settings['gcode_macro resume'].rename_existing} ; execute the klipper RESUME command
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
##########################################################################
|
||||||
|
# #
|
||||||
|
# TEST_STREAM_DELAY: Helper macro to find stream and park delay #
|
||||||
|
# #
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
[gcode_macro TEST_STREAM_DELAY]
|
||||||
|
description: Helper macro to find stream and park delay
|
||||||
|
gcode:
|
||||||
|
{% set min = printer.toolhead.axis_minimum %}
|
||||||
|
{% set max = printer.toolhead.axis_maximum %}
|
||||||
|
{% set act = printer.toolhead.position %}
|
||||||
|
{% set tl = printer['gcode_macro TIMELAPSE_TAKE_FRAME'] %}
|
||||||
|
{% if act.z > 5.0 %}
|
||||||
|
G0 X{min.x + 5.0} F{tl.speed.travel|int * 60}
|
||||||
|
G0 X{(max.x-min.x)/2}
|
||||||
|
G4 P{tl.park.time|float * 1000}
|
||||||
|
_TIMELAPSE_NEW_FRAME HYPERLAPSE=FALSE
|
||||||
|
G0 X{max.x - 5.0}
|
||||||
|
{% else %}
|
||||||
|
{action_raise_error("Toolhead z %.3f to low. Please place head above z = 5.0" % act.z)}
|
||||||
|
{% endif %}
|
Loading…
Reference in New Issue
Block a user