Prevent extra "too long/cold" errors

This commit is contained in:
Scott Lahteine 2019-10-27 17:36:33 -05:00
parent 9720d21301
commit 0f8c3ed29a

View file

@ -986,32 +986,37 @@ void prepare_move_to_destination() {
#if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE) #if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE)
if (!DEBUGGING(DRYRUN)) { if (!DEBUGGING(DRYRUN) && destination.e != current_position.e) {
if (destination.e != current_position.e) { bool ignore_e = false;
#if ENABLED(PREVENT_COLD_EXTRUSION)
if (thermalManager.tooColdToExtrude(active_extruder)) { #if ENABLED(PREVENT_COLD_EXTRUSION)
current_position.e = destination.e; // Behave as if the move really took place, but ignore E part ignore_e = thermalManager.tooColdToExtrude(active_extruder);
SERIAL_ECHO_MSG(MSG_ERR_COLD_EXTRUDE_STOP); if (ignore_e) SERIAL_ECHO_MSG(MSG_ERR_COLD_EXTRUDE_STOP);
} #endif
#endif // PREVENT_COLD_EXTRUSION
#if ENABLED(PREVENT_LENGTHY_EXTRUDE) #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
const float e_delta = ABS(destination.e - current_position.e) * planner.e_factor[active_extruder]; const float e_delta = ABS(destination.e - current_position.e) * planner.e_factor[active_extruder];
if (e_delta > (EXTRUDE_MAXLENGTH)) { if (e_delta > (EXTRUDE_MAXLENGTH)) {
#if ENABLED(MIXING_EXTRUDER) #if ENABLED(MIXING_EXTRUDER)
bool ignore_e = false; float collector[MIXING_STEPPERS];
float collector[MIXING_STEPPERS]; mixer.refresh_collector(1.0, mixer.get_current_vtool(), collector);
mixer.refresh_collector(1.0, mixer.get_current_vtool(), collector); MIXER_STEPPER_LOOP(e) {
MIXER_STEPPER_LOOP(e) if (e_delta * collector[e] > (EXTRUDE_MAXLENGTH)) {
if (e_delta * collector[e] > (EXTRUDE_MAXLENGTH)) { ignore_e = true; break; } ignore_e = true;
#else SERIAL_ECHO_MSG(MSG_ERR_LONG_EXTRUDE_STOP);
constexpr bool ignore_e = true; break;
#endif }
if (ignore_e) {
current_position.e = destination.e; // Behave as if the move really took place, but ignore E part
SERIAL_ECHO_MSG(MSG_ERR_LONG_EXTRUDE_STOP);
} }
} #else
#endif // PREVENT_LENGTHY_EXTRUDE ignore_e = true;
SERIAL_ECHO_MSG(MSG_ERR_LONG_EXTRUDE_STOP);
#endif
}
#endif
if (ignore_e) {
current_position.e = destination.e; // Behave as if the E move really took place
planner.set_e_position_mm(destination.e); // Prevent the planner from complaining too
} }
} }