Anyone care to look this over for glaring errors?
It does spit out a valid grid for me, and expands toward start of x and/or y if you go beyond bed edge max
;--- Start adaptive mesh probing
; this defines a minimum size of 60x60 mm grid for probing if your print is too small, with 20 mm between probes. if you have placed your print items too near the print bed end, we move probe area, so we don't probe outside the print bed.
{if first_layer_print_size[0] > 60 and first_layer_print_size[1] > 60
}M557 X{first_layer_print_min[0]}:{first_layer_print_max[0]} Y{first_layer_print_min[1]}:{first_layer_print_max[1]} S20
{else
}M557 X{
if first_layer_print_min[0]+60 < print_bed_max[0]}{
first_layer_print_min[0]}:{first_layer_print_min[0]+60}{
else}{
first_layer_print_max[0]-60}:{first_layer_print_max[0]}{
endif} Y{
if first_layer_print_min[1]+60 < print_bed_max[1]}{
first_layer_print_min[1]}:{first_layer_print_min[1]+60}{
else}{
first_layer_print_max[1]-60}:{first_layer_print_max[1]}{
endif}{
endif}
G29 S0
;--- Stop adaptive mesh probing