Fix mixing with "unload all" compile
This commit is contained in:
parent
ad7a6e10a7
commit
87875e0de8
6 changed files with 24 additions and 40 deletions
|
@ -95,7 +95,7 @@ void FWRetract::reset() {
|
||||||
*/
|
*/
|
||||||
void FWRetract::retract(const bool retracting
|
void FWRetract::retract(const bool retracting
|
||||||
#if EXTRUDERS > 1
|
#if EXTRUDERS > 1
|
||||||
, bool swapping /* =false */
|
, bool swapping/*=false*/
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
// Prevent two retracts or recovers in a row
|
// Prevent two retracts or recovers in a row
|
||||||
|
@ -128,12 +128,8 @@ void FWRetract::retract(const bool retracting
|
||||||
SERIAL_ECHOLNPAIR("current_hop ", current_hop);
|
SERIAL_ECHOLNPAIR("current_hop ", current_hop);
|
||||||
//*/
|
//*/
|
||||||
|
|
||||||
const float base_retract = (
|
const float base_retract = TERN(RETRACT_SYNC_MIXING, MIXING_STEPPERS, 1)
|
||||||
(swapping ? settings.swap_retract_length : settings.retract_length)
|
* (swapping ? settings.swap_retract_length : settings.retract_length);
|
||||||
#if ENABLED(RETRACT_SYNC_MIXING)
|
|
||||||
* (MIXING_STEPPERS)
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
|
|
||||||
// The current position will be the destination for E and Z moves
|
// The current position will be the destination for E and Z moves
|
||||||
destination = current_position;
|
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
|
// Retract by moving from a faux E position back to the current E position
|
||||||
current_retract[active_extruder] = base_retract;
|
current_retract[active_extruder] = base_retract;
|
||||||
prepare_internal_move_to_destination( // set current to destination
|
prepare_internal_move_to_destination( // set current to destination
|
||||||
settings.retract_feedrate_mm_s
|
settings.retract_feedrate_mm_s * TERN(RETRACT_SYNC_MIXING, MIXING_STEPPERS, 1)
|
||||||
#if ENABLED(RETRACT_SYNC_MIXING)
|
|
||||||
* (MIXING_STEPPERS)
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Is a Z hop set, and has the hop not yet been done?
|
// 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;
|
current_retract[active_extruder] = 0;
|
||||||
|
|
||||||
const feedRate_t fr_mm_s = (
|
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)
|
* (swapping ? settings.swap_retract_recover_feedrate_mm_s : settings.retract_recover_feedrate_mm_s);
|
||||||
#if ENABLED(RETRACT_SYNC_MIXING)
|
|
||||||
* (MIXING_STEPPERS)
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
prepare_internal_move_to_destination(fr_mm_s); // Recover E, set_current_to_destination
|
prepare_internal_move_to_destination(fr_mm_s); // Recover E, set_current_to_destination
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(RETRACT_SYNC_MIXING)
|
TERN_(RETRACT_SYNC_MIXING, mixer.T(old_mixing_tool)); // Restore original mixing tool
|
||||||
mixer.T(old_mixing_tool); // Restore original mixing tool
|
|
||||||
#endif
|
|
||||||
|
|
||||||
retracted[active_extruder] = retracting; // Active extruder now retracted / recovered
|
retracted[active_extruder] = retracting; // Active extruder now retracted / recovered
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ void Mixer::init() {
|
||||||
|
|
||||||
reset_vtools();
|
reset_vtools();
|
||||||
|
|
||||||
#if ENABLED(RETRACT_SYNC_MIXING)
|
#if HAS_MIXER_SYNC_CHANNEL
|
||||||
// AUTORETRACT_TOOL gets the same amount of all filaments
|
// AUTORETRACT_TOOL gets the same amount of all filaments
|
||||||
MIXER_STEPPER_LOOP(i)
|
MIXER_STEPPER_LOOP(i)
|
||||||
color[MIXER_AUTORETRACT_TOOL][i] = COLOR_A_MASK;
|
color[MIXER_AUTORETRACT_TOOL][i] = COLOR_A_MASK;
|
||||||
|
|
|
@ -52,25 +52,19 @@ enum MixTool {
|
||||||
LAST_USER_VIRTUAL_TOOL = MIXING_VIRTUAL_TOOLS - 1,
|
LAST_USER_VIRTUAL_TOOL = MIXING_VIRTUAL_TOOLS - 1,
|
||||||
NR_USER_VIRTUAL_TOOLS,
|
NR_USER_VIRTUAL_TOOLS,
|
||||||
MIXER_DIRECT_SET_TOOL = 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,
|
MIXER_AUTORETRACT_TOOL,
|
||||||
#endif
|
#endif
|
||||||
NR_MIXING_VIRTUAL_TOOLS
|
NR_MIXING_VIRTUAL_TOOLS
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLED(RETRACT_SYNC_MIXING)
|
#define MAX_VTOOLS TERN(HAS_MIXER_SYNC_CHANNEL, 254, 255)
|
||||||
#define MAX_VTOOLS 254
|
|
||||||
#else
|
|
||||||
#define MAX_VTOOLS 255
|
|
||||||
#endif
|
|
||||||
static_assert(NR_MIXING_VIRTUAL_TOOLS <= MAX_VTOOLS, "MIXING_VIRTUAL_TOOLS must be <= " STRINGIFY(MAX_VTOOLS) "!");
|
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_BLOCK_FIELD mixer_comp_t b_color[MIXING_STEPPERS]
|
||||||
#define MIXER_POPULATE_BLOCK() mixer.populate_block(block->b_color)
|
#define MIXER_POPULATE_BLOCK() mixer.populate_block(block->b_color)
|
||||||
#define MIXER_STEPPER_SETUP() mixer.stepper_setup(current_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)
|
#if ENABLED(GRADIENT_MIX)
|
||||||
|
|
||||||
|
|
|
@ -163,16 +163,18 @@ void GcodeSuite::M702() {
|
||||||
|
|
||||||
#if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS)
|
#if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS)
|
||||||
float mix_multiplier = 1.0;
|
float mix_multiplier = 1.0;
|
||||||
if (!parser.seenval('T')) {
|
const bool seenT = parser.seenval('T');
|
||||||
|
if (!seenT) {
|
||||||
mixer.T(MIXER_AUTORETRACT_TOOL);
|
mixer.T(MIXER_AUTORETRACT_TOOL);
|
||||||
mix_multiplier = MIXING_STEPPERS;
|
mix_multiplier = MIXING_STEPPERS;
|
||||||
}
|
}
|
||||||
else
|
#else
|
||||||
|
constexpr bool seenT = true;
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
|
if (seenT) {
|
||||||
const int8_t target_e_stepper = get_target_e_stepper_from_command();
|
const int8_t target_e_stepper = get_target_e_stepper_from_command();
|
||||||
if (target_e_stepper < 0) return;
|
if (target_e_stepper < 0) return;
|
||||||
|
|
||||||
mixer.T(MIXER_DIRECT_SET_TOOL);
|
mixer.T(MIXER_DIRECT_SET_TOOL);
|
||||||
MIXER_STEPPER_LOOP(i) mixer.set_collector(i, (i == (uint8_t)target_e_stepper) ? 1.0 : 0.0);
|
MIXER_STEPPER_LOOP(i) mixer.set_collector(i, (i == (uint8_t)target_e_stepper) ? 1.0 : 0.0);
|
||||||
mixer.normalize();
|
mixer.normalize();
|
||||||
|
|
|
@ -56,6 +56,10 @@
|
||||||
#undef SHOW_TEMP_ADC_VALUES
|
#undef SHOW_TEMP_ADC_VALUES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(MIXING_EXTRUDER) && (ENABLED(RETRACT_SYNC_MIXING) || BOTH(FILAMENT_LOAD_UNLOAD_GCODES, FILAMENT_UNLOAD_ALL_EXTRUDERS))
|
||||||
|
#define HAS_MIXER_SYNC_CHANNEL 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#if EITHER(DUAL_X_CARRIAGE, MULTI_NOZZLE_DUPLICATION)
|
#if EITHER(DUAL_X_CARRIAGE, MULTI_NOZZLE_DUPLICATION)
|
||||||
#define HAS_DUPLICATION_MODE 1
|
#define HAS_DUPLICATION_MODE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2133,17 +2133,14 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||||
#if EXTRUDERS
|
#if EXTRUDERS
|
||||||
{
|
{
|
||||||
current_speed.e = steps_dist_mm.e * inverse_secs;
|
current_speed.e = steps_dist_mm.e * inverse_secs;
|
||||||
#if BOTH(MIXING_EXTRUDER, RETRACT_SYNC_MIXING)
|
#if HAS_MIXER_SYNC_CHANNEL
|
||||||
// Move all mixing extruders at the specified rate
|
// Move all mixing extruders at the specified rate
|
||||||
if (mixer.get_current_vtool() == MIXER_AUTORETRACT_TOOL)
|
if (mixer.get_current_vtool() == MIXER_AUTORETRACT_TOOL)
|
||||||
current_speed.e *= MIXING_STEPPERS;
|
current_speed.e *= MIXING_STEPPERS;
|
||||||
#endif
|
#endif
|
||||||
const feedRate_t cs = ABS(current_speed.e),
|
const feedRate_t cs = ABS(current_speed.e),
|
||||||
max_fr = (settings.max_feedrate_mm_s[E_AXIS_N(extruder)]
|
max_fr = settings.max_feedrate_mm_s[E_AXIS_N(extruder)]
|
||||||
#if BOTH(MIXING_EXTRUDER, RETRACT_SYNC_MIXING)
|
* TERN(HAS_MIXER_SYNC_CHANNEL, MIXING_STEPPERS, 1);
|
||||||
* MIXING_STEPPERS
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
if (cs > max_fr) NOMORE(speed_factor, max_fr / cs);
|
if (cs > max_fr) NOMORE(speed_factor, max_fr / cs);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Reference in a new issue