|
@@ -106,7 +106,9 @@ volatile unsigned char block_buffer_tail; // Index of the block to pro
|
106
|
106
|
//===========================================================================
|
107
|
107
|
//=============================private variables ============================
|
108
|
108
|
//===========================================================================
|
109
|
|
-
|
|
109
|
+#ifdef PREVENT_DANGEROUS_EXTRUDE
|
|
110
|
+ bool allow_cold_extrude=false;
|
|
111
|
+#endif
|
110
|
112
|
#ifdef XY_FREQUENCY_LIMIT
|
111
|
113
|
// Used for the frequency limit
|
112
|
114
|
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
|
465
|
467
|
target[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]);
|
466
|
468
|
target[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]);
|
467
|
469
|
target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]);
|
468
|
|
- target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]);
|
|
470
|
+ target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]);
|
|
471
|
+
|
|
472
|
+ #ifdef PREVENT_DANGEROUS_EXTRUDE
|
|
473
|
+ if(target[E_AXIS]!=position[E_AXIS])
|
|
474
|
+ if(degHotend(active_extruder)<EXTRUDE_MINTEMP && !allow_cold_extrude)
|
|
475
|
+ {
|
|
476
|
+ position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part
|
|
477
|
+ SERIAL_ECHO_START;
|
|
478
|
+ SERIAL_ECHOLNPGM(" cold extrusion prevented");
|
|
479
|
+ }
|
|
480
|
+ if(labs(target[E_AXIS]-position[E_AXIS])>axis_steps_per_unit[E_AXIS]*EXTRUDE_MAXLENGTH)
|
|
481
|
+ {
|
|
482
|
+ position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part
|
|
483
|
+ SERIAL_ECHO_START;
|
|
484
|
+ SERIAL_ECHOLNPGM(" too long extrusion prevented");
|
|
485
|
+ }
|
|
486
|
+ #endif
|
469
|
487
|
|
470
|
488
|
// Prepare to set up new block
|
471
|
489
|
block_t *block = &block_buffer[block_buffer_head];
|
|
@@ -786,3 +804,9 @@ uint8_t movesplanned()
|
786
|
804
|
return (block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
|
787
|
805
|
}
|
788
|
806
|
|
|
807
|
+void allow_cold_extrudes(bool allow)
|
|
808
|
+{
|
|
809
|
+ #ifdef PREVENT_DANGEROUS_EXTRUDE
|
|
810
|
+ allow_cold_extrude=allow;
|
|
811
|
+ #endif
|
|
812
|
+}
|