<p>I believe <code>G30</code> 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.</p>

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

<ol>
<li>Move to the requested position (if selected in command, else N/C)</li>
<li>Deploy probe</li>
<li>Go home</li>
<li>Stowe probe</li>
<li>Report the requested position and probed Z position</li>
<li>Report the current position (home?)</li>
</ol>

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

<p>It looks like <code>G28</code> 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.</p>

<p>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.</p>

<p>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.</p>

CC BY-SA 3.0
2017-06-07T08:10:56.890Z
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.
SusanW
CC BY-SA 4.0
2017-05-11T04:06:54.840Z
2019-07-29T12:10:54.737Z
2019-07-29T12:10:54.737Z
markshancock
<p>I’ve recently had a need to use Z-probe touch 
plate on my MPCNC + Ramps 1.4 + Marlin 1.1.5 setup.</p>

<p>Thought I’d share what ended up working for me.</p>

<p>In Marlin <code>Configuration.h</code>, I made the changes to enable Z-probe:</p>

<pre><code>#define USE_ZMIN_PLUG
#define Z_MIN_ENDSTOP_INVERTING     true
#define Z_MIN_PROBE_ENDSTOP_INVERTING   true
#define FIX_MOUNTED_PROBE
#define PROBE_DOUBLE_TOUCH
#define Z_MIN_POS -100
</code></pre>

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

<pre><code>#define X_PROBE_OFFSET_FROM_EXTRUDER 0
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0
</code></pre>

<p>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. </p>

<pre><code>  #if HAS_BED_PROBE
        MENU_ITEM(gcode, MSG_PROBE_Z, PSTR("G30\nG92 Z19.05"));
  #endif
</code></pre>

<p>Hope this is helpful for you, even after a couple years late.</p>

CC BY-SA 4.0
2019-07-26T06:37:20.153Z
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.
0scar
CC BY-SA 4.0
2019-07-26T02:26:44.190Z
2019-07-26T06:32:53.187Z
2019-07-26T06:32:53.187Z
DangV
<p>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 <em>FIX_MOUNTED_PROBE</em>, which seems closest. </p>

<p>I can make it do a <code>G38.2 Z-50</code>, <code>G92 Z12.6</code> (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 <code>Z_PROBE_OFFSET_FROM_EXTRUDER</code> or <code>M851</code>.</p>

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

<p>... except it doesn't do anything with the height that it measured! Seems odd. The <code>G30</code> 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?</p>

<p>Have I misunderstood what <code>G30</code> is meant to do? I've read <a href="http://marlinfw.org/docs/gcode/G030.html" rel="noreferrer">the docs here</a>, and traced through <code>Marlin_main.cpp</code> and there really is no "outcome". Unless I've missed something?</p>

CC BY-SA 3.0
2017-05-09T07:33:00.773Z
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.
SusanW
<marlin><ramps-1.4><g-code><z-probe>
What does Marlin's G30 code do?
SusanW
# What does Marlin's G30 code do?

(Asked by: username_0 on 2017-05-08)

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](http://marlinfw.org/docs/gcode/G030.html), and traced through `Marlin_main.cpp` and there really is no "outcome". Unless I've missed something?

**Tags:** marlin, ramps-1.4, g-code, z-probe
> **Comments:**
> **username_0**: 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.  

---

## 2 answers

### Answer by username_1 on 2017-05-11. Score: 5

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.

> **Comments:**
> **username_0**: 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.  

---

### Answer by username_2 on 2019-07-26. Score: 0

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 USE_ZMIN_PLUG
#define Z_MIN_ENDSTOP_INVERTING     true
#define Z_MIN_PROBE_ENDSTOP_INVERTING   true
#define FIX_MOUNTED_PROBE
#define PROBE_DOUBLE_TOUCH
#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!
#define X_PROBE_OFFSET_FROM_EXTRUDER 0
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0

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. 
  #if HAS_BED_PROBE
        MENU_ITEM(gcode, MSG_PROBE_Z, PSTR("G30\nG92 Z19.05"));
  #endif

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

> **Comments:**
> **username_3**: 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.  

---

