From 4182ff13c2ef26583cb3693e5d010a0156bd87bf Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 4 Aug 2021 01:43:03 -0500 Subject: [PATCH] Move presets to reset_vtools --- Marlin/src/MarlinCore.cpp | 22 ---------------------- Marlin/src/feature/mixing.cpp | 23 +++++++++++++++++++++-- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 133f2614f37e5..6134699aa1018 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -1562,28 +1562,6 @@ void setup() { queue.inject_P(PSTR(STARTUP_COMMANDS)); #endif -#if ENABLED(MIXING_EXTRUDER) && ENABLED (MIXING_PRESETS) - #if MIXING_STEPPERS == 2 // Vtool presets for 2 steppers (Overriden by slicer) - gcode.process_subcommands_now_P(PSTR ("M163 S0 P1\nM163 S1 P0\nM164 S0")); //Vtool0 - gcode.process_subcommands_now_P(PSTR ("M163 S0 P0\nM163 S1 P1\nM164 S1")); //Vtool1 - gcode.process_subcommands_now_P(PSTR ("M163 S0 P0.50\nM163 S1 P0.50\nM164 S2")); //Vtool2 - gcode.process_subcommands_now_P(PSTR ("M163 S0 P0.75\nM163 S1 P0.25\nM164 S3")); //Vtool3 - gcode.process_subcommands_now_P(PSTR ("M163 S0 P0.25\nM163 S1 P0.75\nM164 S4")); //Vtool4 - gcode.process_subcommands_now_P(PSTR ("M163 S0 P0.33\nM163 S1 P0.67\nM164 S5")); //Vtool5 - gcode.process_subcommands_now_P(PSTR ("M163 S0 P0.67\nM163 S1 P0.33\nM164 S6")); //Vtool6 - gcode.process_subcommands_now_P(PSTR ("M163 S0 P0.60\nM163 S1 P0.40\nM164 S7")); //Vtool7 - #elif MIXING_STEPPERS == 3 // Vtool presets for 3 steppers (Overriden by slicer) - gcode.process_subcommands_now_P(PSTR ("M163 S0 P1\nM163 S1 P0\nM163 S2 P0\nM164 S0")); //Vtool0 - gcode.process_subcommands_now_P(PSTR ("M163 S0 P0\nM163 S1 P1\nM163 S2 P0\nM164 S1")); //Vtool1 - gcode.process_subcommands_now_P(PSTR ("M163 S0 P0\nM163 S1 P0\nM163 S2 P1\nM164 S2")); //Vtool2 - gcode.process_subcommands_now_P(PSTR ("M163 S0 P0.33\nM163 S1 P0.33\nM163 S2 P0.34\nM164 S3")); //Vtool3 - gcode.process_subcommands_now_P(PSTR ("M163 S0 P0.25\nM163 S1 P0.75\nM163 S2 P0\nM164 S4")); //Vtool4 - gcode.process_subcommands_now_P(PSTR ("M163 S0 P0\nM163 S1 P0.75\nM163 S2 P0.25\nM164 S5")); //Vtool5 - gcode.process_subcommands_now_P(PSTR ("M163 S0 P0\nM163 S1 P0.50\nM163 S2 P0.50\nM164 S6")); //Vtool6 - gcode.process_subcommands_now_P(PSTR ("M163 S0 P0.50\nM163 S1 P0.50\nM163 S2 P0\nM164 S7")); //Vtool7 - #endif -#endif - #if ENABLED(HOST_PROMPT_SUPPORT) SETUP_RUN(host_action_prompt_end()); #endif diff --git a/Marlin/src/feature/mixing.cpp b/Marlin/src/feature/mixing.cpp index 4823ac2c608b4..4f536cd22e25e 100644 --- a/Marlin/src/feature/mixing.cpp +++ b/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] = 0.50f; collector[1] = 0.50f; mixer.normalize(2); } + if (MIXING_VIRTUAL_TOOLS > 3) { collector[0] = 0.75f; collector[1] = 0.25f; mixer.normalize(3); } + if (MIXING_VIRTUAL_TOOLS > 4) { collector[0] = 0.25f; collector[1] = 0.75f; mixer.normalize(4); } + if (MIXING_VIRTUAL_TOOLS > 5) { collector[0] = 0.33f; collector[1] = 0.67f; mixer.normalize(5); } + if (MIXING_VIRTUAL_TOOLS > 6) { collector[0] = 0.67f; collector[1] = 0.33f; mixer.normalize(6); } + if (MIXING_VIRTUAL_TOOLS > 7) { collector[0] = 0.60f; collector[1] = 0.40f; mixer.normalize(7); } + #else + if (MIXING_VIRTUAL_TOOLS > 3) { collector[0] = 0.33f; collector[1] = 0.33f; collector[2] = 0.34f; mixer.normalize(3); } + if (MIXING_VIRTUAL_TOOLS > 4) { collector[0] = 0.25f; collector[1] = 0.75f; collector[2] = 0.00f; mixer.normalize(4); } + if (MIXING_VIRTUAL_TOOLS > 5) { collector[0] = 0.00f; collector[2] = 0.25f; mixer.normalize(5); } + if (MIXING_VIRTUAL_TOOLS > 6) { collector[1] = 0.50f; collector[2] = 0.50f; mixer.normalize(6); } + if (MIXING_VIRTUAL_TOOLS > 7) { collector[0] = 0.50f; collector[2] = 0.00f; mixer.normalize(7); } + #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