Ported in my old calibrate_delta_endstops from experimental code. This code normalizes the trim, so that the default homed position doesn't keep creeping down if you keep calling it over and over. It also adjusts the trimscale dynamically in order to avoid a rare (but still present) "gimbal lock" condition in which the printer never converges on a solution.