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.

M125.cpp 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2019 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. /**
  34. * M125: Store current position and move to parking position.
  35. * Called on pause (by M25) to prevent material leaking onto the
  36. * object. On resume (M24) the head will be moved back and the
  37. * print will resume.
  38. *
  39. * When not actively SD printing, M125 simply moves to the park
  40. * position and waits, resuming with a button click or M108.
  41. * Without PARK_HEAD_ON_PAUSE the M125 command does nothing.
  42. *
  43. * L = override retract length
  44. * X = override X
  45. * Y = override Y
  46. * Z = override Z raise
  47. */
  48. void GcodeSuite::M125() {
  49. // Initial retract before move to filament change position
  50. const float retract = -ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) : 0
  51. #ifdef PAUSE_PARK_RETRACT_LENGTH
  52. + (PAUSE_PARK_RETRACT_LENGTH)
  53. #endif
  54. );
  55. point_t park_point = NOZZLE_PARK_POINT;
  56. // Move XY axes to filament change position or given position
  57. if (parser.seenval('X')) park_point.x = RAW_X_POSITION(parser.linearval('X'));
  58. if (parser.seenval('Y')) park_point.y = RAW_X_POSITION(parser.linearval('Y'));
  59. // Lift Z axis
  60. if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
  61. #if HAS_HOTEND_OFFSET && NONE(DUAL_X_CARRIAGE, DELTA)
  62. park_point.x += hotend_offset[X_AXIS][active_extruder];
  63. park_point.y += hotend_offset[Y_AXIS][active_extruder];
  64. #endif
  65. #if ENABLED(SDSUPPORT)
  66. const bool sd_printing = IS_SD_PRINTING();
  67. #else
  68. constexpr bool sd_printing = false;
  69. #endif
  70. #if HAS_LCD_MENU
  71. lcd_pause_show_message(PAUSE_MESSAGE_PAUSING, PAUSE_MODE_PAUSE_PRINT);
  72. const bool show_lcd = parser.seenval('P');
  73. #else
  74. constexpr bool show_lcd = false;
  75. #endif
  76. if (pause_print(retract, park_point, 0, show_lcd)) {
  77. if (!sd_printing || show_lcd) {
  78. wait_for_confirmation(false, 0);
  79. resume_print(0, 0, PAUSE_PARK_RETRACT_LENGTH, 0);
  80. }
  81. }
  82. }
  83. #endif // PARK_HEAD_ON_PAUSE