Giter Club home page Giter Club logo

klipper-macros's People

Contributors

dtk1985 avatar jschuh avatar kirill578 avatar kll avatar krtac avatar olivierberthomme avatar turnero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

klipper-macros's Issues

[FEATURE REQUEST] Z_TILT_ADJUST before BED_MESH_CALIBRATE_FAST.

I have issues w/ z_tilt on one of my printers. I have added Z_TILT_ADJUST just before the BED_MESH_CALIBRATE_FAST line. But update manager is saying it's dirty due to this change. Is there a way to have a variable that would allow this to be enabled ?

Print_Start has no attribute 'EXTRUDER_TEMP

removed all macros from my config, (also removed Mainsail.CFG)
using superslicer and set as recommended
receiving the below error:

Error evaluating 'gcode_macro print_start:gcode': jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'EXTRUDER_TEMP'

cant find anything in my config that is called Print_Start, i do see a file called start_endcfg in the macros area but did not modify in any way.

Error when triggering a M600 command

I'm getting this error when my filament runout sensor triggers a M600

Error evaluating 'gcode_macro _load_unload:gcode': CommandError: Command not valid during printing.

What could be the problem?

Allow setting an offset from the print end parking position

My Voron 0.2 uses sensorless homing, and for this to work the stepper needs to push the toolhead towards the frame until it touches it, resulting in the stepper driver understanding that it has reached its max position.
The PRINT_END macro parks the toolhead at (park_x, max_y), which is fine if it wasn't for homing when a new print is triggered. The printer needs some buffer space when sensorless homing in order to "feel" the frame, but for y homing the toolhead is already at max_y, resulting in a audible bump into it. For now I just updated the PARK macro call with {max_y - 10} instead of {max_y}, but it would be nice to be able to set the x and y positions for the final parking using a variable.
the x parking position is fine, since one could define it in globals.cfg

bed mesh calibration error

When trying to print I get the following error. Any idea why?

gcode_macro bed_mesh_calibrate_fast:gcode': jinja2.exceptions.UndefinedError: 'extras.gcode_macro.GetStatusWrapper object' has no attribute 'gcode_macro bed_mesh_calibrate'

Upcoming klipper changes for bed mesh

Just a heads up for the upcoming changes in klipper regarding bed mesh, here is the message as displayed on mainsail:

Klipper changes to [bed_mesh] module
In an upcoming change to Klipper, the default bed_mesh configuration will no longer be automatically loaded at startup. If you are using a bed_mesh configuration today then it is recommended to add an explicit BED_MESH_PROFILE LOAD=default command to your START_PRINT macro (or equivalent print start commands in your slicer). This change to Klipper is planned for February 1st 2023.

link to the klipper announcement

Not sure if it also applies to adaptive bed mesh, but better safe than sorry!

Cannot override variable_print_max

I recently added a dockable probe and set variable_print_max.

[gcode_macro _km_options]
variable_print_max: (120, 115)

I'm getting this error: Error evaluating 'gcode_macro _km_globals:gcode': CommandError: print_max is not a valid type for _KM_OPTIONS.

"No trigger on probe after full movement" and BED_MESH_CHECK does nothing

BED_MESH_CALIBRATE seems to generate points outside the set mesh_min:
0 | (87.0, 5.0) | (46.0, 21.0)

This is (a part of) my config:

[bed_mesh]
speed: 200
mesh_min: 46, 21 #X-Offset + 5, Y-Offset + 5
mesh_max: 209, 224
probe_count: 3,3
horizontal_move_z: 5
algorithm: lagrange

[bltouch]
sensor_pin: ^PB7
control_pin: PB6
x_offset: -41
y_offset: 16
speed: 5.0
pin_up_touch_mode_reports_triggered: False

Secondly, I tried to check my config with BED_MESH_CHECK. This does nothing (or at least it displays nothing in the console). Am I doing something wrong?

cura slicer issue - first_layer_print_min

Hello,

Thanks for putting this up!

Quick question, I am using cura and trying to get this to print. I get this error when using the PRINT_START macro

Unable to parse parameter 'MESH_MIN'

Any idea how I can get around this?

Thanks!

M300

I tried to install the scripts on an Ender 6 with a Hemera XS modificatation. The base setup is from 3dprintingforbeginners. I get the following error, after starting the firmware:

gcode command M300 already registered

Once the underlying issue is corrected, use the "RESTART"
command to reload the config and restart the host software.
Printer is halted

I cannot find any M300 command defined, beside in the beep.cfg

Setup was done by git cloning in the path ~/printer_data/config/klipper-macros.

As I am a newbie to 3d printing and klipper, I am lost where to search in my configurations. Can you help and provide some directions?

My printer.cfg:

# This file contains pin mappings for the stock 2020 Creality Ender 6.
# To use this config, during "make menuconfig" select the
# STM32F103 with a "28KiB bootloader" and with "Use USB for
# communication" disabled.

# Because this printer has factory wiring, mounts, and firmware for
# a BLTouch, but does not ship with one at this time, default values
# for the sensor have been specified, but disabled, in anticipation of
# future revisions or user modification. User should take care to
# customize the offsets, particularly z-offset, for their specific unit.

# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select the
# USART3 serial port, which is broken out on the 10 pin IDC cable used
# for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC

# Flash this firmware by copying "out/klipper.bin" to a SD card and
# turning on the printer with the card inserted. The firmware
# filename must end in ".bin" and must not match the last filename
# that was flashed.

# See docs/Config_Reference.md for a description of parameters.

################
# Klipper macros personal config
##
# All customizations are documented in globals.cfg. Just copy a variable from
# there into the section below, and change the value to meet your needs.

[gcode_macro _km_options]
# These are examples of some likely customizations:
# Any sheets in the below list will be available with a configurable offset.
#variable_bed_surfaces: ['smooth_1','texture_1']
# Length (in mm) of filament to load (bowden tubes will be longer).
variable_load_length: 5.0
# Hide the Octoprint LCD menu since I don't use it.
#variable_menu_show_octoprint: False
# Customize the filament menus (up to 10 entries).
variable_menu_temperature: [
  {'name' : 'PLA',  'extruder' : 200.0, 'bed' : 60.0},
  {'name' : 'PETG', 'extruder' : 230.0, 'bed' : 85.0}]
gcode: # This line is required by Klipper.
# Any code you put here will run at klipper startup, after the initialization
# for these macros. For example, you could uncomment the following line to
# automatically adjust your bed surface offsets to account for any changes made
# to your Z endstop or probe offset.
#  ADJUST_SURFACE_OFFSETS

