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

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