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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 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. #include "../../../inc/MarlinConfig.h"
  23. #if ENABLED(PARK_HEAD_ON_PAUSE)
  24. #include "../../gcode.h"
  25. #include "../../parser.h"
  26. #include "../../../feature/pause.h"
  27. #include "../../../module/motion.h"
  28. #include "../../../sd/cardreader.h"
  29. #include "../../../module/printcounter.h"
  30. #if HAS_LCD_MENU
  31. #include "../../../lcd/ultralcd.h"
  32. #endif
  33. #if ENABLED(POWER_LOSS_RECOVERY)
  34. #include "../../../feature/powerloss.h"
  35. #endif
  36. /**
  37. * M125: Store current position and move to parking position.
  38. * Called on pause (by M25) to prevent material leaking onto the
  39. * object. On resume (M24) the head will be moved back and the
  40. * print will resume.
  41. *
  42. * When not actively SD printing, M125 simply moves to the park
  43. * position and waits, resuming with a button click or M108.
  44. * Without PARK_HEAD_ON_PAUSE the M125 command does nothing.
  45. *
  46. * L = override retract length
  47. * X = override X
  48. * Y = override Y
  49. * Z = override Z raise
  50. */
  51. void GcodeSuite::M125() {
  52. // Initial retract before move to filament change position
  53. const float retract = -ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) : (PAUSE_PARK_RETRACT_LENGTH));
  54. xyz_pos_t park_point = NOZZLE_PARK_POINT;
  55. // Move XY axes to filament change position or given position
  56. if (parser.seenval('X')) park_point.x = RAW_X_POSITION(parser.linearval('X'));
  57. if (parser.seenval('Y')) park_point.y = RAW_X_POSITION(parser.linearval('Y'));
  58. // Lift Z axis
  59. if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
  60. #if HAS_HOTEND_OFFSET && NONE(DUAL_X_CARRIAGE, DELTA)
  61. park_point += hotend_offset[active_extruder];
  62. #endif
  63. const bool sd_printing = TERN0(SDSUPPORT, IS_SD_PRINTING());
  64. TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT));
  65. const bool show_lcd = TERN0(HAS_LCD_MENU, parser.seenval('P'));
  66. if (pause_print(retract, park_point, 0, show_lcd)) {
  67. TERN_(POWER_LOSS_RECOVERY, if (recovery.enabled) recovery.save(true));
  68. if (!sd_printing || show_lcd) {
  69. wait_for_confirmation(false, 0);
  70. resume_print(0, 0, -retract, 0);
  71. }
  72. }
  73. }
  74. #endif // PARK_HEAD_ON_PAUSE