Browse Source

prevent too long extrudes, or too cold extrudes

pull/1/head
Bernhard 13 years ago
parent
commit
2bc5e7ec9e
  1. 13
      Marlin/Configuration.h
  2. 23
      Marlin/Marlin.pde
  3. 26
      Marlin/planner.cpp
  4. 2
      Marlin/planner.h

13
Marlin/Configuration.h

@ -20,9 +20,6 @@
// if unwanted behavior is observed on a user's machine when running at very slow speeds. // if unwanted behavior is observed on a user's machine when running at very slow speeds.
#define MINIMUM_PLANNER_SPEED 2.0 // (mm/sec) #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 // 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 //// 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_XYJERK 20.0 // (mm/sec)
#define DEFAULT_ZJERK 0.4 // (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 #define AUTOTEMP_OLDWEIGHT 0.98
#endif #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 const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement

23
Marlin/Marlin.pde

@ -110,6 +110,7 @@
// M206 - set additional homeing offset // M206 - set additional homeing offset
// M220 - set speed factor override percentage S:factor in percent // M220 - set speed factor override percentage S:factor in percent
// M301 - Set PID parameters P I and D // M301 - Set PID parameters P I and D
// M302 - Allow cold extrudes
// M400 - Finish all moves // M400 - Finish all moves
// M500 - stores paramters in EEPROM // M500 - stores paramters in EEPROM
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily). // 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 //Inactivity shutdown variables
static unsigned long previous_millis_cmd = 0; static unsigned long previous_millis_cmd = 0;
static unsigned long max_inactive_time = 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 starttime=0;
static unsigned long stoptime=0; static unsigned long stoptime=0;
@ -1057,6 +1059,12 @@ FORCE_INLINE void process_commands()
} }
break; break;
#endif //PIDTEMP #endif //PIDTEMP
case 302: // finish all moves
{
allow_cold_extrudes(true);
}
break;
case 400: // finish all moves case 400: // finish all moves
{ {
st_synchronize(); st_synchronize();
@ -1188,13 +1196,16 @@ void manage_inactivity(byte debug)
if( (millis()-previous_millis_cmd) > max_inactive_time ) if( (millis()-previous_millis_cmd) > max_inactive_time )
if(max_inactive_time) if(max_inactive_time)
kill(); kill();
if( (millis()-previous_millis_cmd) > stepper_inactive_time )
if(stepper_inactive_time) if(stepper_inactive_time)
if( (millis()-last_stepperdisabled_time) > stepper_inactive_time )
{ {
disable_x(); if(previous_millis_cmd>last_stepperdisabled_time)
disable_y(); last_stepperdisabled_time=previous_millis_cmd;
disable_z(); else
disable_e(); {
enquecommand(DEFAULT_STEPPER_DEACTIVE_COMMAND);
last_stepperdisabled_time=millis();
}
} }
#ifdef EXTRUDER_RUNOUT_PREVENT #ifdef EXTRUDER_RUNOUT_PREVENT
if( (millis()-previous_millis_cmd) > EXTRUDER_RUNOUT_SECONDS*1000 ) if( (millis()-previous_millis_cmd) > EXTRUDER_RUNOUT_SECONDS*1000 )

26
Marlin/planner.cpp

@ -106,7 +106,9 @@ volatile unsigned char block_buffer_tail; // Index of the block to pro
//=========================================================================== //===========================================================================
//=============================private variables ============================ //=============================private variables ============================
//=========================================================================== //===========================================================================
#ifdef PREVENT_DANGEROUS_EXTRUDE
bool allow_cold_extrude=false;
#endif
#ifdef XY_FREQUENCY_LIMIT #ifdef XY_FREQUENCY_LIMIT
// Used for the frequency limit // Used for the frequency limit
static unsigned char old_direction_bits = 0; // Old direction bits. Used for speed calculations static unsigned char old_direction_bits = 0; // Old direction bits. Used for speed calculations
@ -467,6 +469,22 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_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 // Prepare to set up new block
block_t *block = &block_buffer[block_buffer_head]; 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); 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
}

2
Marlin/planner.h

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

Loading…
Cancel
Save