prevent too long extrudes, or too cold extrudes

This commit is contained in:
Bernhard 2011-12-09 15:09:52 +01:00
parent aa4f9a6474
commit 2bc5e7ec9e
4 changed files with 57 additions and 13 deletions

View file

@ -20,9 +20,6 @@
// if unwanted behavior is observed on a user's machine when running at very slow speeds.
#define MINIMUM_PLANNER_SPEED 2.0 // (mm/sec)
// If defined the movements slow down when the look ahead buffer is only half full
#define SLOWDOWN
// BASIC SETTINGS: select your board type, thermistor type, axis scaling, and endstop configuration
//// The following define selects which electronics board you have. Please choose the one that matches your setup
@ -248,7 +245,12 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
#define DEFAULT_XYJERK 20.0 // (mm/sec)
#define DEFAULT_ZJERK 0.4 // (mm/sec)
// If defined the movements slow down when the look ahead buffer is only half full
#define SLOWDOWN
//default stepper release if idle
#define DEFAULT_STEPPER_DEACTIVE_TIME 60
#define DEFAULT_STEPPER_DEACTIVE_COMMAND "M84 X Y E" //z stays powered
//===========================================================================
@ -338,6 +340,11 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
#define AUTOTEMP_OLDWEIGHT 0.98
#endif
//this prevents dangerous Extruder moves, i.e. if the temperature is under the limit
//can be software-disabled for whatever purposes by
#define PREVENT_DANGEROUS_EXTRUDE
#define EXTRUDE_MINTEMP 190
#define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances.
const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement

View file

@ -110,6 +110,7 @@
// M206 - set additional homeing offset
// M220 - set speed factor override percentage S:factor in percent
// M301 - Set PID parameters P I and D
// M302 - Allow cold extrudes
// M400 - Finish all moves
// M500 - stores paramters in EEPROM
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
@ -176,7 +177,8 @@ const int sensitive_pins[] = SENSITIVE_PINS; // Sensitive pin list for M42
//Inactivity shutdown variables
static unsigned long previous_millis_cmd = 0;
static unsigned long max_inactive_time = 0;
static unsigned long stepper_inactive_time = 0;
static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000;
static unsigned long last_stepperdisabled_time=30*1000; //first release check after 30 seconds
static unsigned long starttime=0;
static unsigned long stoptime=0;
@ -1057,6 +1059,12 @@ FORCE_INLINE void process_commands()
}
break;
#endif //PIDTEMP
case 302: // finish all moves
{
allow_cold_extrudes(true);
}
break;
case 400: // finish all moves
{
st_synchronize();
@ -1188,14 +1196,17 @@ void manage_inactivity(byte debug)
if( (millis()-previous_millis_cmd) > max_inactive_time )
if(max_inactive_time)
kill();
if( (millis()-previous_millis_cmd) > stepper_inactive_time )
if(stepper_inactive_time)
{
disable_x();
disable_y();
disable_z();
disable_e();
if(stepper_inactive_time)
if( (millis()-last_stepperdisabled_time) > stepper_inactive_time )
{
if(previous_millis_cmd>last_stepperdisabled_time)
last_stepperdisabled_time=previous_millis_cmd;
else
{
enquecommand(DEFAULT_STEPPER_DEACTIVE_COMMAND);
last_stepperdisabled_time=millis();
}
}
#ifdef EXTRUDER_RUNOUT_PREVENT
if( (millis()-previous_millis_cmd) > EXTRUDER_RUNOUT_SECONDS*1000 )
if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)

View file

@ -106,7 +106,9 @@ volatile unsigned char block_buffer_tail; // Index of the block to pro
//===========================================================================
//=============================private variables ============================
//===========================================================================
#ifdef PREVENT_DANGEROUS_EXTRUDE
bool allow_cold_extrude=false;
#endif
#ifdef XY_FREQUENCY_LIMIT
// Used for the frequency limit
static unsigned char old_direction_bits = 0; // Old direction bits. Used for speed calculations
@ -465,7 +467,23 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
target[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]);
target[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]);
target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]);
target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]);
target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]);
#ifdef PREVENT_DANGEROUS_EXTRUDE
if(target[E_AXIS]!=position[E_AXIS])
if(degHotend(active_extruder)<EXTRUDE_MINTEMP && !allow_cold_extrude)
{
position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(" cold extrusion prevented");
}
if(labs(target[E_AXIS]-position[E_AXIS])>axis_steps_per_unit[E_AXIS]*EXTRUDE_MAXLENGTH)
{
position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(" too long extrusion prevented");
}
#endif
// Prepare to set up new block
block_t *block = &block_buffer[block_buffer_head];
@ -786,3 +804,9 @@ uint8_t movesplanned()
return (block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
}
void allow_cold_extrudes(bool allow)
{
#ifdef PREVENT_DANGEROUS_EXTRUDE
allow_cold_extrude=allow;
#endif
}

View file

@ -140,4 +140,6 @@ FORCE_INLINE bool blocks_queued()
else
return true;
}
void allow_cold_extrudes(bool allow);
#endif