Z-max Endstop mount for Primo Core

For those who are interested, I wanted to share my solution for implementing a Zmax limit switch. It uses a small switch affixed to a mount that sandwiches the leadscrew nut.

My main motivation to have a Zmax was to prevent the rail from coming out of the core. I had to enable fulltime limit switches in the firmware. I learned the hard way, however, that the z-max endstop does not record the position of the stop.

Because the available z travel is dependent on the workpiece thickness, I discovered on a recent thick project that the z-max switch triggered on a Z move but Marlin does not acknowledge its stopped position. This caused it to think that the cutter was much higher than the actual position. When the gcode continued to run, it plunged way deep into the work. No problems since its all just test cuts I’m making now to break in the machine.

My wishlist item is for the machine coordinates to home to Zmax and in workspace coordinates to home to Zmin. (touch plate). This would be the perfect solution since I can then home to machine coordinates for tool changes and then back to workspace origin.

Somehow G38.2 doesnt work for me and I think I read somewhere that you cant have both G38.2 and G28 working at the same time.