Skip to content

Commit

Permalink
Move presets to reset_vtools
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 4, 2021
1 parent 944518a commit 4182ff1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
22 changes: 0 additions & 22 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 21 additions & 2 deletions Marlin/src/feature/mixing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 4182ff1

Please sign in to comment.