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 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. #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. /**
  31. * M125: Store current position and move to filament change position.
  32. * Called on pause (by M25) to prevent material leaking onto the
  33. * object. On resume (M24) the head will be moved back and the
  34. * print will resume.
  35. *
  36. * If Marlin is compiled without SD Card support, M125 can be
  37. * used directly to pause the print and move to park position,
  38. * resuming with a button click or M108.
  39. *
  40. * L = override retract length
  41. * X = override X
  42. * Y = override Y
  43. * Z = override Z raise
  44. */
  45. void GcodeSuite::M125() {
  46. // Initial retract before move to filament change position
  47. const float retract = -ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) : 0
  48. #ifdef PAUSE_PARK_RETRACT_LENGTH
  49. + (PAUSE_PARK_RETRACT_LENGTH)
  50. #endif
  51. );
  52. point_t park_point = NOZZLE_PARK_POINT;
  53. // Move XY axes to filament change position or given position
  54. if (parser.seenval('X')) park_point.x = parser.linearval('X');
  55. if (parser.seenval('Y')) park_point.y = parser.linearval('Y');
  56. // Lift Z axis
  57. if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
  58. #if HAS_HOTEND_OFFSET && DISABLED(DUAL_X_CARRIAGE) && DISABLED(DELTA)
  59. park_point.x += (active_extruder ? hotend_offset[X_AXIS][active_extruder] : 0);
  60. park_point.y += (active_extruder ? hotend_offset[Y_AXIS][active_extruder] : 0);
  61. #endif
  62. const bool job_running = print_job_timer.isRunning(),
  63. sd_printing = IS_SD_PRINTING();
  64. if (pause_print(retract, park_point)) {
  65. if (!sd_printing) {
  66. wait_for_confirmation();
  67. resume_print();
  68. }
  69. if (job_running) print_job_timer.start();
  70. }
  71. }
  72. #endif // PARK_HEAD_ON_PAUSE