Unsolved Unexpected behaviour in G32 dual Z bed levelling
-
I have set up dual independent Z axis motors and decided to redo my bed.g to use conditional G code.
I had hoped to share the bed.g file as it should work for any Cartesian with dual Z axis.
During the process I notice that when moving from the first probe point to the second, I am seeing movement of the Y axis which equates to the Y offset value set in G31
I tested this by changing the offset to zero and the movement stopped.Board: Duet WiFi 1.02 or later
Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 3.01-RC5 (2020-03-27b3)
Duet WiFi Server Version: 1.23; Configuration file for Duet WiFi (firmware version 3) ; executed by the firmware on start-up ; ; generated by RepRapFirmware Configuration Tool v2.1.4 on Sat Jan 04 2020 09:46:45 GMT+1000 (Australian Eastern Standard Time) ; General preferences G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"Flsun_I3_Duet" ; set printer name ; Network M552 S1 ; enable network M586 P0 S1 ; enable HTTP M586 P1 S1 ; enable FTP M586 P2 S0 ; disable Telnet ; Drives M569 P0 S1 ; physical drive 0 goes forwards M569 P1 S0 ; physical drive 1 goes backwards M569 P2 S1 ; physical drive 2 goes forwards M569 P3 S1 ; physical drive 3 goes forwards ;M584 X0 Y1 Z2 E3 ; set drive mapping M584 X0 Y1 Z2:4 E3 ; two Z motors connected to driver outputs Z and E1 M671 X-65:255 Y90:90 S5.5 ; leadscrews at left (connected to Z) and right (connected to E1) of X axis M350 X16 Y16 Z16 I1 ; Configure microstepping with interpolation for XYZ M350 E16 I1 ; Configure microstepping with interpolation for E0 M92 X100.00 Y100.00 Z400.00 ; set steps per mm XYZ M92 E1866 ; Set steps per mm for E0 zesty M566 X800.00 Y800.00 Z40.00 E40.00 ; set maximum instantaneous speed changes (mm/min) M203 X12000.00 Y12000.00 Z1200.00 E6000.00 ; set maximum speeds (mm/min) M201 X800.00 Y800.00 Z100.00 E120.00 ; set accelerations (mm/s^2) M906 X1275 Y1275 Z1300 E450 I30 ; set motor currents (mA) and motor idle factor in per cent M84 S30 ; Set idle timeout ; Axis Limits ;M208 X0 Y-6 Z0 S1 ; set axis minima M208 X0:200 Y-6:194 ; X carriage moves from -5 to 205, Y bed goes from 0 to 200 ; Endstops M574 X1 S1 P"xstop" ; configure active-high endstop for low end on X via pin xstop M574 Y1 S1 P"ystop" ; configure active-high endstop for low end on Y via pin ystop M574 Z1 S2 ; configure Z-probe endstop for low end on Z ; Z-Probe M950 S0 C"exp.heater3" ; create servo pin 0 for BLTouch M558 P9 C"^zprobe.in" H3 F40 T6000 A8 S0.03 R0.5 B1 ; set Z probe type to bltouch and the dive height + speeds G31 P500 X30 Y-5 Z1.06 ; set Z probe trigger value, offset and trigger height M557 X35:185 Y20:160 S20 ; define mesh grid ; Heaters M308 S0 P"bedtemp" Y"thermistor" B4725 C7.06e-8 ; configure sensor 0 as thermistor on pin bedtemp M950 H0 C"bedheat" T0 ; create bed heater output on bedheat and map it to sensor 0 M143 H0 S130 ; set temperature limit for heater 0 to 120C M307 H0 B0 S0.3 ; disable bang-bang mode for the bed heater and set PWM limit M308 S1 P"e0temp" Y"thermistor" B4725 C7.06e-8 ; configure sensor 1 as thermistor on pin e0temp M950 H1 C"e0heat" T1 ; create nozzle heater output on e0heat and map it to sensor 1 M143 H1 S280 ; set temperature limit for heater 1 to 280C M307 H1 B0 S1.0 ; disable bang-bang mode for the nozzle heater and set PWM limit ; Fans M950 F0 C"fan0" Q500 ; create fan 0 on pin fan0 and set its frequency M106 P0 C"Part_Fan" S0 B2.0 H-1 ; set fan 0 name and value. Thermostatic control is turned off M950 F1 C"fan1" Q500 ; create fan 1 on pin fan1 and set its frequency M106 P1 C"E0_Fan" S1 H1 B2.0 T45:55 ; set fan 1 name and value. Thermostatic control is turned on M950 F2 C"fan2" Q500 ; create fan 2 on pin fan2 and set its frequency M308 S2 P"mcu-temp" Y"mcu-temp" A"Duet Board" ; Configure MCU sensor M106 P2 C"Controller_Fan" H2 L0.2 X0.5 B1.2 T38:46 ; set fan 2 value, turn on at 50% if the CPU temperature reaches 40C, and increase to full speed gradually as the temperature rises to 46C ; Calibrate MCU temp M912 P0 S-4 ; Set PID autotune parameters M307 H0 A94.1 C310.3 D14.7 S0.60 V24.0 B0 ;M307 H1 A294.1 C170.0 D3.7 S0.70 V24.0 B0 M307 H1 A333.6 C134.3 D10 S0.70 V24.0 B0 ; Tools M563 P0 S"Extruder1" D0 H1 F0 ; define tool 0 G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C ; Custom settings ;M592 D0 A0.012 B0 ; Set non linear extrusion M207 S1.8 F1800 T1800 Z0.1 ; Set retraction ;M593 F25 ; cancel ringing at 25Hz M200 D1.75 ; set all extruder filament diameters to 1.75mm G29 S1 ; Load previously set bed map M376 H4 ; set bed compensation taper (H10 means taper over 10mm) ; Miscellaneous ;T0 ; select first tool ;play startup tune G4 S6 M98 P"0:/macros/songs/itchyscratchy.g"
On a side note, I ran into the max G Code line length when calculating the mid point of the mesh. (The S2 did it)
Hence I used the current position for the second probe point. Can't wait for variablesbed.g
; bed.g ; called to perform automatic bed compensation via G32 ; requires two independent Z lead screw motors to be configured ; https://duet3d.dozuki.com/Wiki/Bed_levelling_using_multiple_independent_Z_motors ; uses conditional G Code for portability (requires Reprap Firmware version 3 or higher) ; Z Mesh probe area must be properly defined in M557 https://duet3d.dozuki.com/Wiki/Gcode#Section_M557_Set_Z_probe_point_or_define_probing_grid ; Note: The maximum amount of correction possible is defined in M671 (S parameter) https://duet3d.dozuki.com/Wiki/Gcode#Section_M671_Define_positions_of_Z_leadscrews_or_bed_levelling_screws M561 ; clear any bed transform ; If the printer hasn't been homed, home it if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed G28 ; Probe the bed and do auto leveling while true if iterations = 5 abort "Too many auto calibration attempts" ;probe at XMin mesh probe point and midway of Y mesh area G30 P0 X{move.compensation.probeGrid.xMin} Y{((move.compensation.probeGrid.yMax-move.compensation.probeGrid.yMin)/2)+move.compensation.probeGrid.yMin} Z-99999 if result != 0 continue ;probe at X Max mesh probe point and midway of Y mesh area G30 P1 X{move.compensation.probeGrid.xMax} Y{move.axes[1].machinePosition} Z-99999 S2 if result != 0 continue ;set maximum probe deviation allowed between the two points if (move.calibration.initial.deviation <= 0.02) break ; if deviation between the two points is too high, repeat the test after Z axis has been adjusted. echo "Repeating calibration because deviation is too high " ^ move.calibration.initial.deviation ^ "mm" ; end loop G28 Z; Probe Z again just to be sure G29 S1 ; Reload bed compensation mesh
-
@OwenD I've done a video to demonstrate this behavior.
The black line on the tape was done by holding a pen on the bed and performing moves in the X axis.
My Probe offsets are X30 Y-5
You can see that when the G32 is performed, first it homes all (this is in bed.g
Then when moving to the first probe point the bed actually moves 5mm in the Y direction.
Then when it moves to the second probe point it moves and additional 5mm in the Y direction.It's not like this is giving me grief, I just don't understand why it is doing that.
The maths for both the homeall and bed.g positions are identical (for Y direction); bed.g ; called to perform automatic bed compensation via G32 ; requires two independent Z lead screw motors to be configured ; https://duet3d.dozuki.com/Wiki/Bed_levelling_using_multiple_independent_Z_motors ; uses conditional G Code for portability (requires Reprap Firmware version 3 or higher) ; Z Mesh probe area must be properly defined in M557 https://duet3d.dozuki.com/Wiki/Gcode#Section_M557_Set_Z_probe_point_or_define_probing_grid ; Note: The maximum amount of correction possible is defined in M671 (S parameter) https://duet3d.dozuki.com/Wiki/Gcode#Section_M671_Define_positions_of_Z_leadscrews_or_bed_levelling_screws M561 ; clear any bed transform ; If the printer hasn't been homed, home it if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed G28 ; Probe the bed and do auto leveling while true if iterations = 5 abort "Too many auto calibration attempts" ;probe at XMin mesh probe point and midway of Y mesh area G30 P0 X{move.compensation.probeGrid.xMin} Y{((move.compensation.probeGrid.yMax-move.compensation.probeGrid.yMin)/2)+move.compensation.probeGrid.yMin} Z-99999 if result != 0 continue ;probe at X Max mesh probe point and midway of Y mesh area G30 P1 X{move.compensation.probeGrid.xMax} Y{move.axes[1].machinePosition} Z-99999 S2 if result != 0 continue ;set maximum probe deviation allowed between the two points if (move.calibration.initial.deviation <= 0.02) break ; if deviation between the two points is too high, repeat the test after Z axis has been adjusted. echo "Repeating calibration because deviation is too high " ^ move.calibration.initial.deviation ^ "mm" ; end loop G28; Home all again just to be sure G29 S1 ; Reload bed compensation mesh
; homeall.g ; called to home all axes ; ; generated by RepRapFirmware Configuration Tool v2.1.4 on Sat Jan 04 2020 09:46:45 GMT+1000 (Australian Eastern Standard Time) G91 ; relative positioning G1 H2 Z5 F6000 ; lift Z relative to current position G1 H1 X-205 Y-205 F1800 ; move quickly to X and Y axis endstops and stop there (first pass) G1 H2 X5 Y5 F6000 ; go back a few mm G1 H1 X-205 Y-205 F360 ; move slowly to X and Y axis endstops once more (second pass) G90 ; absolute positioning G1 H2 X{(move.compensation.probeGrid.xMax/2) - sensors.probes[0].offsets[0]} F6000 G1 H2 Y{(move.compensation.probeGrid.yMax - move.compensation.probeGrid.yMin)/2 + move.compensation.probeGrid.yMin} F6000 G30 ; home Z by probing the bed
-
@OwenD I think you need someone with better understanding of the intricacies of the new conditional gcode and object model than me, but it feels like you're using a different Y coordinate with this line compared to the first line:
G30 P1 X{move.compensation.probeGrid.xMax} Y{move.axes[1].machinePosition} Z-99999 S2
And that the Y coordinate system in that line is using the probe offset. But I really don't know!Ian
-
@droftarts I couldn't use the exact same calculation on the second line because it hit the limit for max length of a gcode in a single line, however "current position" is the position of the first probe, so returns the same value.
For the same reason I had to move to X and Y independently in homeall.g
Not ideal, but necessary for now.
Aside from that the first probe point moves to a different Y position to the homeall.g yet they use the same code.
There is quite likely something I'm not understanding in the way the two processes are calculated, but it's odd.