Catch dangerous extrude before trying several
This commit is contained in:
parent
bb917ecda8
commit
1269c445ab
@ -273,6 +273,10 @@ extern bool axis_known_position[3];
|
||||
extern float zprobe_zoffset;
|
||||
#endif
|
||||
|
||||
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
||||
extern float extrude_min_temp;
|
||||
#endif
|
||||
|
||||
extern int fanSpeed;
|
||||
|
||||
#ifdef BARICUDA
|
||||
|
@ -380,12 +380,13 @@ bool target_direction;
|
||||
void get_arc_coordinates();
|
||||
bool setTargetedHotend(int code);
|
||||
|
||||
void serial_echopair_P(const char *s_P, float v)
|
||||
{ serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_P(const char *s_P, double v)
|
||||
{ serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_P(const char *s_P, unsigned long v)
|
||||
{ serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_P(const char *s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_P(const char *s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_P(const char *s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
|
||||
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
||||
float extrude_min_temp = EXTRUDE_MINTEMP;
|
||||
#endif
|
||||
|
||||
#ifdef SDSUPPORT
|
||||
#include "SdFatUtil.h"
|
||||
@ -1009,8 +1010,11 @@ inline void line_to_current_position() {
|
||||
inline void line_to_z(float zPosition) {
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
|
||||
}
|
||||
inline void line_to_destination(float mm_m) {
|
||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], mm_m/60, active_extruder);
|
||||
}
|
||||
inline void line_to_destination() {
|
||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
||||
line_to_destination(feedrate);
|
||||
}
|
||||
inline void sync_plan_position() {
|
||||
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||
@ -4099,6 +4103,8 @@ inline void gcode_M226() {
|
||||
|
||||
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
||||
|
||||
void set_extrude_min_temp(float temp) { extrude_min_temp = temp; }
|
||||
|
||||
/**
|
||||
* M302: Allow cold extrudes, or set the minimum extrude S<temperature>.
|
||||
*/
|
||||
@ -5444,15 +5450,31 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
||||
void prepare_move() {
|
||||
clamp_to_software_endstops(destination);
|
||||
refresh_cmd_timeout();
|
||||
|
||||
|
||||
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
||||
float de = destination[E_AXIS] - current_position[E_AXIS];
|
||||
if (de) {
|
||||
if (degHotend(active_extruder) < extrude_min_temp) {
|
||||
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);
|
||||
}
|
||||
#ifdef PREVENT_LENGTHY_EXTRUDE
|
||||
if (labs(de) > EXTRUDE_MAXLENGTH) {
|
||||
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
|
||||
|
||||
#ifdef SCARA //for now same as delta-code
|
||||
|
||||
float difference[NUM_AXIS];
|
||||
for (int8_t i = 0; i < NUM_AXIS; i++) difference[i] = destination[i] - current_position[i];
|
||||
|
||||
float cartesian_mm = sqrt( sq(difference[X_AXIS]) +
|
||||
sq(difference[Y_AXIS]) +
|
||||
sq(difference[Z_AXIS]));
|
||||
float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS]));
|
||||
if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); }
|
||||
if (cartesian_mm < 0.000001) { return; }
|
||||
float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
|
||||
@ -5464,9 +5486,7 @@ void prepare_move() {
|
||||
|
||||
for (int s = 1; s <= steps; s++) {
|
||||
float fraction = float(s) / float(steps);
|
||||
for(int8_t i = 0; i < NUM_AXIS; i++) {
|
||||
destination[i] = current_position[i] + difference[i] * fraction;
|
||||
}
|
||||
for (int8_t i = 0; i < NUM_AXIS; i++) destination[i] = current_position[i] + difference[i] * fraction;
|
||||
|
||||
calculate_delta(destination);
|
||||
//SERIAL_ECHOPGM("destination[X_AXIS]="); SERIAL_ECHOLN(destination[X_AXIS]);
|
||||
@ -5476,9 +5496,7 @@ void prepare_move() {
|
||||
//SERIAL_ECHOPGM("delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]);
|
||||
//SERIAL_ECHOPGM("delta[Z_AXIS]="); SERIAL_ECHOLN(delta[Z_AXIS]);
|
||||
|
||||
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS],
|
||||
destination[E_AXIS], feedrate*feedmultiply/60/100.0,
|
||||
active_extruder);
|
||||
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
|
||||
}
|
||||
|
||||
#endif // SCARA
|
||||
@ -5488,9 +5506,7 @@ void prepare_move() {
|
||||
float difference[NUM_AXIS];
|
||||
for (int8_t i=0; i < NUM_AXIS; i++) difference[i] = destination[i] - current_position[i];
|
||||
|
||||
float cartesian_mm = sqrt(sq(difference[X_AXIS]) +
|
||||
sq(difference[Y_AXIS]) +
|
||||
sq(difference[Z_AXIS]));
|
||||
float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS]));
|
||||
if (cartesian_mm < 0.000001) cartesian_mm = abs(difference[E_AXIS]);
|
||||
if (cartesian_mm < 0.000001) return;
|
||||
float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
|
||||
@ -5507,9 +5523,7 @@ void prepare_move() {
|
||||
#ifdef ENABLE_AUTO_BED_LEVELING
|
||||
adjust_delta(destination);
|
||||
#endif
|
||||
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS],
|
||||
destination[E_AXIS], feedrate*feedmultiply/60/100.0,
|
||||
active_extruder);
|
||||
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
|
||||
}
|
||||
|
||||
#endif // DELTA
|
||||
@ -5519,8 +5533,8 @@ void prepare_move() {
|
||||
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
|
||||
// move duplicate extruder into correct duplication position.
|
||||
plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||
plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, current_position[Y_AXIS], current_position[Z_AXIS],
|
||||
current_position[E_AXIS], max_feedrate[X_AXIS], 1);
|
||||
plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset,
|
||||
current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[X_AXIS], 1);
|
||||
sync_plan_position();
|
||||
st_synchronize();
|
||||
extruder_duplication_enabled = true;
|
||||
@ -5528,23 +5542,21 @@ void prepare_move() {
|
||||
}
|
||||
else if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE) { // handle unparking of head
|
||||
if (current_position[E_AXIS] == destination[E_AXIS]) {
|
||||
// this is a travel move - skit it but keep track of current position (so that it can later
|
||||
// be used as start of first non-travel move)
|
||||
// This is a travel move (with no extrusion)
|
||||
// Skip it, but keep track of the current position
|
||||
// (so it can be used as the start of the next non-travel move)
|
||||
if (delayed_move_time != 0xFFFFFFFFUL) {
|
||||
set_current_to_destination();
|
||||
if (destination[Z_AXIS] > raised_parked_position[Z_AXIS])
|
||||
raised_parked_position[Z_AXIS] = destination[Z_AXIS];
|
||||
if (destination[Z_AXIS] > raised_parked_position[Z_AXIS]) raised_parked_position[Z_AXIS] = destination[Z_AXIS];
|
||||
delayed_move_time = millis();
|
||||
return;
|
||||
}
|
||||
}
|
||||
delayed_move_time = 0;
|
||||
// unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
|
||||
plan_buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS],
|
||||
current_position[E_AXIS], min(max_feedrate[X_AXIS],max_feedrate[Y_AXIS]), active_extruder);
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
|
||||
current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
||||
plan_buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], min(max_feedrate[X_AXIS], max_feedrate[Y_AXIS]), active_extruder);
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
||||
active_extruder_parked = false;
|
||||
}
|
||||
}
|
||||
@ -5552,7 +5564,7 @@ void prepare_move() {
|
||||
|
||||
#if !defined(DELTA) && !defined(SCARA)
|
||||
// Do not use feedmultiply for E or Z only moves
|
||||
if ( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) {
|
||||
if (current_position[X_AXIS] == destination[X_AXIS] && current_position[Y_AXIS] == destination[Y_AXIS]) {
|
||||
line_to_destination();
|
||||
}
|
||||
else {
|
||||
@ -5560,7 +5572,7 @@ void prepare_move() {
|
||||
mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], (feedrate/60)*(feedmultiply/100.0), active_extruder);
|
||||
return;
|
||||
#else
|
||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], (feedrate/60)*(feedmultiply/100.0), active_extruder);
|
||||
line_to_destination(feedrate * feedmultiply / 100.0);
|
||||
#endif // MESH_BED_LEVELING
|
||||
}
|
||||
#endif // !(DELTA || SCARA)
|
||||
|
@ -113,9 +113,6 @@ volatile unsigned char block_buffer_tail; // Index of the block to pro
|
||||
//===========================================================================
|
||||
//=============================private variables ============================
|
||||
//===========================================================================
|
||||
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
||||
float extrude_min_temp = EXTRUDE_MINTEMP;
|
||||
#endif
|
||||
#ifdef XY_FREQUENCY_LIMIT
|
||||
// Used for the frequency limit
|
||||
#define MAX_FREQ_TIME (1000000.0/XY_FREQUENCY_LIMIT)
|
||||
@ -508,7 +505,7 @@ float junction_deviation = 0.1;
|
||||
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
||||
if (de) {
|
||||
if (degHotend(active_extruder) < extrude_min_temp) {
|
||||
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
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
|
||||
@ -998,10 +995,6 @@ void plan_set_e_position(const float &e) {
|
||||
st_set_e_position(position[E_AXIS]);
|
||||
}
|
||||
|
||||
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
||||
void set_extrude_min_temp(float temp) { extrude_min_temp = temp; }
|
||||
#endif
|
||||
|
||||
// Calculate the steps/s^2 acceleration rates, based on the mm/s^s
|
||||
void reset_acceleration_rates() {
|
||||
for (int i = 0; i < NUM_AXIS; i++)
|
||||
|
@ -161,10 +161,6 @@ FORCE_INLINE block_t *plan_get_current_block() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
||||
void set_extrude_min_temp(float temp);
|
||||
#endif
|
||||
|
||||
void reset_acceleration_rates();
|
||||
|
||||
#endif //PLANNER_H
|
||||
#endif // PLANNER_H
|
||||
|
Loading…
Reference in New Issue
Block a user