<p>Given the Marlin Firmware what is the difference between the following lines of code:</p>

<blockquote>
  <p>G4 S20</p>
</blockquote>

<p>and</p>

<blockquote>
  <p>G4 P2000</p>
</blockquote>

[{'answer_id': 7433, 'author': 'Pᴀᴜʟsᴛᴇʀ2', 'author_id': 11242, 'author_profile': 'https://3dprinting.stackexchange.com/users/11242', 'pm_score': 1, 'selected': False, 'text': '<p>The code <code>G4</code> refers to <em>dwell</em>. (From what I\'m seeing, it can be written as either <code>G4</code> or <code>G04</code>). <code>P</code>is the length of dwell time, usually in milliseconds. The parameter <code>S</code> seems to be invalid, because the only inputs are <code>X</code> (seconds), <code>P</code> (milliseconds), or <code>U</code> (undefined). If you have <code>S20</code> in your code, it is invalid, whereas <code>P2000</code> will cause all axes to remain unmoving for 2 seconds before moving on. </p>\n\n<p>(Note: Not all machines will accept <code>X</code> or <code>U</code>.)</p>\n\n<p><strong>EDIT:</strong> This answer is specific to <em>non-specific</em> g-code, taken from this <a href="https://all3dp.com/g-code-tutorial-3d-printer-gcode-commands/" rel="nofollow noreferrer"><em>Source</em></a>, since the OP did not state any specifics about their firmware type or equipment used.</p>\n'}, {'answer_id': 7434, 'author': '0scar', 'author_id': 5740, 'author_profile': 'https://3dprinting.stackexchange.com/users/5740', 'pm_score': 4, 'selected': True, 'text': '<p>The answer is that <strong><em>it depends on the type of firmware</em></strong> you are using.</p>\n\n<p>Let us look at the documentation of <a href="https://reprap.org/wiki/G-code#G4:_Dwell" rel="nofollow noreferrer"><code>G4</code></a> to find that <code>G4</code> is valid for all the listed firmware types:\n<a href="https://i.stack.imgur.com/Tt7wT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Tt7wT.png" alt="enter image description here"></a></p>\n\n<blockquote>\n  <p>Pause the machine for a period of time.</p>\n</blockquote>\n\n<p>Furthermore it states that:</p>\n\n<blockquote>\n  <p><strong>Parameters</strong></p>\n  \n  <ul>\n  <li>Pnnn Time to wait, in milliseconds (In Teacup, P0, wait until all previous moves are finished)</li>\n  <li>Snnn Time to wait, in seconds (Only on Repetier, Marlin, Smoothieware, and RepRapFirmware 1.16 and later)</li>\n  </ul>\n</blockquote>\n\n<p>It clearly shows that the <code>S</code> parameter (which defines the pause in seconds) is only supported by a few firmware types. Do note that this documentation may not be up-to-date, so it is best to look into the source code or the users manual of the particular firmware you are using.</p>\n\n<hr>\n\n<p>E.g. if you are using Marlin Firmware, <code>G4 S20</code> will pause the machine for 20 seconds while <code>G4 P2000</code> will pause the machine for 2000 milliseconds which is 2 seconds. This means that a different time is requested, to have 20 seconds waiting time you could use <code>G4 P20000</code></p>\n\n<p>To answer your question what the <strong><em>actual difference</em></strong> between the 2 commands is:</p>\n\n<ul>\n<li>it is <strong>either</strong> 18 seconds of extra waiting time if your firmware supports the <code>S</code> parameter, <strong>or</strong> </li>\n<li>a firmware that skips or chokes on the command because it is not supported (that also probably depends on your firmware).</li>\n</ul>\n'}]
['https://3dprinting.stackexchange.com/questions/7432', 'https://3dprinting.stackexchange.com', 'https://3dprinting.stackexchange.com/users/12999/']