Skip to content

Commit b92fe8f

Browse files
committed
Document pause methods
1 parent 0aaa3ab commit b92fe8f

File tree

4 files changed

+48
-14
lines changed

4 files changed

+48
-14
lines changed

Marlin/src/feature/pause.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ bool unload_filament(const_float_t unload_length, const bool show_lcd/*=false*/,
316316
);
317317

318318
#if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
319-
constexpr float mix_multiplier = 1.0;
319+
constexpr float mix_multiplier = 1.0f;
320320
#endif
321321

322322
if (!ensure_safe_temperature(false, mode)) {
@@ -371,7 +371,7 @@ bool unload_filament(const_float_t unload_length, const bool show_lcd/*=false*/,
371371
*/
372372
uint8_t did_pause_print = 0;
373373

374-
bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const_float_t unload_length/*=0*/, const bool show_lcd/*=false*/ DXC_ARGS) {
374+
bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool show_lcd/*=false*/, const_float_t unload_length/*=0*/ DXC_ARGS) {
375375
DEBUG_SECTION(pp, "pause_print", true);
376376
DEBUG_ECHOLNPAIR("... park.x:", park_point.x, " y:", park_point.y, " z:", park_point.z, " unloadlen:", unload_length, " showlcd:", show_lcd DXC_SAY);
377377

@@ -439,8 +439,14 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const_float
439439
// Disable the Extruder for manual change
440440
disable_active_extruder();
441441

442-
// The saved XYZ will be the parked position, which is fine here
443-
TERN_(POWER_LOSS_RECOVERY, if (was_sd_printing && recovery.enabled) recovery.save(true, current_position.z - resume_position.z, true));
442+
#if ENABLED(POWER_LOSS_RECOVERY)
443+
if (was_sd_printing && recovery.enabled) { // For an SD print
444+
const xyze_pos_t tmp = current_position;
445+
current_position = resume_position;
446+
recovery.save(true, tmp.z - resume_position.z, true);
447+
current_position = tmp;
448+
}
449+
#endif
444450

445451
return true;
446452
}

Marlin/src/feature/pause.h

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,47 @@ extern uint8_t did_pause_print;
8585
#define DXC_SAY
8686
#endif
8787

88-
bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const_float_t unload_length=0, const bool show_lcd=false DXC_PARAMS);
88+
// Pause the print. If unload_length is set, do a Filament Unload
89+
bool pause_print(
90+
const_float_t retract, // (mm) Retraction length
91+
const xyz_pos_t &park_point, // Parking XY Position and Z Raise
92+
const bool show_lcd=false // Set LCD status messages?
93+
const_float_t unload_length=0, // (mm) Filament Change Unload Length - 0 to skip
94+
DXC_PARAMS // Dual-X-Carriage extruder index
95+
);
8996

90-
void wait_for_confirmation(const bool is_reload=false, const int8_t max_beep_count=0 DXC_PARAMS);
97+
void wait_for_confirmation(
98+
const bool is_reload=false, // Reload Filament? (otherwise Resume Print)
99+
const int8_t max_beep_count=0, // Beep alert for attention
100+
DXC_PARAMS // Dual-X-Carriage extruder index
101+
);
91102

92-
void resume_print(const_float_t slow_load_length=0, const_float_t fast_load_length=0, const_float_t extrude_length=ADVANCED_PAUSE_PURGE_LENGTH,
93-
const int8_t max_beep_count=0, const celsius_t targetTemp=0 DXC_PARAMS);
103+
void resume_print(
104+
const_float_t slow_load_length=0, // (mm) Slow Load Length for finishing move
105+
const_float_t fast_load_length=0, // (mm) Fast Load Length for initial move
106+
const_float_t extrude_length=ADVANCED_PAUSE_PURGE_LENGTH, // (mm) Purge length
107+
const int8_t max_beep_count=0, // Beep alert for attention
108+
const celsius_t targetTemp=0 // (°C) A target temperature for the hotend
109+
DXC_PARAMS // Dual-X-Carriage extruder index
110+
);
94111

95-
bool load_filament(const_float_t slow_load_length=0, const_float_t fast_load_length=0, const_float_t extrude_length=0, const int8_t max_beep_count=0,
96-
const bool show_lcd=false, const bool pause_for_user=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT DXC_PARAMS);
112+
bool load_filament(
113+
const_float_t slow_load_length=0, // (mm) Slow Load Length for finishing move
114+
const_float_t fast_load_length=0, // (mm) Fast Load Length for initial move
115+
const_float_t extrude_length=0, // (mm) Purge length
116+
const int8_t max_beep_count=0, // Beep alert for attention
117+
const bool show_lcd=false, // Set LCD status messages?
118+
const bool pause_for_user=false, // Pause for user before returning?
119+
const PauseMode mode=PAUSE_MODE_PAUSE_PRINT // Pause Mode to apply
120+
DXC_PARAMS // Dual-X-Carriage extruder index
121+
);
97122

98-
bool unload_filament(const_float_t unload_length, const bool show_lcd=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT
123+
bool unload_filament(
124+
const_float_t unload_length, // (mm) Filament Unload Length - 0 to skip
125+
const bool show_lcd=false, // Set LCD status messages?
126+
const PauseMode mode=PAUSE_MODE_PAUSE_PRINT // Pause Mode to apply
99127
#if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
100-
, const_float_t mix_multiplier=1.0
128+
, const_float_t mix_multiplier=1.0f // Extrusion multiplier (for a Mixing Extruder)
101129
#endif
102130
);
103131

Marlin/src/gcode/feature/pause/M125.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void GcodeSuite::M125() {
7878
// If possible, show an LCD prompt with the 'P' flag
7979
const bool show_lcd = TERN0(HAS_LCD_MENU, parser.boolval('P'));
8080

81-
if (pause_print(retract, park_point, 0, show_lcd)) {
81+
if (pause_print(retract, park_point, show_lcd, 0)) {
8282
if (ENABLED(EXTENSIBLE_UI) || !sd_printing || show_lcd) {
8383
wait_for_confirmation(false, 0);
8484
resume_print(0, 0, -retract, 0);

Marlin/src/gcode/feature/pause/M600.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void GcodeSuite::M600() {
149149
#endif
150150
);
151151

152-
if (pause_print(retract, park_point, unload_length, true DXC_PASS)) {
152+
if (pause_print(retract, park_point, true, unload_length DXC_PASS)) {
153153
#if ENABLED(MMU2_MENUS)
154154
mmu2_M600();
155155
resume_print(slow_load_length, fast_load_length, 0, beep_count DXC_PASS);

0 commit comments

Comments
 (0)