// 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
#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
//===========================================================================
#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
// 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).
//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;
}
break;
#endif //PIDTEMP
+
+ case 302: // finish all moves
+ {
+ allow_cold_extrudes(true);
+ }
+ break;
case 400: // finish all moves
{
st_synchronize();
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)
//===========================================================================
//=============================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
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];
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
+}
\ No newline at end of file
else
return true;
}
+
+void allow_cold_extrudes(bool allow);
#endif