Bladeren bron

🐛 Fix MMU compile with >5 EXTRUDERS (#22036)

Giuliano Zaro 3 jaren geleden
bovenliggende
commit
eea9b6d8ae
No account linked to committer's email address

+ 2
- 5
Marlin/src/MarlinCore.cpp Bestand weergeven

@@ -317,7 +317,7 @@ void disable_e_steppers() {
317 317
 void disable_e_stepper(const uint8_t e) {
318 318
   #define _CASE_DIS_E(N) case N: DISABLE_AXIS_E##N(); break;
319 319
   switch (e) {
320
-    REPEAT(EXTRUDERS, _CASE_DIS_E)
320
+    REPEAT(E_STEPPERS, _CASE_DIS_E)
321 321
   }
322 322
 }
323 323
 
@@ -1423,10 +1423,7 @@ void setup() {
1423 1423
   #endif
1424 1424
 
1425 1425
   #if HAS_PRUSA_MMU1
1426
-    SETUP_LOG("Prusa MMU1");
1427
-    SET_OUTPUT(E_MUX0_PIN);
1428
-    SET_OUTPUT(E_MUX1_PIN);
1429
-    SET_OUTPUT(E_MUX2_PIN);
1426
+    SETUP_RUN(mmu_init());
1430 1427
   #endif
1431 1428
 
1432 1429
   #if HAS_FANMUX

+ 8
- 1
Marlin/src/feature/mmu/mmu.cpp Bestand weergeven

@@ -24,7 +24,14 @@
24 24
 
25 25
 #if HAS_PRUSA_MMU1
26 26
 
27
-#include "../module/stepper.h"
27
+#include "../MarlinCore.h"
28
+#include "../module/planner.h"
29
+
30
+void mmu_init() {
31
+  SET_OUTPUT(E_MUX0_PIN);
32
+  SET_OUTPUT(E_MUX1_PIN);
33
+  SET_OUTPUT(E_MUX2_PIN);
34
+}
28 35
 
29 36
 void select_multiplexed_stepper(const uint8_t e) {
30 37
   planner.synchronize();

+ 1
- 0
Marlin/src/feature/mmu/mmu.h Bestand weergeven

@@ -21,4 +21,5 @@
21 21
  */
22 22
 #pragma once
23 23
 
24
+void mmu_init();
24 25
 void select_multiplexed_stepper(const uint8_t e);

+ 1
- 1
Marlin/src/inc/Conditionals_LCD.h Bestand weergeven

@@ -517,7 +517,7 @@
517 517
     #define HAS_PRUSA_MMU2 1
518 518
     #define HAS_PRUSA_MMU2S 1
519 519
   #endif
520
-  #if MMU_MODEL == EXTENDABLE_EMU_MMU2 || MMU_MODEL == EXTENDABLE_EMU_MMU2S
520
+  #if MMU_MODEL >= EXTENDABLE_EMU_MMU2
521 521
     #define HAS_EXTENDABLE_MMU 1
522 522
   #endif
523 523
 #endif

+ 9
- 6
Marlin/src/inc/SanityCheck.h Bestand weergeven

@@ -954,9 +954,11 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
954 954
  * Multi-Material-Unit 2 / EXTENDABLE_EMU_MMU2 requirements
955 955
  */
956 956
 #if HAS_PRUSA_MMU2
957
-  #if EXTRUDERS != 5
957
+  #if !HAS_EXTENDABLE_MMU && EXTRUDERS != 5
958 958
     #undef SINGLENOZZLE
959 959
     #error "PRUSA_MMU2(S) requires exactly 5 EXTRUDERS. Please update your Configuration."
960
+  #elif HAS_EXTENDABLE_MMU && EXTRUDERS > 15
961
+    #error "EXTRUDERS is too large for MMU(S) emulation mode. The maximum value is 15."
960 962
   #elif DISABLED(NOZZLE_PARK_FEATURE)
961 963
     #error "PRUSA_MMU2(S) requires NOZZLE_PARK_FEATURE. Enable it to continue."
962 964
   #elif HAS_PRUSA_MMU2S && DISABLED(FILAMENT_RUNOUT_SENSOR)
@@ -969,18 +971,19 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
969 971
     static_assert(nullptr == strstr(MMU2_FILAMENT_RUNOUT_SCRIPT, "M600"), "ADVANCED_PAUSE_FEATURE is required to use M600 with PRUSA_MMU2(S) / HAS_EXTENDABLE_MMU(S).");
970 972
   #endif
971 973
 #endif
972
-#if HAS_EXTENDABLE_MMU && EXTRUDERS > 15
973
-  #error "Too many extruders for MMU(S) emulation mode. (15 maximum)."
974
-#endif
975 974
 
976 975
 /**
977 976
  * Options only for EXTRUDERS > 1
978 977
  */
979 978
 #if HAS_MULTI_EXTRUDER
980 979
 
981
-  #if EXTRUDERS > 8
982
-    #error "Marlin supports a maximum of 8 EXTRUDERS."
980
+  #if HAS_EXTENDABLE_MMU
981
+    #define MAX_EXTRUDERS 15
982
+  #else
983
+    #define MAX_EXTRUDERS  8
983 984
   #endif
985
+  static_assert(EXTRUDERS <= MAX_EXTRUDERS, "Marlin supports a maximum of " STRINGIFY(MAX_EXTRUDERS) " EXTRUDERS.");
986
+  #undef MAX_EXTRUDERS
984 987
 
985 988
   #if ENABLED(HEATERS_PARALLEL)
986 989
     #error "EXTRUDERS must be 1 with HEATERS_PARALLEL."

+ 6
- 4
Marlin/src/module/planner.cpp Bestand weergeven

@@ -213,7 +213,7 @@ xyze_float_t Planner::previous_speed;
213 213
 float Planner::previous_nominal_speed_sqr;
214 214
 
215 215
 #if ENABLED(DISABLE_INACTIVE_EXTRUDER)
216
-  last_move_t Planner::g_uc_extruder_last_move[EXTRUDERS] = { 0 };
216
+  last_move_t Planner::g_uc_extruder_last_move[E_STEPPERS] = { 0 };
217 217
 #endif
218 218
 
219 219
 #ifdef XY_FREQUENCY_LIMIT
@@ -2122,11 +2122,13 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
2122 2122
 
2123 2123
       #if ENABLED(DISABLE_INACTIVE_EXTRUDER) // Enable only the selected extruder
2124 2124
 
2125
-        LOOP_L_N(i, EXTRUDERS)
2125
+        LOOP_L_N(i, E_STEPPERS)
2126 2126
           if (g_uc_extruder_last_move[i]) g_uc_extruder_last_move[i]--;
2127 2127
 
2128
+        #define E_STEPPER_INDEX(E) TERN(SWITCHING_EXTRUDER, (E) / 2, E)
2129
+
2128 2130
         #define ENABLE_ONE_E(N) do{ \
2129
-          if (extruder == N) { \
2131
+          if (E_STEPPER_INDEX(extruder) == N) { \
2130 2132
             ENABLE_AXIS_E##N(); \
2131 2133
             g_uc_extruder_last_move[N] = (BLOCK_BUFFER_SIZE) * 2; \
2132 2134
             if ((N) == 0 && TERN0(HAS_DUPLICATION_MODE, extruder_duplication_enabled)) \
@@ -2145,7 +2147,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
2145 2147
 
2146 2148
       #endif
2147 2149
 
2148
-      REPEAT(EXTRUDERS, ENABLE_ONE_E); // (ENABLE_ONE_E must end with semicolon)
2150
+      REPEAT(E_STEPPERS, ENABLE_ONE_E); // (ENABLE_ONE_E must end with semicolon)
2149 2151
     }
2150 2152
   #endif // EXTRUDERS
2151 2153
 

+ 2
- 2
Marlin/src/module/planner.h Bestand weergeven

@@ -450,8 +450,8 @@ class Planner {
450 450
     #endif
451 451
 
452 452
     #if ENABLED(DISABLE_INACTIVE_EXTRUDER)
453
-       // Counters to manage disabling inactive extruders
454
-      static last_move_t g_uc_extruder_last_move[EXTRUDERS];
453
+      // Counters to manage disabling inactive extruder steppers
454
+      static last_move_t g_uc_extruder_last_move[E_STEPPERS];
455 455
     #endif
456 456
 
457 457
     #if HAS_WIRED_LCD

+ 1
- 1
Marlin/src/module/stepper/indirection.h Bestand weergeven

@@ -418,7 +418,7 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
418 418
     #define    REV_E_DIR(E)   do{ E0_DIR_WRITE(E ? !INVERT_E0_DIR :  INVERT_E0_DIR); }while(0)
419 419
   #endif
420 420
 
421
-#elif HAS_PRUSA_MMU2
421
+#elif HAS_PRUSA_MMU2  // One multiplexed stepper driver
422 422
 
423 423
   #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
424 424
   #define   NORM_E_DIR(E)   E0_DIR_WRITE(!INVERT_E0_DIR)

+ 0
- 5
Marlin/src/pins/pins.h Bestand weergeven

@@ -35,11 +35,6 @@
35 35
  *    These numbers are the same in any pin mapping.
36 36
  */
37 37
 
38
-#if HAS_EXTENDABLE_MMU
39
-  #define MAX_EXTRUDERS 15
40
-#else
41
-  #define MAX_EXTRUDERS 8
42
-#endif
43 38
 #define MAX_E_STEPPERS 8
44 39
 
45 40
 #if   MB(RAMPS_13_EFB, RAMPS_14_EFB, RAMPS_PLUS_EFB, RAMPS_14_RE_ARM_EFB, RAMPS_SMART_EFB, RAMPS_DUO_EFB, RAMPS4DUE_EFB)

+ 3
- 3
Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h Bestand weergeven

@@ -23,10 +23,10 @@
23 23
 
24 24
 #include "env_validate.h"
25 25
 
26
-#if HOTENDS > 8 || E_STEPPERS > 8
27
-  #error "BIGTREE GTR V1.0 supports up to 8 hotends / E-steppers."
28
-#elif HOTENDS > MAX_E_STEPPERS || E_STEPPERS > MAX_E_STEPPERS
26
+#if E_STEPPERS > MAX_E_STEPPERS
29 27
   #error "Marlin extruder/hotends limit! Increase MAX_E_STEPPERS to continue."
28
+#elif HOTENDS > 8 || E_STEPPERS > 8
29
+  #error "BIGTREE GTR V1.0 supports up to 8 hotends / E-steppers."
30 30
 #endif
31 31
 
32 32
 #define BOARD_INFO_NAME "BTT GTR V1.0"

Laden…
Annuleren
Opslaan