Z Axis limit switch to offset spindle

Is there a way to use the z axis limit switch to control a .25 pull back or offset on the spindle?

Meaning: When the z axis limit switch is triggered, the motor controller would lift or drop the spindle a certain distance… I suppose this would be like an automatic tool set. Manually moving the +z axis say 10 inches…So I would push the up button and this would raise my z axis all the way to the end of travel, limit switch would trigger then stop the spindle from raising and then lower the spindle say .25 inch and stop the z axis… Make sense?

Currently the homing cycle has a built in offset in grbl. The offset is customer selectable, but it applies to all axes.

The homing cycle moves each axis toward the corresponding homing switch at a user defined rate. Once the homing switch is tripped, the homing cycle moves off the switch and approaches again at a (usually) slower rate also set by the user. When the switch trips again the homing cycle moves each axis off the switch by a user defined distance.

The default homing pull-off is 1 mm.

Depending on your setup you might be able to set up a G-code macro to do something similar to what you want, but not using the actual switch.

Thanks… Got it to work… Appreciate the quick response