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.

M605.cpp 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. #define DEBUG_DXC_MODE
  24. #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
  25. #include "../gcode.h"
  26. #include "../../module/motion.h"
  27. #include "../../module/stepper.h"
  28. #include "../../module/tool_change.h"
  29. #include "../../module/planner.h"
  30. #if ENABLED(DUAL_X_CARRIAGE)
  31. /**
  32. * M605: Set dual x-carriage movement mode
  33. *
  34. * M605 : Restore user specified DEFAULT_DUAL_X_CARRIAGE_MODE
  35. * M605 S0: Full control mode. The slicer has full control over x-carriage movement
  36. * M605 S1: Auto-park mode. The inactive head will auto park/unpark without slicer involvement
  37. * M605 S2 [Xnnn] [Rmmm]: Duplication mode. The second extruder will duplicate the first with nnn
  38. * units x-offset and an optional differential hotend temperature of
  39. * mmm degrees. E.g., with "M605 S2 X100 R2" the second extruder will duplicate
  40. * the first with a spacing of 100mm in the x direction and 2 degrees hotter.
  41. * M605 S3 : Enable Symmetric Duplication mode. The second extruder will duplicate the first extruder's
  42. * movement similar to the M605 S2 mode. However, the second extruder will be producing
  43. * a mirror image of the first extruder. The initial x-offset and temperature differential are
  44. * set with M605 S2 [Xnnn] [Rmmm] and then followed with a M605 S3 to start the mirrored movement.
  45. * M605 W : IDEX What? command.
  46. *
  47. * Note: the X axis should be homed after changing dual x-carriage mode.
  48. */
  49. void GcodeSuite::M605() {
  50. planner.synchronize();
  51. if (parser.seen('S')) {
  52. dual_x_carriage_mode = (DualXMode)parser.value_byte();
  53. switch (dual_x_carriage_mode) {
  54. case DXC_FULL_CONTROL_MODE:
  55. case DXC_AUTO_PARK_MODE:
  56. break;
  57. case DXC_DUPLICATION_MODE:
  58. if (parser.seen('X')) duplicate_extruder_x_offset = MAX(parser.value_linear_units(), X2_MIN_POS - x_home_pos(0));
  59. if (parser.seen('R')) duplicate_extruder_temp_offset = parser.value_celsius_diff();
  60. if (active_extruder != 0) tool_change(0);
  61. break;
  62. default:
  63. dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
  64. break;
  65. }
  66. active_extruder_parked = false;
  67. extruder_duplication_enabled = false;
  68. delayed_move_time = 0;
  69. }
  70. else if (!parser.seen('W')) // if no S or W parameter, the DXC mode gets reset to the user's default
  71. dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
  72. if (parser.seen('W')) {
  73. SERIAL_ECHO_START();
  74. SERIAL_ECHOPGM("IDEX mode: ");
  75. switch (dual_x_carriage_mode) {
  76. case DXC_FULL_CONTROL_MODE: SERIAL_ECHOPGM("DXC_FULL_CONTROL_MODE"); break;
  77. case DXC_AUTO_PARK_MODE: SERIAL_ECHOPGM("DXC_AUTO_PARK_MODE"); break;
  78. case DXC_DUPLICATION_MODE: SERIAL_ECHOPGM("DXC_DUPLICATION_MODE"); break;
  79. }
  80. SERIAL_ECHOPAIR("\nActive Ext: ", int(active_extruder));
  81. if (!active_extruder_parked) SERIAL_ECHOPGM(" NOT ");
  82. SERIAL_ECHOLNPGM(" parked.");
  83. SERIAL_ECHOPAIR("active_extruder_x_pos: ", current_position[X_AXIS]);
  84. SERIAL_ECHOPAIR(" inactive_extruder_x_pos: ", inactive_extruder_x_pos);
  85. SERIAL_ECHOPAIR("\nT0 Home X: ", x_home_pos(0));
  86. SERIAL_ECHOPAIR("\nT1 Home X: ", x_home_pos(1));
  87. SERIAL_ECHOPAIR("\nextruder_duplication_enabled: ", int(extruder_duplication_enabled));
  88. SERIAL_ECHOPAIR("\nduplicate_extruder_x_offset: ", duplicate_extruder_x_offset);
  89. SERIAL_ECHOPAIR("\nduplicate_extruder_temp_offset: ", duplicate_extruder_temp_offset);
  90. SERIAL_ECHOPAIR("\ndelayed_move_time: ", delayed_move_time);
  91. }
  92. }
  93. #elif ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
  94. void GcodeSuite::M605() {
  95. planner.synchronize();
  96. extruder_duplication_enabled = parser.intval('S') == (int)DXC_DUPLICATION_MODE;
  97. SERIAL_ECHO_START();
  98. SERIAL_ECHOLNPAIR(MSG_DUPLICATION_MODE, extruder_duplication_enabled ? MSG_ON : MSG_OFF);
  99. }
  100. #endif // DUAL_NOZZLE_DUPLICATION_MODE
  101. #endif // DUAL_X_CARRIAGE || DUAL_NOZZLE_DUPLICATION_MODE