I'm using Marlin 1.1.0RC8 to control an MPCNC, using a RAMPS1.4. We've just added a touch-plate to do Z-probing, which works nicely for a single probe (I just want calibrated height for variant bit-lengths, not bed-leveling, but I think it amounts to the same thing). I've set it up in Marlin as FIX_MOUNTED_PROBE, which seems closest.

I can make it do a G38.2 Z-50, G92 Z12.6 (which sets Z to the height of the touch-plate, 12.6mm), which is ok to be going on with, but it seems I'm having to hard-code the Z offset, which I'm sure should really be set by eg Z_PROBE_OFFSET_FROM_EXTRUDER or M851.

My feeling was that I should be able to invoke a G-code G30, and it would do a nice fast-slow double tap, do the equivalent of a G92 Z+zzz to set that height and then withdraw to a safe height. And after a bit of config, it does exactly that...

... except it doesn't do anything with the height that it measured! Seems odd. The G30 code seems to be an elaborate way to move the head up by the clearance amount, via a touch-plate (with the added excitement of being able to crash the bed if anything goes wrong)! What's the point?

Have I misunderstood what G30 is meant to do? I've read the docs here, and traced through Marlin_main.cpp and there really is no "outcome". Unless I've missed something?

  • $\begingroup$ I note that I don't have end-stops on Z, so I can't home/G28 that axis. I can't see that it makes any difference, but I'll go through the code later and see if that's what's wrong. $\endgroup$ – SusanW May 9 '17 at 7:33

I believe G30 is a carry-over from CNC (G-code originated for CNC not printers) I believe it is for going to a secondary reference (home) position and includes an optional by-way-of address that can be included in the command.

Looking at Marlin 1.1.0-1 (latest release), it seems to do what you said:

  1. Move to the requested position (if selected in command, else N/C)
  2. Deploy probe
  3. Go home
  4. Stowe probe
  5. Report the requested position and probed Z position
  6. Report the current position (home?)

It appears that for Marlin, there is only one reference address (home); so, it would seem a G30 would be the same as a G28 (go to primary reference); but, not so.

It looks like G28 is a home of a different color. It looks like it homes the axis one-at-a-time and does not support a by-way-of location. Note that you can select which axis to home by adding the letters 'X' 'Y' and/or 'Z' to the command.

I am not sure what benefit this command has for a 3D Printer other than allowing you to alter the printer's path to home.

Note: Unfortunately I do not have Marlin code up and running on my printer now so I cannot confirm what I am seeing in the code.

  • 1
    $\begingroup$ Mark, I haven't forgotten you've written this! Your contrasting of G30 with G28 surprised me so much - I hadn't thought of G30 as a HOME variant - that it made me re-evaluate all my assumptions, and I'm waiting for a rainy weekend to sit down and properly update all my preconceptions! In particular, G30 does "report" the probe position (back to the monitoring app); I was expecting it to store it internally as a reference... will investigate further. $\endgroup$ – SusanW Jun 7 '17 at 8:10

I’ve recently had a need to use Z-probe touch plate on my MPCNC + Ramps 1.4 + Marlin 1.1.5 setup.

Thought I’d share what ended up working for me.

In Marlin Configuration.h, I made the changes to enable Z-probe:

#define Z_MIN_ENDSTOP_INVERTING     true
#define Z_MIN_POS -100

However, the following might be the key to your issue.
G30 did not do anything for me as well, until I changed these values to 0. The G30 now lowers Z until the Z probe is triggered. I needed to send a G92 to set the new Z value.
Works like a champ!


In case you’re interested, in ultralcd.cpp under lcd_prepare_menu(), I added the a menu item to perform the probe. This way I don’t need a computer to setup the machine and launch a gcode file from the sd card.

        MENU_ITEM(gcode, MSG_PROBE_Z, PSTR("G30\nG92 Z19.05"));

Hope this is helpful for you, even after a couple years late.

  • 1
    $\begingroup$ It is unclear which parameters are set to zero. If you mean the probe offset values, that is not a good idea. Note that this question deals with Marlin 1.1.0, in between 1.1.3 and 1.1.4, the G30 command has undergone a change. $\endgroup$ – 0scar Jul 26 '19 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.