Error Option 'mesh_min' in section 'bed_mesh ' must be specified

Cheers!!!
First of all, sorry for my English since I’m using google translator…
I’ve been hitting my head against a wall for a few hours now.

I was adding and modifying some startup macros that I have found and all of a sudden I got the following error message:

                     Option 'mesh_min' in section 'bed_mesh ' must be specified

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

I’ve been checking the [bed_mesh] section (which I haven’t modified for months) and everything seems to be correct.
I have tried to comment out all the lines of the new code that I was inserting that have to do with the leveling of the bed and it does not work.
I have even returned to leave the code as it was when it worked and I still get the same error.

Printer Model: Ender3
MCU / Printerboard: SKR mini E3 V2
Klipper Mainsail in RaspberryPi 4

Thanks in advance

This is the printer.cfg which was working perfectly:

[stepper_x]
step_pin: PB13
dir_pin: !PB12
enable_pin: !PB14
microsteps: 32
rotation_distance: 39.60
endstop_pin: tmc2209_stepper_x:virtual_endstop
position_endstop: -12
position_min: -12
position_max: 239
homing_speed: 20
homing_retract_dist: 0

[tmc2209 stepper_x]
uart_pin: PC11
tx_pin: PC10
interpolate: True
uart_address: 0
run_current: 0.750
stealthchop_threshold: 999999
diag_pin: ^PC0
driver_SGTHRS: 47 # 255 is most sensitive value, 0 is least sensitive


[stepper_y]
step_pin: PB10
dir_pin: !PB2
enable_pin: !PB11
microsteps: 32
rotation_distance: 39.60
endstop_pin: tmc2209_stepper_y:virtual_endstop
position_endstop: -6
position_min: -6
position_max: 240
homing_speed: 20
homing_retract_dist: 0

[tmc2209 stepper_y]
uart_pin: PC11
tx_pin: PC10
interpolate: True
uart_address: 2
run_current: 0.750
stealthchop_threshold: 999999
diag_pin: ^PC1
driver_SGTHRS: 50


[stepper_z]
step_pin: PB0
dir_pin: PC5
enable_pin: !PB1
microsteps: 16
rotation_distance: 8
endstop_pin: probe:z_virtual_endstop
position_min: -5
position_max: 270

[tmc2209 stepper_z]
uart_pin: PC11
tx_pin: PC10
uart_address: 1
run_current: 1.200
stealthchop_threshold: 999999

[extruder]
step_pin: PB3
dir_pin: !PB4
enable_pin: !PD2
microsteps: 16
rotation_distance: 8.456
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC8
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA0
#control: pid
#pid_Kp: 27.796
#pid_Ki: 1.626
#pid_Kd: 118.928
min_temp: 0
max_temp: 320
pressure_advance = 0.067


[tmc2209 extruder]
uart_pin: PC11
tx_pin: PC10
uart_address: 3
run_current: 0.900
stealthchop_threshold: 999999

[firmware_retraction]
retract_length: 0.50
#   The length of filament (in mm) to retract when G10 is activated,
#   and to unretract when G11 is activated (but see
#   unretract_extra_length below). The default is 0 mm.
retract_speed: 60
#   The speed of retraction, in mm/s. The default is 20 mm/s.
#unretract_extra_length: 0
#   The length (in mm) of *additional* filament to add when
#   unretracting.
#unretract_speed: 10
#   The speed of unretraction, in mm/s. The default is 10 mm/s.


[input_shaper]
shaper_freq_x: 46.15 # frequency for the X mark of the test model
shaper_freq_y: 46.1  # frequency for the Y mark of the test model
shaper_type: ei

[heater_bed]
heater_pin: PC9
sensor_type: ATC Semitec 104GT-2
sensor_pin: PC3
control: pid
pid_Kp: 71.776
pid_Ki: 1.500
pid_Kd: 858.624
min_temp: 0
max_temp: 130

[heater_fan nozzle_cooling_fan]
pin: PC7

[fan]
pin: PC6

[virtual_sdcard]
path: ~/gcode_files

[display_status]

[pause_resume]

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

[mcu rpi]
serial: /tmp/klipper_host_mcu

