Fix mixing with "unload all" compile

This commit is contained in:
Scott Lahteine
2020-04-19 02:01:30 -05:00
parent ad7a6e10a7
commit 87875e0de8
6 changed files with 24 additions and 40 deletions

View File

@ -95,7 +95,7 @@ void FWRetract::reset() {
*/
void FWRetract::retract(const bool retracting
#if EXTRUDERS > 1
, bool swapping /* =false */
, bool swapping/*=false*/
#endif
) {
// Prevent two retracts or recovers in a row
@ -128,12 +128,8 @@ void FWRetract::retract(const bool retracting
SERIAL_ECHOLNPAIR("current_hop ", current_hop);
//*/
const float base_retract = (
(swapping ? settings.swap_retract_length : settings.retract_length)
#if ENABLED(RETRACT_SYNC_MIXING)
* (MIXING_STEPPERS)
#endif
);
const float base_retract = TERN(RETRACT_SYNC_MIXING, MIXING_STEPPERS, 1)
* (swapping ? settings.swap_retract_length : settings.retract_length);
// The current position will be the destination for E and Z moves
destination = current_position;
@ -148,10 +144,7 @@ void FWRetract::retract(const bool retracting
// Retract by moving from a faux E position back to the current E position
current_retract[active_extruder] = base_retract;
prepare_internal_move_to_destination( // set current to destination
settings.retract_feedrate_mm_s
#if ENABLED(RETRACT_SYNC_MIXING)
* (MIXING_STEPPERS)
#endif
settings.retract_feedrate_mm_s * TERN(RETRACT_SYNC_MIXING, MIXING_STEPPERS, 1)
);
// Is a Z hop set, and has the hop not yet been done?
@ -177,18 +170,12 @@ void FWRetract::retract(const bool retracting
current_retract[active_extruder] = 0;
const feedRate_t fr_mm_s = (
(swapping ? settings.swap_retract_recover_feedrate_mm_s : settings.retract_recover_feedrate_mm_s)
#if ENABLED(RETRACT_SYNC_MIXING)
* (MIXING_STEPPERS)
#endif
);
const feedRate_t fr_mm_s = TERN(RETRACT_SYNC_MIXING, MIXING_STEPPERS, 1)
* (swapping ? settings.swap_retract_recover_feedrate_mm_s : settings.retract_recover_feedrate_mm_s);
prepare_internal_move_to_destination(fr_mm_s); // Recover E, set_current_to_destination
}
#if ENABLED(RETRACT_SYNC_MIXING)
mixer.T(old_mixing_tool); // Restore original mixing tool
#endif
TERN_(RETRACT_SYNC_MIXING, mixer.T(old_mixing_tool)); // Restore original mixing tool
retracted[active_extruder] = retracting; // Active extruder now retracted / recovered

View File

@ -115,7 +115,7 @@ void Mixer::init() {
reset_vtools();
#if ENABLED(RETRACT_SYNC_MIXING)
#if HAS_MIXER_SYNC_CHANNEL
// AUTORETRACT_TOOL gets the same amount of all filaments
MIXER_STEPPER_LOOP(i)
color[MIXER_AUTORETRACT_TOOL][i] = COLOR_A_MASK;

View File

@ -52,25 +52,19 @@ enum MixTool {
LAST_USER_VIRTUAL_TOOL = MIXING_VIRTUAL_TOOLS - 1,
NR_USER_VIRTUAL_TOOLS,
MIXER_DIRECT_SET_TOOL = NR_USER_VIRTUAL_TOOLS,
#if ENABLED(RETRACT_SYNC_MIXING)
#if HAS_MIXER_SYNC_CHANNEL
MIXER_AUTORETRACT_TOOL,
#endif
NR_MIXING_VIRTUAL_TOOLS
};
#if ENABLED(RETRACT_SYNC_MIXING)
#define MAX_VTOOLS 254
#else
#define MAX_VTOOLS 255
#endif
#define MAX_VTOOLS TERN(HAS_MIXER_SYNC_CHANNEL, 254, 255)
static_assert(NR_MIXING_VIRTUAL_TOOLS <= MAX_VTOOLS, "MIXING_VIRTUAL_TOOLS must be <= " STRINGIFY(MAX_VTOOLS) "!");
#define MIXER_STEPPER_LOOP(VAR) \
for (uint_fast8_t VAR = 0; VAR < MIXING_STEPPERS; VAR++)
#define MIXER_BLOCK_FIELD mixer_comp_t b_color[MIXING_STEPPERS]
#define MIXER_POPULATE_BLOCK() mixer.populate_block(block->b_color)
#define MIXER_STEPPER_SETUP() mixer.stepper_setup(current_block->b_color)
#define MIXER_STEPPER_LOOP(VAR) for (uint_fast8_t VAR = 0; VAR < MIXING_STEPPERS; VAR++)
#if ENABLED(GRADIENT_MIX)