How to set Z-offset by gcode

  • Hi @admin and everyone else.

    My printer has the glitch that is does not remember the Z-offset (in the ABL menu) after I turn off and on the machine and always defaults to 0.2mm. Until this is fixed in a new firmware update, does anyone know how to adjust it by gcode? Currently 0.45mm works well for me, even after an ABL procedure. But I am using the printer remotely with a networked power switch and OctoPrint. So it means that I have to go to the printer just to set this before I can print. If I can set it in my 'start gcode' printer settings then it will be automated.

    I think G92 is the right code but G92 reports something different than the default 0.2mm. This is what I get after a reboot and and ABL:
    X:117.00 Y:117.00 Z:2.58 E:0.00 Count X:9360 Y:9360 Z:1046
    and the touch screen still reads 0.2mm z-offset.

    @admin, is it possible that my main board is defective? I have flashed the firmware and I have bypassed the power switch (which was burnt). Neither has salved my ABL and z-offset issues.

    Thank you and I do love the printer. I will love it more when all the kinks are worked out as well 😉

  • G29 P6 does not work seem to work. I am going to try teeking the probe z-offset before the ABL. My goal in the end is that I want my mesh to be higher, so that all I need to do is issue a M420 S1 to instate the mesh after a home command and walk away.

  • Oops... should be G29 P6 C0.3 and not P3. I corrected it in the code below

  • Ok, here is the latest.

    @S7EN , it actually does change the z-offset but the LCD does not update until you press z-offset up or down. I was wrong.

    But the next issue is that once Z-offset is changed, it seems to screw up subsequent ABL's. I think it is better to leave this alone except when tuning the z offset during a 'first layer test print'.

    So the gcode script I have so far is:

    M851 Z0.2		; set z-offset of probe to the default in case it was changed
    M109 S120 T0		; set tool temperature that CR6 uses for ABL, then WAIT
    G28			; home the printer
    G29			; run autoleveling, CR-6 will use its default parameters so none are needed
    G29 P6 C0.3		; move the whole mesh up by 0.3mm (correction: not P3 but should be P6)
    M500			; save settings
    M106 S0 		; Turn-off fan
    M104 S0			; Turn-off hotend

    So my current tweaking of the z-offset (on the LCD) while the printer is making it's first layer is 0.5mm. That means the nozzle is too close to the glass (and I have the scratches to prove it) and it needs to go up by 0.3mm. So making the printer 'believe' that the mash is 0.3mm higher than it really is will also make the nozzle rise an additional 0.3mm during normal operation.

    I will go through testing and report back soon. Cheers!

  • @S7EN , it doesn't work. I enter "M851 Z0.45" in the terminal but my LCD still registers Z-offset of 0.2mm.

  • Awesome @S7EN! Good call it works.

Log in to reply