Messed up Klippy on mainsail

Basic Information:

Printer Model: Ender 3 v2 NEO
MCU / Printerboard: Raspi 4

klippy.zip (1.3 MB)

Describe your issue: I am a very new Klippy user, I did not even hear about it until a few days ago when my printer came in and my friends surprised me with a raspi and set up the entire thing for me. So fast forward to today and following a video I added this line of code

[screws_tilt_adjust]
screw1 = 74, 42
screw1_name = front left screw
screw2 = 234, 42
screw2_name = front right screw
screw3 = 234, 218
screw3_name = rear right screw
screw4 = 74, 218
screw4_name = rear left screw
horizontal_move_z = 10
speed = 150
screw_thread = CW-M4
into printer.cfg as instructed. The only other thing of note is all of my cfg files are empty when the person doing this had text there but I thought nothing of it as even tho my friend didn’t tell me why he assured me that it would work (which it did until I stupidly added this thinking it would be so simple) and now I am getting this in my klippy.log. The video was here and any help would be appreciated. I would ask him but I would like to properly learn this

Hello @Cozyboi !

When you SSH into the Pi, you should get some backup files of the printer.cfg.

If nothing else helps, you can retrieve your cfg from your log:

[pause_resume]

[gcode_macro _OBICO_LAYER_CHANGE]
description = Run a scan across the current print area
variable_first_layer_scan_retract_length = 6
variable_first_layer_scan_retract_speed = 15
variable_first_layer_scan_unretract_length = 6.5
variable_first_layer_scan_unretract_speed = 15
variable_first_layer_scan_resume_speed = 50
variable_first_layer_scan_enabled = True
variable_first_layer_scan_stepover = 10
variable_first_layer_scan_speed = 10
variable_first_layer_scan_zhop = 4
variable_first_layer_scan_zhop_speed = 15
variable_verbose = False
variable_current_layer = -1
variable_first_layer_scanning = False
variable_wait = {'resume': "RESUME", 'absolute_coordinates': True, 'absolute_extrude': True, 'e': 0.0}
gcode = 
	
	{% set pause_macro  = "PAUSE"  if printer.configfile.settings['gcode_macro pause']  is not defined
	else printer.configfile.settings['gcode_macro pause'].rename_existing %}
	{% set resume_macro = "RESUME" if printer.configfile.settings['gcode_macro resume'] is not defined
	else printer.configfile.settings['gcode_macro resume'].rename_existing %}
	
	{% set current_layer_default = printer.print_stats.info.current_layer if printer.print_stats.info.current_layer is not none else -1 %}
	{% set current_layer = params.CURRENT_LAYER|default(current_layer_default)|int %}
	
	{% set polygon_points = printer.exclude_object.objects|map(attribute='polygon')|sum(start=[]) if printer.exclude_object is defined else [] %}
	{% set min_x = params.MINX|default(polygon_points|map(attribute=0)|min|default(printer.toolhead.axis_minimum.x))|float %}
	{% set min_y = params.MINY|default(polygon_points|map(attribute=1)|min|default(printer.toolhead.axis_minimum.y))|float %}
	{% set max_x = params.MAXX|default(polygon_points|map(attribute=0)|max|default(printer.toolhead.axis_maximum.x))|float %}
	{% set max_y = params.MAXY|default(polygon_points|map(attribute=1)|max|default(printer.toolhead.axis_maximum.y))|float %}
	
	{% set stepoverCount = ((max_y - min_y) / first_layer_scan_stepover|float)|round(method='ceil')|int %}
	
	
	{% if verbose %} RESPOND PREFIX='OBICO DEBUG:' MSG='{"Layer %d" % (current_layer)}' {% endif %}
	SET_GCODE_VARIABLE MACRO=_OBICO_LAYER_CHANGE VARIABLE=current_layer VALUE={current_layer}
	
	{% if first_layer_scan_enabled and current_layer == 2 %}
	
	{% set wait_dic = {'resume'              : resume_macro,
	'absolute_coordinates': printer.gcode_move.absolute_coordinates,
	'absolute_extrude'    : printer.gcode_move.absolute_extrude,
	'e'                   : printer.gcode_move.gcode_position.e} %}
	SET_GCODE_VARIABLE MACRO=_OBICO_LAYER_CHANGE VARIABLE=wait VALUE="{wait_dic}"
	
	{% if verbose %} RESPOND PREFIX='OBICO DEBUG:' MSG="Prepair scanning" {% endif %}
	{% if verbose %} RESPOND PREFIX='OBICO DEBUG:' MSG='{"Scan Coordinates: Min:[%.3f:%.3f] Max:[%.3f:%.3f]" % (min_x,min_y,max_x,max_y)}' {% endif %}
	{% if printer[printer.toolhead.extruder].can_extrude %}
	{% if verbose %} RESPOND PREFIX='OBICO DEBUG:' MSG='{"Retract %.1fmm filament" % first_layer_scan_retract_length|abs}' {% endif %}
	M83
	G0 E-{first_layer_scan_retract_length|abs} F{first_layer_scan_retract_speed|float * 60}
	{% endif %}
	G91
	G0 Z{first_layer_scan_zhop|abs} F{first_layer_scan_zhop_speed|float * 60}
	{% if verbose %} RESPOND PREFIX='OBICO DEBUG:' MSG='{"Call %s" % pause_macro}' {% endif %}
	{pause_macro}
	
	
	{% if verbose %} RESPOND PREFIX='OBICO DEBUG:' MSG="Start scanning" {% endif %}
	
	UPDATE_DELAYED_GCODE ID=_WAIT_OBICO_LAYER_CHANGE DURATION=1.0
	SET_GCODE_VARIABLE MACRO=_OBICO_LAYER_CHANGE VARIABLE=first_layer_scanning VALUE=True
	G90
	G0 X{min_x} Y{min_y} F{first_layer_scan_resume_speed|float * 60}
	{% for ystep in range(stepoverCount) %}
	G0 Y{min_y + first_layer_scan_stepover|float * ystep} F{first_layer_scan_speed|float * 60}
	G0 X{max_x if ystep % 2 == 0 else min_x}              F{first_layer_scan_speed|float * 60}
	{% endfor %}
	SET_GCODE_VARIABLE MACRO=_OBICO_LAYER_CHANGE VARIABLE=first_layer_scanning VALUE=False
	{% if verbose %} RESPOND PREFIX='OBICO DEBUG:' MSG="Finish scanning" {% endif %}
	{% endif %}

