Przeglądaj źródła

✨ Mixer Presets (#21562)

Vert 3 lat temu
rodzic
commit
5cb961e98b
No account linked to committer's email address
2 zmienionych plików z 22 dodań i 2 usunięć
  1. 1
    0
      Marlin/Configuration.h
  2. 21
    2
      Marlin/src/feature/mixing.cpp

+ 1
- 0
Marlin/Configuration.h Wyświetl plik

@@ -342,6 +342,7 @@
342 342
   #define MIXING_VIRTUAL_TOOLS 16  // Use the Virtual Tool method with M163 and M164
343 343
   //#define DIRECT_MIXING_IN_G1    // Allow ABCDHI mix factors in G1 movement commands
344 344
   //#define GRADIENT_MIX           // Support for gradient mixing with M166 and LCD
345
+  //#define MIXING_PRESETS         // Assign 8 default V-tool presets for 2 or 3 MIXING_STEPPERS
345 346
   #if ENABLED(GRADIENT_MIX)
346 347
     //#define GRADIENT_VTOOL       // Add M166 T to use a V-tool index as a Gradient alias
347 348
   #endif

+ 21
- 2
Marlin/src/feature/mixing.cpp Wyświetl plik

@@ -106,11 +106,32 @@ void Mixer::reset_vtools() {
106 106
       MIXER_STEPPER_LOOP(i)
107 107
         color[t][i] = (i == 0) ? COLOR_A_MASK : 0;
108 108
   #endif
109
+
110
+  // MIXING_PRESETS: Set a variety of obvious mixes as presets
111
+  #if ENABLED(MIXING_PRESETS) && WITHIN(MIXING_STEPPERS, 2, 3)
112
+    #if MIXING_STEPPERS == 2
113
+      if (MIXING_VIRTUAL_TOOLS > 2) { collector[0] = 1; collector[1] = 1; mixer.normalize(2); } // 1:1
114
+      if (MIXING_VIRTUAL_TOOLS > 3) { collector[0] = 3;                   mixer.normalize(3); } // 3:1
115
+      if (MIXING_VIRTUAL_TOOLS > 4) { collector[0] = 1; collector[1] = 3; mixer.normalize(4); } // 1:3
116
+      if (MIXING_VIRTUAL_TOOLS > 5) {                   collector[1] = 2; mixer.normalize(5); } // 1:2
117
+      if (MIXING_VIRTUAL_TOOLS > 6) { collector[0] = 2; collector[1] = 1; mixer.normalize(6); } // 2:1
118
+      if (MIXING_VIRTUAL_TOOLS > 7) { collector[0] = 3; collector[1] = 2; mixer.normalize(7); } // 3:2
119
+    #else
120
+      if (MIXING_VIRTUAL_TOOLS > 3) { collector[0] = 1; collector[1] = 1; collector[2] = 1; mixer.normalize(3); } // 1:1:1
121
+      if (MIXING_VIRTUAL_TOOLS > 4) {                   collector[1] = 3; collector[2] = 0; mixer.normalize(4); } // 1:3:0
122
+      if (MIXING_VIRTUAL_TOOLS > 5) { collector[0] = 0;                   collector[2] = 1; mixer.normalize(5); } // 0:3:1
123
+      if (MIXING_VIRTUAL_TOOLS > 6) {                   collector[1] = 1;                   mixer.normalize(6); } // 0:1:1
124
+      if (MIXING_VIRTUAL_TOOLS > 7) { collector[0] = 1;                   collector[2] = 0; mixer.normalize(7); } // 1:1:0
125
+    #endif
126
+    ZERO(collector);
127
+  #endif
109 128
 }
110 129
 
111 130
 // called at boot
112 131
 void Mixer::init() {
113 132
 
133
+  ZERO(collector);
134
+
114 135
   reset_vtools();
115 136
 
116 137
   #if HAS_MIXER_SYNC_CHANNEL
@@ -119,8 +140,6 @@ void Mixer::init() {
119 140
       color[MIXER_AUTORETRACT_TOOL][i] = COLOR_A_MASK;
120 141
   #endif
121 142
 
122
-  ZERO(collector);
123
-
124 143
   #if EITHER(HAS_DUAL_MIXING, GRADIENT_MIX)
125 144
     update_mix_from_vtool();
126 145
   #endif

Ładowanie…
Anuluj
Zapisz