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 48aa706
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] = 1; collector[1] = 1; mixer.normalize(2); }
if (MIXING_VIRTUAL_TOOLS > 3) { collector[0] = 3; mixer.normalize(3); }
if (MIXING_VIRTUAL_TOOLS > 4) { collector[0] = 1; collector[1] = 3; mixer.normalize(4); }
if (MIXING_VIRTUAL_TOOLS > 5) { collector[1] = 2; mixer.normalize(5); }
if (MIXING_VIRTUAL_TOOLS > 6) { collector[0] = 2; collector[1] = 1; mixer.normalize(6); }
if (MIXING_VIRTUAL_TOOLS > 7) { collector[0] = 3; collector[1] = 2; mixer.normalize(7); }
#else
if (MIXING_VIRTUAL_TOOLS > 3) { collector[0] = 1; collector[1] = 1; collector[2] = 1; mixer.normalize(3); }
if (MIXING_VIRTUAL_TOOLS > 4) { collector[1] = 3; collector[2] = 0; mixer.normalize(4); }
if (MIXING_VIRTUAL_TOOLS > 5) { collector[0] = 0; collector[2] = 1; mixer.normalize(5); }
if (MIXING_VIRTUAL_TOOLS > 6) { collector[1] = 1; mixer.normalize(6); }
if (MIXING_VIRTUAL_TOOLS > 7) { collector[0] = 1; collector[2] = 0; 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 48aa706

Please sign in to comment.