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.

tool_change.cpp 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  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 "tool_change.h"
  23. #include "motion.h"
  24. #include "planner.h"
  25. #include "stepper.h"
  26. #include "../Marlin.h"
  27. #include "../inc/MarlinConfig.h"
  28. #if ENABLED(PARKING_EXTRUDER) && PARKING_EXTRUDER_SOLENOIDS_DELAY > 0
  29. #include "../gcode/gcode.h" // for dwell()
  30. #endif
  31. #if ENABLED(SWITCHING_EXTRUDER) || ENABLED(SWITCHING_NOZZLE)
  32. #include "../module/servo.h"
  33. #endif
  34. #if ENABLED(EXT_SOLENOID) && !ENABLED(PARKING_EXTRUDER)
  35. #include "../feature/solenoid.h"
  36. #endif
  37. #if ENABLED(MK2_MULTIPLEXER)
  38. #include "../feature/snmm.h"
  39. #endif
  40. #if ENABLED(MIXING_EXTRUDER)
  41. #include "../feature/mixing.h"
  42. #endif
  43. #if HAS_LEVELING
  44. #include "../feature/bedlevel/bedlevel.h"
  45. #endif
  46. #if HAS_FANMUX
  47. #include "../feature/fanmux.h"
  48. #endif
  49. #if ENABLED(SWITCHING_EXTRUDER)
  50. #if EXTRUDERS > 3
  51. #define REQ_ANGLES 4
  52. #define _SERVO_NR (e < 2 ? SWITCHING_EXTRUDER_SERVO_NR : SWITCHING_EXTRUDER_E23_SERVO_NR)
  53. #else
  54. #define REQ_ANGLES 2
  55. #define _SERVO_NR SWITCHING_EXTRUDER_SERVO_NR
  56. #endif
  57. void move_extruder_servo(const uint8_t e) {
  58. constexpr int16_t angles[] = SWITCHING_EXTRUDER_SERVO_ANGLES;
  59. static_assert(COUNT(angles) == REQ_ANGLES, "SWITCHING_EXTRUDER_SERVO_ANGLES needs " STRINGIFY(REQ_ANGLES) " angles.");
  60. stepper.synchronize();
  61. #if EXTRUDERS & 1
  62. if (e < EXTRUDERS - 1)
  63. #endif
  64. {
  65. MOVE_SERVO(_SERVO_NR, angles[e]);
  66. safe_delay(500);
  67. }
  68. }
  69. #endif // SWITCHING_EXTRUDER
  70. #if ENABLED(SWITCHING_NOZZLE)
  71. void move_nozzle_servo(const uint8_t e) {
  72. const int16_t angles[2] = SWITCHING_NOZZLE_SERVO_ANGLES;
  73. stepper.synchronize();
  74. MOVE_SERVO(SWITCHING_NOZZLE_SERVO_NR, angles[e]);
  75. safe_delay(500);
  76. }
  77. #endif // SWITCHING_NOZZLE
  78. #if ENABLED(PARKING_EXTRUDER)
  79. void pe_magnet_init() {
  80. for (uint8_t n = 0; n <= 1; ++n)
  81. #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
  82. pe_activate_magnet(n);
  83. #else
  84. pe_deactivate_magnet(n);
  85. #endif
  86. }
  87. void pe_set_magnet(const uint8_t extruder_num, const uint8_t state) {
  88. switch (extruder_num) {
  89. case 1: OUT_WRITE(SOL1_PIN, state); break;
  90. default: OUT_WRITE(SOL0_PIN, state); break;
  91. }
  92. #if PARKING_EXTRUDER_SOLENOIDS_DELAY > 0
  93. gcode.dwell(PARKING_EXTRUDER_SOLENOIDS_DELAY);
  94. #endif
  95. }
  96. inline void parking_extruder_tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) {
  97. if (!no_move) {
  98. const float parkingposx[] = PARKING_EXTRUDER_PARKING_X,
  99. midpos = (parkingposx[0] + parkingposx[1]) * 0.5 + hotend_offset[X_AXIS][active_extruder],
  100. grabpos = parkingposx[tmp_extruder] + hotend_offset[X_AXIS][active_extruder]
  101. + (tmp_extruder == 0 ? -(PARKING_EXTRUDER_GRAB_DISTANCE) : PARKING_EXTRUDER_GRAB_DISTANCE);
  102. /**
  103. * Steps:
  104. * 1. Raise Z-Axis to give enough clearance
  105. * 2. Move to park position of old extruder
  106. * 3. Disengage magnetic field, wait for delay
  107. * 4. Move near new extruder
  108. * 5. Engage magnetic field for new extruder
  109. * 6. Move to parking incl. offset of new extruder
  110. * 7. Lower Z-Axis
  111. */
  112. // STEP 1
  113. #if ENABLED(DEBUG_LEVELING_FEATURE)
  114. SERIAL_ECHOLNPGM("Starting Autopark");
  115. if (DEBUGGING(LEVELING)) DEBUG_POS("current position:", current_position);
  116. #endif
  117. current_position[Z_AXIS] += PARKING_EXTRUDER_SECURITY_RAISE;
  118. #if ENABLED(DEBUG_LEVELING_FEATURE)
  119. SERIAL_ECHOLNPGM("(1) Raise Z-Axis ");
  120. if (DEBUGGING(LEVELING)) DEBUG_POS("Moving to Raised Z-Position", current_position);
  121. #endif
  122. planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
  123. stepper.synchronize();
  124. // STEP 2
  125. current_position[X_AXIS] = parkingposx[active_extruder] + hotend_offset[X_AXIS][active_extruder];
  126. #if ENABLED(DEBUG_LEVELING_FEATURE)
  127. SERIAL_ECHOLNPAIR("(2) Park extruder ", active_extruder);
  128. if (DEBUGGING(LEVELING)) DEBUG_POS("Moving ParkPos", current_position);
  129. #endif
  130. planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder);
  131. stepper.synchronize();
  132. // STEP 3
  133. #if ENABLED(DEBUG_LEVELING_FEATURE)
  134. SERIAL_ECHOLNPGM("(3) Disengage magnet ");
  135. #endif
  136. pe_deactivate_magnet(active_extruder);
  137. // STEP 4
  138. #if ENABLED(DEBUG_LEVELING_FEATURE)
  139. SERIAL_ECHOLNPGM("(4) Move to position near new extruder");
  140. #endif
  141. current_position[X_AXIS] += (active_extruder == 0 ? 10 : -10); // move 10mm away from parked extruder
  142. #if ENABLED(DEBUG_LEVELING_FEATURE)
  143. if (DEBUGGING(LEVELING)) DEBUG_POS("Moving away from parked extruder", current_position);
  144. #endif
  145. planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder);
  146. stepper.synchronize();
  147. // STEP 5
  148. #if ENABLED(DEBUG_LEVELING_FEATURE)
  149. SERIAL_ECHOLNPGM("(5) Engage magnetic field");
  150. #endif
  151. #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
  152. pe_activate_magnet(active_extruder); //just save power for inverted magnets
  153. #endif
  154. pe_activate_magnet(tmp_extruder);
  155. // STEP 6
  156. current_position[X_AXIS] = grabpos + (tmp_extruder == 0 ? (+10) : (-10));
  157. planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder);
  158. current_position[X_AXIS] = grabpos;
  159. #if ENABLED(DEBUG_LEVELING_FEATURE)
  160. SERIAL_ECHOLNPAIR("(6) Unpark extruder ", tmp_extruder);
  161. if (DEBUGGING(LEVELING)) DEBUG_POS("Move UnparkPos", current_position);
  162. #endif
  163. planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS]/2, active_extruder);
  164. stepper.synchronize();
  165. // Step 7
  166. current_position[X_AXIS] = midpos - hotend_offset[X_AXIS][tmp_extruder];
  167. #if ENABLED(DEBUG_LEVELING_FEATURE)
  168. SERIAL_ECHOLNPGM("(7) Move midway between hotends");
  169. if (DEBUGGING(LEVELING)) DEBUG_POS("Move midway to new extruder", current_position);
  170. #endif
  171. planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder);
  172. stepper.synchronize();
  173. #if ENABLED(DEBUG_LEVELING_FEATURE)
  174. SERIAL_ECHOLNPGM("Autopark done.");
  175. #endif
  176. }
  177. else { // nomove == true
  178. // Only engage magnetic field for new extruder
  179. pe_activate_magnet(tmp_extruder);
  180. #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
  181. pe_activate_magnet(active_extruder); // Just save power for inverted magnets
  182. #endif
  183. }
  184. current_position[Z_AXIS] += hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
  185. #if ENABLED(DEBUG_LEVELING_FEATURE)
  186. if (DEBUGGING(LEVELING)) DEBUG_POS("Applying Z-offset", current_position);
  187. #endif
  188. }
  189. #endif // PARKING_EXTRUDER
  190. inline void invalid_extruder_error(const uint8_t e) {
  191. SERIAL_ECHO_START();
  192. SERIAL_CHAR('T');
  193. SERIAL_ECHO_F(e, DEC);
  194. SERIAL_CHAR(' ');
  195. SERIAL_ECHOLNPGM(MSG_INVALID_EXTRUDER);
  196. }
  197. #if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1
  198. inline void mixing_tool_change(const uint8_t tmp_extruder) {
  199. if (tmp_extruder >= MIXING_VIRTUAL_TOOLS)
  200. return invalid_extruder_error(tmp_extruder);
  201. // T0-Tnnn: Switch virtual tool by changing the mix
  202. for (uint8_t j = 0; j < MIXING_STEPPERS; j++)
  203. mixing_factor[j] = mixing_virtual_tool_mix[tmp_extruder][j];
  204. }
  205. #endif // MIXING_EXTRUDER && MIXING_VIRTUAL_TOOLS > 1
  206. #if ENABLED(DUAL_X_CARRIAGE)
  207. inline void dualx_tool_change(const uint8_t tmp_extruder, bool &no_move) {
  208. #if ENABLED(DEBUG_LEVELING_FEATURE)
  209. if (DEBUGGING(LEVELING)) {
  210. SERIAL_ECHOPGM("Dual X Carriage Mode ");
  211. switch (dual_x_carriage_mode) {
  212. case DXC_FULL_CONTROL_MODE: SERIAL_ECHOLNPGM("DXC_FULL_CONTROL_MODE"); break;
  213. case DXC_AUTO_PARK_MODE: SERIAL_ECHOLNPGM("DXC_AUTO_PARK_MODE"); break;
  214. case DXC_DUPLICATION_MODE: SERIAL_ECHOLNPGM("DXC_DUPLICATION_MODE"); break;
  215. }
  216. }
  217. #endif
  218. const float xhome = x_home_pos(active_extruder);
  219. if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE
  220. && IsRunning()
  221. && (delayed_move_time || current_position[X_AXIS] != xhome)
  222. ) {
  223. float raised_z = current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT;
  224. #if ENABLED(MAX_SOFTWARE_ENDSTOPS)
  225. NOMORE(raised_z, soft_endstop_max[Z_AXIS]);
  226. #endif
  227. #if ENABLED(DEBUG_LEVELING_FEATURE)
  228. if (DEBUGGING(LEVELING)) {
  229. SERIAL_ECHOLNPAIR("Raise to ", raised_z);
  230. SERIAL_ECHOLNPAIR("MoveX to ", xhome);
  231. SERIAL_ECHOLNPAIR("Lower to ", current_position[Z_AXIS]);
  232. }
  233. #endif
  234. // Park old head: 1) raise 2) move to park position 3) lower
  235. for (uint8_t i = 0; i < 3; i++)
  236. planner.buffer_line(
  237. i == 0 ? current_position[X_AXIS] : xhome,
  238. current_position[Y_AXIS],
  239. i == 2 ? current_position[Z_AXIS] : raised_z,
  240. current_position[E_AXIS],
  241. planner.max_feedrate_mm_s[i == 1 ? X_AXIS : Z_AXIS],
  242. active_extruder
  243. );
  244. stepper.synchronize();
  245. }
  246. // Apply Y & Z extruder offset (X offset is used as home pos with Dual X)
  247. current_position[Y_AXIS] -= hotend_offset[Y_AXIS][active_extruder] - hotend_offset[Y_AXIS][tmp_extruder];
  248. current_position[Z_AXIS] -= hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
  249. // Activate the new extruder ahead of calling set_axis_is_at_home!
  250. active_extruder = tmp_extruder;
  251. // This function resets the max/min values - the current position may be overwritten below.
  252. set_axis_is_at_home(X_AXIS);
  253. #if ENABLED(DEBUG_LEVELING_FEATURE)
  254. if (DEBUGGING(LEVELING)) DEBUG_POS("New Extruder", current_position);
  255. #endif
  256. // Only when auto-parking are carriages safe to move
  257. if (dual_x_carriage_mode != DXC_AUTO_PARK_MODE) no_move = true;
  258. switch (dual_x_carriage_mode) {
  259. case DXC_FULL_CONTROL_MODE:
  260. // New current position is the position of the activated extruder
  261. current_position[X_AXIS] = inactive_extruder_x_pos;
  262. // Save the inactive extruder's position (from the old current_position)
  263. inactive_extruder_x_pos = destination[X_AXIS];
  264. break;
  265. case DXC_AUTO_PARK_MODE:
  266. // record raised toolhead position for use by unpark
  267. COPY(raised_parked_position, current_position);
  268. raised_parked_position[Z_AXIS] += TOOLCHANGE_UNPARK_ZLIFT;
  269. #if ENABLED(MAX_SOFTWARE_ENDSTOPS)
  270. NOMORE(raised_parked_position[Z_AXIS], soft_endstop_max[Z_AXIS]);
  271. #endif
  272. active_extruder_parked = true;
  273. delayed_move_time = 0;
  274. break;
  275. case DXC_DUPLICATION_MODE:
  276. // If the new extruder is the left one, set it "parked"
  277. // This triggers the second extruder to move into the duplication position
  278. active_extruder_parked = (active_extruder == 0);
  279. current_position[X_AXIS] = active_extruder_parked ? inactive_extruder_x_pos : destination[X_AXIS] + duplicate_extruder_x_offset;
  280. inactive_extruder_x_pos = destination[X_AXIS];
  281. extruder_duplication_enabled = false;
  282. #if ENABLED(DEBUG_LEVELING_FEATURE)
  283. if (DEBUGGING(LEVELING)) {
  284. SERIAL_ECHOLNPAIR("Set inactive_extruder_x_pos=", inactive_extruder_x_pos);
  285. SERIAL_ECHOLNPGM("Clear extruder_duplication_enabled");
  286. }
  287. #endif
  288. break;
  289. }
  290. #if ENABLED(DEBUG_LEVELING_FEATURE)
  291. if (DEBUGGING(LEVELING)) {
  292. SERIAL_ECHOLNPAIR("Active extruder parked: ", active_extruder_parked ? "yes" : "no");
  293. DEBUG_POS("New extruder (parked)", current_position);
  294. }
  295. #endif
  296. // No extra case for HAS_ABL in DUAL_X_CARRIAGE. Does that mean they don't work together?
  297. }
  298. #endif // DUAL_X_CARRIAGE
  299. #define DO_SWITCH_EXTRUDER (SWITCHING_EXTRUDER_SERVO_NR != SWITCHING_NOZZLE_SERVO_NR)
  300. /**
  301. * Perform a tool-change, which may result in moving the
  302. * previous tool out of the way and the new tool into place.
  303. */
  304. void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) {
  305. #if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1
  306. mixing_tool_change(tmp_extruder);
  307. #else // !MIXING_EXTRUDER || MIXING_VIRTUAL_TOOLS <= 1
  308. if (tmp_extruder >= EXTRUDERS)
  309. return invalid_extruder_error(tmp_extruder);
  310. #if HOTENDS > 1
  311. const float old_feedrate_mm_s = fr_mm_s > 0.0 ? fr_mm_s : feedrate_mm_s;
  312. feedrate_mm_s = fr_mm_s > 0.0 ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S;
  313. if (tmp_extruder != active_extruder) {
  314. if (!no_move && axis_unhomed_error()) {
  315. no_move = true;
  316. #if ENABLED(DEBUG_LEVELING_FEATURE)
  317. if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("No move on toolchange");
  318. #endif
  319. }
  320. // Save current position to destination, for use later
  321. set_destination_from_current();
  322. #if HAS_LEVELING
  323. // Set current position to the physical position
  324. const bool leveling_was_active = planner.leveling_active;
  325. set_bed_leveling_enabled(false);
  326. #endif
  327. #if ENABLED(DUAL_X_CARRIAGE)
  328. dualx_tool_change(tmp_extruder, no_move); // Can modify no_move
  329. #else // !DUAL_X_CARRIAGE
  330. #if ENABLED(PARKING_EXTRUDER) // Dual Parking extruder
  331. parking_extruder_tool_change(tmp_extruder, no_move);
  332. #endif
  333. #if ENABLED(SWITCHING_NOZZLE)
  334. // Always raise by at least 1 to avoid workpiece
  335. const float zdiff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
  336. current_position[Z_AXIS] += (zdiff > 0.0 ? zdiff : 0.0) + 1;
  337. planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
  338. move_nozzle_servo(tmp_extruder);
  339. #endif
  340. const float xdiff = hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder],
  341. ydiff = hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder];
  342. #if ENABLED(DEBUG_LEVELING_FEATURE)
  343. if (DEBUGGING(LEVELING)) {
  344. SERIAL_ECHOPAIR("Offset Tool XY by { ", xdiff);
  345. SERIAL_ECHOPAIR(", ", ydiff);
  346. SERIAL_ECHOLNPGM(" }");
  347. }
  348. #endif
  349. // The newly-selected extruder XY is actually at...
  350. current_position[X_AXIS] += xdiff;
  351. current_position[Y_AXIS] += ydiff;
  352. // Set the new active extruder
  353. active_extruder = tmp_extruder;
  354. #endif // !DUAL_X_CARRIAGE
  355. #if HAS_LEVELING
  356. // Restore leveling to re-establish the logical position
  357. set_bed_leveling_enabled(leveling_was_active);
  358. #endif
  359. #if ENABLED(SWITCHING_NOZZLE)
  360. // The newly-selected extruder Z is actually at...
  361. current_position[Z_AXIS] -= zdiff;
  362. #endif
  363. // Tell the planner the new "current position"
  364. SYNC_PLAN_POSITION_KINEMATIC();
  365. #if ENABLED(DELTA)
  366. //LOOP_XYZ(i) update_software_endstops(i); // or modify the constrain function
  367. const bool safe_to_move = current_position[Z_AXIS] < delta_clip_start_height - 1;
  368. #else
  369. constexpr bool safe_to_move = true;
  370. #endif
  371. // Raise, move, and lower again
  372. if (safe_to_move && !no_move && IsRunning()) {
  373. #if DISABLED(SWITCHING_NOZZLE)
  374. // Do a small lift to avoid the workpiece in the move back (below)
  375. current_position[Z_AXIS] += 1.0;
  376. planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
  377. #endif
  378. #if ENABLED(DEBUG_LEVELING_FEATURE)
  379. if (DEBUGGING(LEVELING)) DEBUG_POS("Move back", destination);
  380. #endif
  381. // Move back to the original (or tweaked) position
  382. do_blocking_move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS]);
  383. }
  384. #if ENABLED(SWITCHING_NOZZLE)
  385. else {
  386. // Move back down. (Including when the new tool is higher.)
  387. do_blocking_move_to_z(destination[Z_AXIS], planner.max_feedrate_mm_s[Z_AXIS]);
  388. }
  389. #endif
  390. } // (tmp_extruder != active_extruder)
  391. stepper.synchronize();
  392. #if ENABLED(EXT_SOLENOID) && !ENABLED(PARKING_EXTRUDER)
  393. disable_all_solenoids();
  394. enable_solenoid_on_active_extruder();
  395. #endif
  396. feedrate_mm_s = old_feedrate_mm_s;
  397. #else // HOTENDS <= 1
  398. UNUSED(fr_mm_s);
  399. UNUSED(no_move);
  400. #if ENABLED(MK2_MULTIPLEXER)
  401. if (tmp_extruder >= E_STEPPERS)
  402. return invalid_extruder_error(tmp_extruder);
  403. select_multiplexed_stepper(tmp_extruder);
  404. #endif
  405. // Set the new active extruder
  406. active_extruder = tmp_extruder;
  407. #endif // HOTENDS <= 1
  408. #if DO_SWITCH_EXTRUDER
  409. stepper.synchronize();
  410. move_extruder_servo(active_extruder);
  411. #endif
  412. #if HAS_FANMUX
  413. fanmux_switch(active_extruder);
  414. #endif
  415. SERIAL_ECHO_START();
  416. SERIAL_ECHOLNPAIR(MSG_ACTIVE_EXTRUDER, (int)active_extruder);
  417. #endif // !MIXING_EXTRUDER || MIXING_VIRTUAL_TOOLS <= 1
  418. }