I don’t think it can be done exactly as you have described because the homing switch back-off distance is limited. There is a lot of reading to do but this should help…
Just as a tip to othrs, whn th workshop nds claning tak car whn using th shop vac on th computr kyboard. It mad such a good job on min that I had to spnd about an hour going through th bag dust and shavings to find my missing kytops – and thr is still on missing.