extruder runout prevention.

This commit is contained in:
Bernhard 2011-12-09 13:39:00 +01:00
parent 5b4625f79c
commit 1ec0c3b68a
2 changed files with 28 additions and 4 deletions

View file

@ -156,6 +156,14 @@
#endif #endif
#endif // PIDTEMP #endif // PIDTEMP
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 60
#define EXTRUDER_RUNOUT_EXTRUDE 10 //mm filament
#define EXTRUDER_RUNOUT_SPEED 20 //extrusion speed
//=========================================================================== //===========================================================================
//=============================Mechanical Settings=========================== //=============================Mechanical Settings===========================

View file

@ -499,19 +499,16 @@ FORCE_INLINE void process_commands()
case 1: // G1 case 1: // G1
get_coordinates(); // For X Y Z E F get_coordinates(); // For X Y Z E F
prepare_move(); prepare_move();
previous_millis_cmd = millis();
//ClearToSend(); //ClearToSend();
return; return;
//break; //break;
case 2: // G2 - CW ARC case 2: // G2 - CW ARC
get_arc_coordinates(); get_arc_coordinates();
prepare_arc_move(true); prepare_arc_move(true);
previous_millis_cmd = millis();
return; return;
case 3: // G3 - CCW ARC case 3: // G3 - CCW ARC
get_arc_coordinates(); get_arc_coordinates();
prepare_arc_move(false); prepare_arc_move(false);
previous_millis_cmd = millis();
return; return;
case 4: // G4 dwell case 4: // G4 dwell
LCD_MESSAGEPGM("DWELL..."); LCD_MESSAGEPGM("DWELL...");
@ -521,7 +518,7 @@ FORCE_INLINE void process_commands()
st_synchronize(); st_synchronize();
codenum += millis(); // keep track of when we started waiting codenum += millis(); // keep track of when we started waiting
previous_millis_cmd = millis();
while(millis() < codenum ){ while(millis() < codenum ){
manage_heater(); manage_heater();
} }
@ -837,6 +834,7 @@ FORCE_INLINE void process_commands()
} }
LCD_MESSAGEPGM("Heating done."); LCD_MESSAGEPGM("Heating done.");
starttime=millis(); starttime=millis();
previous_millis_cmd = millis();
} }
break; break;
case 190: // M190 - Wait bed for heater to reach target. case 190: // M190 - Wait bed for heater to reach target.
@ -860,6 +858,7 @@ FORCE_INLINE void process_commands()
manage_heater(); manage_heater();
} }
LCD_MESSAGEPGM("Bed done."); LCD_MESSAGEPGM("Bed done.");
previous_millis_cmd = millis();
#endif #endif
break; break;
@ -1149,6 +1148,7 @@ FORCE_INLINE void get_arc_coordinates()
void prepare_move() void prepare_move()
{ {
if (min_software_endstops) { if (min_software_endstops) {
if (destination[X_AXIS] < 0) destination[X_AXIS] = 0.0; if (destination[X_AXIS] < 0) destination[X_AXIS] = 0.0;
if (destination[Y_AXIS] < 0) destination[Y_AXIS] = 0.0; if (destination[Y_AXIS] < 0) destination[Y_AXIS] = 0.0;
@ -1165,6 +1165,7 @@ void prepare_move()
for(int8_t i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
current_position[i] = destination[i]; current_position[i] = destination[i];
} }
previous_millis_cmd = millis();
} }
void prepare_arc_move(char isclockwise) { void prepare_arc_move(char isclockwise) {
@ -1179,6 +1180,7 @@ void prepare_arc_move(char isclockwise) {
for(int8_t i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
current_position[i] = destination[i]; current_position[i] = destination[i];
} }
previous_millis_cmd = millis();
} }
void manage_inactivity(byte debug) void manage_inactivity(byte debug)
@ -1194,6 +1196,20 @@ void manage_inactivity(byte debug)
disable_z(); disable_z();
disable_e(); disable_e();
} }
#ifdef EXTRUDER_RUNOUT_PREVENT
if( (millis()-previous_millis_cmd) > EXTRUDER_RUNOUT_SECONDS*1000 )
if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)
{
enable_e();
float oldepos=current_position[E_AXIS];
float oldedes=destination[E_AXIS];
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]+EXTRUDER_RUNOUT_EXTRUDE, EXTRUDER_RUNOUT_SPEED*feedmultiply/60/100.0, active_extruder);
current_position[E_AXIS]=oldepos;
destination[E_AXIS]=oldedes;
plan_set_e_position(oldepos);
previous_millis_cmd=millis();
}
#endif
check_axes_activity(); check_axes_activity();
} }