Script for Reporting Y-Axis Deviation in Dual Motor Homing
-
Hello everyone,
I need some advice and help regarding the homing process of the Y-axis for my 3D printer. My setup involves two independent Y-motors, each with its own end stop for homing. Here’s a brief overview of the current homing process:
- The crossbar moves all the way to the front and touches either the left or right endstop.
- It then backs up a few millimeters.
- One motor touches the first endstop again, and the other motor moves to reach the second endstop.
This setup works well for me, but I would like to enhance it by adding a feature that reports if the adjustment made by the second motor is larger than 0.5 mm. This would help in identifying when the motion system may require adjustment.
Here is the script I have so far. The commented-out portion is my attempt to calculate the deviation (
dd
), but it isn’t working correctly.if state.status == "off" M80 ; Turn on power G4 S3 M98 P"0:/sys/led/homeall.g" M98 P"tfree3.g" T0 P0 M280 P0 S0 ; Take probe holder out of the way M204 T2000 ;=== Move X & U === G91 G1 H2 Z20 F18000 G1 H2 X10 U-10 F18000 ;=== Home with Y End Stops === G90 G1 H1 Y-500 F3000 G91 G1 Y5 F1200 G1 H1 Y-10 F240 G92 Y0 G4 P260 var ll = move.axes[1].machinePosition ;=== Home with Right end stop === M584 Y0.1 M574 Y1 S1 P"io1.in" G1 H4 Y-5 F240 ;=== Home with Left end stop === M584 Y0.4 M574 Y1 S1 P"io2.in" G1 H4 Y-5 F240 G4 P260 var rr = move.axes[1].machinePosition var dd = var.rr - var.ll ;if abs(var.dd) > 0.5 ;echo "RR is "^{var.rr}^" mm" ;echo "LL is "^{var.ll}^" mm" ;echo "DD is "^{var.dd}^" mm" G92 Y-999 M584 Y0.1:0.4 M574 Y1 S1 P"io1.in+io2.in" ; configure endstop G90 G1 Y150 F18000 ; Lower Z if !exists(param.L) G91 G1 H2 Z-20 F18000 G90 ; Reset parameters M400 ; make sure everything has stopped before we make changes G90 ; absolute positioning M913 Y100 ; return current to 100% M204 T5000 ; return the accelerations
Thank you,
Nazar
-
Hello everyone,
Just bumping this up—can anyone help with my Y-axis homing process issue? Any guidance would be greatly appreciated!
Thank you!
-
@Nazar you should map both drivers to Y in M584 and then have 2 pins listed in M574
E.g.M574 Y1 S1 P"io1.in+io2.in"
It will then home both together and stop them independently when the endstops are hit.
Make sure the order in M574 matches the order in M584