Fix cold/lengthy extrusion handling
This commit is contained in:
parent
4714fb8fcb
commit
24b302c001
@ -12947,27 +12947,32 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
|||||||
*
|
*
|
||||||
* This may result in several calls to planner.buffer_line to
|
* This may result in several calls to planner.buffer_line to
|
||||||
* do smaller moves for DELTA, SCARA, mesh moves, etc.
|
* do smaller moves for DELTA, SCARA, mesh moves, etc.
|
||||||
|
*
|
||||||
|
* Make sure current_position[E] and destination[E] are good
|
||||||
|
* before calling or cold/lengthy extrusion may get missed.
|
||||||
*/
|
*/
|
||||||
void prepare_move_to_destination() {
|
void prepare_move_to_destination() {
|
||||||
clamp_to_software_endstops(destination);
|
clamp_to_software_endstops(destination);
|
||||||
refresh_cmd_timeout();
|
refresh_cmd_timeout();
|
||||||
|
|
||||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
#if ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
||||||
|
|
||||||
if (!DEBUGGING(DRYRUN)) {
|
if (!DEBUGGING(DRYRUN)) {
|
||||||
if (destination[E_AXIS] != current_position[E_AXIS]) {
|
if (destination[E_AXIS] != current_position[E_AXIS]) {
|
||||||
if (thermalManager.tooColdToExtrude(active_extruder)) {
|
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||||
current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
if (thermalManager.tooColdToExtrude(active_extruder)) {
|
||||||
SERIAL_ECHO_START();
|
current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
||||||
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
|
SERIAL_ECHO_START();
|
||||||
}
|
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
|
||||||
|
}
|
||||||
|
#endif // PREVENT_COLD_EXTRUSION
|
||||||
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
||||||
if (fabs(destination[E_AXIS] - current_position[E_AXIS]) > EXTRUDE_MAXLENGTH / volumetric_multiplier[active_extruder]) {
|
if (FABS(destination[E_AXIS] - current_position[E_AXIS]) > (EXTRUDE_MAXLENGTH) / volumetric_multiplier[active_extruder]) {
|
||||||
current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
||||||
SERIAL_ECHO_START();
|
SERIAL_ECHO_START();
|
||||||
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
|
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
|
||||||
}
|
}
|
||||||
#endif
|
#endif // PREVENT_LENGTHY_EXTRUDE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,24 +719,28 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
|||||||
|
|
||||||
long de = target[E_AXIS] - position[E_AXIS];
|
long de = target[E_AXIS] - position[E_AXIS];
|
||||||
|
|
||||||
|
const float e_factor = volumetric_multiplier[extruder] * flow_percentage[extruder] * 0.01;
|
||||||
|
|
||||||
#if ENABLED(LIN_ADVANCE)
|
#if ENABLED(LIN_ADVANCE)
|
||||||
float de_float = e - position_float[E_AXIS];
|
float de_float = e - position_float[E_AXIS];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
#if ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
||||||
if (de) {
|
if (de) {
|
||||||
if (thermalManager.tooColdToExtrude(extruder)) {
|
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||||
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
if (thermalManager.tooColdToExtrude(extruder)) {
|
||||||
de = 0; // no difference
|
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
||||||
#if ENABLED(LIN_ADVANCE)
|
de = 0; // no difference
|
||||||
position_float[E_AXIS] = e;
|
#if ENABLED(LIN_ADVANCE)
|
||||||
de_float = 0;
|
position_float[E_AXIS] = e;
|
||||||
#endif
|
de_float = 0;
|
||||||
SERIAL_ECHO_START();
|
#endif
|
||||||
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
|
SERIAL_ECHO_START();
|
||||||
}
|
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
|
||||||
|
}
|
||||||
|
#endif // PREVENT_COLD_EXTRUSION
|
||||||
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
||||||
int32_t de_mm = labs(de * volumetric_multiplier[active_extruder]);
|
const int32_t de_mm = labs(de * e_factor);
|
||||||
if (de_mm > (int32_t)axis_steps_per_mm[E_AXIS_N] * (EXTRUDE_MAXLENGTH)) { // It's not important to get max. extrusion length in a precision < 1mm, so save some cycles and cast to int
|
if (de_mm > (int32_t)axis_steps_per_mm[E_AXIS_N] * (EXTRUDE_MAXLENGTH)) { // It's not important to get max. extrusion length in a precision < 1mm, so save some cycles and cast to int
|
||||||
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
||||||
de = 0; // no difference
|
de = 0; // no difference
|
||||||
@ -747,9 +751,9 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
|||||||
SERIAL_ECHO_START();
|
SERIAL_ECHO_START();
|
||||||
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
|
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
|
||||||
}
|
}
|
||||||
#endif
|
#endif // PREVENT_LENGTHY_EXTRUDE
|
||||||
}
|
}
|
||||||
#endif
|
#endif // PREVENT_COLD_EXTRUSION || PREVENT_LENGTHY_EXTRUDE
|
||||||
|
|
||||||
// Compute direction bit-mask for this block
|
// Compute direction bit-mask for this block
|
||||||
uint8_t dm = 0;
|
uint8_t dm = 0;
|
||||||
@ -778,7 +782,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
|||||||
#endif
|
#endif
|
||||||
if (de < 0) SBI(dm, E_AXIS);
|
if (de < 0) SBI(dm, E_AXIS);
|
||||||
|
|
||||||
const float esteps_float = de * volumetric_multiplier[extruder] * flow_percentage[extruder] * 0.01;
|
const float esteps_float = de * e_factor;
|
||||||
const int32_t esteps = abs(esteps_float) + 0.5;
|
const int32_t esteps = abs(esteps_float) + 0.5;
|
||||||
|
|
||||||
// Calculate the buffer head after we push this byte
|
// Calculate the buffer head after we push this byte
|
||||||
|
Loading…
Reference in New Issue
Block a user