Browse Source

Fix tool-change for MIXING_EXTRUDER with < 2 virtual tools (#12417)

Fix #12416

Better handling of `ENABLED(MIXING_EXTRUDER) && !MIXING_VIRTUAL_TOOLS > 1` -  to not fall through to the general case. Fix compiler warnings for `#elif EXTRUDERS < 2`.
AnHardt 6 years ago
parent
commit
9ad3aed0ef
1 changed files with 11 additions and 8 deletions
  1. 11
    8
      Marlin/src/module/tool_change.cpp

+ 11
- 8
Marlin/src/module/tool_change.cpp View File

@@ -498,25 +498,28 @@ inline void invalid_extruder_error(const uint8_t e) {
498 498
  * previous tool out of the way and the new tool into place.
499 499
  */
500 500
 void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) {
501
-  #if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1
501
+  #if ENABLED(MIXING_EXTRUDER)
502 502
 
503
-      if (tmp_extruder >= MIXING_VIRTUAL_TOOLS)
504
-        return invalid_extruder_error(tmp_extruder);
503
+    UNUSED(fr_mm_s);
504
+    UNUSED(no_move);
505
+    if (tmp_extruder >= MIXING_VIRTUAL_TOOLS)
506
+      return invalid_extruder_error(tmp_extruder);
507
+
508
+    #if MIXING_VIRTUAL_TOOLS >  1
505 509
       // T0-Tnnn: Switch virtual tool by changing the index to the mix
506 510
       mixer.T(uint_fast8_t(tmp_extruder));
507
-      UNUSED(fr_mm_s);
508
-      UNUSED(no_move);
511
+    #endif
509 512
 
510 513
   #elif EXTRUDERS < 2
511 514
 
515
+    UNUSED(fr_mm_s);
516
+    UNUSED(no_move);
512 517
     if (tmp_extruder) invalid_extruder_error(tmp_extruder);
513 518
     return;
514 519
 
515 520
   #else
516 521
 
517
-    #if DISABLED(MIXING_EXTRUDER)
518
-      planner.synchronize();
519
-    #endif
522
+    planner.synchronize();
520 523
 
521 524
     #if ENABLED(DUAL_X_CARRIAGE)  // Only T0 allowed if the Printer is in DXC_DUPLICATION_MODE or DXC_SCALED_DUPLICATION_MODE
522 525
       if (tmp_extruder != 0 && dxc_is_duplicating())

Loading…
Cancel
Save