Problems with G32 and G31 - problem and solution

The problem:
After playing with this for a while I found a problem and I think it’s fair to say it’s a bug. When you specify the coordinates for G32 (e.g. X an Y number in the command G32 X0 Y0 A280 B180 I9 J7), the machine uses the coordinates from the first homing after startup, not the current coordinates. So if you have the endstops set up like I did:

[[code]]
## Endstops
endstops_enable true # the endstop module is enabled by default and can be disabled here
#corexy_homing false # set to true if homing on a hbot or corexy
alpha_min_endstop 1.24^ # add a ! to invert if endstop is NO connected to ground
alpha_max_endstop 1.25^ # NOTE set to nc if this is not installed
alpha_homing_direction home_to_min # or set to home_to_max and set alpha_max
alpha_min 0 # this gets loaded after homing when home_to_min is set
alpha_max 340 # this gets loaded after homing when home_to_max is set
beta_min_endstop 1.26^ #
beta_max_endstop 1.27^ #
beta_homing_direction home_to_min #
beta_min 0 #
beta_max 270 #
gamma_min_endstop 1.28^ #
gamma_max_endstop 1.29^ #
gamma_homing_direction home_to_min #
gamma_min 0 #
gamma_max 160 #
[[/code]]

and send the command “G32 X0 Y0 A280 B180 I9 J7”, the head will go to the point where the endstops switch instead of the point where you set the origin using G92 X0Y0. This would a) cause a halt, b) break stuff like probes and holders.
The workaround consists of two parts:
First you have to set the alpha, beta and gamma_min to a negative value, enough to prevent switching the endstops when the machine moves to 0,0,0. -10 works for me. My new setup:

[[code]]
## Endstops
endstops_enable true # the endstop module is enabled by default and can be disabled here
#corexy_homing false # set to true if homing on a hbot or corexy
alpha_min_endstop 1.24^ # add a ! to invert if endstop is NO connected to ground
alpha_max_endstop 1.25^ # NOTE set to nc if this is not installed
alpha_homing_direction home_to_min # or set to home_to_max and set alpha_max
alpha_min -10 # this gets loaded after homing when home_to_min is set
alpha_max 340 # this gets loaded after homing when home_to_max is set
beta_min_endstop 1.26^ #
beta_max_endstop 1.27^ #
beta_homing_direction home_to_min #
beta_min -10 #
beta_max 270 #
gamma_min_endstop 1.28^ #
gamma_max_endstop 1.29^ #
gamma_homing_direction home_to_min #
gamma_min -10 #
gamma_max 160 #
[[/code]]

The second part is you have to keep the original coordinates before issuing the G32 command. So if you wanted to probe from the corner of your PCB, instead of moving the head above the corner and sending the G92 X0 Y0 command to move the WCS and then probing from 0,0, you have to move the head above the corner and then check the current coordinates using M114. Write down the x and y coordinates (eg. 33 and 25) and then use them in the G32 command like this “G32 X33 Y25 A280 B180 I9 J7”. Voila, it should work as intended.

My probe and levelling setup:

[[code]]
zprobe.enable true # set to true to enable a zprobe
zprobe.probe_pin 1.30!^ # pin probe is attached to if NC remove the !, Azteeg X5 this is 1.2
zprobe.slow_feedrate 5 # mm/sec probe feed rate
#zprobe.debounce_ms 1 # set if noisy
zprobe.fast_feedrate 3000 # move feedrate
zprobe.probe_height 5 # how much above bed to start probe NB only needed for G32 on delta
zprobe.return_feedrate 0 # feedrate after a probe, default 0 is double of slow_feedrate (mm/s

leveling-strategy.rectangular-grid.enable true # The strategy must be enabled in the config, as well as the zprob
leveling-strategy.rectangular-grid.x_size 340 # size of bed in the X axis
leveling-strategy.rectangular-grid.y_size 270 # size of bed in the X axis
leveling-strategy.rectangular-grid.grid_x_size 9 # The size of the grid, for example, 7 causes a 7x7 grid with 49 p
leveling-strategy.rectangular-grid.grid_y_size 7 #
leveling-strategy.rectangular-grid.probe_offsets 0,0,0 # Optional probe offsets from the nozzle or tool head
leveling-strategy.rectangular-grid.save false # If the saved grid is to be loaded on boot then this must be set
leveling-strategy.rectangular-grid.initial_height 10 # Optionally an initial_height can be set that tell the intial pro
leveling-strategy.rectangular-grid.do_home false #
leveling-strategy.rectangular-grid.only_by_two_corners true #
[[/code]]

EDIT: (thank you, arthurwolf)

It’s not a bug, the G31 and G32 are supposed to work this way, using MCS, not WCS.

The negative values in the endstop setup should still be used as a part of a proper setup.

Only use A and B parameters with G31, they work currently with G32 as well, but are not supposed to. The two commands work the same, but you have to specify x, y, a, b (and optionally i, j) with G31, whereas G32 uses values from config instead.

Imported from wikidot

Hey.

I don’t think G32 is supposed to have AB parameters, where did you find that ? ( edit : it’s not supposed to have them but apparently it does. That will be fixed soon )

Also, using « uses the coordinates from the first homing after startup » ( properly named the MCS ) is the right thing for G32 to do as far as I know. What you did with setting alpha_min etc, is the correct way of setting up your coordinate system and probing.

Cheers.

In that case it would be good to add this info to the “zprobe” wiki.
G31 and G32 work the same for me, if I use A and B, but you are right, the wiki only mentions using A and B for G31.
Have added an edit to clarify for people too lazy to scroll down.
Edit:
I added an edit to the endstops wiki about the proper setup, I see the PCB milling wiki is already updated.