Normalize load/unload length in M600

This commit is contained in:
Thomas Moore 2017-11-09 22:50:32 -06:00 committed by Scott Lahteine
parent 81b91b3f9d
commit 600c85226e
3 changed files with 33 additions and 26 deletions

View file

@ -94,7 +94,7 @@ static void ensure_safe_temperature() {
}
void do_pause_e_move(const float &length, const float fr) {
current_position[E_AXIS] += length;
current_position[E_AXIS] += length * 100.0 / planner.flow_percentage[active_extruder] / planner.volumetric_multiplier[active_extruder];
set_destination_from_current();
#if IS_KINEMATIC
planner.buffer_line_kinematic(destination, fr, active_extruder);

View file

@ -790,26 +790,28 @@ void prepare_move_to_destination() {
clamp_to_software_endstops(destination);
gcode.refresh_cmd_timeout();
#if ENABLED(PREVENT_COLD_EXTRUSION)
#if ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE)
if (!DEBUGGING(DRYRUN)) {
if (destination[E_AXIS] != current_position[E_AXIS]) {
if (thermalManager.tooColdToExtrude(active_extruder)) {
current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
}
#if ENABLED(PREVENT_COLD_EXTRUSION)
if (thermalManager.tooColdToExtrude(active_extruder)) {
current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
}
#endif // PREVENT_COLD_EXTRUSION
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
if (destination[E_AXIS] - current_position[E_AXIS] > EXTRUDE_MAXLENGTH) {
if (FABS(destination[E_AXIS] - current_position[E_AXIS]) > (EXTRUDE_MAXLENGTH) / planner.volumetric_multiplier[active_extruder]) {
current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
}
#endif
#endif // PREVENT_LENGTHY_EXTRUDE
}
}
#endif
#endif // PREVENT_COLD_EXTRUSION || PREVENT_LENGTHY_EXTRUDE
if (
#if UBL_DELTA // Also works for CARTESIAN (smaller segments follow mesh more closely)

View file

@ -740,24 +740,29 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
long de = target[E_AXIS] - position[E_AXIS];
const float e_factor = volumetric_multiplier[extruder] * flow_percentage[extruder] * 0.01;
#if ENABLED(LIN_ADVANCE)
float de_float = e - position_float[E_AXIS];
float de_float = e - position_float[E_AXIS]; // Should this include e_factor?
#endif
#if ENABLED(PREVENT_COLD_EXTRUSION)
#if ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE)
if (de) {
if (thermalManager.tooColdToExtrude(extruder)) {
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
de = 0; // no difference
#if ENABLED(LIN_ADVANCE)
position_float[E_AXIS] = e;
de_float = 0;
#endif
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
}
#if ENABLED(PREVENT_COLD_EXTRUSION)
if (thermalManager.tooColdToExtrude(extruder)) {
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
de = 0; // no difference
#if ENABLED(LIN_ADVANCE)
position_float[E_AXIS] = e;
de_float = 0;
#endif
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
}
#endif // PREVENT_COLD_EXTRUSION
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
if (labs(de) > (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
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
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
de = 0; // no difference
#if ENABLED(LIN_ADVANCE)
@ -767,9 +772,9 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
SERIAL_ECHO_START();
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
uint8_t dm = 0;
@ -798,7 +803,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
#endif
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;
// Calculate the buffer head after we push this byte