MCPcopy Create free account
hub / github.com/MarlinFirmware/Marlin / pause_print

Function pause_print

Marlin/src/feature/pause.cpp:421–504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419uint8_t did_pause_print = 0;
420
421bool 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) {
422 DEBUG_SECTION(pp, "pause_print", true);
423 DEBUG_ECHOLNPGM("... park.x:", park_point.x, " y:", park_point.y, " z:", park_point.z, " unloadlen:", unload_length, " showlcd:", show_lcd DXC_SAY);
424
425 if (did_pause_print) return false; // already paused
426
427 #if ENABLED(HOST_ACTION_COMMANDS)
428 #ifdef ACTION_ON_PAUSED
429 hostui.paused();
430 #elif defined(ACTION_ON_PAUSE)
431 hostui.pause();
432 #endif
433 #endif
434
435 TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("Pause"), FPSTR(DISMISS_STR)));
436
437 // Indicate that the printer is paused
438 ++did_pause_print;
439
440 // Pause the print job and timer
441 #if HAS_MEDIA
442 const bool was_sd_printing = card.isStillPrinting();
443 if (was_sd_printing) {
444 card.pauseSDPrint();
445 ++did_pause_print; // Indicate SD pause also
446 }
447 #endif
448
449 print_job_timer.pause();
450
451 // Save current position
452 resume_position = current_position;
453
454 // Will the nozzle be parking?
455 const bool do_park = !axes_should_home();
456
457 #if ENABLED(POWER_LOSS_RECOVERY)
458 // Save PLR info in case the power goes out while parked
459 const float park_raise = do_park ? nozzle.park_mode_0_height(park_point.z) - current_position.z : POWER_LOSS_ZRAISE;
460 if (was_sd_printing && recovery.enabled) recovery.save(true, park_raise, do_park);
461 #endif
462
463 // Wait for buffered blocks to complete
464 planner.synchronize();
465
466 #if ALL(ADVANCED_PAUSE_FANS_PAUSE, HAS_FAN)
467 thermalManager.set_fans_paused(true);
468 #endif
469
470 // Initial retract before move to filament change position
471 if (retract && thermalManager.hotEnoughToExtrude(active_extruder)) {
472 DEBUG_ECHOLNPGM("... retract:", retract);
473
474 #if ENABLED(AUTO_BED_LEVELING_UBL)
475 const bool leveling_was_enabled = planner.leveling_active; // save leveling state
476 set_bed_leveling_enabled(false); // turn off leveling
477 #endif
478

Callers 3

M600Method · 0.85
M125Method · 0.85

Calls 15

set_bed_leveling_enabledFunction · 0.85
unscaled_e_moveFunction · 0.85
unload_filamentFunction · 0.85
disable_active_extruderFunction · 0.85
pausedMethod · 0.80
prompt_openMethod · 0.80
isStillPrintingMethod · 0.80
pauseSDPrintMethod · 0.80
park_mode_0_heightMethod · 0.80
set_fans_pausedMethod · 0.80
hotEnoughToExtrudeMethod · 0.80
parkMethod · 0.80

Tested by

no test coverage detected