Squaring the gantry in software?

I also got the skew correction to work now in Marlin. I suspect it wasn’t doing anything before because I home to (0, Y-max) instead of (0,0). After skew correction (0, Y-max) is (-something, Y-max) which is outside of the defined bed size so the skew correction was effectively disabled at that point.

I home at (0, Y-max) because I mounted the router facing the lower right corner, ie. towards (X-max, Y-min). That way, I can just push the gantry towards Y-max and let the carriages bump into the corners. When I push the gantry towards X-min, it comes to a stop on two very small stop blocks I printed (one is 10mm, the other is 15mm, matching the skew I have in the gantry).

My procedure is now:

  1. Push the gantry to Y-max (forward) so it rests against both corners. Enable the Y steppers with M17 Y.
  2. Push the gantry to X-min (left) so it rests on the stop blocks. Enable the X steppers with M17 X.
  3. G92 X0 Y480 Z0 (set current position, my Y-max is 480)
  4. G1 X0 Y0 (go to zero position)
  5. G92 X0 Y0 Z0 (make sure Marlin agrees it's at the zero position)
If I omit the last two steps, then the skew correction does not seem to have any effect. I always move the router to where I want my origin to be (like step 4) and I always include G92 X0 Y0 Z0 as the first line in the gcode (step 5), so it would have worked already. However, when I was plotting things manually to measure the skew I did not do that and skew correction did not kick in.

I’m going to print two (equal) stop blocks to mount on the tubes at Y=0 so I can home to (0,0) directly. That would streamline the setup a little.