My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

M125.cpp 3.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 <https://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 "../../../lcd/marlinui.h"
  28. #include "../../../module/motion.h"
  29. #include "../../../module/printcounter.h"
  30. #include "../../../sd/cardreader.h"
  31. #if ENABLED(POWER_LOSS_RECOVERY)
  32. #include "../../../feature/powerloss.h"
  33. #endif
  34. /**
  35. * M125: Store current position and move to parking position.
  36. * Called on pause (by M25) to prevent material leaking onto the
  37. * object. On resume (M24) the head will be moved back and the
  38. * print will resume.
  39. *
  40. * When not actively SD printing, M125 simply moves to the park
  41. * position and waits, resuming with a button click or M108.
  42. * Without PARK_HEAD_ON_PAUSE the M125 command does nothing.
  43. *
  44. * L<linear> = Override retract Length
  45. * X<pos> = Override park position X
  46. * Y<pos> = Override park position Y
  47. * A<pos> = Override park position A (requires AXIS*_NAME 'A')
  48. * B<pos> = Override park position B (requires AXIS*_NAME 'B')
  49. * C<pos> = Override park position C (requires AXIS*_NAME 'C')
  50. * Z<linear> = Override Z raise
  51. *
  52. * With an LCD menu:
  53. * P<bool> = Always show a prompt and await a response
  54. */
  55. void GcodeSuite::M125() {
  56. // Initial retract before move to filament change position
  57. const float retract = TERN0(HAS_EXTRUDERS, -ABS(parser.axisunitsval('L', E_AXIS, PAUSE_PARK_RETRACT_LENGTH)));
  58. xyz_pos_t park_point = NOZZLE_PARK_POINT;
  59. // Move to filament change position or given position
  60. LINEAR_AXIS_CODE(
  61. if (parser.seenval('X')) park_point.x = RAW_X_POSITION(parser.linearval('X')),
  62. if (parser.seenval('Y')) park_point.y = RAW_Y_POSITION(parser.linearval('Y')),
  63. NOOP,
  64. if (parser.seenval(AXIS4_NAME)) park_point.i = RAW_I_POSITION(parser.linearval(AXIS4_NAME)),
  65. if (parser.seenval(AXIS5_NAME)) park_point.j = RAW_J_POSITION(parser.linearval(AXIS5_NAME)),
  66. if (parser.seenval(AXIS6_NAME)) park_point.k = RAW_K_POSITION(parser.linearval(AXIS6_NAME))
  67. );
  68. // Lift Z axis
  69. if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
  70. #if HAS_HOTEND_OFFSET && NONE(DUAL_X_CARRIAGE, DELTA)
  71. park_point += hotend_offset[active_extruder];
  72. #endif
  73. const bool sd_printing = TERN0(SDSUPPORT, IS_SD_PRINTING());
  74. ui.pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT);
  75. // If possible, show an LCD prompt with the 'P' flag
  76. const bool show_lcd = TERN0(HAS_MARLINUI_MENU, parser.boolval('P'));
  77. if (pause_print(retract, park_point, show_lcd, 0)) {
  78. if (ENABLED(EXTENSIBLE_UI) || BOTH(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT) || !sd_printing || show_lcd) {
  79. wait_for_confirmation(false, 0);
  80. resume_print(0, 0, -retract, 0);
  81. }
  82. }
  83. }
  84. #endif // PARK_HEAD_ON_PAUSE