[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 2500
max_accel_to_decel: 2500
max_z_velocity: 5
max_z_accel: 100
square_corner_velocity: 5


[static_digital_output usb_pullup_enable]
pins: !PA14

[board_pins]
aliases:
    # EXP1 header
    EXP1_1=PB5,  EXP1_3=PA9,   EXP1_5=PA10, EXP1_7=PB8,  EXP1_9=<GND>,
    EXP1_2=PA15, EXP1_4=<RST>, EXP1_6=PB9,  EXP1_8=PB15, EXP1_10=<5V>

# See the sample-lcd.cfg file for definitions of common LCD displays.


#====================================================================
# BLTOUCH
#====================================================================
[bltouch]
sensor_pin: ^PC2
control_pin: PA1
pin_move_time: 0.675
stow_on_each_sample: True
probe_with_touch_mode: False
pin_up_touch_mode_reports_triggered: False
x_offset: -36.50
y_offset: -22.63
#z_offset: 2
speed: 10
lift_speed: 20
samples: 2
sample_retract_dist:5
samples_tolerance_retries: 3

[safe_z_home]
home_xy_position: 117.5, 117.5
speed: 150
z_hop: 5
z_hop_speed: 20

[bed_mesh]
speed: 120
horizontal_move_z: 5
mesh_min: 5,15
mesh_max: 200,200
probe_count: 4,4
algorithm: bicubic

  

[screws_tilt_adjust]
screw1: 69, 60.50        # The (X, Y) coordinate of the first bed leveling screw.
screw1_name: DEL-I
screw2: 238, 60.509
screw2_name: DEL-D
screw3: 69, 230
screw3_name: TRAS-I
screw4: 238, 230
screw4_name: TRAS-D
speed: 80
horizontal_move_z: 5
screw_thread: CW-M4

[filament_switch_sensor FIlamentDetect]
pause_on_runout: False
runout_gcode: PAUSE
#insert_gcode:
#event_delay: 3.0
#pause_delay: 0.5
switch_pin: !PC15


######################################## MACROS ################################################## 
[gcode_macro START_PRINT]
gcode:
  SAVE_GCODE_STATE NAME=start_print_state
  G21 ;Valores Metricos
  G90 ;Posicion Absoluta
  M82 ;Modo Absoluto
  G28 ;Home
  SET_FILAMENT_SENSOR SENSOR=FIlamentDetect ENABLE=0
  M117 Calentando...
  M190 S{params.BED_TEMP|default(printer.heater_bed.target, true) } ; Espera a calentamiento de Cama
  BED_MESH_PROFILE LOAD=default ; Calibracion Alturas Cama
  M109 S{params.EXTRUDER_TEMP|default(printer.extruder.target, true) } ; Espera a calentamiento de Extrusor
  G92 E0
  G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed 
  G1 X1 Y20 Z0.3 F5000.0 ; Move to start position
  G1 X1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
  G1 X1.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
  G1 X1.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
  G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
  G1 X5 Y20 Z0.3 F5000.0 ; Move over to prevent blob squish
  RESTORE_GCODE_STATE NAME=start_print_state

[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
  PAUSE_BASE
  _TOOLHEAD_PARK_PAUSE_CANCEL

[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
  ##### read extrude from  _TOOLHEAD_PARK_PAUSE_CANCEL  macro #####
  {% set extrude = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
  #### get VELOCITY parameter if specified ####
  {% if 'VELOCITY' in params|upper %}
    {% set get_params = ('VELOCITY=' + params.VELOCITY)  %}
  {%else %}
    {% set get_params = "" %}
  {% endif %}
  ##### end of definitions #####
  {% if printer.extruder.can_extrude|lower == 'true' %}
    M83
    G1 E{extrude} F2100
    {% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
  {% else %}
    {action_respond_info("Extruder not hot enough")}
  {% endif %}  
  RESUME_BASE {get_params}


[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
variable_park: True
gcode:
  ## Move head and retract only if not already in the pause state and park set to true
  {% if printer.pause_resume.is_paused|lower == 'false' and park|lower == 'true'%}
    _TOOLHEAD_PARK_PAUSE_CANCEL
  {% endif %}
  TURN_OFF_HEATERS
  CANCEL_PRINT_BASE

[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
variable_extrude: 1.0
gcode:
  ##### set park positon for x and y #####
  # default is your max posion from your printer.cfg
  {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
  {% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
  {% set z_park_delta = 2.0 %}
  ##### calculate save lift position #####
  {% set max_z = printer.toolhead.axis_maximum.z|float %}
  {% set act_z = printer.toolhead.position.z|float %}
  {% if act_z < (max_z - z_park_delta) %}
    {% set z_safe = z_park_delta %}
  {% else %}
    {% set z_safe = max_z - act_z %}
  {% endif %}
  ##### end of definitions #####
  {% if printer.extruder.can_extrude|lower == 'true' %}
    M83
    G1 E-{extrude} F2100
    {% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
  {% else %}
    {action_respond_info("Extruder not hot enough")}
  {% endif %}
  {% if "xyz" in printer.toolhead.homed_axes %}
    G91
    G1 Z{z_safe} F900
    G90
    G1 X{x_park} Y{y_park} F6000
    {% if printer.gcode_move.absolute_coordinates|lower == 'false' %} G91 {% endif %}
  {% else %}
    {action_respond_info("Printer not homed")}
  {% endif %}


[gcode_macro Encender_Leds]
gcode:
    SET_LED LED=my_neopixel RED=1 GREEN=1 BLUE=1 WHITE=0

[gcode_macro Apagar_Leds]
gcode:
    SET_LED LED=my_neopixel RED=0 GREEN=0 BLUE=0 WHITE=0


[output_pin mainpower]
pin: !rpi:gpio27
value: 1
shutdown_value: 0

[output_pin reset]
pin: rpi:gpio17
value: 0
shutdown_value: 1

[output_pin pson]
pin: PC13
value: 1
shutdown_value: 0

#[gcode_button prueba]
#pin: ^rpi:gpio22
#   The pin on which the button is connected. This parameter must be
#   provided.
#analog_range:
#   Two comma separated resistances (in Ohms) specifying the minimum
#   and maximum resistance range for the button. If analog_range is
#   provided then the pin must be an analog capable pin. The default
#   is to use digital gpio for the button.
#analog_pullup_resistor:
#   The pullup resistance (in Ohms) when analog_range is specified.
#   The default is 4700 ohms.
#press_gcode: G28
#   A list of G-Code commands to execute when the button is pressed.
#   G-Code templates are supported. This parameter must be provided.
#release_gcode:
#   A list of G-Code commands to execute when the button is released.
#   G-Code templates are supported. The default is to not run any
#   commands on a button release.

[gcode_macro POWER_OFF]
gcode:
  SET_PIN PIN=mainpower VALUE=0
  SET_PIN PIN=reset VALUE=1

[display]
lcd_type: emulated_st7920
display_group: _default_16x4
en_pin: EXP1_7
spi_software_sclk_pin: EXP1_6
spi_software_mosi_pin: EXP1_8
spi_software_miso_pin: PA3
encoder_pins: ^EXP1_5, ^EXP1_3
click_pin: ^!EXP1_2

[menu __main __octoprint]
type: disabled

[menu __main __leds]
type: list
name: Leds
index: 1

[menu __main __leds __Encender]
type: command
name: Encender Leds
gcode:
    SET_LED LED=my_neopixel RED=1 GREEN=1 BLUE=1 WHITE=0

[menu __main __leds __Apagar]
type: command
name: Apagar Leds
gcode:
    SET_LED LED=my_neopixel RED=0 GREEN=0 BLUE=0 WHITE=0



[neopixel my_neopixel]
pin: PA8
#   The pin connected to the neopixel. This parameter must be
#   provided.
chain_count: 13
#   The number of Neopixel chips that are "daisy chained" to the
#   provided pin. The default is 1 (which indicates only a single
#   Neopixel is connected to the pin).
color_order: RGB
#   Set the pixel order required by the LED hardware (using a string
#   containing the letters R, G, B, W with W optional). Alternatively,
#   this may be a comma separated list of pixel orders - one for each
#   LED in the chain. The default is GRB.
#initial_RED: 0.0
#initial_GREEN: 0.0
#initial_BLUE: 0.0
#initial_WHITE: 0.0
#   See the "led" section for information on these parameters.

#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bltouch]
#*# z_offset = 3.105
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 30.309
#*# pid_ki = 1.981
#*# pid_kd = 115.933
#*#
#*# [bed_mesh malla]
#*# version = 1
#*# points =
#*# 	-0.007500, 0.126250, 0.082500, 0.101250
#*# 	-0.100000, 0.010000, -0.055000, -0.060000
#*# 	-0.096250, -0.035000, -0.071250, -0.078750
#*# 	-0.028750, 0.038750, 0.016250, 0.008750
#*# tension = 0.2
#*# mesh_x_pps = 2
#*# algo = bicubic
#*# min_x = 10.0
#*# min_y = 10.0
#*# y_count = 4
#*# mesh_y_pps = 2
#*# x_count = 4
#*# max_x = 199.99
#*# max_y = 199.99
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 	  -0.020000, 0.115000, 0.063750, 0.055000
#*# 	  -0.075000, 0.035000, -0.043750, -0.066250
#*# 	  -0.123750, -0.012500, -0.065000, -0.090000
#*# 	  -0.038750, 0.035000, 0.005000, -0.010000
#*# tension = 0.2
#*# min_x = 10.0
#*# algo = bicubic
#*# y_count = 4
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 4
#*# max_y = 199.99
#*# mesh_x_pps = 2
#*# max_x = 199.99
#*#
#*# [bed_mesh ]
#*# version = 1
#*# points =
#*# 	  -0.020000, 0.115000, 0.063750, 0.055000
#*# 	  -0.075000, 0.035000, -0.043750, -0.066250
#*# 	  -0.123750, -0.012500, -0.065000, -0.090000
#*# 	  -0.038750, 0.035000, 0.005000, -0.010000
#*# tension = 0.2
#*# min_x = 10.0
#*# algo = bicubic
#*# y_count = 4
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 4
#*# max_y = 199.99
#*# mesh_x_pps = 2
#*# max_x = 199.99

Hello @Kbles !

So we may have a look on the complete thing.
Could you please add the klippy.log?

Well I think I’ve made some progress.
I have tried putting back an old backup printer.cfg and I have modified it back to how it was just before the failure.
The server has started perfectly with no errors up to the time of saving the mesh after a bed leveling.
The error occurred at the precise moment of saving the mesh in the file.
this is the Printer.cfg that causes the failure after leveling the bed

[stepper_x]
step_pin: PB13
dir_pin: !PB12
enable_pin: !PB14
microsteps: 32
rotation_distance: 39.60
endstop_pin: tmc2209_stepper_x:virtual_endstop
position_endstop: -12
position_min: -12
position_max: 239
homing_speed: 20
homing_retract_dist: 0

[tmc2209 stepper_x]
uart_pin: PC11
tx_pin: PC10
interpolate: True
uart_address: 0
run_current: 0.750
stealthchop_threshold: 999999
diag_pin: ^PC0
driver_SGTHRS: 47 # 255 is most sensitive value, 0 is least sensitive


[stepper_y]
step_pin: PB10
dir_pin: !PB2
enable_pin: !PB11
microsteps: 32
rotation_distance: 39.60
endstop_pin: tmc2209_stepper_y:virtual_endstop
position_endstop: -6
position_min: -6
position_max: 240
homing_speed: 20
homing_retract_dist: 0

[tmc2209 stepper_y]
uart_pin: PC11
tx_pin: PC10
interpolate: True
uart_address: 2
run_current: 0.750
stealthchop_threshold: 999999
diag_pin: ^PC1
driver_SGTHRS: 50


[stepper_z]
step_pin: PB0
dir_pin: PC5
enable_pin: !PB1
microsteps: 16
rotation_distance: 8
endstop_pin: probe:z_virtual_endstop
position_min: -5
position_max: 270

[tmc2209 stepper_z]
uart_pin: PC11
tx_pin: PC10
uart_address: 1
run_current: 1.200
stealthchop_threshold: 999999

[extruder]
step_pin: PB3
dir_pin: !PB4
enable_pin: !PD2
microsteps: 16
rotation_distance: 8.456
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC8
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA0
#control: pid
#pid_Kp: 27.796
#pid_Ki: 1.626
#pid_Kd: 118.928
min_temp: 0
max_temp: 320
pressure_advance = 0.067


[tmc2209 extruder]
uart_pin: PC11
tx_pin: PC10
uart_address: 3
run_current: 0.900
stealthchop_threshold: 999999

[firmware_retraction]
retract_length: 0.50
#   The length of filament (in mm) to retract when G10 is activated,
#   and to unretract when G11 is activated (but see
#   unretract_extra_length below). The default is 0 mm.
retract_speed: 60
#   The speed of retraction, in mm/s. The default is 20 mm/s.
#unretract_extra_length: 0
#   The length (in mm) of *additional* filament to add when
#   unretracting.
#unretract_speed: 10
#   The speed of unretraction, in mm/s. The default is 10 mm/s.


[input_shaper]
shaper_freq_x: 46.15 # frequency for the X mark of the test model
shaper_freq_y: 46.1  # frequency for the Y mark of the test model
shaper_type: ei

[heater_bed]
heater_pin: PC9
sensor_type: ATC Semitec 104GT-2
sensor_pin: PC3
control: pid
pid_Kp: 71.776
pid_Ki: 1.500
pid_Kd: 858.624
min_temp: 0
max_temp: 130

[heater_fan nozzle_cooling_fan]
pin: PC7

[fan]
pin: PC6

[virtual_sdcard]
path: ~/gcode_files

[display_status]

[pause_resume]

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

[mcu rpi]
serial: /tmp/klipper_host_mcu

[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 2500
max_accel_to_decel: 2500
max_z_velocity: 5
max_z_accel: 100
square_corner_velocity: 5


[static_digital_output usb_pullup_enable]
pins: !PA14

[board_pins]
aliases:
    # EXP1 header
    EXP1_1=PB5,  EXP1_3=PA9,   EXP1_5=PA10, EXP1_7=PB8,  EXP1_9=<GND>,
    EXP1_2=PA15, EXP1_4=<RST>, EXP1_6=PB9,  EXP1_8=PB15, EXP1_10=<5V>

# See the sample-lcd.cfg file for definitions of common LCD displays.


#====================================================================
# BLTOUCH
#====================================================================
[bltouch]
sensor_pin: ^PC2
control_pin: PA1
pin_move_time: 0.675
stow_on_each_sample: True
probe_with_touch_mode: False
pin_up_touch_mode_reports_triggered: False
x_offset: -36.50
y_offset: -22.63
#z_offset: 2
speed: 10
lift_speed: 20
samples: 2
sample_retract_dist:5
samples_tolerance_retries: 3

[safe_z_home]
home_xy_position: 117.5, 117.5
speed: 150
z_hop: 5
z_hop_speed: 20

[bed_mesh]
speed: 120
horizontal_move_z: 5
mesh_min: 5,15
mesh_max: 200,200
probe_count: 4,4
algorithm: bicubic

  

[screws_tilt_adjust]
screw1: 69, 60.50        # The (X, Y) coordinate of the first bed leveling screw.
screw1_name: DEL-I
screw2: 238, 60.509
screw2_name: DEL-D
screw3: 69, 230
screw3_name: TRAS-I
screw4: 238, 230
screw4_name: TRAS-D
speed: 80
horizontal_move_z: 5
screw_thread: CW-M4

[filament_switch_sensor FIlamentDetect]
pause_on_runout: False
runout_gcode: PAUSE
#insert_gcode:
#event_delay: 3.0
#pause_delay: 0.5
switch_pin: !PC15


######################################## MACROS ################################################## 

[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
  PAUSE_BASE
  M125 

[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
  ##### read extrude from  _TOOLHEAD_PARK_PAUSE_CANCEL  macro #####
  {% set extrude = printer['gcode_macro M125'].extrude %}
  #### get VELOCITY parameter if specified ####
  {% if 'VELOCITY' in params|upper %}
    {% set get_params = ('VELOCITY=' + params.VELOCITY)  %}
  {%else %}
    {% set get_params = "" %}
  {% endif %}
  ##### end of definitions #####
  {% if printer.extruder.can_extrude|lower == 'true' %}
    M83
    G1 E{extrude} F2100
    {% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
  {% else %}
    {action_respond_info("Extruder not hot enough")}
  {% endif %}  
  RESUME_BASE {get_params}

[gcode_macro START_PRINT]
#default_parameter_BED_TEMP: 65
#default_parameter_EXTRUDER_TEMP: 215
gcode:
  {% set BED_TEMP = params.BED|default(60)|int %}
  {% set EXTRUDER_TEMP = params.EXTRUDER|default(210)|int %}
   CLEAR_PAUSE
   M140 S{BED_TEMP}

   G28 ; home printer

   G1 ; set units to millimeters2
   G90 ; use absolute coordinates
   M82 ; use absolute distances for extrusion

   M190 S{BED_TEMP}
   SCREWS_TILT_CALCULATE
   SET_GCODE_OFFSET Z=-0.10

   BED_MESH_PROFILE LOAD={malla}
   G28 Z ; re-home z after loading mesh profile

   G1 X10 Y30 Z5 F3000 ; move to bottom left corner
   G1 Z1 F300 ; position head above bed
   G92 E0 ; reset extruder

   M109 S{EXTRUDER_TEMP}
   DRAW_LINE SPEED=1800

[gcode_macro DRAW_LINE]
#default_parameter_SPEED: 900
gcode:
  {% set SPEED = params.SPEED|default(900)|int %}  
    G92 E0 ;Reset Extruder
    G1 Z2.0 F3000 ;Move Z Axis up
    G1 X10.1 Y20 Z0.28 F{SPEED} ;Move to start position
    G1 X10.1 Y200.0 Z0.28 F{SPEED} E15 ;Draw the first line
    G1 X10.4 Y200.0 Z0.28 F{SPEED} ;Move to side a little
    G1 X10.4 Y20 Z0.28 F{SPEED}.0 E30 ;Draw the second line
    G92 E0 ;Reset Extruder
    G1 Z2.0 F3000 ;Move Z Axis up

[gcode_macro SCREWS_TILT]
gcode:
    SCREWS_TILT_CALCULATE

[gcode_macro G28_Z]
gcode:
    G28 Z

[gcode_macro DISABLE_EXTRUDER]
gcode:
   SET_STEPPER_ENABLE STEPPER=extruder ENABLE=0

[gcode_macro ADD_BED_MESH]
default_parameter_TARGET_TEMP: 65
gcode:
  {% set TARGET_TEMP = params.TARGET|default(60)|int %}
    M140 S{TARGET_TEMP} # Wait for the bed to hit TARGET_TEMP
    G28 #remove line if you ran G28 before starting this macro
    M190 S{TARGET_TEMP} # Wait for the bed to hit TARGET_TEMP
    BED_MESH_CALIBRATE
    BED_MESH_PROFILE SAVE={malla}
    SAVE_CONFIG   



[gcode_macro Disable_XY_Steppers]
gcode:
   SET_STEPPER_ENABLE STEPPER=stepper_x ENABLE=0
   SET_STEPPER_ENABLE STEPPER=stepper_y ENABLE=0

[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
   M220 S100 ; Reset Speed factor override percentage to default (100%)
   M221 S100 ; Reset Extrude factor override percentage to default (100%)
   G91 ; Set coordinates to relative
   {% if printer.extruder.temperature >= 170 %}
      G1 F1800 E-1 ; Retract filament 3 mm to prevent oozing
   {% endif %}
   ;if all axis are homed, lift the hotend to leave room for hot filament to ooze and to keep it clear of the bed.
   {% if printer.toolhead.homed_axes == "xyz" %}
      G1 F6000 Z10 ; Move Z Axis up 10 mm to allow filament ooze freely
   M125
      # G90 ; Set coordinates to absolute
      #G1 X10 Y221 F1000 ; Move Printer Head Out of Way
      ; M84 ; Disable stepper motors - don't so the gantry stays aligned
   {% endif %}
   ;set part fan speed to zero.
   M106 S0
   ;bed and hotend are left at the print temps in case I want to restart.
   CLEAR_PAUSE
   BASE_CANCEL_PRINT

[gcode_macro SAVE_AT_END]
variable_save: 0
gcode:
    SET_GCODE_VARIABLE MACRO=SAVE_AT_END VARIABLE=save VALUE=1

[gcode_macro SAVE_IF_SET]
gcode:
    {% if printer["gcode_macro SAVE_AT_END"].save == 1 %}
    {action_respond_info("Saving was requested - saving and restarting now")}
    SAVE_CONFIG
    {% endif %}

[gcode_macro CLEAN_NOZZLE]
gcode:
    M104 S245
    {% if printer.toolhead.homed_axes != "xyz" %}
    G28
    {% endif %}
    G1 X150 Y150 Z150

[gcode_macro END_PRINT]
gcode:
    # Set LEDs to Green for completion
    #SET_LED LED=my_neopixel RED=0.0 GREEN=1.0 BLUE=0.0
    # Turn off bed, extruder, and fan
    M140 S0
    M104 S0
    M106 S0
    # Move nozzle away from print while retracting
    G91 ;releative positioning
    G1 X-2 Y-2 E-0.8 F300
    # Raise nozzle by 10mm
    G1 Z10 F3000
    G90 ; Absolute Positioning
    G1 X0 Y295 ;Present print
    # Disable steppers
    # M84 ; don't so the gantry doesn't go out of alignment
    SAVE_IF_SET
    # Set LEDs to white for illumination
    #SET_LED LED=my_neopixel RED=1.0 GREEN=1.0 BLUE=1.0
    SET_SKEW CLEAR=1
    

[gcode_macro ABS60]
gcode:
	M140 S60  ;set bed temperature and do not wait
	M109 S235 ;set print head temperature and wait

[gcode_macro ABS80]
gcode:
	M140 S80  ;set bed temperature and do not wait
	M109 S235 ;set print head temperature and wait

[gcode_macro ABS100]
gcode:
	M140 S100  ;set bed temperature and do not wait
	M109 S235 ;set print head temperature and wait

[gcode_macro PLA60]
gcode:
	M140 S60  ;set bed temperature and do not wait
	M109 S205 ;set print head temperature and wait



[idle_timeout]
gcode:
   TURN_OFF_HEATERS
   M84             ; disable steppers
timeout: 1800      ;30 min

# LOW_TEMP_CHECK checks if there is a setpoint for the  extruder. Untested! 
# - If this setpoint is reached, continue. 
# - If not, heat to setpoint.
# - If no setpoint, heat to parameter T (default@200)    
    


[gcode_macro LOW_TEMP_CHECK_T]
#default_parameter_T: 210
gcode: 
  {% set T = params.T|default(210)|int %} 

    {% if printer.extruder.target != 0 %} # if there is a setpoint for extruder
        {% if printer.extruder.temperature < printer.extruder.target %} # if not reached, heat
            M117 Heating from {printer.extruder.temperature} to {printer.extruder.target}.
            M109 S{printer.extruder.target|float} 
        {% endif %}
    {% else %} # if no setpoint for extruder
        {% if printer.extruder.target < T %}  # heat to T.
            M117 No setpoint, heating to {T}.
            M109 S{T}
        {% endif %}
    {% endif %}


# load filament
[gcode_macro M701]
gcode:
    SAVE_GCODE_STATE NAME=loading_filament
    M117 Loading Filament
    M83
    G92 E0.0
    LOW_TEMP_CHECK
    G1 E150 F100  # length of bowden tube till cold-end (~420mm) 
    G1 E50 F100  # some extra to prime the nozzle --> slower 
    G92 E0.0
    RESTORE_GCODE_STATE NAME=loading_filament

#unload filament
[gcode_macro M702]
gcode:
    SAVE_GCODE_STATE NAME=unloading_filament
    M125 # park
    M117 Unloading Filament 
    LOW_TEMP_CHECK
    G91 # set relative
    G1 E10 F100 
    G92 E0.0
    G1 E-150 F100 # the E is the length of the bowden tube (150) + 50 mm. 
    G92 E0.0
    RESTORE_GCODE_STATE NAME=unloading_filament

#
# Park toolhead
[gcode_macro M125]
variable_extrude: 1.0
gcode:
    SAVE_GCODE_STATE NAME=parking
    M117 Parking toolhead
    G91
    G1 Z20 F600 # move up 5 mm
    G90
    G1 X239 Y240 F6000 # move to park position
    M83
    G1 E-{extrude} F2100
  {% if printer.extruder.can_extrude|lower == 'true' %}
    M83
    G1 E-{extrude} F2100
    {% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
  {% else %}
    {action_respond_info("Extruder not hot enough")}
  {% endif %}
    RESTORE_GCODE_STATE NAME=parking
#

    
    


[pause_resume]
recover_velocity: 50

##[gcode_macro M73]
##rename_existing: M990073
 #variable_R: 0
 #variable_P: 0
 #default_parameter_P: 0
 #default_parameter_R: 0
##gcode:
 #SET_GCODE_VARIABLE MACRO=M73 VARIABLE=R TYPE=int VALUE={params.R}
 #SET_GCODE_VARIABLE MACRO=M73 VARIABLE=P TYPE=int VALUE={params.P}
 ##M990073 P{params.P}
 ##M117 { "%02d:%02d" % (params.R|int // 60, (params.R|int) % 60) } remaining
## end


[gcode_macro M300]
gcode:
    # Use a default 1kHz tone if S is omitted.
   ## {% set S = params.S|default(1000)|int %}
    # Use a 10ms duration is P is omitted.
    ##{% set P = params.P|default(100)|int %}
    ##SET_PIN PIN=BEEPER_pin VALUE={S}
    ##G4 P{P}
    ##SET_PIN PIN=BEEPER_pin VALUE=0

#default_parameter_S=1000
#default_parameter_P=100
  {% set S = params.S|default(1000)|int %}
  {% set P = params.P|default(100)|int %}
gcode:  
    SET_PIN PIN=beeper_pin VALUE={S}
    G4 P{P}
    SET_PIN PIN=beeper_pin VALUE=0
#    

[gcode_macro Encender_Leds]
gcode:
    SET_LED LED=my_neopixel RED=1 GREEN=1 BLUE=1 WHITE=0

[gcode_macro Apagar_Leds]
gcode:
    SET_LED LED=my_neopixel RED=0 GREEN=0 BLUE=0 WHITE=0


[output_pin mainpower]
pin: !rpi:gpio27
value: 1
shutdown_value: 0

[output_pin reset]
pin: rpi:gpio17
value: 0
shutdown_value: 1

[output_pin pson]
pin: PC13
value: 1
shutdown_value: 0

#[gcode_button prueba]
#pin: ^rpi:gpio22
#   The pin on which the button is connected. This parameter must be
#   provided.
#analog_range:
#   Two comma separated resistances (in Ohms) specifying the minimum
#   and maximum resistance range for the button. If analog_range is
#   provided then the pin must be an analog capable pin. The default
#   is to use digital gpio for the button.
#analog_pullup_resistor:
#   The pullup resistance (in Ohms) when analog_range is specified.
#   The default is 4700 ohms.
#press_gcode: G28
#   A list of G-Code commands to execute when the button is pressed.
#   G-Code templates are supported. This parameter must be provided.
#release_gcode:
#   A list of G-Code commands to execute when the button is released.
#   G-Code templates are supported. The default is to not run any
#   commands on a button release.

[gcode_macro POWER_OFF]
gcode:
  SET_PIN PIN=mainpower VALUE=0
  SET_PIN PIN=reset VALUE=1

[display]
lcd_type: emulated_st7920
display_group: _default_16x4
en_pin: EXP1_7
spi_software_sclk_pin: EXP1_6
spi_software_mosi_pin: EXP1_8
spi_software_miso_pin: PA3
encoder_pins: ^EXP1_5, ^EXP1_3
click_pin: ^!EXP1_2

[menu __main __octoprint]
type: disabled

[menu __main __leds]
type: list
name: Leds
index: 1

[menu __main __leds __Encender]
type: command
name: Encender Leds
gcode:
    SET_LED LED=my_neopixel RED=1 GREEN=1 BLUE=1 WHITE=0

[menu __main __leds __Apagar]
type: command
name: Apagar Leds
gcode:
    SET_LED LED=my_neopixel RED=0 GREEN=0 BLUE=0 WHITE=0



[neopixel my_neopixel]
pin: PA8
#   The pin connected to the neopixel. This parameter must be
#   provided.
chain_count: 13
#   The number of Neopixel chips that are "daisy chained" to the
#   provided pin. The default is 1 (which indicates only a single
#   Neopixel is connected to the pin).
color_order: RGB
#   Set the pixel order required by the LED hardware (using a string
#   containing the letters R, G, B, W with W optional). Alternatively,
#   this may be a comma separated list of pixel orders - one for each
#   LED in the chain. The default is GRB.
#initial_RED: 0.0
#initial_GREEN: 0.0
#initial_BLUE: 0.0
#initial_WHITE: 0.0
#   See the "led" section for information on these parameters.

#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bltouch]
#*# z_offset = 3.105
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 30.309
#*# pid_ki = 1.981
#*# pid_kd = 115.933
#*#
#*# [bed_mesh malla]
#*# version = 1
#*# points =
#*# 	-0.007500, 0.126250, 0.082500, 0.101250
#*# 	-0.100000, 0.010000, -0.055000, -0.060000
#*# 	-0.096250, -0.035000, -0.071250, -0.078750
#*# 	-0.028750, 0.038750, 0.016250, 0.008750
#*# tension = 0.2
#*# mesh_x_pps = 2
#*# algo = bicubic
#*# min_x = 10.0
#*# min_y = 10.0
#*# y_count = 4
#*# mesh_y_pps = 2
#*# x_count = 4
#*# max_x = 199.99
#*# max_y = 199.99
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 	  -0.020000, 0.115000, 0.063750, 0.055000
#*# 	  -0.075000, 0.035000, -0.043750, -0.066250
#*# 	  -0.123750, -0.012500, -0.065000, -0.090000
#*# 	  -0.038750, 0.035000, 0.005000, -0.010000
#*# tension = 0.2
#*# min_x = 10.0
#*# algo = bicubic
#*# y_count = 4
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 4
#*# max_y = 199.99
#*# mesh_x_pps = 2
#*# max_x = 199.99
#*#
#*# [bed_mesh ]
#*# version = 1
#*# points =
#*# 	  -0.020000, 0.115000, 0.063750, 0.055000
#*# 	  -0.075000, 0.035000, -0.043750, -0.066250
#*# 	  -0.123750, -0.012500, -0.065000, -0.090000
#*# 	  -0.038750, 0.035000, 0.005000, -0.010000
#*# tension = 0.2
#*# min_x = 10.0
#*# algo = bicubic
#*# y_count = 4
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 4
#*# max_y = 199.99
#*# mesh_x_pps = 2
#*# max_x = 199.99

Thank you for your attention EddyMI3D and for responding so quickly.
:smiling_face: :smiling_face: :smiling_face:

So during running the macro ADD_BED_MESH?

So could you pleas add the klippy.log?

I’m trying to do it, but it’s so big and heavy that it won’t let me lift or stick it… :sweat_smile: :sweat_smile:

Klippy.log:

I’m have the same issue also after preforming a bed Mesh on a new setup

Raspberry Pi Desktop (Raspbian)
Voxel Aquila (Ender 3 V2 Clone) (Stock Main board)
Octiprint with Klipper

As I was configuring the printer I did a Bed Mesh the the error appeared. Even though I have “mesh_min” in the bed_mesh section.

Here is my printer.cfg

# This file contains pin mappings for the stock 2020 Creality Ender 3
# V2. To use this config, during "make menuconfig" select the
# STM32F103 with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# communication.

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

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

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

#############################
#       Stepper Moters      #
#############################

[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: 50

[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: 50

[stepper_z]
step_pin: PB6
dir_pin: !PB5
enable_pin: !PC3
microsteps: 16
rotation_distance: 8
endstop_pin: probe:z_virtual_endstop
#endstop_pin: ^PA7
#position_endstop: 0.0
position_max: 250

[extruder]
max_extrude_only_distance: 100.0
step_pin: PB4
dir_pin: PB3
enable_pin: !PC3
microsteps: 16
rotation_distance: 34.406
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PA1
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC5
# Auto Tuned for Aquila
#control = pid
#pid_kp = 31.562
#pid_ki = 2.505
#pid_kd = 99.419
min_temp: 0
max_temp: 250

#############################
#       Bed Heater          #
#############################


[heater_bed]
heater_pin: PA2
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC4
# Auto Tuned for Aquila 
#control = pid
#pid_kp = 70.156
#pid_ki = 1.212
#pid_kd = 1015.510
min_temp: 0
max_temp: 130

#############################
#       Fan Control         #
#############################


[fan]
pin: PA0

#############################
#    Main Control Unit      #
#############################


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

#############################
#      Printer   Type       #
#############################


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

#############################
#    Probe Config BLTouch   #
#############################

[bltouch]
sensor_pin: ^PB1
control_pin: PB0
x_offset: -50.3
y_offset: -11.6
#z_offset = 2.305
probe_with_touch_mode: True
stow_on_each_sample: False

[safe_z_home]
home_xy_position: 110, 110 # Coordinates to the center of print bed
speed: 50
z_hop: 15                 # Move up 15mm
z_hop_speed: 5

[bed_mesh]
speed: 120
horizontal_move_z: 5
mesh_min: 35, 6
mesh_max: 184.5, 208
probe_count: 5
#mesh_pps: 5, 5
#algorithm: lagrange
#move_check_distance: 5
#split_delta_z: .025

#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 31.562
#*# pid_ki = 2.505
#*# pid_kd = 99.419
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 70.156
#*# pid_ki = 1.212
#*# pid_kd = 1015.510
#*#
#*# [bltouch]
#*# z_offset = 2.250
#*#
#*# [bed_mesh ]
#*# version = 1
#*# points =
#*# 	  0.407500, 0.220000, 0.020000, -0.085000, -0.592500
#*# 	  0.207500, 0.012500, -0.237500, -0.365000, -0.862500
#*# 	  0.085000, -0.127500, -0.390000, -0.527500, -1.067500
#*# 	  -0.025000, -0.255000, -0.550000, -0.735000, -1.260000
#*# 	  -0.192500, -0.432500, -0.727500, -0.915000, -1.467500
#*# tension = 0.2
#*# min_x = 35.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 6.0
#*# x_count = 5
#*# max_y = 208.0
#*# mesh_x_pps = 2
#*# max_x = 184.47


I’ve attached my Klippy log
klippy.log (1.5 MB)

Well, I moved pass this but for completeness sake I’ll post what worked for me.

I noticed in the klippy.log that the error

Config error
Traceback (most recent call last):
  File "/home/pi/klipper/klippy/klippy.py", line 175, in _connect
    self._read_config()

Was in the middle for the generated bed mesh that was using the default profile. So I deleted that from my printer.cfg

#*# [bed_mesh ]
#*# version = 1
#*# points =
#*# 	  0.402500,

Then I saved the file, issued a restart got a ‘Ready’ so O reran the Mesh again and named it Aquila and it saved successfully.

1 Like

@Kbles , @TheGoldenOne :

Due to the offset of the BLTouch, this is outside the printbed when starting the mesh.

You have to take care that BLtouch is always above the bed when doing the mesh.

1 Like

Thank you very much for the help @EddyMI3D I’ll check it out and see how it goes…