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.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. /**
  29. * M125: Store current position and move to filament change position.
  30. * Called on pause (by M25) to prevent material leaking onto the
  31. * object. On resume (M24) the head will be moved back and the
  32. * print will resume.
  33. *
  34. * If Marlin is compiled without SD Card support, M125 can be
  35. * used directly to pause the print and move to park position,
  36. * resuming with a button click or M108.
  37. *
  38. * L = override retract length
  39. * X = override X
  40. * Y = override Y
  41. * Z = override Z raise
  42. */
  43. void GcodeSuite::M125() {
  44. // Initial retract before move to filament change position
  45. const float retract = parser.seen('L') ? parser.value_axis_units(E_AXIS) : 0
  46. #ifdef PAUSE_PARK_RETRACT_LENGTH
  47. - (PAUSE_PARK_RETRACT_LENGTH)
  48. #endif
  49. ;
  50. // Lift Z axis
  51. const float z_lift = parser.linearval('Z')
  52. #ifdef PAUSE_PARK_Z_ADD
  53. + PAUSE_PARK_Z_ADD
  54. #endif
  55. ;
  56. // Move XY axes to filament change position or given position
  57. const float x_pos = parser.linearval('X')
  58. #ifdef PAUSE_PARK_X_POS
  59. + PAUSE_PARK_X_POS
  60. #endif
  61. #if HOTENDS > 1 && DISABLED(DUAL_X_CARRIAGE)
  62. + (active_extruder ? hotend_offset[X_AXIS][active_extruder] : 0)
  63. #endif
  64. ;
  65. const float y_pos = parser.linearval('Y')
  66. #ifdef PAUSE_PARK_Y_POS
  67. + PAUSE_PARK_Y_POS
  68. #endif
  69. #if HOTENDS > 1 && DISABLED(DUAL_X_CARRIAGE)
  70. + (active_extruder ? hotend_offset[Y_AXIS][active_extruder] : 0)
  71. #endif
  72. ;
  73. #if DISABLED(SDSUPPORT)
  74. const bool job_running = print_job_timer.isRunning();
  75. #endif
  76. if (pause_print(retract, z_lift, x_pos, y_pos)) {
  77. #if DISABLED(SDSUPPORT)
  78. // Wait for lcd click or M108
  79. wait_for_filament_reload();
  80. // Return to print position and continue
  81. resume_print();
  82. if (job_running) print_job_timer.start();
  83. #endif
  84. }
  85. }
  86. #endif // PARK_HEAD_ON_PAUSE