<h1>This function is called by the g-codes M125 and M600</h1>

<p>I could find <code>ADVANCED_PAUSE_FEATURE</code> defined in <code>configuration_adv.h</code> and called in <code>Conditionals_post.h</code>, trice in <code>Marlin.h</code>, referenced as needed for M600 in <code>Marlin_Main.ccp</code> and mentioned 2 times.</p>

<p>In <code>Marlin_Main.ccp</code> it also declares the function <code>pause_print</code> in line 6482 to 6571. Its start and end are these:</p>

<pre><code>static bool pause_print(const float &amp;retract, const point_t &amp;park_point, const float &amp;unload_length = 0,
                          const int8_t max_beep_count = 0, const bool show_lcd = false
  ) {
    if (move_away_flag) return false; // already paused

    #ifdef ACTION_ON_PAUSE
      SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE);
    #endif

[...]

    HOTEND_LOOP()
    thermalManager.start_heater_idle_timer(e, nozzle_timeout);

    return true;
  }
</code></pre>

<p>This function does define the pause state, and relies on the <code>ADVANCED_PAUSE_FEATURE</code> in some cases. But what calls it? Simple enough, both calls are in the same <code>Marlin_Main.ccp</code> that defines it. The calls are in the functions that are used for filament change:</p>

<ul>
<li><code>gcode_M125</code><sup><a href="https://github.com/MarlinFirmware/Marlin/blob/86b65e52c4dd72cf55a3f943fd861602d8421772/Marlin/Marlin_main.cpp#L8534" rel="nofollow noreferrer">line 8534</a></sup> (Save current position and move to filament change position)</li>
<li><code>gcode_M600</code><sup><a href="https://github.com/MarlinFirmware/Marlin/blob/86b65e52c4dd72cf55a3f943fd861602d8421772/Marlin/Marlin_main.cpp#L9939" rel="nofollow noreferrer">line 9939</a></sup> (Pause for filament change: "M600 X Y Z E L")</li>
</ul>

CC BY-SA 4.0
2018-12-17T10:53:57.090Z
Thank you! The reason I ask is that my Ender 3 used to park the nozzle assembly when I pause, which allowed me to inspect my print. Now after I flash with generic marlin it does not, it just stops printing but the nozzle doesn't move ......................................................................................................................................................... I figured I would just edit one of the parameters passed from the function call but if I cant find where it is called when accessed from the menu then I cannot do that. So how would I fix that? Thanks
cds333
CC BY-SA 4.0
2018-12-17T11:46:58.610Z
@cds333 tha is a different question. Open a new question for that.
Trish
CC BY-SA 4.0
2018-12-15T20:49:45.970Z
2018-12-16T12:08:00.900Z
2018-12-16T12:08:00.900Z
Trish
<p>I found the pause_print() function in Marlin_main.cpp but when I search the rest of the files I cannot find the file that calls this function. I expected to find it somewhere in the file that controls the LCD menu but it only exists in main.</p>

<p>What file has the function calls that happen when I select a menu option from the LCD?</p>

<p>And why isn't pause_print() showing up elsewhere as a function call?</p>

CC BY-SA 4.0
2018-12-15T23:26:21.383Z
That is because this function has nothing to do with pausing the printer from the display menu. This function is used by the functionality that pauses the printer as part of filament changing or parking head on pause. Used by M125 and M600.
0scar
CC BY-SA 4.0
2018-12-17T11:01:23.213Z
Ahhh. Thank you; my mistake. I foolishly thought that the function that pauses the printer would be called "pause". Would you happen to know where that function call is located? thanks
cds333
CC BY-SA 4.0
2018-12-17T11:06:35.537Z
Why did you delete your other question (adding menu items)? It was a valid one, I already started an answer for that one!
0scar
<marlin><firmware>
Marlin firmware function call location for menu commands?
cds333
# Marlin firmware function call location for menu commands?

(Asked by: username_0 on 2018-12-15)

I found the pause\_print() function in Marlin\_main.cpp but when I search the rest of the files I cannot find the file that calls this function. I expected to find it somewhere in the file that controls the LCD menu but it only exists in main.

What file has the function calls that happen when I select a menu option from the LCD?

And why isn't pause\_print() showing up elsewhere as a function call?

**Tags:** marlin, firmware

> **Comments:**
> **username_1**: That is because this function has nothing to do with pausing the printer from the display menu. This function is used by the functionality that pauses the printer as part of filament changing or parking head on pause. Used by M125 and M600.  
> **username_0**: Ahhh. Thank you; my mistake. I foolishly thought that the function that pauses the printer would be called "pause". Would you happen to know where that function call is located? thanks  
> **username_1**: Why did you delete your other question (adding menu items)? It was a valid one, I already started an answer for that one!  

---

## 1 answers

### Answer by username_2 on 2018-12-15. Score: 2

# This function is called by the g-codes M125 and M600

I could find `ADVANCED_PAUSE_FEATURE` defined in `configuration_adv.h` and called in `Conditionals_post.h`, trice in `Marlin.h`, referenced as needed for M600 in `Marlin_Main.ccp` and mentioned 2 times.

In `Marlin_Main.ccp` it also declares the function `pause_print` in line 6482 to 6571. Its start and end are these:

```
static bool pause_print(const float &retract, const point_t &park_point, const float &unload_length = 0,
                          const int8_t max_beep_count = 0, const bool show_lcd = false
  ) {
    if (move_away_flag) return false; // already paused

    #ifdef ACTION_ON_PAUSE
      SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE);
    #endif

[...]

    HOTEND_LOOP()
    thermalManager.start_heater_idle_timer(e, nozzle_timeout);

    return true;
  }

```

This function does define the pause state, and relies on the `ADVANCED_PAUSE_FEATURE` in some cases. But what calls it? Simple enough, both calls are in the same `Marlin_Main.ccp` that defines it. The calls are in the functions that are used for filament change:

* `gcode_M125`[line 8534](https://github.com/MarlinFirmware/Marlin/blob/86b65e52c4dd72cf55a3f943fd861602d8421772/Marlin/Marlin_main.cpp#L8534) (Save current position and move to filament change position)
* `gcode_M600`[line 9939](https://github.com/MarlinFirmware/Marlin/blob/86b65e52c4dd72cf55a3f943fd861602d8421772/Marlin/Marlin_main.cpp#L9939) (Pause for filament change: "M600 X Y Z E L")

> **Comments:**
> **username_0**: Thank you! The reason I ask is that my Ender 3 used to park the nozzle assembly when I pause, which allowed me to inspect my print. Now after I flash with generic marlin it does not, it just stops printing but the nozzle doesn't move ......................................................................................................................................................... I figured I would just edit one of the parameters passed from the function call but if I cant find where it is called when accessed from the menu then I cannot do that. So how would I fix that? Thanks  
> **username_2**: @username_0 tha is a different question. Open a new question for that.  

---