# This line includes all the standard macros.
[include klipper-macros/*.cfg]
# Uncomment to include features that require specific hardware support.
# LCD menu support for features like bed surface selection and pause next layer.
[include klipper-macros/optional/lcd_menus.cfg]
# Optimized bed leveling
#[include klipper-macros/optional/bed_mesh.cfg]

# The sections below here are required for the macros to work.
[idle_timeout]
gcode:
  _KM_IDLE_TIMEOUT

[pause_resume]

[respond]

[save_variables]
filename: ~/printer_data/config/variables.cfg # UPDATE THIS FOR YOUR PATH!!!

[virtual_sdcard]
path: ~/gcode_files

[display_status]

# Uncomment the sections below if Fluidd complains (because it's confused).
#
#[gcode_macro CANCEL_PRINT]
#rename_existing: CANCEL_PRINT_BASE
#gcode: CANCEL_PRINT_BASE{% for k in params %}{' '~k~'='~params[k]}{% endfor %}
################
### End klipper-macros personal config
################



# Some additionals temperatures to show in graph
[temperature_sensor raspberry_pi]
sensor_type: temperature_host
min_temp: 10
max_temp: 100

[temperature_sensor mcu_temp]
sensor_type: temperature_mcu
min_temp: 0
max_temp: 100

### manual bed leveling (Klipper config with new Hemera XS screw positions
[bed_screws]
screw1: 46, 39
screw2: 233, 39
screw3: 46, 228
screw4: 233, 228

#####
#####
# the original printer file config

[stepper_x]
step_pin: PB8
dir_pin: PB7
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA5
position_endstop: 257
position_max: 257
homing_speed: 50

[stepper_y]
step_pin: PC2
dir_pin: !PB9
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA6
position_endstop: 250
position_max: 250
homing_speed: 50

[stepper_z]
step_pin: PB6
dir_pin: PB5
enable_pin: !PC3
microsteps: 16
rotation_distance: 8
position_endstop: 0.0                     # disable to use BLTouch
endstop_pin: ^PA7                         # disable to use BLTouch
# endstop_pin: probe:z_virtual_endstop    # enable to use BLTouch
# position_min: -5                        # enable to use BLTouch
position_max: 400
position_min: -2

# [safe_z_home]                           # enable for BLTouch
# home_xy_position: 150.7, 137
# speed: 100
# z_hop: 10
# z_hop_speed: 5

# [bltouch]                               # enable for BLTouch
# sensor_pin: ^PB1
# control_pin: PB0
# x_offset: 20.7
# y_offset: 7
# z_offset: 2.4
# speed: 3.0

# [bed_mesh]                              # enable for BLTouch
# speed: 100
# mesh_min: 10, 10
# mesh_max: 250, 250
# algorithm: bicubic
# probe_count: 5,5

[extruder]
max_extrude_only_distance: 500.0
step_pin: PB4
dir_pin: !PB3
enable_pin: !PC3
microsteps: 16
rotation_distance: 7.6
nozzle_diameter: 0.400
filament_diameter: 1.750
pressure_advance: 0.05 # (always in the range of 0.05) from comment https://www.reddit.com/r/klippers/comments/gsrotv/anyone_using_pressure_advance_with_direct_drive/
heater_pin: PA1
sensor_type: ATC Semitec 104GT-2
sensor_pin: PC5
#control: pid
#pid_Kp: 26.949
#pid_Ki: 1.497
#pid_Kd: 121.269
min_extrude_temp: 170
min_temp: 0
max_temp: 300

[heater_bed]
heater_pin: PA2
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC4
#control: pid
#pid_Kp: 327.11
#pid_Ki: 19.20
#pid_Kd: 1393.45
min_temp: 0
max_temp: 100

[fan]
pin: PA0

[filament_switch_sensor e0_sensor]
switch_pin: PA4

[mcu]
serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
restart_method: command

[printer]
kinematics: corexy
max_velocity: 500
max_accel: 2000
max_z_velocity: 10
max_z_accel: 100

[t5uid1]
firmware: dgus_reloaded
machine_name: Ender 6
# volume: 0
brightness: 100
z_min: 0
z_max: 400

[virtual_sdcard]
path: ~/printer_data/gcodes

[display_status]

[gcode_macro POWEROFF]
gcode:
  RESPOND TYPE=command MSG=action:poweroff
  
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
    TURN_OFF_HEATERS
    CLEAR_PAUSE
    SDCARD_RESET_FILE
    BASE_CANCEL_PRINT

#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 30.765
#*# pid_ki = 2.972
#*# pid_kd = 79.604
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 61.787
#*# pid_ki = 0.851
#*# pid_kd = 1121.439

Layers.cfg file calls a macro that doesn't exist

A macro in Layers.cfg calls SET_PRINT_STATS_INFO which throws an error on my system. Should this macro be included somewhere? It looks like it is not a command that Klipper recognizes at this time.

When the filament runs out, the M600 command is not executed

I would like some advice, I use your macros and
when executing the M600 command, when the filament sensor reports that the filament is running out, it reports this error...

!! Error evaluating 'gcode_macro _load_unload:gcode': CommandError: Command not valid during printing.

i use this filament sensor setup:

[filament_switch_sensor filament_sensor]
pause_on_runout: True
switch_pin: PG12
runout_gcode: M600

Readme correction

First of all thank you these Macros are amazing I don't understand the magic behind them but they work for example when is probing the bed it only probe where is going to print? that's genius. I have to play with changing the surfaces because I have been looking for that for a long time.

There is a warning in the Read me that you need to have bed_heater configured I think you mean heater_bed.

Add support for heater-less chambers

I finally had the time to install a chamber thermistor on my printer, without a dedicated heater. My printing process now is as follows:

  • preheat bed to 100C
  • preheat nozzle to 169C
  • start my nevermore air filter to circulate air around
  • manually check the printer after a while and wait until my chamber temp reaches X degrees

Now, the preheating and nevermore spinup is all done through a temperature preset, so it's not really an issue for now, but what could be improved in the print start macros is add support for heater-less chambers, where the user only uses the bed for heating them.

To me this would require:

  • a preheat temp for nozzle and bed, which will be different form actual printing temps (for example I chose 169 for the extruder since it doesn't start melting filament and the hotend fan still moves heat around)
  • spin up chosen auxiliary fans (one nevermore filter in my case but I also heard people spinning up par cooling fans or two nevermores for more air circulation)
  • wait for the chamber thermistor to reach the desired chamber temperature, using a simple TEMPERATURE_WAIT command and then start printing

As I see it nozzle and bed temps for heatup should be global vars, where chamber temp is passed as usual in the PRINT_START command. Chamber commands won't work since you don't have a proper chamber element in your printer.cfg, so it needs to be its own.

Let me know if it sounds feasible, happy to help if needed

M300 macro fails if no `scale` parameter is defined in the `[output_pin beeper]` printer section

I have a printer with a beeper available, and I can trigger it from my mainsail interface just fine. When calling the M300 command it fails, with the error

Error evaluating 'gcode_macro m300:gcode': UndefinedError: 'dict object' has no attribute 'scale'

The macro seems to be looking for a scale parameter in the beeper printer section, and if it's not defined the macro crashes. I would either update the README by mentioning that a scale paramter must be set or provide a default value for the parameter in the macro

LCD menu Offset tune

Looks like when you fix the G-Code offset for the klicky probe breaks something in the LCD Menu. Every time I want to adjust the offset from the LCD the offset reset by -5 in my case. Thanks

note about relative_reference_index

no issue, just a note for the warning section:

let's say you use 5x5 mesh and enable relative_reference_index in the [bed_mesh] section of printer.cfg and set it to 12 so it references the middle of the bed (##FOLLOW THE FORUMULA FOR relative_reference_index, for example: [(5x5)-1] / 2 = 12), when you want to print something it starts the heatup process, printhead goes to the safe_z_home position and after probing the point klipper throws 3 internal errors for the macros and shuts down. I guess because I was trying to print a small object and your macro switched to 3x3 mesh mode, but still wanted to use the "relative_reference_index: 12" (12th point - non-existent in this case) and the macros could not handle that. I could not figure out for a day what is happening, reinstalled the whole OS lol

[PRINT_START] extruder gets to final temperature and start oozing before leveling the bed

I think it would be better to bring the extruder to printing temp after having the bed leveled, since in the current state it would start oozing for a while if the mesh to probe is big.

I suggest going from

[gcode_macro print_start]
gcode:
...
    {% if km.start_level_bed_at_temp %}
        M104 S{EXTRUDER} # set the final extruder target temperature
        G28 Z # Re-home only the Z axis now that the bed has stabilized.
        BED_MESH_CALIBRATE{% if MESH_MIN %} MESH_MIN={MESH_MIN}{% endif
                        %}{% if MESH_MAX %} MESH_MAX={MESH_MAX}{% endif %}
        PARK
    {% endif %}

to

[gcode_macro print_start]
gcode:
...
    {% if km.start_level_bed_at_temp %}
        G28 Z # Re-home only the Z axis now that the bed has stabilized.
        BED_MESH_CALIBRATE{% if MESH_MIN %} MESH_MIN={MESH_MIN}{% endif
                        %}{% if MESH_MAX %} MESH_MAX={MESH_MAX}{% endif %}
        M104 S{EXTRUDER} # set the final extruder target temperature
        PARK
    {% endif %}

LCD setup menu error related to bed mesh

Do I need custom hardware to use your LCD menus? I'm using stock display from ender3 (12864)

Error evaluating 'menu __main __setup __bed_surface:input': ValueError: '' is not in list                                                                                                     
Traceback (most recent call last):                                                                                                                                                            
  File "/home/printer/klipper/klipper/klippy/extras/gcode_macro.py", line 61, in render                                                                                                       
    return str(self.template.render(context))                                                                                                                                                 
  File "/home/printer/klipper/venv/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render                                                                                   
    self.environment.handle_exception()                                                                                                                                                       
  File "/home/printer/klipper/venv/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception                                                                          
    reraise(*rewrite_traceback_stack(source=source))                                                                                                                                          
  File "/home/printer/klipper/venv/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise                                                                                        
    raise value.with_traceback(tb)                                                                                                                                                            
  File "<template>", line 2, in top-level template code                                                                                                                                       
ValueError: '' is not in list
List drawing error
Traceback (most recent call last):
  File "/home/printer/klipper/klipper/klippy/extras/gcode_macro.py", line 61, in render
    return str(self.template.render(context))
  File "/home/printer/klipper/venv/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/home/printer/klipper/venv/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/home/printer/klipper/venv/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 2, in top-level template code
ValueError: '' is not in list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/printer/klipper/klipper/klippy/extras/display/menu.py", line 625, in draw_container
    text = current.render_name(selected)
  File "/home/printer/klipper/klipper/klippy/extras/display/menu.py", line 164, in render_name
    name = str(self._render_name())
  File "/home/printer/klipper/klipper/klippy/extras/display/menu.py", line 66, in _render_name
    context = self.get_context()
  File "/home/printer/klipper/klipper/klippy/extras/display/menu.py", line 488, in get_context
    value = (self._eval_value(context) if self._input_value is None
  File "/home/printer/klipper/klipper/klippy/extras/display/menu.py", line 521, in _eval_value
    self._input_tpl.render(context)))
  File "/home/printer/klipper/klipper/klippy/extras/gcode_macro.py", line 66, in render
    raise self.gcode.error(msg)
gcode.CommandError: Error evaluating 'menu __main __setup __bed_surface:input': ValueError: '' is not in list

printer.cfg

# This file contains common pin mappings for the 2018 Creality
# Ender 3. To use this config, the firmware should be compiled for the
# AVR atmega1284p.

# Note, a number of Melzi boards are shipped with a bootloader that
# requires the following command to flash the board:
#  avrdude -p atmega1284p -c arduino -b 57600 -P /dev/ttyUSB0 -U out/klipper.elf.hex
# If the above command does not work and "make flash" does not work
# then one may need to flash a bootloader to the board - see the
# Klipper docs/Bootloaders.md file for more information.

# See docs/Config_Reference.md for a description of parameters.

[stepper_x]
step_pin: ar54
dir_pin: !ar55
enable_pin: !ar38
microsteps: 16
rotation_distance: 40
endstop_pin: ^ar3
position_min: -3
position_endstop: -3
position_max: 250
homing_speed: 50

[stepper_y]
step_pin: ar60
dir_pin: !ar61
enable_pin: !ar56
microsteps: 16
rotation_distance: 40
endstop_pin: ^ar14
position_min: -6
position_endstop: -6
position_max: 235
homing_speed: 50

[stepper_z]
step_pin: ar46
dir_pin: ar48
enable_pin: !ar62
microsteps: 16
rotation_distance: 7.96
endstop_pin: probe:z_virtual_endstop
position_max: 250
position_min: -3

[extruder]
step_pin: ar26
dir_pin: !ar28
enable_pin: !ar24
max_extrude_only_distance: 420.0
min_extrude_temp: 170
microsteps: 16
rotation_distance: 7.71
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: ar10
sensor_type: EPCOS 100K B57560G104F
sensor_pin: analog13
pressure_advance = 0.5
min_temp: 0
max_temp: 250

[heater_bed]
heater_pin: ar8
sensor_type: EPCOS 100K B57560G104F
sensor_pin: analog14
min_temp: 0
max_temp: 130

[tmc2208 stepper_x]
uart_pin: ar40
interpolate: True
run_current: 0.580
sense_resistor: 0.11
stealthchop_threshold: 150

[tmc2208 stepper_y]
uart_pin: ar59
interpolate: True
run_current: 0.580
sense_resistor: 0.11
stealthchop_threshold: 150

[tmc2208 stepper_z]
uart_pin: ar42
interpolate: True
run_current: 0.580
sense_resistor: 0.11
stealthchop_threshold: 150

[tmc2208 extruder]
uart_pin: ar44
interpolate: True
run_current: 0.650
sense_resistor: 0.11
stealthchop_threshold: 150

[fan]
pin: ar9

[heater_fan my_nozzle_fan]
pin: ar7
heater: extruder
heater_temp: 50.0

[mcu]
serial: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0

[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100

[bed_screws]
screw1: 31.7, 31.7
screw2: 31.7, 201
screw3: 201, 201
screw4: 201, 31.7

[display]
lcd_type: st7920
cs_pin: ar27
sclk_pin: ar25
sid_pin: ar29
encoder_pins: ^ar23, ^ar17
click_pin: ^!ar35

[bltouch]
sensor_pin: ^ar18
control_pin: ar11
x_offset: -60.5
y_offset: -16.6
pin_move_time: 0.4
samples: 1
sample_retract_dist: 2

[safe_z_home]
home_xy_position: 177.5, 133.6
speed: 50.0
z_hop: 10.0
z_hop_speed: 10.0

[bed_mesh]
speed: 50
horizontal_move_z: 5
mesh_min: 31.7, 31.7
mesh_max: 189, 201
probe_count: 3, 3
fade_start: 1.0
mesh_pps: 2, 2

[screws_tilt_adjust]
screw1: 250, 48.3
screw1_name: front right screw
screw2: 250, 217.6
screw2_name: rear right screw
screw3: 92.2, 217.6
screw3_name: rear left screw
screw4: 92.2, 48.3
screw4_name: front left screw
horizontal_move_z: 10
speed: 50.0
screw_thread: CW-M3

[input_shaper]
#shaper_freq_x: 29.62
#shaper_freq_y: 29.41
shaper_freq_x: 37.56
shaper_freq_y: 41.09
shaper_type: mzv

[virtual_sdcard]
path: ~/klipper/gcodes

[display_status]

[pause_resume]

[gcode_macro PRINTER_OFF]
gcode:
    tuya_off

[include macros.cfg]

[output_pin beeper]
pin: EXP1_1
pwm: True
value: 0
shutdown_value: 0
cycle_time: 0.001 # PWM frequency : 0.001 = 1ms will give a tone of 1kHz (not pitch perfect).

[include timelapse.cfg]

# Common EXP1 / EXP2 (display) pins
[board_pins]
aliases:
    # Common EXP1 header found on many "all-in-one" ramps clones
    EXP1_1=ar37, EXP1_3=ar17, EXP1_5=ar23, EXP1_7=ar27, EXP1_9=<GND>,
    EXP1_2=ar35, EXP1_4=ar16, EXP1_6=ar25, EXP1_8=ar29, EXP1_10=<5V>,
    # EXP2 header
    EXP2_1=ar50, EXP2_3=ar31, EXP2_5=ar33, EXP2_7=ar49, EXP2_9=<GND>,
    EXP2_2=ar52, EXP2_4=ar53, EXP2_6=ar51, EXP2_8=ar41, EXP2_10=<RST>,
    # Pins EXP2_1, EXP2_6, EXP2_2 are also MISO, MOSI, SCK of bus "spi"
    # Note, some boards wire: EXP2_8=<RST>, EXP2_10=ar41
    # Marlin pin map
    ar0=PE0, ar1=PE1, ar2=PE4, ar3=PE5, ar4=PG5,
    ar5=PE3, ar6=PH3, ar7=PH4, ar8=PH5, ar9=PH6,
    ar10=PB4, ar11=PB5, ar12=PB6, ar13=PB7, ar14=PJ1,
    ar15=PJ0, ar16=PH1, ar17=PH0, ar18=PD3, ar19=PD2,
    ar20=PD1, ar21=PD0, ar22=PA0, ar23=PA1, ar24=PA2,
    ar25=PA3, ar26=PA4, ar27=PA5, ar28=PA6, ar29=PA7,
    ar30=PC7, ar31=PC6, ar32=PC5, ar33=PC4, ar34=PC3,
    ar35=PC2, ar36=PC1, ar37=PC0, ar38=PD7, ar39=PG2,
    ar40=PG1, ar41=PG0, ar42=PL7, ar43=PL6, ar44=PL5,
    ar45=PL4, ar46=PL3, ar47=PL2, ar48=PL1, ar49=PL0,
    ar50=PB3, ar51=PB2, ar52=PB1, ar53=PB0, ar54=PF0,
    ar55=PF1, ar56=PF2, ar57=PF3, ar58=PF4, ar59=PF5,
    ar60=PF6, ar61=PF7, ar62=PK0, ar63=PK1, ar64=PK2,
    ar65=PK3, ar66=PK4, ar67=PK5, ar68=PK6, ar69=PK7,
    analog0=PF0, analog1=PF1, analog2=PF2, analog3=PF3, analog4=PF4,
    analog5=PF5, analog6=PF6, analog7=PF7, analog8=PK0, analog9=PK1,
    analog10=PK2, analog11=PK3, analog12=PK4, analog13=PK5, analog14=PK6,
    analog15=PK7,
    # Additional aliases
    ml70=PG4, ml71=PG3, ml72=PJ2, ml73=PJ3, ml74=PJ7,
    ml75=PJ4, ml76=PJ5, ml77=PJ6, ml78=PE2, ml79=PE6,
    ml80=PE7, ml81=PD4, ml82=PD5, ml83=PD6, ml84=PH2,
    ml85=PH7

#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 	  0.097500, 0.077500, 0.082500
#*# 	  0.055000, -0.005000, -0.045000
#*# 	  0.037500, 0.002500, 0.020000
#*# x_count = 3
#*# y_count = 3
#*# mesh_x_pps = 2
#*# mesh_y_pps = 2
#*# algo = lagrange
#*# tension = 0.2
#*# min_x = 30.0
#*# max_x = 173.0
#*# min_y = 30.0
#*# max_y = 205.0
#*#
#*# [bltouch]
#*# z_offset = 1.301
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 26.134
#*# pid_ki = 1.405
#*# pid_kd = 121.525
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 61.15
#*# pid_ki = 10.39
#*# pid_kd = 247.78

macros.cfg

[gcode_macro _km_options]
variable_load_length: 420.0
variable_load_speed: 480.0
variable_menu_show_octoprint: False
variable_menu_show_sdcard: False
variable_menu_temperature: [
  {'name' : 'PLA',  'extruder' : 190.0, 'bed' : 40.0},
  {'name' : 'TPU', 'extruder' : 200.0, 'bed' : 40.0},
  {'name' : 'PETG',  'extruder' : 230.0, 'bed' : 65.0}]
variable_start_purge_length: 20
gcode: # This line is required by Klipper.
# Any code you put here will run at klipper startup, after the initialization
# for these macros. For example, you could uncomment the following line to
# automatically adjust your bed surface offsets to account for any changes made
# to your Z endstop or probe offset.
#  ADJUST_SURFACE_OFFSETS

# This line includes all the standard macros.
[include macros/*.cfg]
# Uncomment to include features that require specific hardware support.
# LCD menu support for features like bed surface selection and pause next layer.
[include macros/optional/lcd_menus.cfg]
# Optimized bed leveling
[include macros/optional/bed_mesh.cfg]

# The sections below here are required for the macros to work. If your config
# already has some of these sections you should merge the duplicates into one
# (or if they are identical just remove one of them).
[idle_timeout]
gcode:
  _KM_IDLE_TIMEOUT # This line must be in your idle_timeout section.

[respond]

[save_variables]
filename: ~/klipper/config/variables.cfg # UPDATE THIS FOR YOUR PATH!!!

# Uncomment the sections below if Fluidd complains (because it's confused).
#[gcode_macro CANCEL_PRINT]
#rename_existing: CANCEL_PRINT_FAKE_BASE
#gcode: CANCEL_PRINT_FAKE_BASE {rawparams}

[BUG] Print fails using raft for buildplate adhesion

Describe the bug
I slice my models with Cura 5.1
Using brim or skirt as buildplate adhesion works a s aspected.
If i choose Raft (in my Case 4 Layers) i get this error and print fails.

Klipper error messages
00:30
SDCARD_RESET_FILE cannot be run from the sdcard
00:30
Error on 'SET_PRINT_STATS_INFO CURRENT_LAYER="-4"': CURRENT_LAYER must have minimum of 0
00:30
Error on 'SET_PRINT_STATS_INFO CURRENT_LAYER="-4"': CURRENT_LAYER must have minimum of 0

Klipper config
config (2).zip
CFFFP_mandibula.zip

Bed mesh process produces points that cannot be reached (move out of range)

Haven't had issues with mesh bed leveling until today, and it looks like that for large enough prints the mesh leveling doesn't work properly.I have a 300x300 bed and while trying to print a piece covering almost all width of it I got errors when the macro generated the probing points:

PRINT_START command:

PRINT_START  EXTRUDER=215 BED=60 MESH_MIN=7.99438,99.422 MESH_MAX=292.006,200.578 LAYERS=495

generated points as taken from the console:

Move out of range: -40.006 83.422 8.000 [0.000]
Move out of range: -40.006 83.422 8.000 [0.000]

35 | (-40.0, 184.6) | (8.0, 200.6)
34 | (16.8, 184.6) | (64.8, 200.6)
33 | (73.6, 184.6) | (121.6, 200.6)
32 | (130.4, 184.6) | (178.4, 200.6)
31 | (187.2, 184.6) | (235.2, 200.6)
30 | (244.0, 184.6) | (292.0, 200.6)
29 | (244.0, 164.3) | (292.0, 180.3)
28 | (187.2, 164.3) | (235.2, 180.3)
27 | (130.4, 164.3) | (178.4, 180.3)
26 | (73.6, 164.3) | (121.6, 180.3)
25 | (16.8, 164.3) | (64.8, 180.3)
24 | (-40.0, 164.3) | (8.0, 180.3)
23 | (-40.0, 144.1) | (8.0, 160.1)
22 | (16.8, 144.1) | (64.8, 160.1)
21 | (73.6, 144.1) | (121.6, 160.1)
20 | (130.4, 144.1) | (178.4, 160.1)
19 | (187.2, 144.1) | (235.2, 160.1)
18 | (244.0, 144.1) | (292.0, 160.1)
17 | (244.0, 123.9) | (292.0, 139.9)
16 | (187.2, 123.9) | (235.2, 139.9)
15 | (130.4, 123.9) | (178.4, 139.9)
14 | (73.6, 123.9) | (121.6, 139.9)
13 | (16.8, 123.9) | (64.8, 139.9)
12 | (-40.0, 123.9) | (8.0, 139.9)
11 | (-40.0, 103.7) | (8.0, 119.7)
10 | (16.8, 103.7) | (64.8, 119.7)
9 | (73.6, 103.7) | (121.6, 119.7)
8 | (130.4, 103.7) | (178.4, 119.7)
7 | (187.2, 103.7) | (235.2, 119.7)
6 | (244.0, 103.7) | (292.0, 119.7)
5 | (244.0, 83.4) | (292.0, 99.4)
4 | (187.2, 83.4) | (235.2, 99.4)
3 | (130.4, 83.4) | (178.4, 99.4)
2 | (73.6, 83.4) | (121.6, 99.4)
1 | (16.8, 83.4) | (64.8, 99.4)
0 | (-40.0, 83.4) | (8.0, 99.4)

bed_mesh: generated points
Index | Tool Adjusted | Probe

This error never occurred with smaller prints, so I think it's just an edge case that needs to be figured out.
I tried to set variable_probe_mesh_padding to 0.0 to try and mitigate the issue without luck

Lemme know if you need other info

Move out of range

I am getting a move out of range error every time I start a print. It is attempting to move it to X 245 and my max is set to X 235. Where can I resolve this? I have looked all over and tried to get help elsewhere (discord server) but no one is able to decipher the macros. I believe it has something to do with the draw purge line process, because it happens immediately after the print area mesh probe.

[BUG] Is there a way to cancel PRINT_START?

Describe the bug
I find myself having to use the emergency stop (M112?) to stop the PRINT_START macro. On my printer, it takes a while to warm up and complete the bed mesh (10-20 minutes), meanwhile I find a reason to stop it but the only way I can is to use the E-Stop. I then have to restart the firmware.

Hitting cancel print does not work until the macro finished.

Is there another way to stop the PRINT_START Macro?

Error when running bed_mesh_calibrate_fast

Error evaluating 'gcode_macro bed_mesh_calibrate_fast:gcode': jinja2.exceptions.UndefinedError: 'extras.gcode_macro.GetStatusWrapper object' has no attribute 'gcode_macro bed_mesh_calibrate'

Macro for loading and unloading of filament is not working

2:41 PM - Error evaluating 'gcode_macro _load_unload:gcode': TypeError: '<' not supported between instances of 'str' and 'int'
2:41 PM - load_filament LENGTH=150 SPEED=1500 EXTRUDER=extruder MINIMUM=250

I guess there is a problem with type conversion.

ERROR evaluaton `gcode_macro check .....[BUG]

Describe the bug
I installed the macro in the correct directory and called it in the printer. cfg and when I restarted it pops up with an Error I have absolutely no idea what that means... my klipper is literally stock except for configuring and tuning my printer so nothing else is conflicting with it...

Klipper error messages
Error evaluating gcode_macro check_km_config:gcode: gcode.CommandError:park_y is invalid

Klipper config
My config is stock board config with tuned features like pressure advance PID tuned etc.... no other macros installed except PID hotend and bed...

[BUG] Unable to start print due to "bed_surfaces" error

Describe the bug
Please provide a clear and concise description of what the bug is.
When starting a print, I get the below error after bed_mesh is completed.
Printer is Ender 3 Pro w/ Duet 2 Wifi. Prints start w/o issue if klipper-macros is not loaded.

Klipper error messages
Paste any error Klipper error messages you observed when encountering the bug.
Error evaluating 'gcode_macro _apply_bed_surface_offset:gcode': jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'bed_surfaces'

Klipper config
Paste any relevant sections from your Klipper config, or attach the full config if you prefer. Please also note any other macros you are including as part of your config.

printer.cfg has basics for functions.

[gcode_macro _km_options]
# These are examples of some likely customizations:
# Any sheets in the below list will be available with a configurable offset.
variable_bed_surfaces: ['smooth_1','texture_1']
# Length (in mm) of filament to load (bowden tubes will be longer).
variable_load_length: 250.0
# Hide the Octoprint LCD menu since I don't use it.
#variable_menu_show_octoprint: False
# Customize the filament menus (up to 10 entries).
#variable_menu_temperature: [
#  {'name' : 'PLA',  'extruder' : 200.0, 'bed' : 60.0},
#  {'name' : 'PETG', 'extruder' : 230.0, 'bed' : 85.0},
#  {'name' : 'ABS',  'extruder' : 245.0, 'bed' : 110.0, 'chamber' : 60}]
# Length of filament (in millimeters) to purge at print start.
variable_start_purge_length: 30 # This value works for most setups.
gcode: # This line is required by Klipper.
# Any code you put here will run at klipper startup, after the initialization
# for these macros. For example, you could uncomment the following line to
# automatically adjust your bed surface offsets to account for any changes made
# to your Z endstop or probe offset.
#  ADJUST_SURFACE_OFFSETS

# This line includes all the standard macros.
[include klipper-macros/*.cfg]
# Uncomment to include features that require specific hardware support.
# LCD menu support for features like bed surface selection and pause next layer.
#[include klipper-macros/optional/lcd_menus.cfg]
# Optimized bed leveling
[include klipper-macros/optional/bed_mesh.cfg]

# The sections below here are required for the macros to work.
[idle_timeout]
gcode:
  _KM_IDLE_TIMEOUT

m109/m190 temps

For some reaon my m109 and m190 temps seem odd. Can you tell me where this info is being pulled from? For extruder is is 108 and for bed it is 62. I don't think I have thoses values set anywhere in my slicers. My goal is to higher the extruder and also I would prefer if they both preheat at the same time. As of now, it is doing the bed first. Any assistance would be great! I appreciate this plugin.

BUG: Malformed commmand _gcode_wait_wrapper

Issueing a M109 T1 S205 or M104 T1 S205 (etc)

fails with error
Malformed command '_GCODE_WAIT_WRAPPER HEATER={'pressure_advance': 0.0, 'target': 0.0, 'power': 0.0, 'can_extrude': True, 'smooth_time': 0.04, 'temperature': 16.18} S="20" M="109" T="1"'

Will disable heaters.cfg by renaming it to heaters.cfg.backup to bypass this section.

max_accel values get reset

I'm new to all this and not sure what I'm doing, so sorry if I'm asking in the wrong place. long story short, tried to set up input shaping using an adxl345, but after I set up the new max values in the printer.cfg, when I start a new print using your macros the console shows:
max_velocity: 500.000000
max_accel: 500.000000
max_accel_to_decel: 250.000000
square_corner_velocity: 8.000000

I have no idea what I'm doing so I don't know why the values I put in the printer.cfg get overridden (if I type m201 in the console after a restart before a print, it gives me the values in the printer.cfg). Using prusaslicer and the printer limits reflect what I have in the printer.cfg. Any help would be appreciated. Thanks.

edit:
after tinkering around a bit, I noticed I left a value in prusaslicer in the print settings (acceleration control>default). However, now I get this:

max_velocity: 500.000000
max_accel: 2500.000000
max_accel_to_decel: 1250.000000
square_corner_velocity: 8.000000

so something is still changing square_corner and halving max accel to decel.

Error "TOTAL_LAYER must have minimum of 0" after updating to latest layers.cfg

I am getting the following errors after getting the latest version. Unfortunately, I am much too new in klipper to even understand how to correct/circumvent this issue. I have reverted to the previous version of layers.cfg in the meantime.

Extrude below minimum temp
6:22 PM
Extrude below minimum temp
See the 'min_extrude_temp' config option for details
6:22 PM
Error on 'SET_PRINT_STATS_INFO TOTAL_LAYER="-1"': TOTAL_LAYER must have minimum of 0

[BUG]Grinding with direct drive extruders on pause and finish

I have three printers using these macros. I started with an ender 3 pro with an skr mini e3 v3 board, and I have no issues with that printer. I then installed them on a sovol sv03 (with same skr mainboard) and just today on an ender 3 v2 with a creality 4.2.7 board. The sovol comes stock with a direct drive, but on my ender 3 v2 I have a micro swiss ng installed. Both these printers are having the same issue where when I pause/cancel a print, where the printer will grind when parking the head. Same when a print finishes, but it only does it once. The ender 3 pro which has a bowden set up does not have this issue. Here's a video of what happens when a print is paused and canceled:
https://www.youtube.com/shorts/m60P4iKn_JA

any help would be appreciated.
ender3v2 config:
printer.cfg.zip
sovol sv03 config:
printer (1).cfg.zip
ender 3 pro config (no issue with this printer):
printer (2).cfg.zip

Z offset Issue

Hi,

I'm receiving "Error evaluating 'gcode_macro set_gcode_offset:gcode': jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'bed_surfaces' " when I tried to click to the z offset buttons on dashboard.

204156617-aaa85874-a2bd-4f2c-bc0f-8e06c478fd6b

Could you please help?

Printer: Ender 3 v2
Mainboard: SKR Mini E3 V3

Best Regards.

Nozzle temperature doesn't return to original value after cooling down waiting for filament replacement

Happened to me tonight: my printer stopped as the filament ran out mid print, and I only noticed it this morning. The printer sat idle long enough to enter cooldown, so the bed stayed at temperature while the nozzle stopped heating. I loaded the filament using the provided macro and resumed the print, and I noticed that the nozzle temp stayed at the filament loading temperature, and not the printing temperature.
Happy to provide more details if needed

[BUG] ADJUST_SURFACE_OFFSETS IGNORE malformed command

Describe the bug
Please provide a clear and concise description of what the bug is.
When attempting to run ADJUST_SURFACE_OFFSETS IGNORE I get a malformed command error.

Klipper error messages
Paste any error Klipper error messages you observed when encountering the bug.

10:05 AM
Malformed command 'ADJUST_SURFACE_OFFSETS ignore'
10:05 AM
ADJUST_SURFACE_OFFSETS ignore
10:03 AM
Malformed command 'ADJUST_SURFACE_OFFSETS IGNORE'
10:03 AM
ADJUST_SURFACE_OFFSETS IGNORE
10:03 AM
Unknown command:"ADJUST_SURFACE_OFFSETS0"
10:03 AM
ADJUST_SURFACE_OFFSETS 0
10:03 AM
Malformed command 'ADJUST_SURFACE_OFFSETS IGNORE'
10:03 AM
ADJUST_SURFACE_OFFSETS IGNORE
10:02 AM
Active bed surface: default; offset: 0.744
10:02 AM
Z probe offset or endstop position changed. Run ADJUST_SURFACE_OFFSETS to adjust the offset for all saved surfaces by the change differential, or run ADJUST_SURFACE_OFFSETS IGNORE to hide this message without making changes.
10:01 AM
Klipper state: Disconnect
10:01 AM
SAVE_CONFIG
10:01 AM
bltouch: z_offset: 0.475
The SAVE_CONFIG command will update the printer config file
with the above and restart the printer.
10:01 AM
Z_OFFSET_APPLY_PROBE
9:25 AM
Active bed surface: default; offset: 0.744
9:25 AM
- Type HELP to get a list of available commands.
- Click on the "?" button to get a searchable list.
- Commands in the console are clickable and will be placed into the input field.
- Use the tab key to complete your inputs. If there are several options, a list is displayed.
- Use the ⇵ arrow keys to navigate through the previous entries.

Klipper config
Paste any relevant sections from your Klipper config, or attach the full config if you prefer. Please also note any other macros you are including as part of your config.
-- variables.cfg --

bed_surfaces = {'active': 'default', 'available': {'default': {'offset': 0.744}}, 'endstop_z': 0.0, 'probe_z': 1.219}

-- printer.cfg --

#[include addons/neopixel.cfg]
#[include addons/runout.cfg]

# This file contains common pin mappings for the BIGTREETECH Manta E3EZ
# To use this config, the firmware should be compiled for the
# STM32G0B1 with a "8KiB bootloader" "8 MHz crystal"
# and "USB (on PA11/PA12)" or "CAN bus (on PB12/PB13)".

# See docs/Config_Reference.md for a description of parameters.

[temperature_sensor raspberry_pi]
sensor_type: temperature_host
min_temp: 10
max_temp: 100

[temperature_sensor mcu_temp]
sensor_type: temperature_mcu
min_temp: 0
max_temp: 100

[force_move]
enable_force_move: True

[mcu rpi]
serial: /tmp/klipper_host_mcu

# All customizations are documented in globals.cfg. Just copy a variable from
# there into the section below, and change the value to meet your needs.

[gcode_macro _km_options]
# These are examples of some likely customizations:
# Any sheets in the below list will be available with a configurable offset.
#variable_bed_surfaces: ['smooth_1','texture_1']
# Length (in mm) of filament to load (bowden tubes will be longer).
variable_load_length: 250.0
# Minimum printable XY coordinate. Defaults to X and Y position_min.
variable_print_min: (0, 0) # example: (0, 0)
# Maximum printable XY coordinate. Defaults to X and Y position_max.
variable_print_max: (220, 220) # example: (220, 220)
# Scaling factor for M900 command (negative values make M900 a no-op).
#variable_pressure_advance_scale: -1.0
# Distance (in millimeters) between the purge lines and the print area.
variable_start_purge_clearance: -15.0
# Level gantry in PRINT_START after bed temp stabilizes; False to disable.
variable_start_quad_gantry_level_at_temp: False
# Hide the Octoprint LCD menu since I don't use it.
#variable_menu_show_octoprint: False
# Customize the filament menus (up to 10 entries).
#variable_menu_temperature: [
#  {'name' : 'PLA',  'extruder' : 200.0, 'bed' : 60.0},
#  {'name' : 'PETG', 'extruder' : 230.0, 'bed' : 85.0},
#  {'name' : 'ABS',  'extruder' : 245.0, 'bed' : 110.0, 'chamber' : 60}]
# Length of filament (in millimeters) to purge at print start.
variable_start_purge_length: 30 # This value works for most setups.
gcode: # This line is required by Klipper.
# Any code you put here will run at klipper startup, after the initialization
# for these macros. For example, you could uncomment the following line to
# automatically adjust your bed surface offsets to account for any changes made
# to your Z endstop or probe offset.
#  ADJUST_SURFACE_OFFSETS

# This line includes all the standard macros.
[include klipper-macros/*.cfg]
# Uncomment to include features that require specific hardware support.
# LCD menu support for features like bed surface selection and pause next layer.
#[include klipper-macros/optional/lcd_menus.cfg]
# Optimized bed leveling
[include klipper-macros/optional/bed_mesh.cfg]

# The sections below here are required for the macros to work. If your config
# already has some of these sections you should merge the duplicates into one
# (or if they are identical just remove one of them).
[idle_timeout]
gcode:
  _KM_IDLE_TIMEOUT # This line must be in your idle_timeout section.

[pause_resume]

[respond]

[save_variables]
filename: /home/pi/printer_data/variables.cfg # UPDATE THIS FOR YOUR PATH!!!

[virtual_sdcard]
path: ~/printer_data/gcodes # UPDATE THIS FOR YOUR PATH!!!

[display_status]

# Uncomment the sections below if Fluidd complains (because it's confused).
#[gcode_macro CANCEL_PRINT]
#rename_existing: CANCEL_PRINT_FAKE_BASE
#gcode: CANCEL_PRINT_FAKE_BASE {rawparams}

[stepper_x]
step_pin: PA14
dir_pin: !PA10
enable_pin: !PA13
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC4
#endstop_pin: !PC4
position_endstop: 0
#position_max: 235
position_max: 250
homing_speed: 50

[stepper_y]
step_pin: PC8
dir_pin: !PA15
enable_pin: !PC14
microsteps: 16
rotation_distance: 40
endstop_pin: ^PB0
#endstop_pin: PB0
position_endstop: 0
position_max: 235
homing_speed: 50

[stepper_z]
step_pin: PD2
dir_pin: !PD4
enable_pin: !PD3
microsteps: 16
rotation_distance: 8
#endstop_pin: ^PC6
#position_endstop: 0
position_min: -3.5
position_max: 220
endstop_pin: probe:z_virtual_endstop


[stepper_z1]
step_pin: PB7
dir_pin: PB6
enable_pin: !PB4
microsteps: 16
rotation_distance: 8

[extruder]
step_pin: PD5
dir_pin: PD6
enable_pin: !PB3
microsteps: 16
rotation_distance: 33.500
gear_ratio: 50:17
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PB11 #HE0
#sensor_type: EPCOS 100K B57560G104F
sensor_type: ATC Semitec 104GT-2
sensor_pin: PA4 #TH0
#control: pid
#pid_Kp: 21.527
#pid_Ki: 1.063
#pid_Kd: 108.982
min_temp: 0
max_temp: 275
max_extrude_only_distance: 300

[heater_bed]
heater_pin: PB2 #HB
sensor_type: EPCOS 100K B57560G104F #Generic 3950
sensor_pin: PA3 #TB
#control: pid
# tuned for stock hardware with 50 degree Celsius target
#pid_Kp: 54.027
#pid_Ki: 0.770
#pid_Kd: 948.182
min_temp: 0
max_temp: 130

[fan]
pin: PA8

[heater_fan heatbreak_cooling_fan]
pin: PB15

[heater_fan board_cooling_fan]
pin: PB14
heater: extruder, heater_bed

[filament_switch_sensor E0Stop]
switch_pin: PC5
pause_on_runout: false #pause handled by macro
runout_gcode:
  M600 #calls a macro with the name M600 (so it can be called by slicers too)

[mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32g0b1xx_3F00350012504B4B38383620-if00

[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100

########################################
# TMC2209 configuration
########################################

[tmc2209 stepper_x]
uart_pin: PB8
#diag_pin: PC4
run_current: 0.800
stealthchop_threshold: 999999

[tmc2209 stepper_y]
uart_pin: PC9
#diag_pin: PB0
run_current: 0.800
stealthchop_threshold: 999999

[tmc2209 stepper_z]
uart_pin: PD0
#diag_pin: PC6
run_current: 0.650
stealthchop_threshold: 999999

[tmc2209 stepper_z1]
uart_pin: PB5
run_current: 0.650
stealthchop_threshold: 999999

[tmc2209 extruder]
uart_pin: PD1
run_current: 0.800
stealthchop_threshold: 999999

[board_pins]
aliases:
    # EXP1 header
    EXP1_1=PC1, EXP1_3=PC3, EXP1_5=PC0, EXP1_7=PA2, EXP1_9=<GND>,
    EXP1_2=PC2,  EXP1_4=<RST>, EXP1_6=PA0, EXP1_8=PA1, EXP1_10=<5V>

[bltouch]
sensor_pin: PA6
control_pin: PA7
set_output_mode: 5V
pin_move_time: 0.675
stow_on_each_sample: False
probe_with_touch_mode: True
pin_up_touch_mode_reports_triggered: False
x_offset: -42.0
y_offset: -8.0
#z_offset: 1.000
speed: 10
lift_speed: 20
samples: 2
sample_retract_dist:5
samples_tolerance_retries: 3

[safe_z_home]
home_xy_position: 117, 117
speed: 150
z_hop: 10
z_hop_speed: 20

[bed_mesh]
algorithm: bicubic
speed: 150
horizontal_move_z: 10
mesh_min: 35,35
#mesh_max: 220,220
#mesh_min: 30,30
mesh_max: 195,195
probe_count: 7,7
fade_end: 10
mesh_pps: 2,2
fade_start: 0.6
fade_end: 10
fade_target: 0
; relative_reference_index = ()(x points * y points) - 1) / 2
relative_reference_index: 24

[z_tilt]
# Ender screw edge offsets are 35,35
# z_positions = IRL position of the stepper itself, in nozzle coords so will be off the bed at the back
# points = probe locations = nozzle + probe offset
# stepper X are 30mm off bed edge left & right
# stepper Y is 80 off the back when nozzle at Y=230 = 230+80
z_positions:
	-30, 310       ##Stepper Location Z0, as if the nozzle were in the screw
	265, 310       ##Stepper Location Z1, as if the nozzle were in the screw
points:
    73, 117
    238, 117
speed: 200
horizontal_move_z: 10
retries: 20
#retry_tolerance:0.010
retry_tolerance:0.005

#[output_pin PS_ON]
#pin: PA9

#[output_pin pb9_pin]
#pin: PB9

#[neopixel my_neopixel]
#pin: PC7

#[adxl345]
#cs_pin: PC15
#spi_software_miso_pin: PC11
#spi_software_mosi_pin: PC12
#spi_software_sclk_pin: PC10

[bed_screws]
screw1: 30.5, 37
screw1_name: front left screw
screw2: 30.5, 207
screw2_name: rear left screw
screw3: 204.5, 207
screw3_name: rear right screw
screw4: 204.5, 37
screw4_name: front right screw

[screws_tilt_adjust]
screw1: 75,205
screw1_name: rear left screw
screw2: 75,35
screw2_name: front left screw
screw3: 245,205
screw3_name: rear right screw
screw4: 245,35
screw4_name: front right screw
horizontal_move_z: 5
speed: 50
screw_thread: CW-M4

#[display]
#lcd_type: st7920
#cs_pin: EXP1_7
#sclk_pin: EXP1_6
#sid_pin: EXP1_8
#encoder_pins: ^EXP1_5, ^EXP1_3
#click_pin: ^!EXP1_2

[output_pin beeper]
pin: EXP1_1

[gcode_arcs]
resolution: 0.05

[gcode_macro DUMP_VARIABLES]
gcode:
    {% set filter_name = params.NAME|default('')|string|lower %}
    {% set filter_value = params.VALUE|default('')|string|lower %}
    {% set show_cfg = params.SHOW_CFG|default(0)|int %}
    
    {% set out = [] %}

    {% for key1 in printer %}
        {% for key2 in printer[key1] %}
            {% if (show_cfg or not (key1|lower == 'configfile' and key2|lower in ['config', 'settings'])) and (filter_name in key1|lower or filter_name in key2|lower) and filter_value in printer[key1][key2]|string|lower %}
                {% set dummy = out.append("printer['%s'].%s = %s" % (key1, key2, printer[key1][key2])) %}
            {% endif %}
        {% else %}
            {% if filter_name in key1|lower and filter_value in printer[key1]|string|lower %}
                {% set dummy = out.append("printer['%s'] = %s" % (key1, printer[key1])) %}
            {% endif %}
        {% endfor %}
    {% endfor %}
    
    {action_respond_info(out|join("\n"))}

[delayed_gcode bed_mesh_init]
initial_duration: .01
gcode:
  BED_MESH_PROFILE LOAD=default

#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 31.050
#*# pid_ki = 1.784
#*# pid_kd = 135.067
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 68.251
#*# pid_ki = 1.143
#*# pid_kd = 1018.640
#*#
#*# [bltouch]
#*# z_offset = 0.475

[BUG] Error evaluating 'gcode_macro bed_mesh_calibrate_fast

After uploading the file to print I get the following error.

Error evaluating 'gcode_macro bed_mesh_calibrate_fast:gcode': jinja2.exceptions.UndefinedError: 'extras.gcode_macro.GetStatusWrapper object' has no attribute 'gcode_macro bed_mesh_calibrate'

I add in Slicer

BED_MESH_PROFILE LOAD=default

What does this error mean and how to fix it?

klipper crashed when pressing lcd button

Klipper will crash when pressing the button on my lcd. The screen is a default ender 3 screen. I am only using the lcd macro, and I can add any more info if needed

Problem with variable_bed_surfaces

I recently add a klicky probe now every time I enable the variable_bed_surfaces. I'm getting this error: Error evaluating 'gcode_macro set_surface_active:gcode': TypeError: a float is required

[Variables]
bed_surfaces = {'active': u'smooth', 'available': {u'smooth': {'offset': '0'}, u'texture': {'offset': 0.0}}}

Support/Feature Request: M600 with Telegram bot message

Hi,

I am trying to add a message to the Telegram Bot when a Filament Change is triggered. Basically I would need something like this to work:

# Overwrite the M600 in jshuh klipper-macros to add telegram message to Filament Change
[gcode_macro m600]
rename_existing: M600.284564
gcode:
  RESPOND PREFIX=tgalarm MSG=Print paused for Filament change!
  M600.284564

I added this after the import of the klipper-macros in my printer.cfg. But I throws an error because M600 is not defined. Sadly I could not find my answers in the klipper manual.

Is there any way to extend the M600 macro (or all macros) to send messages via respond to telegram bot? Any directions are highly appreciated. If not it would be great to have some configuration option to send messages on some g-codes for user interaction.

Best Klaas

Custom Start_Print

Trying to adopt this new setup and I'm unsure how to incorporate my normal start print macro. I run a Z_TILT_ADJUST and CALIBRATE_Z job before each print. I don't see where it'd make sense to drop this in. I'm also using a Euclid Probe, so I need to include M401 to pick up the probe and M402 to stow it.

[gcode_macro G32]
gcode: 
	G28
	QUERY_PROBE
	M401
	Z_TILT_ADJUST
	CALIBRATE_Z

[gcode_macro PRINT_START]
gcode: 

	{% set BED_TEMP = params.BED|default(60)|float %}
	{% set EXTRUDER_TEMP = params.EXTRUDER|default(245)|float %}
	{% set CHAMBER_TEMP = params.CHAMBER|default(21)|float %}
        {% set PREHEAT = (EXTRUDER_TEMP * 0.6)|default(120)|float %}
  	M104 S{PREHEAT} 
	M190 S{BED_TEMP}    
  	G32 
        G90         
	M220 S100     
	M221 S100  
  	M190 S{BED_TEMP}  
        M109 S{EXTRUDER_TEMP}  
        G92 E0      
	QUERY_PROBE
	M402

Unusual (intermittent) error while using Z-TILT and bed_mesh_fast in Print Start

Let me start by saying congratulations on an amazing collection of Macros,
I love the At Layer/ Next Layer macros, it allows for so many options, keep up the great work.

I have my Printer.cfg set to use the temps provided from slicer,
Heat Bed and preheat Extruder, Run Z-Tilt to sync both stepper motors, do a fast bed mesh calibrate,
finish heating extruder and start printing.
It worked perfectly for 10+ prints yesterday, pausing at layer X to do a filament swap, changing settings at layers,
I was delighted with life and thought I found my ideal solution, but the gremlins got in last night while I slept,

I am using a BLTouch for vitrual Z-Endstop and have noticed some intermittent Errors cropping up.

First print this morning I got a BLTouch failed to deploy Error.
I restarted everything (complete power-down and reboot)
BLTouch ran its self test ok and next print ran without issue.

Several (successful) prints later I got another BLTouch failed to deploy Error.
But manually checking with BLTOUCH_Debug reveals no issues.
Console output:
13:43 File opened:First layer calibration_0.2mm_PETG_I3MEGAS_5m.gcode Size:132373
13:43 File selected
13:47 BLTouch failed to deploy
13:47 BLTouch failed to deploy
13:47 BLTouch failed to deploy
13:47 BLTOUCH_DEBUG COMMAND=pin_down
13:47 Sending BLTOUCH_DEBUG COMMAND=pin_down
13:47 BLTOUCH_DEBUG COMMAND=pin_up
13:47 Sending BLTOUCH_DEBUG COMMAND=pin_up

Once I reset and try again it homes, then probes Z after Bed Heating,
then I have received errors during Z-Tilt
See Console Output below:
13:49 Retries: 10/20 Probed points range: 0.006250 tolerance: 0.002500
13:49 probe at 0.000,125.000 is z=2.545837
13:49 probe at 145.000,125.000 is z=2.554587
stepper_z = -0.010584
stepper_z1 = -0.001845
13:49 Making the following Z adjustments:
13:49 Retries: 11/20 Probed points range: 0.008750 tolerance: 0.002500
13:49 Retries aborting: Probed points range is increasing.

It appears the wrong results are getting logged, If I immediately manually re-run a Z-Tilt
I get the following:
13:49 Z_TILT_ADJUST
13:49 probe at 0.000,125.000 is z=2.551834
13:49 probe at 145.000,125.000 is z=2.554334
13:49 Making the following Z adjustments:
stepper_z = -0.003690
stepper_z1 = -0.001200
13:49 Retries: 0/20 Probed points range: 0.002500 tolerance: 0.002500

If I re-run after doing a manual Z-Tilt, it will happily probe the bed for the bed_mesh_fast and complete the print:
13:51 Generating new points...
13:51 bed_mesh: generated points
Index | Tool Adjusted | Probe
13:51 0 | (1.0, 24.0) | (30.0, 5.0)
13:51 1 | (43.5, 24.0) | (72.5, 5.0)
blah ......
blah ......
13:51 23 | (128.5, 209.0) | (157.5, 190.0)
13:51 24 | (171.0, 209.0) | (200.0, 190.0)
13:52 Mesh Bed Leveling Complete
13:52 Bed Mesh state has been saved to profile [default]
for the current session. The SAVE_CONFIG command will
update the printer config file and restart the printer.
13:52 Active bed surface: default; offset: 0.000
13:57 Done printing file

Config File:
printer.cfg.txt

The only possible difference I can think of is the bed was already at temp when I got the last error, (can't remember what setting this morning during first error), is there some sort of timing issue with macro calling the BLTouch to action?

Thanks for any help / suggestions

Mistake in providet "add to moonraker.conf"

I copied the code as in the box and pasted it to my moonraker.conf.
The Button showed me an error.

To solve the problem i simply switched the lines "path: ..." and "origin: ...", as the rest of the configs where written like this.

'''
[update_manager klipper-macros]
type: git_repo
path: ~/printer_data/config/klipper-macros # UPDATE THIS FOR YOUR PATH!!!
origin: https://github.com/jschuh/klipper-macros.git
primary_branch: main
is_system_service: False
managed_services: klipper
'''

Now everything's ok.

Thanks for your awesome work, try to figure out all of the functionality!
Greetings from Austria!
Markus

Bed heating wait duration

Hello,

This is not an issue with your macros. Everything's been working great. I'm trying to turn off the delay between the bed reaching temperature and the print starting.

I tried setting variable_start_bed_heat_delay: 0 but it still waits for an amount of time after the bed has reached temp to start the print.

How can I turn this feature off for some prints?

Thanks!

[BUG] Internal error during connect: unexpected EOF while parsing

Before making a report please ensure you've followed the troubleshooting steps at:
https://github.com/jschuh/klipper-macros#troubleshooting

Describe the bug
Upon starting Mainsail i get the following error:

"Klipper reports: ERROR

Internal error during connect: unexpected EOF while parsing (, line 0)

Once the underlying issue is corrected, use the "RESTART"
command to reload the config and restart the host software.
Printer is halted"

If i remove [include klipper-macros/*.cfg] the Printer doesn't display any errors, except for the basic macros missing.
Was working fine until i updated this morning. I have removed the entire klipper-macros and re-pulled it.

Klipper errors
No commands fired except for "startup" or what the initialization does when the printer is turned on.

Klipper config
Attached Klippy log with configs.
klippy (3).log

PRINT_END Issue

Hi,

When my prints finish and the PRINT_END macro executes my bed goes out beyond it's limits to present the finished print and makes a grinding noise. Do you know what I can modify so it doesn't go as far? Thanks!

Load existing bed mesh instead of probing

Apart from overriding PRINT_START, is there a way to load an existing bed mesh instead of probing the bed before each print? Especially with shorter prints, this greatly reduces the overall time

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.