[delayed_gcode _WAIT_OBICO_LAYER_CHANGE]
gcode = 
	{% set lc_macro = printer['gcode_macro _OBICO_LAYER_CHANGE'] %}
	{% if lc_macro.first_layer_scanning %}
	
	{% if lc_macro.verbose %} RESPOND PREFIX='OBICO DEBUG:' MSG="Waiting for first layer scan..." {% endif %}
	UPDATE_DELAYED_GCODE ID=_WAIT_OBICO_LAYER_CHANGE DURATION=1.0
	{% else %}
	
	{% if lc_macro.verbose %} RESPOND PREFIX='OBICO DEBUG:' MSG="Resume print" {% endif %}
	{% if lc_macro.verbose %} RESPOND PREFIX='OBICO DEBUG:' MSG='{"Call %s VELOCITY=%.1f" % (lc_macro.wait.resume, lc_macro.first_layer_scan_resume_speed)}' {% endif %}
	{lc_macro.wait.resume} VELOCITY={lc_macro.first_layer_scan_resume_speed}
	G91
	G0 Z-{lc_macro.first_layer_scan_zhop|abs} F{lc_macro.first_layer_scan_zhop_speed|float * 60}
	{% if printer[printer.toolhead.extruder].can_extrude %}
	{% if lc_macro.verbose %} RESPOND PREFIX='OBICO DEBUG:' MSG='{"Extrude %.1fmm filament" % lc_macro.first_layer_scan_unretract_length|abs}' {% endif %}
	M83
	G0 E{lc_macro.first_layer_scan_unretract_length|abs} F{lc_macro.first_layer_scan_unretract_speed|float * 60}
	{% endif %}
	
	
	{% if lc_macro.wait.absolute_coordinates %} G90 {% endif %}
	{% if lc_macro.wait.absolute_extrude %}
	M82
	G92 E{lc_macro.wait.e}
	{% endif %}
	{% endif %}

