瀏覽代碼

✨ Mixer Presets (#21562)

Vert 2 年之前
父節點
當前提交
5cb961e98b
沒有連結到貢獻者的電子郵件帳戶。
共有 2 個檔案被更改,包括 22 行新增2 行删除
  1. 1
    0
      Marlin/Configuration.h
  2. 21
    2
      Marlin/src/feature/mixing.cpp

+ 1
- 0
Marlin/Configuration.h 查看文件

@@ -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 查看文件

@@ -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

Loading…
取消
儲存