[QUESTION] Setting specific procedure for each homing axis

Basic Information:

Printer Model: Custom core XY
MCU / Printerboard: Smoothieboard 120mhz
klippy.log klippy.log - Google Drive

Describe your issue:

I want to specify a procedure for homing each axis. Specially Z because there are obstacles.
I tried various configuration found with google, but i always have the error: "Source contains parsing errors: ‘/home/pi/printer_data/config/printer.cfg’ " even with configuration files that other users say that works.

This is what i must do when homing Z:

[homing_override]
gcode:
G91
G0 Z20 F2000
G90
G28 XY
G0 X20 Y105
G28 Z
G92 Z1.25
G0 Z20
G0 X55 Y100

Photo of the machine for better understanding:

thanks in advance

Hello @JOSEDELLABOSCA !

Please set your code snippet at preformatted text
Format

Without, the parsing issues are formatted away and we can’t tell.

BTW: you can upload your log here:
Upload

1 Like

Ok, already done.

Post your printer.cfg file, please

1 Like

You can try like the following:

[homing_override]
axes: xyz
gcode:
  {% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}

  {% if home_all or 'X' in params %}
    _HOME_X
  {% endif %}
  
  {% if home_all or 'Y' in params %}
    _HOME_Y
  {% endif %}
  
  {% if home_all or 'Z' in params %}
    M117 Homing Z...
    G90
    G0 X121 Y132 F6000 #move print head to safe position in the center of the bed
    G28 Z
    G0 Z5 F600
    M117
  {% endif %}
[include fluidd.cfg]

[mcu]

serial: /dev/serial/by-id/usb-Klipper_lpc1769_0FF0000DC384C8AEA5D8C156C62000F5-if00

[virtual_sdcard]

path: /home/pi/printer_data/gcodes

on_error_gcode: CANCEL_PRINT

[printer]

kinematics: corexy

max_velocity: 1000

max_accel: 1000

max_z_velocity: 200

max_z_accel: 200

[stepper_x]

step_pin: P2.3

dir_pin: !P0.22

enable_pin: !P0.21

microsteps: 16

rotation_distance: 40

endstop_pin: P1.25

position_endstop: 0

position_min: 0

position_max: 295

homing_speed: 50

[stepper_y]

step_pin: P2.2

dir_pin: !P0.20

enable_pin: !P0.19

microsteps: 16

rotation_distance: 40

endstop_pin: P1.29

position_endstop: 0

position_max: 200

homing_speed: 50

[stepper_z]

step_pin: P2.1

dir_pin: !P0.11

enable_pin: !P0.10

microsteps: 16

rotation_distance: 8

endstop_pin: ^!P1.28

position_endstop: 0.5

position_max: 350

[extruder]

step_pin: P2.0

dir_pin: P0.5

enable_pin: !P0.4

microsteps: 16

rotation_distance: 7.200

nozzle_diameter: 0.400

filament_diameter: 1.750

heater_pin: P2.5

sensor_type: EPCOS 100K B57560G104F

sensor_pin: P0.23

control: pid

pid_Kp: 29.7

pid_Ki: 1.783

pid_Kd: 124

min_temp: 0

max_temp: 250

[heater_bed]

heater_pin: P2.7

sensor_type: Honeywell 100K 135-104LAG-J01

sensor_pin: P0.24

control: pid

pid_Kd: 872

pid_Ki: 13.252

pid_Kp: 215

min_temp: 0

max_temp: 110

[fan]

pin: P2.4

[static_digital_output leds]

pins: P1.18, P1.19, P1.20, P1.21, P4.28

[mcp4451 stepper_digipot1]

i2c_address: 44

# Scale the config so that wiper values can be specified in amps.

scale: 2.25

# wiper 0 is X (aka alpha), 1 is Y, 2 is Z, 3 is E0

wiper_0: 0.8

wiper_1: 0.8

wiper_2: 1.8

wiper_3: 1.0

[mcp4451 stepper_digipot2]

i2c_address: 45

scale: 2.25

# wiper 0 is E1

wiper_0: 1.0

[force_move]

enable_force_move: true

# Set to true to enable FORCE_MOVE and SET_KINEMATIC_POSITION

# extended G-Code commands. The default is false.

i ommited the [homing_override] section posted in the first post.

Attach the file, please.

should i replace _HOME_X and _HOME_Y with the specific gcode?

1 Like

printer.cfg (1.8 KB)

Well, the file apparently does not contain the statements that are causing your issue, so I cannot provide further insights.

printer.cfg (1.9 KB)
there you go with the non working section successfully added

You are missing the required indentation. Replace by:

[homing_override]
gcode:
    G91
    G0 Z20 F2000
    G90
    G28 XY
    G0 X20 Y105
    G28 Z
    G92 Z1.25
    G0 Z20
    G0 X55 Y100

We should highlight this more.
Wanted to point towards this as well but thought it was missing only due to copying here as he tested a working config as well…

So never assume anything but verify everything!

Perfect. now i got this error when trying to home any axis are all of them:

14:22:50
$ G28
14:22:50
!! Must home axis first: 0.000 0.000 20.000 [0.000]
14:22:50
!! Must home axis first: 0.000 0.000 20.000 [0.000]

I do not know your printer nor your requirements. Generally:

  • You need to home first before issuing any G0 / G1 commands
  • You can work around this by SET_KINEMATIC_POSITION
  • After using SET_KINEMATIC_POSITION nevertheless a G28 is needed
  • A safer alternative is using set_position_ in homing_override

have you looked at the picture?

as you can see, inductive sensor needs to be positioned where the steel rectangle is, because the base is made of aluminum. And the piece of steel is higher than the print surface, so first i need to move the base down (or increse Z position) regardless of the homing axis

You honestly think that, without any explanation, someone is able to guess your requirements from this picture for a completely foreign printer?

I’m not going to suggest anything here as all these shenanigans might lead to crashing your head in the one or the other way.

  • Seems like safe_z_home could do the job (likely the only safe variant)
  • SET_KINEMATIC_POSITION Z=<value> will allow you to “fake” a homed Z-axis and you can then move it with G0 Z... F.... but be aware that the axis can now be crashed at will
  • homing_override with set_position_z and potentially a limitation on axes: xy should go into the same direction

You will need to figure out what is the best approach for you.

I understand this, obviously, thats why i’ve been testing different settings two days now before asking.
I read the documentation but i couldn’t find something related to coding things like " {% set home_all = ‘X’ not in params and ‘Y’ not in params and ‘Z’ not in params %} " what the reserved words and variables are, etc etc. I even do not know what languaje is used here. Even that the config file is indentation dependient.

i can use [safe_z_home] but i need to set an offset of 1.25mm from Z probe to Noozle position.

Likely, you can use 3 approaches:

  • Determine your “regular” z-offset as described here after homing and on the printer bed → Now your 1.25mm should be already compensated
  • Determine your probe’s z-offset on your special landing place, safe it and later correct it by your 1.25mm
  • Add a SET_GCODE_OFFSET to your slicer’s starting gcode

Just out of curiosity:
Your setup seems not to allow using your probe for building a bed-mesh, correct?
If so, why the hell do you fight around with it? It just

  • makes your printing head more bulky and heavy
  • adds meaningless complexity
  • is less precise than a simple microswitch

If all this is the case, I honestly would recommend exchanging it for a simple z-axis microswitch or any probe that can deal with the material combination.