Browse Source

✨ Mixer Presets (#21562)

Vert 3 years ago
parent
commit
5cb961e98b
No account linked to committer's email address
2 changed files with 22 additions and 2 deletions
  1. 1
    0
      Marlin/Configuration.h
  2. 21
    2
      Marlin/src/feature/mixing.cpp

+ 1
- 0
Marlin/Configuration.h View File

342
   #define MIXING_VIRTUAL_TOOLS 16  // Use the Virtual Tool method with M163 and M164
342
   #define MIXING_VIRTUAL_TOOLS 16  // Use the Virtual Tool method with M163 and M164
343
   //#define DIRECT_MIXING_IN_G1    // Allow ABCDHI mix factors in G1 movement commands
343
   //#define DIRECT_MIXING_IN_G1    // Allow ABCDHI mix factors in G1 movement commands
344
   //#define GRADIENT_MIX           // Support for gradient mixing with M166 and LCD
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
   #if ENABLED(GRADIENT_MIX)
346
   #if ENABLED(GRADIENT_MIX)
346
     //#define GRADIENT_VTOOL       // Add M166 T to use a V-tool index as a Gradient alias
347
     //#define GRADIENT_VTOOL       // Add M166 T to use a V-tool index as a Gradient alias
347
   #endif
348
   #endif

+ 21
- 2
Marlin/src/feature/mixing.cpp View File

106
       MIXER_STEPPER_LOOP(i)
106
       MIXER_STEPPER_LOOP(i)
107
         color[t][i] = (i == 0) ? COLOR_A_MASK : 0;
107
         color[t][i] = (i == 0) ? COLOR_A_MASK : 0;
108
   #endif
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
 // called at boot
130
 // called at boot
112
 void Mixer::init() {
131
 void Mixer::init() {
113
 
132
 
133
+  ZERO(collector);
134
+
114
   reset_vtools();
135
   reset_vtools();
115
 
136
 
116
   #if HAS_MIXER_SYNC_CHANNEL
137
   #if HAS_MIXER_SYNC_CHANNEL
119
       color[MIXER_AUTORETRACT_TOOL][i] = COLOR_A_MASK;
140
       color[MIXER_AUTORETRACT_TOOL][i] = COLOR_A_MASK;
120
   #endif
141
   #endif
121
 
142
 
122
-  ZERO(collector);
123
-
124
   #if EITHER(HAS_DUAL_MIXING, GRADIENT_MIX)
143
   #if EITHER(HAS_DUAL_MIXING, GRADIENT_MIX)
125
     update_mix_from_vtool();
144
     update_mix_from_vtool();
126
   #endif
145
   #endif

Loading…
Cancel
Save