Browse Source

Mixer Presets (#21562)

vanilla_fb_2.0.x
Vert 3 years ago
committed by Scott Lahteine
parent
commit
ecb625a666
  1. 1
      Marlin/Configuration.h
  2. 23
      Marlin/src/feature/mixing.cpp

1
Marlin/Configuration.h

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

23
Marlin/src/feature/mixing.cpp

@ -106,11 +106,32 @@ void Mixer::reset_vtools() {
MIXER_STEPPER_LOOP(i)
color[t][i] = (i == 0) ? COLOR_A_MASK : 0;
#endif
// MIXING_PRESETS: Set a variety of obvious mixes as presets
#if ENABLED(MIXING_PRESETS) && WITHIN(MIXING_STEPPERS, 2, 3)
#if MIXING_STEPPERS == 2
if (MIXING_VIRTUAL_TOOLS > 2) { collector[0] = 1; collector[1] = 1; mixer.normalize(2); } // 1:1
if (MIXING_VIRTUAL_TOOLS > 3) { collector[0] = 3; mixer.normalize(3); } // 3:1
if (MIXING_VIRTUAL_TOOLS > 4) { collector[0] = 1; collector[1] = 3; mixer.normalize(4); } // 1:3
if (MIXING_VIRTUAL_TOOLS > 5) { collector[1] = 2; mixer.normalize(5); } // 1:2
if (MIXING_VIRTUAL_TOOLS > 6) { collector[0] = 2; collector[1] = 1; mixer.normalize(6); } // 2:1
if (MIXING_VIRTUAL_TOOLS > 7) { collector[0] = 3; collector[1] = 2; mixer.normalize(7); } // 3:2
#else
if (MIXING_VIRTUAL_TOOLS > 3) { collector[0] = 1; collector[1] = 1; collector[2] = 1; mixer.normalize(3); } // 1:1:1
if (MIXING_VIRTUAL_TOOLS > 4) { collector[1] = 3; collector[2] = 0; mixer.normalize(4); } // 1:3:0
if (MIXING_VIRTUAL_TOOLS > 5) { collector[0] = 0; collector[2] = 1; mixer.normalize(5); } // 0:3:1
if (MIXING_VIRTUAL_TOOLS > 6) { collector[1] = 1; mixer.normalize(6); } // 0:1:1
if (MIXING_VIRTUAL_TOOLS > 7) { collector[0] = 1; collector[2] = 0; mixer.normalize(7); } // 1:1:0
#endif
ZERO(collector);
#endif
}
// called at boot
void Mixer::init() {
ZERO(collector);
reset_vtools();
#if HAS_MIXER_SYNC_CHANNEL
@ -119,8 +140,6 @@ void Mixer::init() {
color[MIXER_AUTORETRACT_TOOL][i] = COLOR_A_MASK;
#endif
ZERO(collector);
#if EITHER(HAS_DUAL_MIXING, GRADIENT_MIX)
update_mix_from_vtool();
#endif

Loading…
Cancel
Save