My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pause.cpp 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. * feature/pause.cpp - Pause feature support functions
  24. * This may be combined with related G-codes if features are consolidated.
  25. */
  26. #include "../inc/MarlinConfig.h"
  27. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  28. #include "../Marlin.h"
  29. #include "../gcode/gcode.h"
  30. #include "../module/motion.h"
  31. #include "../module/planner.h"
  32. #include "../module/stepper.h"
  33. #include "../module/printcounter.h"
  34. #include "../module/temperature.h"
  35. #if ENABLED(FWRETRACT)
  36. #include "../feature/fwretract.h"
  37. #endif
  38. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  39. #include "../feature/runout.h"
  40. #endif
  41. #if ENABLED(ULTIPANEL)
  42. #include "../lcd/ultralcd.h"
  43. #endif
  44. #include "../libs/buzzer.h"
  45. #include "../libs/nozzle.h"
  46. #include "pause.h"
  47. // private:
  48. static float resume_position[XYZE];
  49. AdvancedPauseMenuResponse advanced_pause_menu_response;
  50. float filament_change_unload_length[EXTRUDERS],
  51. filament_change_load_length[EXTRUDERS];
  52. #if ENABLED(SDSUPPORT)
  53. #include "../sd/cardreader.h"
  54. #endif
  55. #if HAS_BUZZER
  56. static void filament_change_beep(const int8_t max_beep_count, const bool init=false) {
  57. static millis_t next_buzz = 0;
  58. static int8_t runout_beep = 0;
  59. if (init) next_buzz = runout_beep = 0;
  60. const millis_t ms = millis();
  61. if (ELAPSED(ms, next_buzz)) {
  62. if (max_beep_count < 0 || runout_beep < max_beep_count + 5) { // Only beep as long as we're supposed to
  63. next_buzz = ms + ((max_beep_count < 0 || runout_beep < max_beep_count) ? 1000 : 500);
  64. BUZZ(50, 880 - (runout_beep & 1) * 220);
  65. runout_beep++;
  66. }
  67. }
  68. }
  69. #endif
  70. /**
  71. * Ensure a safe temperature for extrusion
  72. *
  73. * - Fail if the TARGET temperature is too low
  74. * - Display LCD placard with temperature status
  75. * - Return when heating is done or aborted
  76. *
  77. * Returns 'true' if heating was completed, 'false' for abort
  78. */
  79. static bool ensure_safe_temperature(const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT) {
  80. #if ENABLED(PREVENT_COLD_EXTRUSION)
  81. if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) {
  82. SERIAL_ERROR_START();
  83. SERIAL_ERRORLNPGM(MSG_HOTEND_TOO_COLD);
  84. return false;
  85. }
  86. #endif
  87. #if ENABLED(ULTIPANEL)
  88. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT, mode);
  89. #else
  90. UNUSED(mode);
  91. #endif
  92. return thermalManager.wait_for_hotend(active_extruder);
  93. }
  94. static void do_pause_e_move(const float &length, const float &fr) {
  95. current_position[E_AXIS] += length / planner.e_factor[active_extruder];
  96. planner.buffer_line(current_position, fr, active_extruder);
  97. planner.synchronize();
  98. }
  99. /**
  100. * Load filament into the hotend
  101. *
  102. * - Fail if the a safe temperature was not reached
  103. * - If pausing for confirmation, wait for a click or M108
  104. * - Show "wait for load" placard
  105. * - Load and purge filament
  106. * - Show "Purge more" / "Continue" menu
  107. * - Return when "Continue" is selected
  108. *
  109. * Returns 'true' if load was completed, 'false' for abort
  110. */
  111. bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=0*/, const int8_t max_beep_count/*=0*/,
  112. const bool show_lcd/*=false*/, const bool pause_for_user/*=false*/,
  113. const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/
  114. DXC_ARGS
  115. ) {
  116. #if DISABLED(ULTIPANEL)
  117. UNUSED(show_lcd);
  118. #endif
  119. if (!ensure_safe_temperature(mode)) {
  120. #if ENABLED(ULTIPANEL)
  121. if (show_lcd) // Show status screen
  122. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
  123. #endif
  124. return false;
  125. }
  126. if (pause_for_user) {
  127. #if ENABLED(ULTIPANEL)
  128. if (show_lcd) // Show "insert filament"
  129. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT, mode);
  130. #endif
  131. SERIAL_ECHO_START();
  132. SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_INSERT);
  133. #if HAS_BUZZER
  134. filament_change_beep(max_beep_count, true);
  135. #else
  136. UNUSED(max_beep_count);
  137. #endif
  138. KEEPALIVE_STATE(PAUSED_FOR_USER);
  139. wait_for_user = true; // LCD click or M108 will clear this
  140. while (wait_for_user) {
  141. #if HAS_BUZZER
  142. filament_change_beep(max_beep_count);
  143. #endif
  144. idle(true);
  145. }
  146. KEEPALIVE_STATE(IN_HANDLER);
  147. }
  148. #if ENABLED(ULTIPANEL)
  149. if (show_lcd) // Show "wait for load" message
  150. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, mode);
  151. #endif
  152. #if ENABLED(DUAL_X_CARRIAGE)
  153. const int8_t saved_ext = active_extruder;
  154. const bool saved_ext_dup_mode = extruder_duplication_enabled;
  155. active_extruder = DXC_ext;
  156. extruder_duplication_enabled = false;
  157. #endif
  158. // Slow Load filament
  159. if (slow_load_length) do_pause_e_move(slow_load_length, FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE);
  160. // Fast Load Filament
  161. if (fast_load_length) {
  162. #if FILAMENT_CHANGE_FAST_LOAD_ACCEL > 0
  163. const float saved_acceleration = planner.retract_acceleration;
  164. planner.retract_acceleration = FILAMENT_CHANGE_FAST_LOAD_ACCEL;
  165. #endif
  166. do_pause_e_move(fast_load_length, FILAMENT_CHANGE_FAST_LOAD_FEEDRATE);
  167. #if FILAMENT_CHANGE_FAST_LOAD_ACCEL > 0
  168. planner.retract_acceleration = saved_acceleration;
  169. #endif
  170. }
  171. #if ENABLED(DUAL_X_CARRIAGE) // Tie the two extruders movement back together.
  172. active_extruder = saved_ext;
  173. extruder_duplication_enabled = saved_ext_dup_mode;
  174. stepper.set_directions();
  175. #endif
  176. #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
  177. #if ENABLED(ULTIPANEL)
  178. if (show_lcd)
  179. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_CONTINUOUS_PURGE);
  180. #endif
  181. wait_for_user = true;
  182. for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
  183. do_pause_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
  184. wait_for_user = false;
  185. #else
  186. do {
  187. if (purge_length > 0) {
  188. // "Wait for filament purge"
  189. #if ENABLED(ULTIPANEL)
  190. if (show_lcd)
  191. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_PURGE, mode);
  192. #endif
  193. // Extrude filament to get into hotend
  194. do_pause_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE);
  195. }
  196. // Show "Purge More" / "Resume" menu and wait for reply
  197. #if ENABLED(ULTIPANEL)
  198. if (show_lcd) {
  199. KEEPALIVE_STATE(PAUSED_FOR_USER);
  200. wait_for_user = false;
  201. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_OPTION, mode);
  202. while (advanced_pause_menu_response == ADVANCED_PAUSE_RESPONSE_WAIT_FOR) idle(true);
  203. KEEPALIVE_STATE(IN_HANDLER);
  204. }
  205. #endif
  206. // Keep looping if "Purge More" was selected
  207. } while (
  208. #if ENABLED(ULTIPANEL)
  209. show_lcd && advanced_pause_menu_response == ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE
  210. #else
  211. 0
  212. #endif
  213. );
  214. #endif
  215. return true;
  216. }
  217. /**
  218. * Unload filament from the hotend
  219. *
  220. * - Fail if the a safe temperature was not reached
  221. * - Show "wait for unload" placard
  222. * - Retract, pause, then unload filament
  223. * - Disable E stepper (on most machines)
  224. *
  225. * Returns 'true' if unload was completed, 'false' for abort
  226. */
  227. bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
  228. const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/
  229. ) {
  230. if (!ensure_safe_temperature(mode)) {
  231. #if ENABLED(ULTIPANEL)
  232. if (show_lcd) // Show status screen
  233. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
  234. #endif
  235. return false;
  236. }
  237. #if DISABLED(ULTIPANEL)
  238. UNUSED(show_lcd);
  239. #else
  240. if (show_lcd)
  241. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_UNLOAD, mode);
  242. #endif
  243. // Retract filament
  244. do_pause_e_move(-FILAMENT_UNLOAD_RETRACT_LENGTH, PAUSE_PARK_RETRACT_FEEDRATE);
  245. // Wait for filament to cool
  246. safe_delay(FILAMENT_UNLOAD_DELAY);
  247. // Quickly purge
  248. do_pause_e_move(FILAMENT_UNLOAD_RETRACT_LENGTH + FILAMENT_UNLOAD_PURGE_LENGTH, planner.max_feedrate_mm_s[E_AXIS]);
  249. // Unload filament
  250. #if FILAMENT_CHANGE_UNLOAD_ACCEL > 0
  251. const float saved_acceleration = planner.retract_acceleration;
  252. planner.retract_acceleration = FILAMENT_CHANGE_UNLOAD_ACCEL;
  253. #endif
  254. do_pause_e_move(unload_length, FILAMENT_CHANGE_UNLOAD_FEEDRATE);
  255. #if FILAMENT_CHANGE_FAST_LOAD_ACCEL > 0
  256. planner.retract_acceleration = saved_acceleration;
  257. #endif
  258. // Disable extruders steppers for manual filament changing (only on boards that have separate ENABLE_PINS)
  259. #if E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN
  260. disable_e_stepper(active_extruder);
  261. safe_delay(100);
  262. #endif
  263. return true;
  264. }
  265. // public:
  266. /**
  267. * Pause procedure
  268. *
  269. * - Abort if already paused
  270. * - Send host action for pause, if configured
  271. * - Abort if TARGET temperature is too low
  272. * - Display "wait for start of filament change" (if a length was specified)
  273. * - Initial retract, if current temperature is hot enough
  274. * - Park the nozzle at the given position
  275. * - Call unload_filament (if a length was specified)
  276. *
  277. * Returns 'true' if pause was completed, 'false' for abort
  278. */
  279. uint8_t did_pause_print = 0;
  280. bool pause_print(const float &retract, const point_t &park_point, const float &unload_length/*=0*/, const bool show_lcd/*=false*/ DXC_ARGS) {
  281. if (did_pause_print) return false; // already paused
  282. #ifdef ACTION_ON_PAUSE
  283. SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE);
  284. #endif
  285. #if ENABLED(ULTIPANEL)
  286. if (show_lcd) // Show initial message
  287. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT);
  288. #endif
  289. if (!DEBUGGING(DRYRUN) && unload_length && thermalManager.targetTooColdToExtrude(active_extruder)) {
  290. SERIAL_ERROR_START();
  291. SERIAL_ERRORLNPGM(MSG_HOTEND_TOO_COLD);
  292. #if ENABLED(ULTIPANEL)
  293. if (show_lcd) { // Show status screen
  294. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
  295. LCD_MESSAGEPGM(MSG_M600_TOO_COLD);
  296. }
  297. #endif
  298. return false; // unable to reach safe temperature
  299. }
  300. // Indicate that the printer is paused
  301. ++did_pause_print;
  302. // Pause the print job and timer
  303. #if ENABLED(SDSUPPORT)
  304. if (card.sdprinting) {
  305. card.pauseSDPrint();
  306. ++did_pause_print; // Indicate SD pause also
  307. }
  308. #endif
  309. print_job_timer.pause();
  310. // Save current position
  311. COPY(resume_position, current_position);
  312. // Wait for buffered blocks to complete
  313. planner.synchronize();
  314. // Initial retract before move to filament change position
  315. if (retract && thermalManager.hotEnoughToExtrude(active_extruder))
  316. do_pause_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE);
  317. // Park the nozzle by moving up by z_lift and then moving to (x_pos, y_pos)
  318. if (!axis_unhomed_error())
  319. Nozzle::park(2, park_point);
  320. #if ENABLED(DUAL_X_CARRIAGE)
  321. const int8_t saved_ext = active_extruder;
  322. const bool saved_ext_dup_mode = extruder_duplication_enabled;
  323. active_extruder = DXC_ext;
  324. extruder_duplication_enabled = false;
  325. #endif
  326. if (unload_length) // Unload the filament
  327. unload_filament(unload_length, show_lcd);
  328. #if ENABLED(DUAL_X_CARRIAGE)
  329. active_extruder = saved_ext;
  330. extruder_duplication_enabled = saved_ext_dup_mode;
  331. stepper.set_directions();
  332. #endif
  333. return true;
  334. }
  335. /**
  336. * - Show "Insert filament and press button to continue"
  337. * - Wait for a click before returning
  338. * - Heaters can time out, reheated before accepting a click
  339. *
  340. * Used by M125 and M600
  341. */
  342. void wait_for_filament_reload(const int8_t max_beep_count/*=0*/ DXC_ARGS) {
  343. bool nozzle_timed_out = false;
  344. #if ENABLED(ULTIPANEL)
  345. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT);
  346. #endif
  347. SERIAL_ECHO_START();
  348. SERIAL_ERRORLNPGM(MSG_FILAMENT_CHANGE_INSERT);
  349. #if HAS_BUZZER
  350. filament_change_beep(max_beep_count, true);
  351. #endif
  352. // Start the heater idle timers
  353. const millis_t nozzle_timeout = (millis_t)(PAUSE_PARK_NOZZLE_TIMEOUT) * 1000UL;
  354. HOTEND_LOOP()
  355. thermalManager.start_heater_idle_timer(e, nozzle_timeout);
  356. #if ENABLED(DUAL_X_CARRIAGE)
  357. const int8_t saved_ext = active_extruder;
  358. const bool saved_ext_dup_mode = extruder_duplication_enabled;
  359. active_extruder = DXC_ext;
  360. extruder_duplication_enabled = false;
  361. #endif
  362. // Wait for filament insert by user and press button
  363. KEEPALIVE_STATE(PAUSED_FOR_USER);
  364. wait_for_user = true; // LCD click or M108 will clear this
  365. while (wait_for_user) {
  366. #if HAS_BUZZER
  367. filament_change_beep(max_beep_count);
  368. #endif
  369. // If the nozzle has timed out, wait for the user to press the button to re-heat the nozzle, then
  370. // re-heat the nozzle, re-show the insert screen, restart the idle timers, and start over
  371. if (!nozzle_timed_out)
  372. HOTEND_LOOP()
  373. nozzle_timed_out |= thermalManager.is_heater_idle(e);
  374. if (nozzle_timed_out) {
  375. #if ENABLED(ULTIPANEL)
  376. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE);
  377. #endif
  378. SERIAL_ECHO_START();
  379. #if ENABLED(ULTIPANEL) && ENABLED(EMERGENCY_PARSER)
  380. SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_HEAT);
  381. #elif ENABLED(EMERGENCY_PARSER)
  382. SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_HEAT_M108);
  383. #else
  384. SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_HEAT_LCD);
  385. #endif
  386. // Wait for LCD click or M108
  387. while (wait_for_user) idle(true);
  388. // Re-enable the heaters if they timed out
  389. HOTEND_LOOP() thermalManager.reset_heater_idle_timer(e);
  390. // Wait for the heaters to reach the target temperatures
  391. ensure_safe_temperature();
  392. #if ENABLED(ULTIPANEL)
  393. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT);
  394. #endif
  395. SERIAL_ECHO_START();
  396. #if ENABLED(ULTIPANEL) && ENABLED(EMERGENCY_PARSER)
  397. SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_INSERT);
  398. #elif ENABLED(EMERGENCY_PARSER)
  399. SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_INSERT_M108);
  400. #else
  401. SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_INSERT_LCD);
  402. #endif
  403. // Start the heater idle timers
  404. const millis_t nozzle_timeout = (millis_t)(PAUSE_PARK_NOZZLE_TIMEOUT) * 1000UL;
  405. HOTEND_LOOP()
  406. thermalManager.start_heater_idle_timer(e, nozzle_timeout);
  407. wait_for_user = true; // Wait for user to load filament
  408. nozzle_timed_out = false;
  409. #if HAS_BUZZER
  410. filament_change_beep(max_beep_count, true);
  411. #endif
  412. }
  413. idle(true);
  414. }
  415. #if ENABLED(DUAL_X_CARRIAGE)
  416. active_extruder = saved_ext;
  417. extruder_duplication_enabled = saved_ext_dup_mode;
  418. stepper.set_directions();
  419. #endif
  420. KEEPALIVE_STATE(IN_HANDLER);
  421. }
  422. /**
  423. * Resume or Start print procedure
  424. *
  425. * - Abort if not paused
  426. * - Reset heater idle timers
  427. * - Load filament if specified, but only if:
  428. * - a nozzle timed out, or
  429. * - the nozzle is already heated.
  430. * - Display "wait for print to resume"
  431. * - Re-prime the nozzle...
  432. * - FWRETRACT: Recover/prime from the prior G10.
  433. * - !FWRETRACT: Retract by resume_position[E], if negative.
  434. * Not sure how this logic comes into use.
  435. * - Move the nozzle back to resume_position
  436. * - Sync the planner E to resume_position[E]
  437. * - Send host action for resume, if configured
  438. * - Resume the current SD print job, if any
  439. */
  440. void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=ADVANCED_PAUSE_PURGE_LENGTH*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) {
  441. /*
  442. SERIAL_ECHOPGM("start of resume_print()\n");
  443. SERIAL_ECHOPAIR("\ndual_x_carriage_mode:", dual_x_carriage_mode);
  444. SERIAL_ECHOPAIR("\nextruder_duplication_enabled:", extruder_duplication_enabled);
  445. SERIAL_ECHOPAIR("\nactive_extruder:", active_extruder);
  446. SERIAL_ECHOPGM("\n\n");
  447. */
  448. if (!did_pause_print) return;
  449. // Re-enable the heaters if they timed out
  450. bool nozzle_timed_out = false;
  451. HOTEND_LOOP() {
  452. nozzle_timed_out |= thermalManager.is_heater_idle(e);
  453. thermalManager.reset_heater_idle_timer(e);
  454. }
  455. if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) // Load the new filament
  456. load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out, ADVANCED_PAUSE_MODE_PAUSE_PRINT DXC_PASS);
  457. #if ENABLED(ULTIPANEL)
  458. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_RESUME); // "Wait for print to resume"
  459. #endif
  460. // Intelligent resuming
  461. #if ENABLED(FWRETRACT)
  462. // If retracted before goto pause
  463. if (fwretract.retracted[active_extruder])
  464. do_pause_e_move(-fwretract.retract_length, fwretract.retract_feedrate_mm_s);
  465. #endif
  466. // If resume_position is negative
  467. if (resume_position[E_AXIS] < 0) do_pause_e_move(resume_position[E_AXIS], PAUSE_PARK_RETRACT_FEEDRATE);
  468. // Move XY to starting position, then Z
  469. do_blocking_move_to_xy(resume_position[X_AXIS], resume_position[Y_AXIS], NOZZLE_PARK_XY_FEEDRATE);
  470. // Move Z_AXIS to saved position
  471. do_blocking_move_to_z(resume_position[Z_AXIS], NOZZLE_PARK_Z_FEEDRATE);
  472. // Now all extrusion positions are resumed and ready to be confirmed
  473. // Set extruder to saved position
  474. planner.set_e_position_mm((destination[E_AXIS] = current_position[E_AXIS] = resume_position[E_AXIS]));
  475. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  476. runout.reset();
  477. #endif
  478. #if ENABLED(ULTIPANEL)
  479. // Show status screen
  480. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
  481. #endif
  482. #ifdef ACTION_ON_RESUME
  483. SERIAL_ECHOLNPGM("//action:" ACTION_ON_RESUME);
  484. #endif
  485. --did_pause_print;
  486. #if ENABLED(SDSUPPORT)
  487. if (did_pause_print) {
  488. card.startFileprint();
  489. --did_pause_print;
  490. }
  491. #endif
  492. }
  493. #endif // ADVANCED_PAUSE_FEATURE