My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

M217.cpp 6.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../../inc/MarlinConfigPre.h"
  23. #if EXTRUDERS > 1
  24. #include "../gcode.h"
  25. #include "../../module/tool_change.h"
  26. #if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
  27. #include "../../module/motion.h"
  28. #endif
  29. #include "../../MarlinCore.h" // for SP_X_STR, etc.
  30. extern const char SP_X_STR[], SP_Y_STR[], SP_Z_STR[];
  31. void M217_report(const bool eeprom=false) {
  32. #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
  33. serialprintPGM(eeprom ? PSTR(" M217") : PSTR("Toolchange:"));
  34. SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length),
  35. " B", LINEAR_UNIT(toolchange_settings.extra_resume));
  36. SERIAL_ECHOPAIR_P(SP_E_STR, LINEAR_UNIT(toolchange_settings.extra_prime),
  37. SP_P_STR, LINEAR_UNIT(toolchange_settings.prime_speed));
  38. SERIAL_ECHOPAIR(" R", LINEAR_UNIT(toolchange_settings.retract_speed),
  39. " U", LINEAR_UNIT(toolchange_settings.unretract_speed),
  40. " F", toolchange_settings.fan_speed,
  41. " G", toolchange_settings.fan_time);
  42. #if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
  43. SERIAL_ECHOPAIR(" N", int(migration.automode));
  44. SERIAL_ECHOPAIR(" L", LINEAR_UNIT(migration.last));
  45. #endif
  46. #if ENABLED(TOOLCHANGE_PARK)
  47. SERIAL_ECHOPAIR(" W", LINEAR_UNIT(toolchange_settings.enable_park));
  48. SERIAL_ECHOPAIR_P(SP_X_STR, LINEAR_UNIT(toolchange_settings.change_point.x));
  49. SERIAL_ECHOPAIR_P(SP_Y_STR, LINEAR_UNIT(toolchange_settings.change_point.y));
  50. #endif
  51. #if ENABLED(TOOLCHANGE_FS_PRIME_FIRST_USED)
  52. SERIAL_ECHOPAIR(" V", LINEAR_UNIT(enable_first_prime));
  53. #endif
  54. #else
  55. UNUSED(eeprom);
  56. #endif
  57. SERIAL_ECHOPAIR_P(SP_Z_STR, LINEAR_UNIT(toolchange_settings.z_raise));
  58. SERIAL_EOL();
  59. }
  60. /**
  61. * M217 - Set SINGLENOZZLE toolchange parameters
  62. *
  63. * // Tool change command
  64. * Q Prime active tool and exit
  65. *
  66. * // Tool change settings
  67. * S[linear] Swap length
  68. * B[linear] Extra Swap length
  69. * E[linear] Prime length
  70. * P[linear/m] Prime speed
  71. * R[linear/m] Retract speed
  72. * U[linear/m] UnRetract speed
  73. * V[linear] 0/1 Enable auto prime first extruder used
  74. * W[linear] 0/1 Enable park & Z Raise
  75. * X[linear] Park X (Requires TOOLCHANGE_PARK)
  76. * Y[linear] Park Y (Requires TOOLCHANGE_PARK)
  77. * Z[linear] Z Raise
  78. * F[linear] Fan Speed 0-255
  79. * G[linear/s] Fan time
  80. *
  81. * Tool migration settings
  82. * A[0|1] Enable auto-migration on runout
  83. * L[index] Last extruder to use for auto-migration
  84. *
  85. * Tool migration command
  86. * T[index] Migrate to next extruder or the given extruder
  87. */
  88. void GcodeSuite::M217() {
  89. #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
  90. static constexpr float max_extrude = TERN(PREVENT_LENGTHY_EXTRUDE, EXTRUDE_MAXLENGTH, 500);
  91. if (parser.seen('Q')) { tool_change_prime(); return; }
  92. if (parser.seenval('S')) { const float v = parser.value_linear_units(); toolchange_settings.swap_length = constrain(v, 0, max_extrude); }
  93. if (parser.seenval('B')) { const float v = parser.value_linear_units(); toolchange_settings.extra_resume = constrain(v, -10, 10); }
  94. if (parser.seenval('E')) { const float v = parser.value_linear_units(); toolchange_settings.extra_prime = constrain(v, 0, max_extrude); }
  95. if (parser.seenval('P')) { const int16_t v = parser.value_linear_units(); toolchange_settings.prime_speed = constrain(v, 10, 5400); }
  96. if (parser.seenval('R')) { const int16_t v = parser.value_linear_units(); toolchange_settings.retract_speed = constrain(v, 10, 5400); }
  97. if (parser.seenval('U')) { const int16_t v = parser.value_linear_units(); toolchange_settings.unretract_speed = constrain(v, 10, 5400); }
  98. #if TOOLCHANGE_FS_FAN >= 0 && HAS_FAN
  99. if (parser.seenval('F')) { const int16_t v = parser.value_linear_units(); toolchange_settings.fan_speed = constrain(v, 0, 255); }
  100. if (parser.seenval('G')) { const int16_t v = parser.value_linear_units(); toolchange_settings.fan_time = constrain(v, 1, 30); }
  101. #endif
  102. #endif
  103. #if ENABLED(TOOLCHANGE_FS_PRIME_FIRST_USED)
  104. if (parser.seenval('V')) { enable_first_prime = parser.value_linear_units(); }
  105. #endif
  106. #if ENABLED(TOOLCHANGE_PARK)
  107. if (parser.seenval('W')) { toolchange_settings.enable_park = parser.value_linear_units(); }
  108. if (parser.seenval('X')) { const int16_t v = parser.value_linear_units(); toolchange_settings.change_point.x = constrain(v, X_MIN_POS, X_MAX_POS); }
  109. if (parser.seenval('Y')) { const int16_t v = parser.value_linear_units(); toolchange_settings.change_point.y = constrain(v, Y_MIN_POS, Y_MAX_POS); }
  110. #endif
  111. if (parser.seenval('Z')) { toolchange_settings.z_raise = parser.value_linear_units(); }
  112. #if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
  113. migration.target = 0; // 0 = disabled
  114. if (parser.seenval('L')) { // Last
  115. const int16_t lval = parser.value_int();
  116. if (WITHIN(lval, 0, EXTRUDERS - 1)) {
  117. migration.last = lval;
  118. migration.automode = (active_extruder < migration.last);
  119. }
  120. }
  121. if (parser.seen('A')) // Auto on/off
  122. migration.automode = parser.value_bool();
  123. if (parser.seen('T')) { // Migrate now
  124. if (parser.has_value()) {
  125. const int16_t tval = parser.value_int();
  126. if (WITHIN(tval, 0, EXTRUDERS - 1) && tval != active_extruder) {
  127. migration.target = tval + 1;
  128. extruder_migration();
  129. migration.target = 0; // disable
  130. return;
  131. }
  132. else
  133. migration.target = 0; // disable
  134. }
  135. else {
  136. extruder_migration();
  137. return;
  138. }
  139. }
  140. #endif
  141. M217_report();
  142. }
  143. #endif // EXTRUDERS > 1