[virtual_sdcard]
path = ~/printer_data/gcodes
on_error_gcode = CANCEL_PRINT

[display_status]

[respond]

[gcode_macro CANCEL_PRINT]
description = Cancel the actual running print
rename_existing = CANCEL_PRINT_BASE
gcode = 
	
	{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
	{% set allow_park = client.park_at_cancel|default(false)|lower == 'true' %}
	{% set retract = client.cancel_retract|default(5.0)|abs %}
	
	{% set park_x = "" if (client.park_at_cancel_x|default(none) is none)
	else "X=" ~ client.park_at_cancel_x %}
	{% set park_y = "" if (client.park_at_cancel_y|default(none) is none)
	else "Y=" ~ client.park_at_cancel_y %}
	{% set custom_park = park_x|length > 0 or park_y|length > 0 %}
	
	
	{% if printer['gcode_macro RESUME'].restore_idle_timeout > 0 %}
	SET_IDLE_TIMEOUT TIMEOUT={printer['gcode_macro RESUME'].restore_idle_timeout}
	{% endif %}
	{% if (custom_park or not printer.pause_resume.is_paused) and allow_park %} _TOOLHEAD_PARK_PAUSE_CANCEL {park_x} {park_y} {% endif %}
	_CLIENT_RETRACT LENGTH={retract}
	TURN_OFF_HEATERS
	M106 S0
	{client.user_cancel_macro|default("")}
	SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=idle_state VALUE=False
	
	SET_PAUSE_NEXT_LAYER ENABLE=0
	SET_PAUSE_AT_LAYER ENABLE=0 LAYER=0
	CANCEL_PRINT_BASE

[gcode_macro PAUSE]
description = Pause the actual running print
rename_existing = PAUSE_BASE
gcode = 
	
	{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
	{% set idle_timeout = client.idle_timeout|default(0) %}
	{% set temp = printer[printer.toolhead.extruder].target if printer.toolhead.extruder != '' else 0 %}
	{% set restore = False if printer.toolhead.extruder == ''
	else True  if params.RESTORE|default(1)|int == 1 else False %}
	
	SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=last_extruder_temp VALUE="{{'restore': restore, 'temp': temp}}"
	
	{% if idle_timeout > 0 %}
	SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=restore_idle_timeout VALUE={printer.configfile.settings.idle_timeout.timeout}
	SET_IDLE_TIMEOUT TIMEOUT={idle_timeout}
	{% endif %}
	PAUSE_BASE
	{client.user_pause_macro|default("")}
	_TOOLHEAD_PARK_PAUSE_CANCEL {rawparams}

[gcode_macro RESUME]
description = Resume the actual running print
rename_existing = RESUME_BASE
variable_last_extruder_temp = {'restore': False, 'temp': 0}
variable_restore_idle_timeout = 0
variable_idle_state = False
gcode = 
	
	{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
	{% set velocity = printer.configfile.settings.pause_resume.recover_velocity %}
	{% set sp_move = client.speed_move|default(velocity) %}
	{% set runout_resume = True if client.runout_sensor|default("") == ""
	else True if not printer[client.runout_sensor].enabled
	else printer[client.runout_sensor].filament_detected %}
	{% set can_extrude = True if printer.toolhead.extruder == ''
	else printer[printer.toolhead.extruder].can_extrude %}
	{% set do_resume = False %}
	{% set prompt_txt = [] %}
	
	
	{% if printer.idle_timeout.state|upper == "IDLE" or idle_state %}
	SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=idle_state VALUE=False
	{% if last_extruder_temp.restore %}
	
	RESPOND TYPE=echo MSG='{"Restoring \"%s\" temperature to %3.1f\u00B0C, this may take some time" % (printer.toolhead.extruder, last_extruder_temp.temp) }'
	M109 S{last_extruder_temp.temp}
	{% set do_resume = True %}
	{% elif can_extrude %}
	{% set do_resume = True %}
	{% else %}
	RESPOND TYPE=error MSG='{"Resume aborted !!! \"%s\" not hot enough, please heat up again and press RESUME" % printer.toolhead.extruder}'
	{% set _d = prompt_txt.append("\"%s\" not hot enough, please heat up again and press RESUME" % printer.toolhead.extruder) %}
	{% endif %}
	
	{% elif can_extrude %}
	{% set do_resume = True %}
	{% else %}
	RESPOND TYPE=error MSG='{"Resume aborted !!! \"%s\" not hot enough, please heat up again and press RESUME" % printer.toolhead.extruder}'
	{% set _d = prompt_txt.append("\"%s\" not hot enough, please heat up again and press RESUME" % printer.toolhead.extruder) %}
	{% endif %}
	{% if runout_resume %}
	{% if do_resume %}
	{% if restore_idle_timeout > 0 %} SET_IDLE_TIMEOUT TIMEOUT={restore_idle_timeout} {% endif %}
	{client.user_resume_macro|default("")}
	_CLIENT_EXTRUDE
	RESUME_BASE VELOCITY={params.VELOCITY|default(sp_move)}
	{% endif %}
	{% else %}
	RESPOND TYPE=error MSG='{"Resume aborted !!! \"%s\" detects no filament, please load filament and press RESUME" % (client.runout_sensor.split(" "))[1]}'
	{% set _d = prompt_txt.append("\"%s\" detects no filament, please load filament and press RESUME" % (client.runout_sensor.split(" "))[1]) %}
	{% endif %}
	
	{% if not (runout_resume and do_resume) %}
	RESPOND TYPE=command MSG="action:prompt_begin RESUME aborted !!!"
	{% for element in prompt_txt %}
	RESPOND TYPE=command MSG='{"action:prompt_text %s" % element}'
	{% endfor %}
	RESPOND TYPE=command MSG="action:prompt_footer_button Ok|RESPOND TYPE=command MSG=action:prompt_end|info"
	RESPOND TYPE=command MSG="action:prompt_show"
	{% endif %}

[gcode_macro SET_PAUSE_NEXT_LAYER]
description = Enable a pause if the next layer is reached
gcode = 
	{% set pause_next_layer = printer['gcode_macro SET_PRINT_STATS_INFO'].pause_next_layer %}
	{% set ENABLE = params.ENABLE|default(1)|int != 0 %}
	{% set MACRO = params.MACRO|default(pause_next_layer.call, True) %}
	SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_next_layer VALUE="{{ 'enable': ENABLE, 'call': MACRO }}"

[gcode_macro SET_PAUSE_AT_LAYER]
description = Enable/disable a pause if a given layer number is reached
gcode = 
	{% set pause_at_layer = printer['gcode_macro SET_PRINT_STATS_INFO'].pause_at_layer %}
	{% set ENABLE = params.ENABLE|int != 0 if params.ENABLE is defined
	else params.LAYER is defined %}
	{% set LAYER = params.LAYER|default(pause_at_layer.layer)|int %}
	{% set MACRO = params.MACRO|default(pause_at_layer.call, True) %}
	SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{{ 'enable': ENABLE, 'layer': LAYER, 'call': MACRO }}"

[gcode_macro SET_PRINT_STATS_INFO]
rename_existing = SET_PRINT_STATS_INFO_BASE
description = Overwrite, to get pause_next_layer and pause_at_layer feature
variable_pause_next_layer = { 'enable': False, 'call': "PAUSE" }
variable_pause_at_layer = { 'enable': False, 'layer': 0, 'call': "PAUSE" }
gcode = 
	{% if pause_next_layer.enable %}
	RESPOND TYPE=echo MSG='{"%s, forced by pause_next_layer" % pause_next_layer.call}'
	{pause_next_layer.call}
	SET_PAUSE_NEXT_LAYER ENABLE=0
	{% elif pause_at_layer.enable and params.CURRENT_LAYER is defined and params.CURRENT_LAYER|int == pause_at_layer.layer %}
	RESPOND TYPE=echo MSG='{"%s, forced by pause_at_layer [%d]" % (pause_at_layer.call, pause_at_layer.layer)}'
	{pause_at_layer.call}
	SET_PAUSE_AT_LAYER ENABLE=0
	{% endif %}
	SET_PRINT_STATS_INFO_BASE {rawparams}

[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
description = Helper: park toolhead used in PAUSE and CANCEL_PRINT
gcode = 
	
	{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
	{% set velocity = printer.configfile.settings.pause_resume.recover_velocity %}
	{% set use_custom     = client.use_custom_pos|default(false)|lower == 'true' %}
	{% set custom_park_x  = client.custom_park_x|default(0.0) %}
	{% set custom_park_y  = client.custom_park_y|default(0.0) %}
	{% set park_dz        = client.custom_park_dz|default(2.0)|abs %}
	{% set sp_hop         = client.speed_hop|default(15) * 60 %}
	{% set sp_move        = client.speed_move|default(velocity) * 60 %}
	
	{% set origin    = printer.gcode_move.homing_origin %}
	{% set act       = printer.gcode_move.gcode_position %}
	{% set max       = printer.toolhead.axis_maximum %}
	{% set cone      = printer.toolhead.cone_start_z|default(max.z) %}
	{% 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 - origin.z)]|min %}
	{% set x_park = params.X       if params.X is defined
	else custom_park_x  if use_custom
	else 0.0            if round_bed
	else (max.x - 5.0) %}
	{% set y_park = params.Y       if params.Y is defined
	else custom_park_y  if use_custom
	else (max.y - 5.0)  if round_bed and z_park < cone
	else 0.0            if round_bed
	else (max.y - 5.0) %}
	
	_CLIENT_RETRACT
	{% if "xyz" in printer.toolhead.homed_axes %}
	G90
	G1 Z{z_park} F{sp_hop}
	G1 X{x_park} Y{y_park} F{sp_move}
	{% if not printer.gcode_move.absolute_coordinates %} G91 {% endif %}
	{% else %}
	RESPOND TYPE=echo MSG='Printer not homed'
	{% endif %}

[gcode_macro _CLIENT_EXTRUDE]
description = Extrudes, if the extruder is hot enough
gcode = 
	
	{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
	{% set use_fw_retract = (client.use_fw_retract|default(false)|lower == 'true') and (printer.firmware_retraction is defined) %}
	{% set length = params.LENGTH|default(client.unretract)|default(1.0)|float %}
	{% set speed = params.SPEED|default(client.speed_unretract)|default(35) %}
	{% set absolute_extrude = printer.gcode_move.absolute_extrude %}
	
	{% if printer.toolhead.extruder != '' %}
	{% if printer[printer.toolhead.extruder].can_extrude %}
	{% if use_fw_retract %}
	{% if length < 0 %}
	G10
	{% else %}
	G11
	{% endif %}
	{% else %}
	M83
	G1 E{length} F{(speed|float|abs) * 60}
	{% if absolute_extrude %}
	M82
	{% endif %}
	{% endif %}
	{% else %}
	RESPOND TYPE=echo MSG='{"\"%s\" not hot enough" % printer.toolhead.extruder}'
	{% endif %}
	{% endif %}

[gcode_macro _CLIENT_RETRACT]
description = Retracts, if the extruder is hot enough
gcode = 
	{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
	{% set length = params.LENGTH|default(client.retract)|default(1.0)|float %}
	{% set speed = params.SPEED|default(client.speed_retract)|default(35) %}
	
	_CLIENT_EXTRUDE LENGTH=-{length|float|abs} SPEED={speed|float|abs}

[stepper_x]
step_pin = PC2
dir_pin = PB9
enable_pin = !PC3
microsteps = 16
rotation_distance = 40
endstop_pin = ^PA5
position_endstop = 0
position_max = 235
homing_speed = 80

[stepper_y]
step_pin = PB8
dir_pin = PB7
enable_pin = !PC3
microsteps = 16
rotation_distance = 40
endstop_pin = ^PA6
position_endstop = 0
position_max = 235
homing_speed = 80

[stepper_z]
step_pin = PB6
dir_pin = !PB5
enable_pin = !PC3
microsteps = 16
rotation_distance = 8
endstop_pin = probe:z_virtual_endstop
position_max = 250
position_min = -5
homing_speed = 4
second_homing_speed = 1
homing_retract_dist = 2.0

[extruder]
max_extrude_only_distance = 100.0
step_pin = PB4
dir_pin = PB3
enable_pin = !PC3
microsteps = 16
rotation_distance = 29.211
nozzle_diameter = 0.400
filament_diameter = 1.750
heater_pin = PA1
sensor_type = EPCOS 100K B57560G104F
sensor_pin = PC5
control = pid
pid_kp = 21.527
pid_ki = 1.063
pid_kd = 108.982
min_temp = 0
max_temp = 250

[heater_bed]
heater_pin = PA2
sensor_type = EPCOS 100K B57560G104F
sensor_pin = PC4
control = pid
pid_kp = 70.405
pid_ki = 1.229
pid_kd = 1008.553
min_temp = 0
max_temp = 130

[fan]
pin = PA0

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

[printer]
kinematics = cartesian
max_velocity = 1500
max_accel = 5000
max_z_velocity = 5
square_corner_velocity = 5.0
max_z_accel = 100

[bltouch]
sensor_pin = ^PB1
control_pin = PB0
x_offset = -45.0
y_offset = -10.0
speed = 50
samples = 1
sample_retract_dist = 8.0
z_offset = 2.290

[safe_z_home]
home_xy_position = 160,120
speed = 1000
z_hop = 10
z_hop_speed = 100

[bed_mesh]
speed = 2000
mesh_min = 30,30
mesh_max = 189,189
probe_count = 5,5
fade_start = 1
fade_end = 10
fade_target = 0
algorithm = bicubic

[bed_screws]
screw1 = 30,25
screw1_name = 1
screw2 = 200,25
screw2_name = 2
screw3 = 200,195
screw3_name = 3
screw4 = 30,195
screw4_name = 4

[screws_tilt_adjust]
screw1 = 67, 42
screw1_name = front left screw
screw2 = 237.60, 42
screw2_name = front right screw
screw3 = 237.60, 212
screw3_name = rear right screw
screw4 = 67.60, 212
screw4_name = rear left screw
horizontal_move_z = 10
speed = 1500
screw_thread = CW-M4

[output_pin beeper]
pin = PB13

[bed_mesh default]
version = 1
points = 
	0.172500, 0.117500, 0.122500, 0.190000, 0.170000
	0.092500, 0.050000, 0.055000, 0.132500, 0.147500
	0.150000, 0.050000, 0.037500, 0.095000, 0.082500
	0.117500, 0.070000, 0.067500, 0.125000, 0.110000
	0.165000, 0.125000, 0.117500, 0.170000, 0.152500
x_count = 5
y_count = 5
mesh_x_pps = 2
mesh_y_pps = 2
algo = bicubic
tension = 0.2
min_x = 30.0
max_x = 189.0
min_y = 30.0
max_y = 189.0

Thank you all for your input. The issue ended up being i accidentally deleted all my files trying to add in the screw adjust settings, a user on discord 3d print server had me check my backup configs which led to us learning that Opera GX is shit for 3d printers as it will NOT show you the code in the config files. This issue is resolved

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.