===== Config file ===== [virtual_sdcard] path = ~/printer_data/gcodes on_error_gcode = CANCEL_PRINT [pause_resume] [display_status] [gcode_macro CANCEL_PRINT] description = Cancel the actual running print rename_existing = CANCEL_PRINT_BASE gcode = TURN_OFF_HEATERS CLEAR_PAUSE SDCARD_RESET_FILE BASE_CANCEL_PRINT M107 G91 G1 Z5 G90 G1 X5 Y320 [gcode_macro PAUSE] description = Pause the actual running print rename_existing = BASE_PAUSE gcode = SAVE_GCODE_STATE NAME=PAUSE_state BASE_PAUSE {% set X = params.X|default(10) %} {% set Y = params.Y|default(10) %} {% set E = params.E|default(2) %} {% set Z = params.Z|default(150) %} G91 G1E-{E}F2100 G1 Z{Z} G90 G1 X{X} Y{Y} F6000 [gcode_macro RESUME] description = Resume the actual running print rename_existing = BASE_RESUME gcode = {% set E = params.E|default(2) %} G91 G1 E{E} F2100 G90 RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 BASE_RESUME [gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL] description = Helper: park toolhead used in PAUSE and CANCEL_PRINT gcode = {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} {% set velocity = printer.configfile.settings.pause_resume.recover_velocity %} {% set use_custom = False if not macro_found else False if client.use_custom_pos is not defined else True if client.use_custom_pos|lower == 'true' else False %} {% set custom_park_x = 0.0 if not macro_found else client.custom_park_x|default(0.0) %} {% set custom_park_y = 0.0 if not macro_found else client.custom_park_y|default(0.0) %} {% set park_dz = 2.0 if not macro_found else client.custom_park_dz|default(2.0)|abs %} {% set use_fw_retract = False if not macro_found else False if client.use_fw_retract is not defined else True if client.use_fw_retract|lower == 'true' and printer.firmware_retraction is defined else False %} {% set retract = 1.0 if not macro_found else client.retract|default(1.0)|abs %} {% set sp_retract = 2100 if not macro_found else client.speed_retract|default(35) * 60 %} {% set sp_hop = 900 if not macro_found else client.speed_hop|default(15) * 60 %} {% set sp_move = velocity * 60 if not macro_found else client.speed_move|default(velocity) * 60 %} {% set act = printer.toolhead.position %} {% set max = printer.toolhead.axis_maximum %} {% set cone = printer.toolhead.cone_start_z|default(max.z) %} {% set round_bed = True if printer.configfile.settings.printer.kinematics is in ['delta','polar','rotary_delta','winch'] else False %} {% set z_min = params.Z_MIN|default(0)|float %} {% set z_park = [[(act.z + park_dz), z_min]|max, max.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) %} {% if printer.extruder.can_extrude %} {% if use_fw_retract %} G10 {% else %} M83 G1 E-{retract} F{sp_retract} {% if printer.gcode_move.absolute_extrude %} M82 {% endif %} {% endif %} {% else %} {action_respond_info("Extruder not hot enough")} {% endif %} {% 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 %} {action_respond_info("Printer not homed")} {% endif %} [gcode_macro TEST_SPEED] gcode = {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} {% set iterations = params.ITERATIONS|default(5)|int %} {% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %} {% set bound = params.BOUND|default(20)|int %} {% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %} {% 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 %} {% 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 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_GCODE_STATE NAME=TEST_SPEED { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } G28 {% if printer.configfile.settings.quad_gantry_level %} {% if printer.quad_gantry_level.applied == False %} QUAD_GANTRY_LEVEL G28 Z {% endif %} {% endif %} G90 G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{30*60} 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 G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} {% for i in range(iterations) %} 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} 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} 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} 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 %} 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} G28 G90 G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60} G4 P1000 GET_POSITION RESTORE_GCODE_STATE NAME=TEST_SPEED [idle_timeout] gcode = timeout = 10 [gcode_macro Z_SPEED] gcode = {% if [gcode_move, gcode_position].z == 2.5 %} M220 S100 {% endif %} [gcode_macro SHUTDOWN_MACHINE] gcode = {action_call_remote_method( " shutdown_machine " )} [gcode_macro PID_EXTRUDER] description = PID Tuning for Extruders gcode = {% set T = params.T|default(255) %} PID_CALIBRATE HEATER =extruder TARGET ={T} [gcode_macro PID_BED] description = PID Tuning for Bed gcode = {% set T = params.T|default(80) %} PID_CALIBRATE HEATER =heater_bed TARGET ={T} [gcode_macro BED_LEVEL] gcode = G28 BED_SCREWS_ADJUST [gcode_macro m900] description = Sets pressure advance. Usage: M900 [K] [T] gcode = {% set km = printer["gcode_macro config"] %} {% if km.pressure_advance_scale > 0.0 %} {% set extruder = "extruder" ~ params.T|replace('0', '') if "T" in params else printer.toolhead.extruder %} {% if 'K' in params %} SET_PRESSURE_ADVANCE EXTRUDER="{extruder}" ADVANCE="{ params.K|float * km.pressure_advance_scale}" {% endif %} {% endif %} [gcode_macro config] variable_pressure_advance_scale = -1.0 gcode = [gcode_macro START_PRINT] description = Start Printing gcode = {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(200)|float %} {% set BED_TEMP = params.BED_TEMP|default(80)|float %} G21 G90 M82 M107 M104 S{EXTRUDER_TEMP} M140 S{BED_TEMP} G28 M190 S{BED_TEMP} M109 S{EXTRUDER_TEMP} PRIME_LINE M220 S50 [gcode_macro END_PRINT] description = End Printing gcode = G91 G1 E-2 F2700 G1 E-2 Z0.2 F2400 G1 Z10 F3000 G90 G1 X5 Y325 F3000 M107 M104 S0 M140 S0 M84 XYE G90 M117 print done [gcode_macro PRIME_LINE] description = Print prime line gcode = G1 Z3.0 F3000 G92 E0 G1 X20 Y20.0 Z0.28 F3000 G92 E0 G1 X10 Y10 Z0.28 F3000.0 G1 X10 Y170.0 Z0.28 F1500.0 E12 G1 X10.3 Y10.0 Z0.28 F1500.0 E18 G92 E0 G1 Z1.0 F3000 M117 Printing [mcu] serial = /dev/serial/by-id/usb-Klipper_stm32f407xx_2E0038001250465636393320-if00 restart_method = command [printer] kinematics = corexy max_velocity = 800 square_corner_velocity = 5.0 max_accel = 3000 max_accel_to_decel = 3000 max_z_velocity = 25 max_z_accel = 100 [stepper_x] step_pin = PE3 dir_pin = PE2 enable_pin = !PE4 microsteps = 32 rotation_distance = 40 endstop_pin = !PA15 position_endstop = 0 position_max = 325 homing_speed = 50 [stepper_y] step_pin = PE0 dir_pin = PB9 enable_pin = !PE4 microsteps = 32 rotation_distance = 40 endstop_pin = !PD2 position_endstop = 0 position_max = 325 homing_speed = 50 [stepper_z] step_pin = PB5 dir_pin = PB4 enable_pin = !PB8 microsteps = 32 rotation_distance = 8 endstop_pin = !PC8 position_endstop = 0 homing_speed = 10 second_homing_speed = 2 position_min = -0.5 position_max = 350 [stepper_z1] step_pin = PD15 dir_pin = PA1 enable_pin = !PA3 microsteps = 32 rotation_distance = 8 endstop_pin = !PC4 [extruder] step_pin = PD6 dir_pin = PD3 enable_pin = !PB3 microsteps = 32 rotation_distance = 15.632 nozzle_diameter = 0.600 filament_diameter = 1.75 heater_pin = PE5 sensor_type = PT1000 sensor_pin = PC1 pullup_resistor = 4700 control = pid pid_kp = 16.767 pid_ki = 0.735 pid_kd = 95.572 min_temp = 0 max_temp = 400 pressure_advance = 0 [heater_bed] heater_pin = PA0 sensor_type = EPCOS 100K B57560G104F sensor_pin = PC0 control = pid pid_kp = 325.10 pid_ki = 63.35 pid_kd = 417.10 min_temp = 0 max_temp = 130 [heater_fan heater_fan] pin = PC14 max_power = 1.0 shutdown_speed = 1.0 heater = extruder heater_temp = 50.0 fan_speed = 1.0 [fan] pin = PB1 max_power = 1.0 shutdown_speed = 0 cycle_time = 0.010 hardware_pwm = False kick_start_time = 0.100 off_below = 0.0 [filament_switch_sensor filament_detection] switch_pin = PE6 pause_on_runout = true runout_gcode = PAUSE [bed_screws] screw1 = 32,52 screw1_name = front left screw screw2 = 295,50 screw2_name = front right screw screw3 = 295,275 screw3_name = back right screw screw4 = 32,275 screw4_name = back left screw speed = 150 [temperature_sensor lepotato] sensor_type = temperature_host min_temp = 10 max_temp = 100 [temperature_sensor mcu] sensor_type = temperature_mcu sensor_mcu = mcu [input_shaper] shaper_type_x = mzv shaper_freq_x = 45.5 shaper_type_y = mzv shaper_freq_y = 46.5 ======================= Loaded MCU 'mcu' 105 commands (v0.11.0-92-g4cd5e9d2 / gcc: (15:9-2019-q4-0ubuntu1) 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599] binutils: (2.34-4ubuntu1+13ubuntu1) 2.34) MCU 'mcu' config: ADC_MAX=4095 BUS_PINS_i2c1=PB6,PB7 BUS_PINS_i2c1a=PB8,PB9 BUS_PINS_i2c2=PB10,PB11 BUS_PINS_i2c2a=PH4,PH5 BUS_PINS_i2c3=PA8,PC9 BUS_PINS_i2c3a=PH7,PH8 BUS_PINS_spi1=PA6,PA7,PA5 BUS_PINS_spi1a=PB4,PB5,PB3 BUS_PINS_spi2=PB14,PB15,PB13 BUS_PINS_spi2a=PC2,PC3,PB10 BUS_PINS_spi2b=PI2,PI3,PI1 BUS_PINS_spi3=PB4,PB5,PB3 BUS_PINS_spi3a=PC11,PC12,PC10 CLOCK_FREQ=168000000 MCU=stm32f407xx PWM_MAX=255 RESERVE_PINS_USB=PA11,PA12 RESERVE_PINS_crystal=PH0,PH1 STATS_SUMSQ_BASE=256 STEPPER_BOTH_EDGE=1 Configured MCU 'mcu' (1024 moves) Args: ['/home/nathan/klipper/klippy/klippy.py', '/home/nathan/printer_data/config/printer.cfg', '-I', '/home/nathan/printer_data/comms/klippy.serial', '-l', '/home/nathan/printer_data/logs/klippy.log', '-a', '/home/nathan/printer_data/comms/klippy.sock'] Git version: 'v0.11.0-198-g33b18fd6' Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper CPU: 4 core ARMv8 Processor rev 4 (v8l) Python: '3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]' webhooks client 281473855109584: {'program': 'Moonraker', 'version': 'v0.8.0-18-gfd5ea0c'} =============== Log rollover at Tue Jun 27 03:21:21 2023 =============== Stats 29714.0: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000003 bytes_write=182025 bytes_read=4804630 bytes_retransmit=9 bytes_invalid=0 send_seq=30281 receive_seq=30281 retransmit_seq=11 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011558 heater_bed: target=0 temp=23.5 pwm=0.000 lepotato: temp=42.0 mcu: temp=36.0 sysload=0.24 cputime=489.878 memavail=1643804 print_time=504501.610 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.2 pwm=0.000 Attempting MCU 'mcu' reset command webhooks client 281473855109584: Disconnected Restarting printer Start printer at Tue Jun 27 03:21:22 2023 (1687854082.4 29715.1) ===== Config file ===== [virtual_sdcard] path = ~/printer_data/gcodes on_error_gcode = CANCEL_PRINT [pause_resume] [display_status] [gcode_macro CANCEL_PRINT] description = Cancel the actual running print rename_existing = CANCEL_PRINT_BASE gcode = TURN_OFF_HEATERS CLEAR_PAUSE SDCARD_RESET_FILE BASE_CANCEL_PRINT M107 G91 G1 Z5 G90 G1 X5 Y320 [gcode_macro PAUSE] description = Pause the actual running print rename_existing = BASE_PAUSE gcode = SAVE_GCODE_STATE NAME=PAUSE_state BASE_PAUSE {% set X = params.X|default(10) %} {% set Y = params.Y|default(10) %} {% set E = params.E|default(2) %} {% set Z = params.Z|default(150) %} G91 G1E-{E}F2100 G1 Z{Z} G90 G1 X{X} Y{Y} F6000 [gcode_macro RESUME] description = Resume the actual running print rename_existing = BASE_RESUME gcode = {% set E = params.E|default(2) %} G91 G1 E{E} F2100 G90 RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 BASE_RESUME [gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL] description = Helper: park toolhead used in PAUSE and CANCEL_PRINT gcode = {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} {% set velocity = printer.configfile.settings.pause_resume.recover_velocity %} {% set use_custom = False if not macro_found else False if client.use_custom_pos is not defined else True if client.use_custom_pos|lower == 'true' else False %} {% set custom_park_x = 0.0 if not macro_found else client.custom_park_x|default(0.0) %} {% set custom_park_y = 0.0 if not macro_found else client.custom_park_y|default(0.0) %} {% set park_dz = 2.0 if not macro_found else client.custom_park_dz|default(2.0)|abs %} {% set use_fw_retract = False if not macro_found else False if client.use_fw_retract is not defined else True if client.use_fw_retract|lower == 'true' and printer.firmware_retraction is defined else False %} {% set retract = 1.0 if not macro_found else client.retract|default(1.0)|abs %} {% set sp_retract = 2100 if not macro_found else client.speed_retract|default(35) * 60 %} {% set sp_hop = 900 if not macro_found else client.speed_hop|default(15) * 60 %} {% set sp_move = velocity * 60 if not macro_found else client.speed_move|default(velocity) * 60 %} {% set act = printer.toolhead.position %} {% set max = printer.toolhead.axis_maximum %} {% set cone = printer.toolhead.cone_start_z|default(max.z) %} {% set round_bed = True if printer.configfile.settings.printer.kinematics is in ['delta','polar','rotary_delta','winch'] else False %} {% set z_min = params.Z_MIN|default(0)|float %} {% set z_park = [[(act.z + park_dz), z_min]|max, max.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) %} {% if printer.extruder.can_extrude %} {% if use_fw_retract %} G10 {% else %} M83 G1 E-{retract} F{sp_retract} {% if printer.gcode_move.absolute_extrude %} M82 {% endif %} {% endif %} {% else %} {action_respond_info("Extruder not hot enough")} {% endif %} {% 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 %} {action_respond_info("Printer not homed")} {% endif %} [gcode_macro TEST_SPEED] gcode = {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} {% set iterations = params.ITERATIONS|default(5)|int %} {% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %} {% set bound = params.BOUND|default(20)|int %} {% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %} {% 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 %} {% 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 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_GCODE_STATE NAME=TEST_SPEED { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } G28 {% if printer.configfile.settings.quad_gantry_level %} {% if printer.quad_gantry_level.applied == False %} QUAD_GANTRY_LEVEL G28 Z {% endif %} {% endif %} G90 G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{30*60} 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 G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} {% for i in range(iterations) %} 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} 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} 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} 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 %} 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} G28 G90 G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60} G4 P1000 GET_POSITION RESTORE_GCODE_STATE NAME=TEST_SPEED [idle_timeout] gcode = timeout = 10 [gcode_macro Z_SPEED] gcode = {% if [gcode_move, gcode_position].z == 2.5 %} M220 S100 {% endif %} [gcode_macro SHUTDOWN_MACHINE] gcode = {action_call_remote_method( " shutdown_machine " )} [gcode_macro PID_EXTRUDER] description = PID Tuning for Extruders gcode = {% set T = params.T|default(255) %} PID_CALIBRATE HEATER =extruder TARGET ={T} [gcode_macro PID_BED] description = PID Tuning for Bed gcode = {% set T = params.T|default(80) %} PID_CALIBRATE HEATER =heater_bed TARGET ={T} [gcode_macro BED_LEVEL] gcode = G28 BED_SCREWS_ADJUST [gcode_macro m900] description = Sets pressure advance. Usage: M900 [K] [T] gcode = {% set km = printer["gcode_macro config"] %} {% if km.pressure_advance_scale > 0.0 %} {% set extruder = "extruder" ~ params.T|replace('0', '') if "T" in params else printer.toolhead.extruder %} {% if 'K' in params %} SET_PRESSURE_ADVANCE EXTRUDER="{extruder}" ADVANCE="{ params.K|float * km.pressure_advance_scale}" {% endif %} {% endif %} [gcode_macro config] variable_pressure_advance_scale = -1.0 gcode = [gcode_macro START_PRINT] description = Start Printing gcode = {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(200)|float %} {% set BED_TEMP = params.BED_TEMP|default(80)|float %} G21 G90 M82 M107 M104 S{EXTRUDER_TEMP} M140 S{BED_TEMP} G28 M190 S{BED_TEMP} M109 S{EXTRUDER_TEMP} PRIME_LINE M220 S50 [gcode_macro END_PRINT] description = End Printing gcode = G91 G1 E-2 F2700 G1 E-2 Z0.2 F2400 G1 Z10 F3000 G90 G1 X5 Y325 F3000 M107 M104 S0 M140 S0 M84 XYE G90 M117 print done [gcode_macro PRIME_LINE] description = Print prime line gcode = G1 Z3.0 F3000 G92 E0 G1 X20 Y20.0 Z0.28 F3000 G92 E0 G1 X10 Y10 Z0.28 F3000.0 G1 X10 Y170.0 Z0.28 F1500.0 E12 G1 X10.3 Y10.0 Z0.28 F1500.0 E18 G92 E0 G1 Z1.0 F3000 M117 Printing [mcu] serial = /dev/serial/by-id/usb-Klipper_stm32f407xx_2E0038001250465636393320-if00 restart_method = command [printer] kinematics = corexy max_velocity = 800 square_corner_velocity = 5.0 max_accel = 3000 max_accel_to_decel = 3000 max_z_velocity = 25 max_z_accel = 100 [stepper_x] step_pin = PE3 dir_pin = PE2 enable_pin = !PE4 microsteps = 32 rotation_distance = 40 endstop_pin = !PA15 position_endstop = 0 position_max = 325 homing_speed = 50 [stepper_y] step_pin = PE0 dir_pin = PB9 enable_pin = !PE4 microsteps = 32 rotation_distance = 40 endstop_pin = !PD2 position_endstop = 0 position_max = 325 homing_speed = 50 [stepper_z] step_pin = PB5 dir_pin = PB4 enable_pin = !PB8 microsteps = 32 rotation_distance = 8 endstop_pin = !PC8 position_endstop = 0 homing_speed = 10 second_homing_speed = 2 position_min = -0.5 position_max = 350 [stepper_z1] step_pin = PD15 dir_pin = PA1 enable_pin = !PA3 microsteps = 32 rotation_distance = 8 endstop_pin = !PC4 [extruder] step_pin = PD6 dir_pin = PD3 enable_pin = !PB3 microsteps = 32 rotation_distance = 15.632 nozzle_diameter = 0.600 filament_diameter = 1.75 heater_pin = PE5 sensor_type = PT1000 sensor_pin = PC1 pullup_resistor = 4700 control = pid pid_kp = 16.767 pid_ki = 0.735 pid_kd = 95.572 min_temp = 0 max_temp = 400 pressure_advance = 0 [heater_bed] heater_pin = PA0 sensor_type = EPCOS 100K B57560G104F sensor_pin = PC0 control = pid pid_kp = 325.10 pid_ki = 63.35 pid_kd = 417.10 min_temp = 0 max_temp = 130 [heater_fan heater_fan] pin = PC14 max_power = 1.0 shutdown_speed = 1.0 heater = extruder heater_temp = 50.0 fan_speed = 1.0 [fan] pin = PB1 max_power = 1.0 shutdown_speed = 0 cycle_time = 0.010 hardware_pwm = False kick_start_time = 0.100 off_below = 0.0 [filament_switch_sensor filament_detection] switch_pin = PE6 pause_on_runout = true runout_gcode = PAUSE [bed_screws] screw1 = 32,52 screw1_name = front left screw screw2 = 295,50 screw2_name = front right screw screw3 = 295,275 screw3_name = back right screw screw4 = 32,275 screw4_name = back left screw speed = 150 [temperature_sensor lepotato] sensor_type = temperature_host min_temp = 10 max_temp = 100 [temperature_sensor mcu] sensor_type = temperature_mcu sensor_mcu = mcu [input_shaper] shaper_type_x = mzv shaper_freq_x = 45.5 shaper_type_y = mzv shaper_freq_y = 46.5 ======================= Extruder max_extrude_ratio=0.598682 mcu 'mcu': Starting serial connect mcu 'mcu': Unable to open serial port: [Errno 2] could not open port /dev/serial/by-id/usb-Klipper_stm32f407xx_2E0038001250465636393320-if00: [Errno 2] No such file or directory: '/dev/serial/by-id/usb-Klipper_stm32f407xx_2E0038001250465636393320-if00' webhooks client 281473855358720: New connection webhooks client 281473855358720: Client info {'program': 'Moonraker', 'version': 'v0.8.0-18-gfd5ea0c'} Loaded MCU 'mcu' 105 commands (v0.11.0-92-g4cd5e9d2 / gcc: (15:9-2019-q4-0ubuntu1) 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599] binutils: (2.34-4ubuntu1+13ubuntu1) 2.34) MCU 'mcu' config: ADC_MAX=4095 BUS_PINS_i2c1=PB6,PB7 BUS_PINS_i2c1a=PB8,PB9 BUS_PINS_i2c2=PB10,PB11 BUS_PINS_i2c2a=PH4,PH5 BUS_PINS_i2c3=PA8,PC9 BUS_PINS_i2c3a=PH7,PH8 BUS_PINS_spi1=PA6,PA7,PA5 BUS_PINS_spi1a=PB4,PB5,PB3 BUS_PINS_spi2=PB14,PB15,PB13 BUS_PINS_spi2a=PC2,PC3,PB10 BUS_PINS_spi2b=PI2,PI3,PI1 BUS_PINS_spi3=PB4,PB5,PB3 BUS_PINS_spi3a=PC11,PC12,PC10 CLOCK_FREQ=168000000 MCU=stm32f407xx PWM_MAX=255 RESERVE_PINS_USB=PA11,PA12 RESERVE_PINS_crystal=PH0,PH1 STATS_SUMSQ_BASE=256 STEPPER_BOTH_EDGE=1 mcu_temperature 'mcu' nominal base=-247.333333 slope=1213.333333 Sending MCU 'mcu' printer configuration... Configured MCU 'mcu' (1024 moves) Starting heater checks for heater_bed Starting heater checks for extruder Stats 29721.5: gcodein=0 mcu: mcu_awake=0.000 mcu_task_avg=0.000000 mcu_task_stddev=0.000000 bytes_write=1254 bytes_read=4329 bytes_retransmit=9 bytes_invalid=0 send_seq=147 receive_seq=147 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=167999720 heater_bed: target=0 temp=0.0 pwm=0.000 lepotato: temp=43.0 mcu: temp=0.0 sysload=0.22 cputime=490.761 memavail=1642832 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=0.0 pwm=0.000 webhooks: registering remote method 'shutdown_machine' for connection id: 281473855358720 webhooks: registering remote method 'reboot_machine' for connection id: 281473855358720 webhooks: registering remote method 'pause_job_queue' for connection id: 281473855358720 webhooks: registering remote method 'start_job_queue' for connection id: 281473855358720 Stats 29722.5: gcodein=0 mcu: mcu_awake=0.003 mcu_task_avg=0.000008 mcu_task_stddev=0.000010 bytes_write=1260 bytes_read=4360 bytes_retransmit=9 bytes_invalid=0 send_seq=148 receive_seq=148 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168006992 heater_bed: target=0 temp=0.0 pwm=0.000 lepotato: temp=43.0 mcu: temp=0.0 sysload=0.22 cputime=490.802 memavail=1642832 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=0.0 pwm=0.000 Stats 29723.5: gcodein=0 mcu: mcu_awake=0.003 mcu_task_avg=0.000008 mcu_task_stddev=0.000010 bytes_write=1274 bytes_read=4477 bytes_retransmit=9 bytes_invalid=0 send_seq=150 receive_seq=150 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011016 heater_bed: target=0 temp=23.7 pwm=0.000 lepotato: temp=43.0 mcu: temp=36.2 sysload=0.20 cputime=490.826 memavail=1642836 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.2 pwm=0.000 Stats 29724.5: gcodein=0 mcu: mcu_awake=0.003 mcu_task_avg=0.000008 mcu_task_stddev=0.000010 bytes_write=1280 bytes_read=4622 bytes_retransmit=9 bytes_invalid=0 send_seq=151 receive_seq=151 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168012020 heater_bed: target=0 temp=23.4 pwm=0.000 lepotato: temp=42.0 mcu: temp=36.1 sysload=0.20 cputime=490.852 memavail=1642840 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.1 pwm=0.000 Stats 29725.5: gcodein=0 mcu: mcu_awake=0.003 mcu_task_avg=0.000008 mcu_task_stddev=0.000010 bytes_write=1286 bytes_read=4782 bytes_retransmit=9 bytes_invalid=0 send_seq=152 receive_seq=152 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168012217 heater_bed: target=0 temp=23.6 pwm=0.000 lepotato: temp=42.0 mcu: temp=36.1 sysload=0.20 cputime=490.879 memavail=1642840 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.0 pwm=0.000 Stats 29726.5: gcodein=0 mcu: mcu_awake=0.003 mcu_task_avg=0.000008 mcu_task_stddev=0.000010 bytes_write=1292 bytes_read=4955 bytes_retransmit=9 bytes_invalid=0 send_seq=153 receive_seq=153 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168012244 heater_bed: target=0 temp=23.6 pwm=0.000 lepotato: temp=42.0 mcu: temp=36.1 sysload=0.20 cputime=490.908 memavail=1642840 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.0 pwm=0.000 Stats 29727.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000003 bytes_write=1298 bytes_read=5114 bytes_retransmit=9 bytes_invalid=0 send_seq=154 receive_seq=154 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168012100 heater_bed: target=0 temp=23.6 pwm=0.000 lepotato: temp=42.0 mcu: temp=36.0 sysload=0.20 cputime=490.935 memavail=1642840 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.2 pwm=0.000 Stats 29728.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000003 bytes_write=1304 bytes_read=5274 bytes_retransmit=9 bytes_invalid=0 send_seq=155 receive_seq=155 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168012054 heater_bed: target=0 temp=23.6 pwm=0.000 lepotato: temp=42.0 mcu: temp=36.1 sysload=0.18 cputime=490.963 memavail=1642840 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=22.9 pwm=0.000 Stats 29729.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000003 bytes_write=1310 bytes_read=5447 bytes_retransmit=9 bytes_invalid=0 send_seq=156 receive_seq=156 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168012053 heater_bed: target=0 temp=23.6 pwm=0.000 lepotato: temp=42.0 mcu: temp=36.1 sysload=0.18 cputime=490.991 memavail=1642840 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.1 pwm=0.000 Stats 29730.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000003 bytes_write=1316 bytes_read=5592 bytes_retransmit=9 bytes_invalid=0 send_seq=157 receive_seq=157 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011994 heater_bed: target=0 temp=23.7 pwm=0.000 lepotato: temp=42.0 mcu: temp=36.0 sysload=0.18 cputime=491.019 memavail=1642840 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=22.9 pwm=0.000 Stats 29731.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000003 bytes_write=1322 bytes_read=5752 bytes_retransmit=9 bytes_invalid=0 send_seq=158 receive_seq=158 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011962 heater_bed: target=0 temp=23.5 pwm=0.000 lepotato: temp=42.0 mcu: temp=36.1 sysload=0.18 cputime=491.046 memavail=1642840 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.0 pwm=0.000 Stats 29732.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000004 bytes_write=1328 bytes_read=5939 bytes_retransmit=9 bytes_invalid=0 send_seq=159 receive_seq=159 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011930 heater_bed: target=0 temp=23.5 pwm=0.000 lepotato: temp=42.0 mcu: temp=36.1 sysload=0.18 cputime=491.075 memavail=1642840 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.1 pwm=0.000 Stats 29733.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000004 bytes_write=1334 bytes_read=6084 bytes_retransmit=9 bytes_invalid=0 send_seq=160 receive_seq=160 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011910 heater_bed: target=0 temp=23.6 pwm=0.000 lepotato: temp=42.0 mcu: temp=36.2 sysload=0.17 cputime=491.102 memavail=1642840 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.1 pwm=0.000 Stats 29734.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000004 bytes_write=1340 bytes_read=6258 bytes_retransmit=9 bytes_invalid=0 send_seq=161 receive_seq=161 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011882 heater_bed: target=0 temp=23.6 pwm=0.000 lepotato: temp=42.0 mcu: temp=36.1 sysload=0.17 cputime=491.130 memavail=1642844 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.1 pwm=0.000 Stats 29735.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000004 bytes_write=1346 bytes_read=6417 bytes_retransmit=9 bytes_invalid=0 send_seq=162 receive_seq=162 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011901 heater_bed: target=0 temp=23.7 pwm=0.000 lepotato: temp=41.0 mcu: temp=36.1 sysload=0.17 cputime=491.158 memavail=1642844 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.0 pwm=0.000 Stats 29736.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000004 bytes_write=1352 bytes_read=6562 bytes_retransmit=9 bytes_invalid=0 send_seq=163 receive_seq=163 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011895 heater_bed: target=0 temp=23.6 pwm=0.000 lepotato: temp=41.0 mcu: temp=36.0 sysload=0.17 cputime=491.185 memavail=1642844 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=22.9 pwm=0.000 Stats 29737.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000003 bytes_write=1358 bytes_read=6750 bytes_retransmit=9 bytes_invalid=0 send_seq=164 receive_seq=164 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011849 heater_bed: target=0 temp=23.5 pwm=0.000 lepotato: temp=42.0 mcu: temp=36.0 sysload=0.17 cputime=491.214 memavail=1642844 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=22.9 pwm=0.000 Stats 29738.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000003 bytes_write=1364 bytes_read=6909 bytes_retransmit=9 bytes_invalid=0 send_seq=165 receive_seq=165 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011833 heater_bed: target=0 temp=23.5 pwm=0.000 lepotato: temp=41.0 mcu: temp=36.0 sysload=0.15 cputime=491.242 memavail=1642844 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.0 pwm=0.000 Stats 29739.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000003 bytes_write=1370 bytes_read=7054 bytes_retransmit=9 bytes_invalid=0 send_seq=166 receive_seq=166 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011844 heater_bed: target=0 temp=23.5 pwm=0.000 lepotato: temp=42.0 mcu: temp=36.0 sysload=0.15 cputime=491.269 memavail=1642844 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=22.9 pwm=0.000 Stats 29740.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000003 bytes_write=1376 bytes_read=7228 bytes_retransmit=9 bytes_invalid=0 send_seq=167 receive_seq=167 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011811 heater_bed: target=0 temp=23.7 pwm=0.000 lepotato: temp=41.0 mcu: temp=36.1 sysload=0.15 cputime=491.298 memavail=1642844 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.1 pwm=0.000 Stats 29741.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000003 bytes_write=1382 bytes_read=7387 bytes_retransmit=9 bytes_invalid=0 send_seq=168 receive_seq=168 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011807 heater_bed: target=0 temp=23.6 pwm=0.000 lepotato: temp=41.0 mcu: temp=36.0 sysload=0.15 cputime=491.325 memavail=1642844 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.0 pwm=0.000 Stats 29742.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000004 bytes_write=1388 bytes_read=7539 bytes_retransmit=9 bytes_invalid=0 send_seq=169 receive_seq=169 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011788 heater_bed: target=0 temp=23.6 pwm=0.000 lepotato: temp=41.0 mcu: temp=36.3 sysload=0.15 cputime=491.352 memavail=1642844 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.0 pwm=0.000 Stats 29743.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000004 bytes_write=1394 bytes_read=7703 bytes_retransmit=9 bytes_invalid=0 send_seq=170 receive_seq=170 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011773 heater_bed: target=0 temp=23.6 pwm=0.000 lepotato: temp=42.0 mcu: temp=36.0 sysload=0.14 cputime=491.381 memavail=1642844 print_time=0.009 buffer_time=0.000 print_stall=0 extruder: target=0 temp=23.1 pwm=0.000 Stats 29744.5: gcodein=0 mcu: mcu_awake=0.001 mcu_task_avg=0.000005 mcu_task_stddev=0.000004 bytes_write=1400 bytes_read=7862 bytes_retransmit=9 bytes_invalid=0 send_seq=171 receive_seq=171 retransmit_seq=2 srtt=0.000 rttvar=0.000 rto=0.025 ready_bytes=0 upcoming_bytes=0 freq=168011752 heater_bed: target=0 temp=23.7 pwm=0.000 lepotato: temp=41.0 mcu: temp=36.0 sysload=0.14 cputime=491.416 memavail=1642852 print_time=28.031 buffer_time=0.437 print_stall=0 extruder: target=0 temp=23.0 pwm=0.000 Attempting MCU 'mcu' reset command webhooks client 281473855358720: Disconnected Restarting printer Start printer at Tue Jun 27 03:21:53 2023 (1687854113.4 29746.1) ===== Config file ===== [virtual_sdcard] path = ~/printer_data/gcodes on_error_gcode = CANCEL_PRINT [pause_resume] [display_status] [gcode_macro CANCEL_PRINT] description = Cancel the actual running print rename_existing = CANCEL_PRINT_BASE gcode = TURN_OFF_HEATERS CLEAR_PAUSE SDCARD_RESET_FILE BASE_CANCEL_PRINT M107 G91 G1 Z5 G90 G1 X5 Y320 [gcode_macro PAUSE] description = Pause the actual running print rename_existing = BASE_PAUSE gcode = SAVE_GCODE_STATE NAME=PAUSE_state BASE_PAUSE {% set X = params.X|default(10) %} {% set Y = params.Y|default(10) %} {% set E = params.E|default(2) %} {% set Z = params.Z|default(150) %} G91 G1E-{E}F2100 G1 Z{Z} G90 G1 X{X} Y{Y} F6000 [gcode_macro RESUME] description = Resume the actual running print rename_existing = BASE_RESUME gcode = {% set E = params.E|default(2) %} G91 G1 E{E} F2100 G90 RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 BASE_RESUME [gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL] description = Helper: park toolhead used in PAUSE and CANCEL_PRINT gcode = {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} {% set velocity = printer.configfile.settings.pause_resume.recover_velocity %} {% set use_custom = False if not macro_found else False if client.use_custom_pos is not defined else True if client.use_custom_pos|lower == 'true' else False %} {% set custom_park_x = 0.0 if not macro_found else client.custom_park_x|default(0.0) %} {% set custom_park_y = 0.0 if not macro_found else client.custom_park_y|default(0.0) %} {% set park_dz = 2.0 if not macro_found else client.custom_park_dz|default(2.0)|abs %} {% set use_fw_retract = False if not macro_found else False if client.use_fw_retract is not defined else True if client.use_fw_retract|lower == 'true' and printer.firmware_retraction is defined else False %} {% set retract = 1.0 if not macro_found else client.retract|default(1.0)|abs %} {% set sp_retract = 2100 if not macro_found else client.speed_retract|default(35) * 60 %} {% set sp_hop = 900 if not macro_found else client.speed_hop|default(15) * 60 %} {% set sp_move = velocity * 60 if not macro_found else client.speed_move|default(velocity) * 60 %} {% set act = printer.toolhead.position %} {% set max = printer.toolhead.axis_maximum %} {% set cone = printer.toolhead.cone_start_z|default(max.z) %} {% set round_bed = True if printer.configfile.settings.printer.kinematics is in ['delta','polar','rotary_delta','winch'] else False %} {% set z_min = params.Z_MIN|default(0)|float %} {% set z_park = [[(act.z + park_dz), z_min]|max, max.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) %} {% if printer.extruder.can_extrude %} {% if use_fw_retract %} G10 {% else %} M83 G1 E-{retract} F{sp_retract} {% if printer.gcode_move.absolute_extrude %} M82 {% endif %} {% endif %} {% else %} {action_respond_info("Extruder not hot enough")} {% endif %} {% 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 %} {action_respond_info("Printer not homed")} {% endif %} [gcode_macro TEST_SPEED] gcode = {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} {% set iterations = params.ITERATIONS|default(5)|int %} {% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %} {% set bound = params.BOUND|default(20)|int %} {% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %} {% 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 %} {% 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 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_GCODE_STATE NAME=TEST_SPEED { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } G28 {% if printer.configfile.settings.quad_gantry_level %} {% if printer.quad_gantry_level.applied == False %} QUAD_GANTRY_LEVEL G28 Z {% endif %} {% endif %} G90 G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{30*60} 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 G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} {% for i in range(iterations) %} 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} 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} 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} 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 %} 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} G28 G90 G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60} G4 P1000 GET_POSITION RESTORE_GCODE_STATE NAME=TEST_SPEED [gcode_macro _get_pos] variable_x = 0.0 variable_y = 0.0 variable_z = 0.0 gcode = {% set X_pos = printer.[gcode_move, gcode_position].x} {% set Y_pos = printer.[gcode_move, gcode_position].y} {% set z_pos = printer.[gcode_move, gcode_position].z} SET_GCODE_VARIABLE MACRO=_get_pos VARIABLE=x VALUE{X_pos} SET_GCODE_VARIABLE MACRO=_get_pos VARIABLE=y VALUE{Y_pos} SET_GCODE_VARIABLE MACRO=_get_pos VARIABLE=z VALUE{Z_pos} [gcode_macro _zone_vars] variable_zone_xy = 0 variable_zone_z = 0 variable_zone_delta = 0 variable_zone_x = 0 variable_x_max = 325 variable_y_max = 325 variable_z_max = 350 gcode = [gcode_macro _set_zone_core_xy] gcode = {% if [gcode_macro, _get_pos].x >=0 and < [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >=0 and < [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=50 SHAPER_FREQ_Y=50 {% else if [gcode_macro, _get_pos].x >= [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >=0 and < [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=100 SHAPER_FREQ_Y=100 {% else if [gcode_macro, _get_pos].x >=0 and < [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >= [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=150 SHAPER_FREQ_Y=150 {% else if [gcode_macro, _get_pos].x >= [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >= [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=200 SHAPER_FREQ_Y=200 [gcode_macro G0] rename_exsisting = G0.1 gcode = _get_pos _set_zone_core_xy G0.1 {rawparams} [gcode_macro G1] rename_exsisting = G1.1 gcode = _get_pos _set_zone_core_xy G1.1 {rawparams} [idle_timeout] gcode = timeout = 10 [gcode_macro Z_SPEED] gcode = {% if [gcode_move, gcode_position].z == 2.5 %} M220 S100 {% endif %} [gcode_macro SHUTDOWN_MACHINE] gcode = {action_call_remote_method( " shutdown_machine " )} [gcode_macro PID_EXTRUDER] description = PID Tuning for Extruders gcode = {% set T = params.T|default(255) %} PID_CALIBRATE HEATER =extruder TARGET ={T} [gcode_macro PID_BED] description = PID Tuning for Bed gcode = {% set T = params.T|default(80) %} PID_CALIBRATE HEATER =heater_bed TARGET ={T} [gcode_macro BED_LEVEL] gcode = G28 BED_SCREWS_ADJUST [gcode_macro m900] description = Sets pressure advance. Usage: M900 [K] [T] gcode = {% set km = printer["gcode_macro config"] %} {% if km.pressure_advance_scale > 0.0 %} {% set extruder = "extruder" ~ params.T|replace('0', '') if "T" in params else printer.toolhead.extruder %} {% if 'K' in params %} SET_PRESSURE_ADVANCE EXTRUDER="{extruder}" ADVANCE="{ params.K|float * km.pressure_advance_scale}" {% endif %} {% endif %} [gcode_macro config] variable_pressure_advance_scale = -1.0 gcode = [gcode_macro START_PRINT] description = Start Printing gcode = {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(200)|float %} {% set BED_TEMP = params.BED_TEMP|default(80)|float %} G21 G90 M82 M107 M104 S{EXTRUDER_TEMP} M140 S{BED_TEMP} G28 M190 S{BED_TEMP} M109 S{EXTRUDER_TEMP} PRIME_LINE M220 S50 [gcode_macro END_PRINT] description = End Printing gcode = G91 G1 E-2 F2700 G1 E-2 Z0.2 F2400 G1 Z10 F3000 G90 G1 X5 Y325 F3000 M107 M104 S0 M140 S0 M84 XYE G90 M117 print done [gcode_macro PRIME_LINE] description = Print prime line gcode = G1 Z3.0 F3000 G92 E0 G1 X20 Y20.0 Z0.28 F3000 G92 E0 G1 X10 Y10 Z0.28 F3000.0 G1 X10 Y170.0 Z0.28 F1500.0 E12 G1 X10.3 Y10.0 Z0.28 F1500.0 E18 G92 E0 G1 Z1.0 F3000 M117 Printing [mcu] serial = /dev/serial/by-id/usb-Klipper_stm32f407xx_2E0038001250465636393320-if00 restart_method = command [printer] kinematics = corexy max_velocity = 800 square_corner_velocity = 5.0 max_accel = 3000 max_accel_to_decel = 3000 max_z_velocity = 25 max_z_accel = 100 [stepper_x] step_pin = PE3 dir_pin = PE2 enable_pin = !PE4 microsteps = 32 rotation_distance = 40 endstop_pin = !PA15 position_endstop = 0 position_max = 325 homing_speed = 50 [stepper_y] step_pin = PE0 dir_pin = PB9 enable_pin = !PE4 microsteps = 32 rotation_distance = 40 endstop_pin = !PD2 position_endstop = 0 position_max = 325 homing_speed = 50 [stepper_z] step_pin = PB5 dir_pin = PB4 enable_pin = !PB8 microsteps = 32 rotation_distance = 8 endstop_pin = !PC8 position_endstop = 0 homing_speed = 10 second_homing_speed = 2 position_min = -0.5 position_max = 350 [stepper_z1] step_pin = PD15 dir_pin = PA1 enable_pin = !PA3 microsteps = 32 rotation_distance = 8 endstop_pin = !PC4 [extruder] step_pin = PD6 dir_pin = PD3 enable_pin = !PB3 microsteps = 32 rotation_distance = 15.632 nozzle_diameter = 0.600 filament_diameter = 1.75 heater_pin = PE5 sensor_type = PT1000 sensor_pin = PC1 pullup_resistor = 4700 control = pid pid_kp = 16.767 pid_ki = 0.735 pid_kd = 95.572 min_temp = 0 max_temp = 400 pressure_advance = 0 [heater_bed] heater_pin = PA0 sensor_type = EPCOS 100K B57560G104F sensor_pin = PC0 control = pid pid_kp = 325.10 pid_ki = 63.35 pid_kd = 417.10 min_temp = 0 max_temp = 130 [heater_fan heater_fan] pin = PC14 max_power = 1.0 shutdown_speed = 1.0 heater = extruder heater_temp = 50.0 fan_speed = 1.0 [fan] pin = PB1 max_power = 1.0 shutdown_speed = 0 cycle_time = 0.010 hardware_pwm = False kick_start_time = 0.100 off_below = 0.0 [filament_switch_sensor filament_detection] switch_pin = PE6 pause_on_runout = true runout_gcode = PAUSE [bed_screws] screw1 = 32,52 screw1_name = front left screw screw2 = 295,50 screw2_name = front right screw screw3 = 295,275 screw3_name = back right screw screw4 = 32,275 screw4_name = back left screw speed = 150 [temperature_sensor lepotato] sensor_type = temperature_host min_temp = 10 max_temp = 100 [temperature_sensor mcu] sensor_type = temperature_mcu sensor_mcu = mcu [input_shaper] shaper_type_x = mzv shaper_freq_x = 45.5 shaper_type_y = mzv shaper_freq_y = 46.5 ======================= Error loading template 'gcode_macro _get_pos:gcode': jinja2.exceptions.TemplateSyntaxError: expected name or number Traceback (most recent call last): File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 51, in __init__ self.template = env.from_string(script) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 941, in from_string return cls.from_code(self, self.compile(source), globals, None) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 638, in compile self.handle_exception(source=source_hint) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "", line -86, in template jinja2.exceptions.TemplateSyntaxError: expected name or number Config error Traceback (most recent call last): File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 51, in __init__ self.template = env.from_string(script) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 941, in from_string return cls.from_code(self, self.compile(source), globals, None) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 638, in compile self.handle_exception(source=source_hint) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "", line -86, in template jinja2.exceptions.TemplateSyntaxError: expected name or number During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/nathan/klipper/klippy/klippy.py", line 175, in _connect self._read_config() File "/home/nathan/klipper/klippy/klippy.py", line 141, in _read_config self.load_object(config, section_config.get_name(), None) File "/home/nathan/klipper/klippy/klippy.py", line 130, in load_object self.objects[section] = init_func(config.getsection(section)) File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 194, in load_config_prefix return GCodeMacro(config) File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 124, in __init__ self.template = gcode_macro.load_template(config, 'gcode') File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 81, in load_template return TemplateWrapper(self.printer, self.env, name, script) File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 56, in __init__ raise printer.config_error(msg) configparser.Error: Error loading template 'gcode_macro _get_pos:gcode': jinja2.exceptions.TemplateSyntaxError: expected name or number webhooks client 281473855167344: New connection webhooks client 281473855167344: Client info {'program': 'Moonraker', 'version': 'v0.8.0-18-gfd5ea0c'} Unable to issue reset command on MCU 'mcu' webhooks client 281473855167344: Disconnected Restarting printer Start printer at Tue Jun 27 03:22:36 2023 (1687854156.3 29789.0) ===== Config file ===== [virtual_sdcard] path = ~/printer_data/gcodes on_error_gcode = CANCEL_PRINT [pause_resume] [display_status] [gcode_macro CANCEL_PRINT] description = Cancel the actual running print rename_existing = CANCEL_PRINT_BASE gcode = TURN_OFF_HEATERS CLEAR_PAUSE SDCARD_RESET_FILE BASE_CANCEL_PRINT M107 G91 G1 Z5 G90 G1 X5 Y320 [gcode_macro PAUSE] description = Pause the actual running print rename_existing = BASE_PAUSE gcode = SAVE_GCODE_STATE NAME=PAUSE_state BASE_PAUSE {% set X = params.X|default(10) %} {% set Y = params.Y|default(10) %} {% set E = params.E|default(2) %} {% set Z = params.Z|default(150) %} G91 G1E-{E}F2100 G1 Z{Z} G90 G1 X{X} Y{Y} F6000 [gcode_macro RESUME] description = Resume the actual running print rename_existing = BASE_RESUME gcode = {% set E = params.E|default(2) %} G91 G1 E{E} F2100 G90 RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 BASE_RESUME [gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL] description = Helper: park toolhead used in PAUSE and CANCEL_PRINT gcode = {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} {% set velocity = printer.configfile.settings.pause_resume.recover_velocity %} {% set use_custom = False if not macro_found else False if client.use_custom_pos is not defined else True if client.use_custom_pos|lower == 'true' else False %} {% set custom_park_x = 0.0 if not macro_found else client.custom_park_x|default(0.0) %} {% set custom_park_y = 0.0 if not macro_found else client.custom_park_y|default(0.0) %} {% set park_dz = 2.0 if not macro_found else client.custom_park_dz|default(2.0)|abs %} {% set use_fw_retract = False if not macro_found else False if client.use_fw_retract is not defined else True if client.use_fw_retract|lower == 'true' and printer.firmware_retraction is defined else False %} {% set retract = 1.0 if not macro_found else client.retract|default(1.0)|abs %} {% set sp_retract = 2100 if not macro_found else client.speed_retract|default(35) * 60 %} {% set sp_hop = 900 if not macro_found else client.speed_hop|default(15) * 60 %} {% set sp_move = velocity * 60 if not macro_found else client.speed_move|default(velocity) * 60 %} {% set act = printer.toolhead.position %} {% set max = printer.toolhead.axis_maximum %} {% set cone = printer.toolhead.cone_start_z|default(max.z) %} {% set round_bed = True if printer.configfile.settings.printer.kinematics is in ['delta','polar','rotary_delta','winch'] else False %} {% set z_min = params.Z_MIN|default(0)|float %} {% set z_park = [[(act.z + park_dz), z_min]|max, max.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) %} {% if printer.extruder.can_extrude %} {% if use_fw_retract %} G10 {% else %} M83 G1 E-{retract} F{sp_retract} {% if printer.gcode_move.absolute_extrude %} M82 {% endif %} {% endif %} {% else %} {action_respond_info("Extruder not hot enough")} {% endif %} {% 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 %} {action_respond_info("Printer not homed")} {% endif %} [gcode_macro TEST_SPEED] gcode = {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} {% set iterations = params.ITERATIONS|default(5)|int %} {% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %} {% set bound = params.BOUND|default(20)|int %} {% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %} {% 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 %} {% 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 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_GCODE_STATE NAME=TEST_SPEED { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } G28 {% if printer.configfile.settings.quad_gantry_level %} {% if printer.quad_gantry_level.applied == False %} QUAD_GANTRY_LEVEL G28 Z {% endif %} {% endif %} G90 G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{30*60} 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 G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} {% for i in range(iterations) %} 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} 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} 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} 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 %} 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} G28 G90 G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60} G4 P1000 GET_POSITION RESTORE_GCODE_STATE NAME=TEST_SPEED [gcode_macro get_pos] variable_x = 0.0 variable_y = 0.0 variable_z = 0.0 gcode = {% set X_pos = printer.[gcode_move, gcode_position].x} {% set Y_pos = printer.[gcode_move, gcode_position].y} {% set z_pos = printer.[gcode_move, gcode_position].z} SET_GCODE_VARIABLE MACRO=_get_pos VARIABLE=x VALUE{X_pos} SET_GCODE_VARIABLE MACRO=_get_pos VARIABLE=y VALUE{Y_pos} SET_GCODE_VARIABLE MACRO=_get_pos VARIABLE=z VALUE{Z_pos} [gcode_macro _zone_vars] variable_zone_xy = 0 variable_zone_z = 0 variable_zone_delta = 0 variable_zone_x = 0 variable_x_max = 325 variable_y_max = 325 variable_z_max = 350 gcode = [gcode_macro _set_zone_core_xy] gcode = {% if [gcode_macro, _get_pos].x >=0 and < [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >=0 and < [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=50 SHAPER_FREQ_Y=50 {% else if [gcode_macro, _get_pos].x >= [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >=0 and < [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=100 SHAPER_FREQ_Y=100 {% else if [gcode_macro, _get_pos].x >=0 and < [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >= [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=150 SHAPER_FREQ_Y=150 {% else if [gcode_macro, _get_pos].x >= [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >= [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=200 SHAPER_FREQ_Y=200 [gcode_macro G0] rename_exsisting = G0.1 gcode = _get_pos _set_zone_core_xy G0.1 {rawparams} [gcode_macro G1] rename_exsisting = G1.1 gcode = _get_pos _set_zone_core_xy G1.1 {rawparams} [idle_timeout] gcode = timeout = 10 [gcode_macro Z_SPEED] gcode = {% if [gcode_move, gcode_position].z == 2.5 %} M220 S100 {% endif %} [gcode_macro SHUTDOWN_MACHINE] gcode = {action_call_remote_method( " shutdown_machine " )} [gcode_macro PID_EXTRUDER] description = PID Tuning for Extruders gcode = {% set T = params.T|default(255) %} PID_CALIBRATE HEATER =extruder TARGET ={T} [gcode_macro PID_BED] description = PID Tuning for Bed gcode = {% set T = params.T|default(80) %} PID_CALIBRATE HEATER =heater_bed TARGET ={T} [gcode_macro BED_LEVEL] gcode = G28 BED_SCREWS_ADJUST [gcode_macro m900] description = Sets pressure advance. Usage: M900 [K] [T] gcode = {% set km = printer["gcode_macro config"] %} {% if km.pressure_advance_scale > 0.0 %} {% set extruder = "extruder" ~ params.T|replace('0', '') if "T" in params else printer.toolhead.extruder %} {% if 'K' in params %} SET_PRESSURE_ADVANCE EXTRUDER="{extruder}" ADVANCE="{ params.K|float * km.pressure_advance_scale}" {% endif %} {% endif %} [gcode_macro config] variable_pressure_advance_scale = -1.0 gcode = [gcode_macro START_PRINT] description = Start Printing gcode = {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(200)|float %} {% set BED_TEMP = params.BED_TEMP|default(80)|float %} G21 G90 M82 M107 M104 S{EXTRUDER_TEMP} M140 S{BED_TEMP} G28 M190 S{BED_TEMP} M109 S{EXTRUDER_TEMP} PRIME_LINE M220 S50 [gcode_macro END_PRINT] description = End Printing gcode = G91 G1 E-2 F2700 G1 E-2 Z0.2 F2400 G1 Z10 F3000 G90 G1 X5 Y325 F3000 M107 M104 S0 M140 S0 M84 XYE G90 M117 print done [gcode_macro PRIME_LINE] description = Print prime line gcode = G1 Z3.0 F3000 G92 E0 G1 X20 Y20.0 Z0.28 F3000 G92 E0 G1 X10 Y10 Z0.28 F3000.0 G1 X10 Y170.0 Z0.28 F1500.0 E12 G1 X10.3 Y10.0 Z0.28 F1500.0 E18 G92 E0 G1 Z1.0 F3000 M117 Printing [mcu] serial = /dev/serial/by-id/usb-Klipper_stm32f407xx_2E0038001250465636393320-if00 restart_method = command [printer] kinematics = corexy max_velocity = 800 square_corner_velocity = 5.0 max_accel = 3000 max_accel_to_decel = 3000 max_z_velocity = 25 max_z_accel = 100 [stepper_x] step_pin = PE3 dir_pin = PE2 enable_pin = !PE4 microsteps = 32 rotation_distance = 40 endstop_pin = !PA15 position_endstop = 0 position_max = 325 homing_speed = 50 [stepper_y] step_pin = PE0 dir_pin = PB9 enable_pin = !PE4 microsteps = 32 rotation_distance = 40 endstop_pin = !PD2 position_endstop = 0 position_max = 325 homing_speed = 50 [stepper_z] step_pin = PB5 dir_pin = PB4 enable_pin = !PB8 microsteps = 32 rotation_distance = 8 endstop_pin = !PC8 position_endstop = 0 homing_speed = 10 second_homing_speed = 2 position_min = -0.5 position_max = 350 [stepper_z1] step_pin = PD15 dir_pin = PA1 enable_pin = !PA3 microsteps = 32 rotation_distance = 8 endstop_pin = !PC4 [extruder] step_pin = PD6 dir_pin = PD3 enable_pin = !PB3 microsteps = 32 rotation_distance = 15.632 nozzle_diameter = 0.600 filament_diameter = 1.75 heater_pin = PE5 sensor_type = PT1000 sensor_pin = PC1 pullup_resistor = 4700 control = pid pid_kp = 16.767 pid_ki = 0.735 pid_kd = 95.572 min_temp = 0 max_temp = 400 pressure_advance = 0 [heater_bed] heater_pin = PA0 sensor_type = EPCOS 100K B57560G104F sensor_pin = PC0 control = pid pid_kp = 325.10 pid_ki = 63.35 pid_kd = 417.10 min_temp = 0 max_temp = 130 [heater_fan heater_fan] pin = PC14 max_power = 1.0 shutdown_speed = 1.0 heater = extruder heater_temp = 50.0 fan_speed = 1.0 [fan] pin = PB1 max_power = 1.0 shutdown_speed = 0 cycle_time = 0.010 hardware_pwm = False kick_start_time = 0.100 off_below = 0.0 [filament_switch_sensor filament_detection] switch_pin = PE6 pause_on_runout = true runout_gcode = PAUSE [bed_screws] screw1 = 32,52 screw1_name = front left screw screw2 = 295,50 screw2_name = front right screw screw3 = 295,275 screw3_name = back right screw screw4 = 32,275 screw4_name = back left screw speed = 150 [temperature_sensor lepotato] sensor_type = temperature_host min_temp = 10 max_temp = 100 [temperature_sensor mcu] sensor_type = temperature_mcu sensor_mcu = mcu [input_shaper] shaper_type_x = mzv shaper_freq_x = 45.5 shaper_type_y = mzv shaper_freq_y = 46.5 ======================= Error loading template 'gcode_macro get_pos:gcode': jinja2.exceptions.TemplateSyntaxError: expected name or number Traceback (most recent call last): File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 51, in __init__ self.template = env.from_string(script) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 941, in from_string return cls.from_code(self, self.compile(source), globals, None) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 638, in compile self.handle_exception(source=source_hint) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "", line -86, in template jinja2.exceptions.TemplateSyntaxError: expected name or number Config error Traceback (most recent call last): File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 51, in __init__ self.template = env.from_string(script) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 941, in from_string return cls.from_code(self, self.compile(source), globals, None) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 638, in compile self.handle_exception(source=source_hint) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "", line -86, in template jinja2.exceptions.TemplateSyntaxError: expected name or number During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/nathan/klipper/klippy/klippy.py", line 175, in _connect self._read_config() File "/home/nathan/klipper/klippy/klippy.py", line 141, in _read_config self.load_object(config, section_config.get_name(), None) File "/home/nathan/klipper/klippy/klippy.py", line 130, in load_object self.objects[section] = init_func(config.getsection(section)) File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 194, in load_config_prefix return GCodeMacro(config) File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 124, in __init__ self.template = gcode_macro.load_template(config, 'gcode') File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 81, in load_template return TemplateWrapper(self.printer, self.env, name, script) File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 56, in __init__ raise printer.config_error(msg) configparser.Error: Error loading template 'gcode_macro get_pos:gcode': jinja2.exceptions.TemplateSyntaxError: expected name or number webhooks client 281473855163024: New connection webhooks client 281473855163024: Client info {'program': 'Moonraker', 'version': 'v0.8.0-18-gfd5ea0c'} Unable to issue reset command on MCU 'mcu' webhooks client 281473855163024: Disconnected Restarting printer Start printer at Tue Jun 27 03:22:57 2023 (1687854177.2 29809.9) ===== Config file ===== [virtual_sdcard] path = ~/printer_data/gcodes on_error_gcode = CANCEL_PRINT [pause_resume] [display_status] [gcode_macro CANCEL_PRINT] description = Cancel the actual running print rename_existing = CANCEL_PRINT_BASE gcode = TURN_OFF_HEATERS CLEAR_PAUSE SDCARD_RESET_FILE BASE_CANCEL_PRINT M107 G91 G1 Z5 G90 G1 X5 Y320 [gcode_macro PAUSE] description = Pause the actual running print rename_existing = BASE_PAUSE gcode = SAVE_GCODE_STATE NAME=PAUSE_state BASE_PAUSE {% set X = params.X|default(10) %} {% set Y = params.Y|default(10) %} {% set E = params.E|default(2) %} {% set Z = params.Z|default(150) %} G91 G1E-{E}F2100 G1 Z{Z} G90 G1 X{X} Y{Y} F6000 [gcode_macro RESUME] description = Resume the actual running print rename_existing = BASE_RESUME gcode = {% set E = params.E|default(2) %} G91 G1 E{E} F2100 G90 RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 BASE_RESUME [gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL] description = Helper: park toolhead used in PAUSE and CANCEL_PRINT gcode = {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} {% set velocity = printer.configfile.settings.pause_resume.recover_velocity %} {% set use_custom = False if not macro_found else False if client.use_custom_pos is not defined else True if client.use_custom_pos|lower == 'true' else False %} {% set custom_park_x = 0.0 if not macro_found else client.custom_park_x|default(0.0) %} {% set custom_park_y = 0.0 if not macro_found else client.custom_park_y|default(0.0) %} {% set park_dz = 2.0 if not macro_found else client.custom_park_dz|default(2.0)|abs %} {% set use_fw_retract = False if not macro_found else False if client.use_fw_retract is not defined else True if client.use_fw_retract|lower == 'true' and printer.firmware_retraction is defined else False %} {% set retract = 1.0 if not macro_found else client.retract|default(1.0)|abs %} {% set sp_retract = 2100 if not macro_found else client.speed_retract|default(35) * 60 %} {% set sp_hop = 900 if not macro_found else client.speed_hop|default(15) * 60 %} {% set sp_move = velocity * 60 if not macro_found else client.speed_move|default(velocity) * 60 %} {% set act = printer.toolhead.position %} {% set max = printer.toolhead.axis_maximum %} {% set cone = printer.toolhead.cone_start_z|default(max.z) %} {% set round_bed = True if printer.configfile.settings.printer.kinematics is in ['delta','polar','rotary_delta','winch'] else False %} {% set z_min = params.Z_MIN|default(0)|float %} {% set z_park = [[(act.z + park_dz), z_min]|max, max.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) %} {% if printer.extruder.can_extrude %} {% if use_fw_retract %} G10 {% else %} M83 G1 E-{retract} F{sp_retract} {% if printer.gcode_move.absolute_extrude %} M82 {% endif %} {% endif %} {% else %} {action_respond_info("Extruder not hot enough")} {% endif %} {% 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 %} {action_respond_info("Printer not homed")} {% endif %} [gcode_macro TEST_SPEED] gcode = {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} {% set iterations = params.ITERATIONS|default(5)|int %} {% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %} {% set bound = params.BOUND|default(20)|int %} {% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %} {% 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 %} {% 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 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_GCODE_STATE NAME=TEST_SPEED { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } G28 {% if printer.configfile.settings.quad_gantry_level %} {% if printer.quad_gantry_level.applied == False %} QUAD_GANTRY_LEVEL G28 Z {% endif %} {% endif %} G90 G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{30*60} 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 G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} {% for i in range(iterations) %} 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} 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} 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} 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 %} 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} G28 G90 G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60} G4 P1000 GET_POSITION RESTORE_GCODE_STATE NAME=TEST_SPEED [gcode_macro _get_pos] variable_x = 0 variable_y = 0 variable_z = 0 gcode = {% set X_pos = printer.[gcode_move, gcode_position].x} {% set Y_pos = printer.[gcode_move, gcode_position].y} {% set z_pos = printer.[gcode_move, gcode_position].z} SET_GCODE_VARIABLE MACRO=_get_pos VARIABLE=x VALUE{X_pos} SET_GCODE_VARIABLE MACRO=_get_pos VARIABLE=y VALUE{Y_pos} SET_GCODE_VARIABLE MACRO=_get_pos VARIABLE=z VALUE{Z_pos} [gcode_macro _zone_vars] variable_zone_xy = 0 variable_zone_z = 0 variable_zone_delta = 0 variable_zone_x = 0 variable_x_max = 325 variable_y_max = 325 variable_z_max = 350 gcode = [gcode_macro _set_zone_core_xy] gcode = {% if [gcode_macro, _get_pos].x >=0 and < [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >=0 and < [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=50 SHAPER_FREQ_Y=50 {% else if [gcode_macro, _get_pos].x >= [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >=0 and < [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=100 SHAPER_FREQ_Y=100 {% else if [gcode_macro, _get_pos].x >=0 and < [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >= [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=150 SHAPER_FREQ_Y=150 {% else if [gcode_macro, _get_pos].x >= [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >= [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=200 SHAPER_FREQ_Y=200 [gcode_macro G0] rename_exsisting = G0.1 gcode = _get_pos _set_zone_core_xy G0.1 {rawparams} [gcode_macro G1] rename_exsisting = G1.1 gcode = _get_pos _set_zone_core_xy G1.1 {rawparams} [idle_timeout] gcode = timeout = 10 [gcode_macro Z_SPEED] gcode = {% if [gcode_move, gcode_position].z == 2.5 %} M220 S100 {% endif %} [gcode_macro SHUTDOWN_MACHINE] gcode = {action_call_remote_method( " shutdown_machine " )} [gcode_macro PID_EXTRUDER] description = PID Tuning for Extruders gcode = {% set T = params.T|default(255) %} PID_CALIBRATE HEATER =extruder TARGET ={T} [gcode_macro PID_BED] description = PID Tuning for Bed gcode = {% set T = params.T|default(80) %} PID_CALIBRATE HEATER =heater_bed TARGET ={T} [gcode_macro BED_LEVEL] gcode = G28 BED_SCREWS_ADJUST [gcode_macro m900] description = Sets pressure advance. Usage: M900 [K] [T] gcode = {% set km = printer["gcode_macro config"] %} {% if km.pressure_advance_scale > 0.0 %} {% set extruder = "extruder" ~ params.T|replace('0', '') if "T" in params else printer.toolhead.extruder %} {% if 'K' in params %} SET_PRESSURE_ADVANCE EXTRUDER="{extruder}" ADVANCE="{ params.K|float * km.pressure_advance_scale}" {% endif %} {% endif %} [gcode_macro config] variable_pressure_advance_scale = -1.0 gcode = [gcode_macro START_PRINT] description = Start Printing gcode = {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(200)|float %} {% set BED_TEMP = params.BED_TEMP|default(80)|float %} G21 G90 M82 M107 M104 S{EXTRUDER_TEMP} M140 S{BED_TEMP} G28 M190 S{BED_TEMP} M109 S{EXTRUDER_TEMP} PRIME_LINE M220 S50 [gcode_macro END_PRINT] description = End Printing gcode = G91 G1 E-2 F2700 G1 E-2 Z0.2 F2400 G1 Z10 F3000 G90 G1 X5 Y325 F3000 M107 M104 S0 M140 S0 M84 XYE G90 M117 print done [gcode_macro PRIME_LINE] description = Print prime line gcode = G1 Z3.0 F3000 G92 E0 G1 X20 Y20.0 Z0.28 F3000 G92 E0 G1 X10 Y10 Z0.28 F3000.0 G1 X10 Y170.0 Z0.28 F1500.0 E12 G1 X10.3 Y10.0 Z0.28 F1500.0 E18 G92 E0 G1 Z1.0 F3000 M117 Printing [mcu] serial = /dev/serial/by-id/usb-Klipper_stm32f407xx_2E0038001250465636393320-if00 restart_method = command [printer] kinematics = corexy max_velocity = 800 square_corner_velocity = 5.0 max_accel = 3000 max_accel_to_decel = 3000 max_z_velocity = 25 max_z_accel = 100 [stepper_x] step_pin = PE3 dir_pin = PE2 enable_pin = !PE4 microsteps = 32 rotation_distance = 40 endstop_pin = !PA15 position_endstop = 0 position_max = 325 homing_speed = 50 [stepper_y] step_pin = PE0 dir_pin = PB9 enable_pin = !PE4 microsteps = 32 rotation_distance = 40 endstop_pin = !PD2 position_endstop = 0 position_max = 325 homing_speed = 50 [stepper_z] step_pin = PB5 dir_pin = PB4 enable_pin = !PB8 microsteps = 32 rotation_distance = 8 endstop_pin = !PC8 position_endstop = 0 homing_speed = 10 second_homing_speed = 2 position_min = -0.5 position_max = 350 [stepper_z1] step_pin = PD15 dir_pin = PA1 enable_pin = !PA3 microsteps = 32 rotation_distance = 8 endstop_pin = !PC4 [extruder] step_pin = PD6 dir_pin = PD3 enable_pin = !PB3 microsteps = 32 rotation_distance = 15.632 nozzle_diameter = 0.600 filament_diameter = 1.75 heater_pin = PE5 sensor_type = PT1000 sensor_pin = PC1 pullup_resistor = 4700 control = pid pid_kp = 16.767 pid_ki = 0.735 pid_kd = 95.572 min_temp = 0 max_temp = 400 pressure_advance = 0 [heater_bed] heater_pin = PA0 sensor_type = EPCOS 100K B57560G104F sensor_pin = PC0 control = pid pid_kp = 325.10 pid_ki = 63.35 pid_kd = 417.10 min_temp = 0 max_temp = 130 [heater_fan heater_fan] pin = PC14 max_power = 1.0 shutdown_speed = 1.0 heater = extruder heater_temp = 50.0 fan_speed = 1.0 [fan] pin = PB1 max_power = 1.0 shutdown_speed = 0 cycle_time = 0.010 hardware_pwm = False kick_start_time = 0.100 off_below = 0.0 [filament_switch_sensor filament_detection] switch_pin = PE6 pause_on_runout = true runout_gcode = PAUSE [bed_screws] screw1 = 32,52 screw1_name = front left screw screw2 = 295,50 screw2_name = front right screw screw3 = 295,275 screw3_name = back right screw screw4 = 32,275 screw4_name = back left screw speed = 150 [temperature_sensor lepotato] sensor_type = temperature_host min_temp = 10 max_temp = 100 [temperature_sensor mcu] sensor_type = temperature_mcu sensor_mcu = mcu [input_shaper] shaper_type_x = mzv shaper_freq_x = 45.5 shaper_type_y = mzv shaper_freq_y = 46.5 ======================= Error loading template 'gcode_macro _get_pos:gcode': jinja2.exceptions.TemplateSyntaxError: expected name or number Traceback (most recent call last): File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 51, in __init__ self.template = env.from_string(script) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 941, in from_string return cls.from_code(self, self.compile(source), globals, None) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 638, in compile self.handle_exception(source=source_hint) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "", line -36, in template jinja2.exceptions.TemplateSyntaxError: expected name or number Config error Traceback (most recent call last): File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 51, in __init__ self.template = env.from_string(script) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 941, in from_string return cls.from_code(self, self.compile(source), globals, None) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 638, in compile self.handle_exception(source=source_hint) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "", line -36, in template jinja2.exceptions.TemplateSyntaxError: expected name or number During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/nathan/klipper/klippy/klippy.py", line 175, in _connect self._read_config() File "/home/nathan/klipper/klippy/klippy.py", line 141, in _read_config self.load_object(config, section_config.get_name(), None) File "/home/nathan/klipper/klippy/klippy.py", line 130, in load_object self.objects[section] = init_func(config.getsection(section)) File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 194, in load_config_prefix return GCodeMacro(config) File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 124, in __init__ self.template = gcode_macro.load_template(config, 'gcode') File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 81, in load_template return TemplateWrapper(self.printer, self.env, name, script) File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 56, in __init__ raise printer.config_error(msg) configparser.Error: Error loading template 'gcode_macro _get_pos:gcode': jinja2.exceptions.TemplateSyntaxError: expected name or number webhooks client 281473855167440: New connection webhooks client 281473855167440: Client info {'program': 'Moonraker', 'version': 'v0.8.0-18-gfd5ea0c'} Unable to issue reset command on MCU 'mcu' webhooks client 281473855167440: Disconnected Restarting printer Start printer at Tue Jun 27 03:23:25 2023 (1687854205.2 29837.9) ===== Config file ===== [virtual_sdcard] path = ~/printer_data/gcodes on_error_gcode = CANCEL_PRINT [pause_resume] [display_status] [gcode_macro CANCEL_PRINT] description = Cancel the actual running print rename_existing = CANCEL_PRINT_BASE gcode = TURN_OFF_HEATERS CLEAR_PAUSE SDCARD_RESET_FILE BASE_CANCEL_PRINT M107 G91 G1 Z5 G90 G1 X5 Y320 [gcode_macro PAUSE] description = Pause the actual running print rename_existing = BASE_PAUSE gcode = SAVE_GCODE_STATE NAME=PAUSE_state BASE_PAUSE {% set X = params.X|default(10) %} {% set Y = params.Y|default(10) %} {% set E = params.E|default(2) %} {% set Z = params.Z|default(150) %} G91 G1E-{E}F2100 G1 Z{Z} G90 G1 X{X} Y{Y} F6000 [gcode_macro RESUME] description = Resume the actual running print rename_existing = BASE_RESUME gcode = {% set E = params.E|default(2) %} G91 G1 E{E} F2100 G90 RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 BASE_RESUME [gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL] description = Helper: park toolhead used in PAUSE and CANCEL_PRINT gcode = {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} {% set velocity = printer.configfile.settings.pause_resume.recover_velocity %} {% set use_custom = False if not macro_found else False if client.use_custom_pos is not defined else True if client.use_custom_pos|lower == 'true' else False %} {% set custom_park_x = 0.0 if not macro_found else client.custom_park_x|default(0.0) %} {% set custom_park_y = 0.0 if not macro_found else client.custom_park_y|default(0.0) %} {% set park_dz = 2.0 if not macro_found else client.custom_park_dz|default(2.0)|abs %} {% set use_fw_retract = False if not macro_found else False if client.use_fw_retract is not defined else True if client.use_fw_retract|lower == 'true' and printer.firmware_retraction is defined else False %} {% set retract = 1.0 if not macro_found else client.retract|default(1.0)|abs %} {% set sp_retract = 2100 if not macro_found else client.speed_retract|default(35) * 60 %} {% set sp_hop = 900 if not macro_found else client.speed_hop|default(15) * 60 %} {% set sp_move = velocity * 60 if not macro_found else client.speed_move|default(velocity) * 60 %} {% set act = printer.toolhead.position %} {% set max = printer.toolhead.axis_maximum %} {% set cone = printer.toolhead.cone_start_z|default(max.z) %} {% set round_bed = True if printer.configfile.settings.printer.kinematics is in ['delta','polar','rotary_delta','winch'] else False %} {% set z_min = params.Z_MIN|default(0)|float %} {% set z_park = [[(act.z + park_dz), z_min]|max, max.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) %} {% if printer.extruder.can_extrude %} {% if use_fw_retract %} G10 {% else %} M83 G1 E-{retract} F{sp_retract} {% if printer.gcode_move.absolute_extrude %} M82 {% endif %} {% endif %} {% else %} {action_respond_info("Extruder not hot enough")} {% endif %} {% 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 %} {action_respond_info("Printer not homed")} {% endif %} [gcode_macro TEST_SPEED] gcode = {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} {% set iterations = params.ITERATIONS|default(5)|int %} {% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %} {% set bound = params.BOUND|default(20)|int %} {% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %} {% 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 %} {% 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 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_GCODE_STATE NAME=TEST_SPEED { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } G28 {% if printer.configfile.settings.quad_gantry_level %} {% if printer.quad_gantry_level.applied == False %} QUAD_GANTRY_LEVEL G28 Z {% endif %} {% endif %} G90 G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{30*60} 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 G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} {% for i in range(iterations) %} 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} 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} 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} 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 %} 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} G28 G90 G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60} G4 P1000 GET_POSITION RESTORE_GCODE_STATE NAME=TEST_SPEED [gcode_macro _get_pos] variable_x = 0 variable_y = 0 variable_z = 0 gcode = {% set X_pos = printer.[gcode_move, gcode_position].x} {% set Y_pos = printer.[gcode_move, gcode_position].y} {% set z_pos = printer.[gcode_move, gcode_position].z} SET_GCODE_VARIABLE MACRO=_get_pos VARIABLE=x VALUE{X_pos} SET_GCODE_VARIABLE MACRO=_get_pos VARIABLE=y VALUE{Y_pos} SET_GCODE_VARIABLE MACRO=_get_pos VARIABLE=z VALUE{Z_pos} [gcode_macro _zone_vars] variable_zone_xy = 0 variable_zone_z = 0 variable_zone_delta = 0 variable_zone_x = 0 variable_x_max = 325 variable_y_max = 325 variable_z_max = 350 gcode = [gcode_macro _set_zone_core_xy] gcode = {% if [gcode_macro, _get_pos].x >=0 and < [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >=0 and < [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=50 SHAPER_FREQ_Y=50 {% else if [gcode_macro, _get_pos].x >= [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >=0 and < [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=100 SHAPER_FREQ_Y=100 {% else if [gcode_macro, _get_pos].x >=0 and < [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >= [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=150 SHAPER_FREQ_Y=150 {% else if [gcode_macro, _get_pos].x >= [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >= [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=200 SHAPER_FREQ_Y=200 [gcode_macro G0] rename_exsisting = G0.1 gcode = _get_pos _set_zone_core_xy G0.1 {rawparams} [gcode_macro G1] rename_exsisting = G1.1 gcode = _get_pos _set_zone_core_xy G1.1 {rawparams} [idle_timeout] gcode = timeout = 10 [gcode_macro Z_SPEED] gcode = {% if [gcode_move, gcode_position].z == 2.5 %} M220 S100 {% endif %} [gcode_macro SHUTDOWN_MACHINE] gcode = {action_call_remote_method( " shutdown_machine " )} [gcode_macro PID_EXTRUDER] description = PID Tuning for Extruders gcode = {% set T = params.T|default(255) %} PID_CALIBRATE HEATER =extruder TARGET ={T} [gcode_macro PID_BED] description = PID Tuning for Bed gcode = {% set T = params.T|default(80) %} PID_CALIBRATE HEATER =heater_bed TARGET ={T} [gcode_macro BED_LEVEL] gcode = G28 BED_SCREWS_ADJUST [gcode_macro m900] description = Sets pressure advance. Usage: M900 [K] [T] gcode = {% set km = printer["gcode_macro config"] %} {% if km.pressure_advance_scale > 0.0 %} {% set extruder = "extruder" ~ params.T|replace('0', '') if "T" in params else printer.toolhead.extruder %} {% if 'K' in params %} SET_PRESSURE_ADVANCE EXTRUDER="{extruder}" ADVANCE="{ params.K|float * km.pressure_advance_scale}" {% endif %} {% endif %} [gcode_macro config] variable_pressure_advance_scale = -1.0 gcode = [gcode_macro START_PRINT] description = Start Printing gcode = {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(200)|float %} {% set BED_TEMP = params.BED_TEMP|default(80)|float %} G21 G90 M82 M107 M104 S{EXTRUDER_TEMP} M140 S{BED_TEMP} G28 M190 S{BED_TEMP} M109 S{EXTRUDER_TEMP} PRIME_LINE M220 S50 [gcode_macro END_PRINT] description = End Printing gcode = G91 G1 E-2 F2700 G1 E-2 Z0.2 F2400 G1 Z10 F3000 G90 G1 X5 Y325 F3000 M107 M104 S0 M140 S0 M84 XYE G90 M117 print done [gcode_macro PRIME_LINE] description = Print prime line gcode = G1 Z3.0 F3000 G92 E0 G1 X20 Y20.0 Z0.28 F3000 G92 E0 G1 X10 Y10 Z0.28 F3000.0 G1 X10 Y170.0 Z0.28 F1500.0 E12 G1 X10.3 Y10.0 Z0.28 F1500.0 E18 G92 E0 G1 Z1.0 F3000 M117 Printing [mcu] serial = /dev/serial/by-id/usb-Klipper_stm32f407xx_2E0038001250465636393320-if00 restart_method = command [printer] kinematics = corexy max_velocity = 800 square_corner_velocity = 5.0 max_accel = 3000 max_accel_to_decel = 3000 max_z_velocity = 25 max_z_accel = 100 [stepper_x] step_pin = PE3 dir_pin = PE2 enable_pin = !PE4 microsteps = 32 rotation_distance = 40 endstop_pin = !PA15 position_endstop = 0 position_max = 325 homing_speed = 50 [stepper_y] step_pin = PE0 dir_pin = PB9 enable_pin = !PE4 microsteps = 32 rotation_distance = 40 endstop_pin = !PD2 position_endstop = 0 position_max = 325 homing_speed = 50 [stepper_z] step_pin = PB5 dir_pin = PB4 enable_pin = !PB8 microsteps = 32 rotation_distance = 8 endstop_pin = !PC8 position_endstop = 0 homing_speed = 10 second_homing_speed = 2 position_min = -0.5 position_max = 350 [stepper_z1] step_pin = PD15 dir_pin = PA1 enable_pin = !PA3 microsteps = 32 rotation_distance = 8 endstop_pin = !PC4 [extruder] step_pin = PD6 dir_pin = PD3 enable_pin = !PB3 microsteps = 32 rotation_distance = 15.632 nozzle_diameter = 0.600 filament_diameter = 1.75 heater_pin = PE5 sensor_type = PT1000 sensor_pin = PC1 pullup_resistor = 4700 control = pid pid_kp = 16.767 pid_ki = 0.735 pid_kd = 95.572 min_temp = 0 max_temp = 400 pressure_advance = 0 [heater_bed] heater_pin = PA0 sensor_type = EPCOS 100K B57560G104F sensor_pin = PC0 control = pid pid_kp = 325.10 pid_ki = 63.35 pid_kd = 417.10 min_temp = 0 max_temp = 130 [heater_fan heater_fan] pin = PC14 max_power = 1.0 shutdown_speed = 1.0 heater = extruder heater_temp = 50.0 fan_speed = 1.0 [fan] pin = PB1 max_power = 1.0 shutdown_speed = 0 cycle_time = 0.010 hardware_pwm = False kick_start_time = 0.100 off_below = 0.0 [filament_switch_sensor filament_detection] switch_pin = PE6 pause_on_runout = true runout_gcode = PAUSE [bed_screws] screw1 = 32,52 screw1_name = front left screw screw2 = 295,50 screw2_name = front right screw screw3 = 295,275 screw3_name = back right screw screw4 = 32,275 screw4_name = back left screw speed = 150 [temperature_sensor lepotato] sensor_type = temperature_host min_temp = 10 max_temp = 100 [temperature_sensor mcu] sensor_type = temperature_mcu sensor_mcu = mcu [input_shaper] shaper_type_x = mzv shaper_freq_x = 45.5 shaper_type_y = mzv shaper_freq_y = 46.5 ======================= Error loading template 'gcode_macro _get_pos:gcode': jinja2.exceptions.TemplateSyntaxError: expected name or number Traceback (most recent call last): File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 51, in __init__ self.template = env.from_string(script) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 941, in from_string return cls.from_code(self, self.compile(source), globals, None) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 638, in compile self.handle_exception(source=source_hint) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "", line 55, in template jinja2.exceptions.TemplateSyntaxError: expected name or number Config error Traceback (most recent call last): File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 51, in __init__ self.template = env.from_string(script) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 941, in from_string return cls.from_code(self, self.compile(source), globals, None) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 638, in compile self.handle_exception(source=source_hint) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "", line 55, in template jinja2.exceptions.TemplateSyntaxError: expected name or number During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/nathan/klipper/klippy/klippy.py", line 175, in _connect self._read_config() File "/home/nathan/klipper/klippy/klippy.py", line 141, in _read_config self.load_object(config, section_config.get_name(), None) File "/home/nathan/klipper/klippy/klippy.py", line 130, in load_object self.objects[section] = init_func(config.getsection(section)) File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 194, in load_config_prefix return GCodeMacro(config) File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 124, in __init__ self.template = gcode_macro.load_template(config, 'gcode') File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 81, in load_template return TemplateWrapper(self.printer, self.env, name, script) File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 56, in __init__ raise printer.config_error(msg) configparser.Error: Error loading template 'gcode_macro _get_pos:gcode': jinja2.exceptions.TemplateSyntaxError: expected name or number webhooks client 281473855163168: New connection webhooks client 281473855163168: Client info {'program': 'Moonraker', 'version': 'v0.8.0-18-gfd5ea0c'} Unable to issue reset command on MCU 'mcu' webhooks client 281473855163168: Disconnected Restarting printer Start printer at Tue Jun 27 03:24:00 2023 (1687854240.0 29872.7) ===== Config file ===== [virtual_sdcard] path = ~/printer_data/gcodes on_error_gcode = CANCEL_PRINT [pause_resume] [display_status] [gcode_macro CANCEL_PRINT] description = Cancel the actual running print rename_existing = CANCEL_PRINT_BASE gcode = TURN_OFF_HEATERS CLEAR_PAUSE SDCARD_RESET_FILE BASE_CANCEL_PRINT M107 G91 G1 Z5 G90 G1 X5 Y320 [gcode_macro PAUSE] description = Pause the actual running print rename_existing = BASE_PAUSE gcode = SAVE_GCODE_STATE NAME=PAUSE_state BASE_PAUSE {% set X = params.X|default(10) %} {% set Y = params.Y|default(10) %} {% set E = params.E|default(2) %} {% set Z = params.Z|default(150) %} G91 G1E-{E}F2100 G1 Z{Z} G90 G1 X{X} Y{Y} F6000 [gcode_macro RESUME] description = Resume the actual running print rename_existing = BASE_RESUME gcode = {% set E = params.E|default(2) %} G91 G1 E{E} F2100 G90 RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 BASE_RESUME [gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL] description = Helper: park toolhead used in PAUSE and CANCEL_PRINT gcode = {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} {% set velocity = printer.configfile.settings.pause_resume.recover_velocity %} {% set use_custom = False if not macro_found else False if client.use_custom_pos is not defined else True if client.use_custom_pos|lower == 'true' else False %} {% set custom_park_x = 0.0 if not macro_found else client.custom_park_x|default(0.0) %} {% set custom_park_y = 0.0 if not macro_found else client.custom_park_y|default(0.0) %} {% set park_dz = 2.0 if not macro_found else client.custom_park_dz|default(2.0)|abs %} {% set use_fw_retract = False if not macro_found else False if client.use_fw_retract is not defined else True if client.use_fw_retract|lower == 'true' and printer.firmware_retraction is defined else False %} {% set retract = 1.0 if not macro_found else client.retract|default(1.0)|abs %} {% set sp_retract = 2100 if not macro_found else client.speed_retract|default(35) * 60 %} {% set sp_hop = 900 if not macro_found else client.speed_hop|default(15) * 60 %} {% set sp_move = velocity * 60 if not macro_found else client.speed_move|default(velocity) * 60 %} {% set act = printer.toolhead.position %} {% set max = printer.toolhead.axis_maximum %} {% set cone = printer.toolhead.cone_start_z|default(max.z) %} {% set round_bed = True if printer.configfile.settings.printer.kinematics is in ['delta','polar','rotary_delta','winch'] else False %} {% set z_min = params.Z_MIN|default(0)|float %} {% set z_park = [[(act.z + park_dz), z_min]|max, max.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) %} {% if printer.extruder.can_extrude %} {% if use_fw_retract %} G10 {% else %} M83 G1 E-{retract} F{sp_retract} {% if printer.gcode_move.absolute_extrude %} M82 {% endif %} {% endif %} {% else %} {action_respond_info("Extruder not hot enough")} {% endif %} {% 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 %} {action_respond_info("Printer not homed")} {% endif %} [gcode_macro TEST_SPEED] gcode = {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} {% set iterations = params.ITERATIONS|default(5)|int %} {% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %} {% set bound = params.BOUND|default(20)|int %} {% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %} {% 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 %} {% 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 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_GCODE_STATE NAME=TEST_SPEED { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } G28 {% if printer.configfile.settings.quad_gantry_level %} {% if printer.quad_gantry_level.applied == False %} QUAD_GANTRY_LEVEL G28 Z {% endif %} {% endif %} G90 G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{30*60} 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 G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} {% for i in range(iterations) %} 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} 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} 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} 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 %} 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} G28 G90 G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60} G4 P1000 GET_POSITION RESTORE_GCODE_STATE NAME=TEST_SPEED [gcode_macro _get_pos] variable_x = 0 variable_y = 0 variable_z = 0 gcode = {% set X_pos = printer.[gcode_move, gcode_position].x %} {% set Y_pos = printer.[gcode_move, gcode_position].y %} {% set z_pos = printer.[gcode_move, gcode_position].z %} SET_GCODE_VARIABLE MACRO=_get_pos VARIABLE=x VALUE{X_pos} SET_GCODE_VARIABLE MACRO=_get_pos VARIABLE=y VALUE{Y_pos} SET_GCODE_VARIABLE MACRO=_get_pos VARIABLE=z VALUE{Z_pos} [gcode_macro _zone_vars] variable_zone_xy = 0 variable_zone_z = 0 variable_zone_delta = 0 variable_zone_x = 0 variable_x_max = 325 variable_y_max = 325 variable_z_max = 350 gcode = [gcode_macro _set_zone_core_xy] gcode = {% if [gcode_macro, _get_pos].x >=0 and < [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >=0 and < [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=50 SHAPER_FREQ_Y=50 {% else if [gcode_macro, _get_pos].x >= [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >=0 and < [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=100 SHAPER_FREQ_Y=100 {% else if [gcode_macro, _get_pos].x >=0 and < [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >= [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=150 SHAPER_FREQ_Y=150 {% else if [gcode_macro, _get_pos].x >= [gcode_macro, _zone_vars].X_max / 2 and [gcode_macro, _get_pos].y >= [gcode_macro, _zone_vars].Y_max / 2 %} SET_INPUT_SHAPER SHAPER_TYPE=ZV SHAPER_FREQ_X=200 SHAPER_FREQ_Y=200 [gcode_macro G0] rename_exsisting = G0.1 gcode = _get_pos _set_zone_core_xy G0.1 {rawparams} [gcode_macro G1] rename_exsisting = G1.1 gcode = _get_pos _set_zone_core_xy G1.1 {rawparams} [idle_timeout] gcode = timeout = 10 [gcode_macro Z_SPEED] gcode = {% if [gcode_move, gcode_position].z == 2.5 %} M220 S100 {% endif %} [gcode_macro SHUTDOWN_MACHINE] gcode = {action_call_remote_method( " shutdown_machine " )} [gcode_macro PID_EXTRUDER] description = PID Tuning for Extruders gcode = {% set T = params.T|default(255) %} PID_CALIBRATE HEATER =extruder TARGET ={T} [gcode_macro PID_BED] description = PID Tuning for Bed gcode = {% set T = params.T|default(80) %} PID_CALIBRATE HEATER =heater_bed TARGET ={T} [gcode_macro BED_LEVEL] gcode = G28 BED_SCREWS_ADJUST [gcode_macro m900] description = Sets pressure advance. Usage: M900 [K] [T] gcode = {% set km = printer["gcode_macro config"] %} {% if km.pressure_advance_scale > 0.0 %} {% set extruder = "extruder" ~ params.T|replace('0', '') if "T" in params else printer.toolhead.extruder %} {% if 'K' in params %} SET_PRESSURE_ADVANCE EXTRUDER="{extruder}" ADVANCE="{ params.K|float * km.pressure_advance_scale}" {% endif %} {% endif %} [gcode_macro config] variable_pressure_advance_scale = -1.0 gcode = [gcode_macro START_PRINT] description = Start Printing gcode = {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(200)|float %} {% set BED_TEMP = params.BED_TEMP|default(80)|float %} G21 G90 M82 M107 M104 S{EXTRUDER_TEMP} M140 S{BED_TEMP} G28 M190 S{BED_TEMP} M109 S{EXTRUDER_TEMP} PRIME_LINE M220 S50 [gcode_macro END_PRINT] description = End Printing gcode = G91 G1 E-2 F2700 G1 E-2 Z0.2 F2400 G1 Z10 F3000 G90 G1 X5 Y325 F3000 M107 M104 S0 M140 S0 M84 XYE G90 M117 print done [gcode_macro PRIME_LINE] description = Print prime line gcode = G1 Z3.0 F3000 G92 E0 G1 X20 Y20.0 Z0.28 F3000 G92 E0 G1 X10 Y10 Z0.28 F3000.0 G1 X10 Y170.0 Z0.28 F1500.0 E12 G1 X10.3 Y10.0 Z0.28 F1500.0 E18 G92 E0 G1 Z1.0 F3000 M117 Printing [mcu] serial = /dev/serial/by-id/usb-Klipper_stm32f407xx_2E0038001250465636393320-if00 restart_method = command [printer] kinematics = corexy max_velocity = 800 square_corner_velocity = 5.0 max_accel = 3000 max_accel_to_decel = 3000 max_z_velocity = 25 max_z_accel = 100 [stepper_x] step_pin = PE3 dir_pin = PE2 enable_pin = !PE4 microsteps = 32 rotation_distance = 40 endstop_pin = !PA15 position_endstop = 0 position_max = 325 homing_speed = 50 [stepper_y] step_pin = PE0 dir_pin = PB9 enable_pin = !PE4 microsteps = 32 rotation_distance = 40 endstop_pin = !PD2 position_endstop = 0 position_max = 325 homing_speed = 50 [stepper_z] step_pin = PB5 dir_pin = PB4 enable_pin = !PB8 microsteps = 32 rotation_distance = 8 endstop_pin = !PC8 position_endstop = 0 homing_speed = 10 second_homing_speed = 2 position_min = -0.5 position_max = 350 [stepper_z1] step_pin = PD15 dir_pin = PA1 enable_pin = !PA3 microsteps = 32 rotation_distance = 8 endstop_pin = !PC4 [extruder] step_pin = PD6 dir_pin = PD3 enable_pin = !PB3 microsteps = 32 rotation_distance = 15.632 nozzle_diameter = 0.600 filament_diameter = 1.75 heater_pin = PE5 sensor_type = PT1000 sensor_pin = PC1 pullup_resistor = 4700 control = pid pid_kp = 16.767 pid_ki = 0.735 pid_kd = 95.572 min_temp = 0 max_temp = 400 pressure_advance = 0 [heater_bed] heater_pin = PA0 sensor_type = EPCOS 100K B57560G104F sensor_pin = PC0 control = pid pid_kp = 325.10 pid_ki = 63.35 pid_kd = 417.10 min_temp = 0 max_temp = 130 [heater_fan heater_fan] pin = PC14 max_power = 1.0 shutdown_speed = 1.0 heater = extruder heater_temp = 50.0 fan_speed = 1.0 [fan] pin = PB1 max_power = 1.0 shutdown_speed = 0 cycle_time = 0.010 hardware_pwm = False kick_start_time = 0.100 off_below = 0.0 [filament_switch_sensor filament_detection] switch_pin = PE6 pause_on_runout = true runout_gcode = PAUSE [bed_screws] screw1 = 32,52 screw1_name = front left screw screw2 = 295,50 screw2_name = front right screw screw3 = 295,275 screw3_name = back right screw screw4 = 32,275 screw4_name = back left screw speed = 150 [temperature_sensor lepotato] sensor_type = temperature_host min_temp = 10 max_temp = 100 [temperature_sensor mcu] sensor_type = temperature_mcu sensor_mcu = mcu [input_shaper] shaper_type_x = mzv shaper_freq_x = 45.5 shaper_type_y = mzv shaper_freq_y = 46.5 ======================= Error loading template 'gcode_macro _get_pos:gcode': jinja2.exceptions.TemplateSyntaxError: expected name or number Traceback (most recent call last): File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 51, in __init__ self.template = env.from_string(script) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 941, in from_string return cls.from_code(self, self.compile(source), globals, None) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 638, in compile self.handle_exception(source=source_hint) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "", line 55, in template jinja2.exceptions.TemplateSyntaxError: expected name or number Config error Traceback (most recent call last): File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 51, in __init__ self.template = env.from_string(script) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 941, in from_string return cls.from_code(self, self.compile(source), globals, None) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 638, in compile self.handle_exception(source=source_hint) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/home/nathan/klippy-env/lib/python3.10/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "", line 55, in template jinja2.exceptions.TemplateSyntaxError: expected name or number During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/nathan/klipper/klippy/klippy.py", line 175, in _connect self._read_config() File "/home/nathan/klipper/klippy/klippy.py", line 141, in _read_config self.load_object(config, section_config.get_name(), None) File "/home/nathan/klipper/klippy/klippy.py", line 130, in load_object self.objects[section] = init_func(config.getsection(section)) File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 194, in load_config_prefix return GCodeMacro(config) File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 124, in __init__ self.template = gcode_macro.load_template(config, 'gcode') File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 81, in load_template return TemplateWrapper(self.printer, self.env, name, script) File "/home/nathan/klipper/klippy/extras/gcode_macro.py", line 56, in __init__ raise printer.config_error(msg) configparser.Error: Error loading template 'gcode_macro _get_pos:gcode': jinja2.exceptions.TemplateSyntaxError: expected name or number webhooks client 281473855176368: New connection webhooks client 281473855176368: Client info {'program': 'Moonraker', 'version': 'v0.8.0-18-gfd5ea0c'}