Bed_mesh_calibrate

Hi again, my mind is melting. I try to figure out how to set up the correct values for BED_MESH_CALIBRATE but I’m lost. I have an Ender 5 so 0,0 is in the upper right corner. My BlTouch has an offset of -37,-12 to the nozzle. Im doing a 3,3 grid.
So I tried

mesh_min: -37,-12

The first point is measured at 0,0 (which seems plausible), the next one is done at 110.5, 0 (Why? I have an 220 bed), the last one can’t be done because the probe is off the bed. It seems that he’s taking the position of the nozzle as reference, which doesn’t make any sense to me). What values do I have to take to get a valid grid?

BR
Vince

You should always set 0,0 to the front left corner, and home to max if your endstops are located in the back right corner. Everything in Klipper is defined with standard cartesian coordinates, and nothing will be correct if you define 0,0 anywhere other than the front left corner of the bed.

Ok, seems logical. How do I do this??

The stock Ender 5 config is configured this way. Make sure your bltouch offsets are correct as well. -37,-12 would mean the bltouch is 37mm to the left of the nozzle, and 12mm in front of the nozzle.

https://github.com/KevinOConnor/klipper/blob/master/config/printer-creality-ender5-2019.cfg

yepp, my offset is correct - It worked flawlessly in Marlin. Im Using a creality 427 board so I did choose this config. Which settings are the ones that define the start point and the homing at max?

Edit: I just run a quick winmerge. Is it?

position_endstop

If I set this to 235 for x and y I can’t home anymore. X axis goes all the way left instead of right. And this is only major difference (except pins) to my config file. So it seems for me that 0,0 is on the back right side

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

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

[stepper_z]
step_pin: PB5
dir_pin: PB6
enable_pin: !PC3
microsteps: 16
rotation_distance: 8
endstop_pin: probe:z_virtual_endstop
position_max: 300
position_min: -3

[extruder]
max_extrude_only_distance: 100.0
step_pin: PB3
dir_pin: PB4
enable_pin: !PC3
microsteps: 16
rotation_distance: 33.500
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: 54.027
#pid_Ki: 0.770
#pid_Kd: 948.182
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: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100

[display]
lcd_type: st7920
cs_pin: PB12
sclk_pin: PB13
sid_pin: PB15
encoder_pins: ^PB14, ^PB10
click_pin: ^!PB2

[virtual_sdcard]
path: ~/gcode_files

[display_status]

[pause_resume]

[bltouch]
sensor_pin: PA7
control_pin: PB0
x_offset: -37
y_offset: -12
#z_offset: 0
samples: 1

[safe_z_home]
home_xy_position: 110,110 # Change coordinates to the center of your print bed
speed: 50
z_hop: 10                 # Move up 10mm
z_hop_speed: 5

[bed_mesh]
speed: 30
horizontal_move_z: 10
mesh_min: 0,0
mesh_max: 184,200
probe_count: 3,3

[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
  #TURN_OFF_HEATERS
  CANCEL_PRINT_BASE

#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 24.973
#*# pid_ki = 1.321
#*# pid_kd = 117.998
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 75.272
#*# pid_ki = 1.667
#*# pid_kd = 849.630
#*#
#*# [bltouch]
#*# z_offset = 2.250

This means your motors are running backward. Simply invert your X and Y direction pins. Do this by removing the ! as I’ve shown below.

[stepper_x]
step_pin: PB9
dir_pin: PC2
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA5
position_endstop: 235
position_max: 235
homing_speed: 50
[stepper_y]
step_pin: PB7
dir_pin: PB8
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA6
position_endstop: 235
position_max: 235
homing_speed: 50