Browse Source

Init MIXING virtual tools as switching

pull/1/head
Scott Lahteine 7 years ago
parent
commit
e34c6827ea
  1. 19
      Marlin/src/feature/mixing.cpp

19
Marlin/src/feature/mixing.cpp

@ -35,12 +35,21 @@ float mixing_factor[MIXING_STEPPERS]; // Reciprocal of mix proportion. 0.0 = off
float mixing_virtual_tool_mix[MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS];
void mixing_tools_init() {
// Initialize mixing to 100% color 1
for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
mixing_factor[i] = (i == 0) ? 1.0 : 0.0;
for (uint8_t t = 0; t < MIXING_VIRTUAL_TOOLS; t++)
// Virtual Tools 0, 1, 2, 3 = Filament 1, 2, 3, 4, etc.
for (uint8_t t = 0; t < MIXING_VIRTUAL_TOOLS && t < MIXING_STEPPERS; t++)
for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
mixing_virtual_tool_mix[t][i] = mixing_factor[i];
mixing_virtual_tool_mix[t][i] = (t == i) ? 1.0 : 0.0;
// Remaining virtual tools are 100% filament 1
#if MIXING_STEPPERS < MIXING_VIRTUAL_TOOLS
for (uint8_t t = MIXING_STEPPERS; t < MIXING_VIRTUAL_TOOLS; t++)
for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
mixing_virtual_tool_mix[t][i] = (i == 0) ? 1.0 : 0.0;
#endif
// Initialize mixing to tool 0 color
for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
mixing_factor[i] = mixing_virtual_tool_mix[0][i];
}
#endif // MIXING_VIRTUAL_TOOLS > 1

Loading…
Cancel
Save