瀏覽代碼

prevent too long extrudes, or too cold extrudes

Bernhard 13 年之前
父節點
當前提交
2bc5e7ec9e
共有 4 個檔案被更改,包括 57 行新增13 行删除
  1. 10
    3
      Marlin/Configuration.h
  2. 19
    8
      Marlin/Marlin.pde
  3. 26
    2
      Marlin/planner.cpp
  4. 2
    0
      Marlin/planner.h

+ 10
- 3
Marlin/Configuration.h 查看文件

20
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
20
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
21
 #define MINIMUM_PLANNER_SPEED 2.0 // (mm/sec)
21
 #define MINIMUM_PLANNER_SPEED 2.0 // (mm/sec)
22
 
22
 
23
-// If defined the movements slow down when the look ahead buffer is only half full
24
-#define SLOWDOWN
25
-
26
 // BASIC SETTINGS: select your board type, thermistor type, axis scaling, and endstop configuration
23
 // BASIC SETTINGS: select your board type, thermistor type, axis scaling, and endstop configuration
27
 
24
 
28
 //// The following define selects which electronics board you have. Please choose the one that matches your setup
25
 //// The following define selects which electronics board you have. Please choose the one that matches your setup
248
 #define DEFAULT_XYJERK                20.0    // (mm/sec)
245
 #define DEFAULT_XYJERK                20.0    // (mm/sec)
249
 #define DEFAULT_ZJERK                 0.4     // (mm/sec)
246
 #define DEFAULT_ZJERK                 0.4     // (mm/sec)
250
 
247
 
248
+// If defined the movements slow down when the look ahead buffer is only half full
249
+#define SLOWDOWN
251
 
250
 
251
+//default stepper release if idle
252
+#define DEFAULT_STEPPER_DEACTIVE_TIME 60
253
+#define DEFAULT_STEPPER_DEACTIVE_COMMAND "M84 X Y E"  //z stays  powered
252
 
254
 
253
 
255
 
254
 //===========================================================================
256
 //===========================================================================
338
   #define AUTOTEMP_OLDWEIGHT 0.98
340
   #define AUTOTEMP_OLDWEIGHT 0.98
339
 #endif
341
 #endif
340
 
342
 
343
+//this prevents dangerous Extruder moves, i.e. if the temperature is under the limit
344
+//can be software-disabled for whatever purposes by
345
+#define PREVENT_DANGEROUS_EXTRUDE
346
+#define EXTRUDE_MINTEMP 190
347
+#define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances.
341
 
348
 
342
 const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
349
 const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
343
 
350
 

+ 19
- 8
Marlin/Marlin.pde 查看文件

110
 // M206 - set additional homeing offset
110
 // M206 - set additional homeing offset
111
 // M220 - set speed factor override percentage S:factor in percent
111
 // M220 - set speed factor override percentage S:factor in percent
112
 // M301 - Set PID parameters P I and D
112
 // M301 - Set PID parameters P I and D
113
+// M302 - Allow cold extrudes
113
 // M400 - Finish all moves
114
 // M400 - Finish all moves
114
 // M500 - stores paramters in EEPROM
115
 // M500 - stores paramters in EEPROM
115
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
116
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
176
 //Inactivity shutdown variables
177
 //Inactivity shutdown variables
177
 static unsigned long previous_millis_cmd = 0;
178
 static unsigned long previous_millis_cmd = 0;
178
 static unsigned long max_inactive_time = 0;
179
 static unsigned long max_inactive_time = 0;
179
-static unsigned long stepper_inactive_time = 0;
180
+static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000;
181
+static unsigned long last_stepperdisabled_time=30*1000; //first release check after 30 seconds
180
 
182
 
181
 static unsigned long starttime=0;
183
 static unsigned long starttime=0;
182
 static unsigned long stoptime=0;
184
 static unsigned long stoptime=0;
1057
       }
1059
       }
1058
       break;
1060
       break;
1059
     #endif //PIDTEMP
1061
     #endif //PIDTEMP
1062
+      
1063
+    case 302: // finish all moves
1064
+    {
1065
+      allow_cold_extrudes(true);
1066
+    }
1067
+    break;
1060
     case 400: // finish all moves
1068
     case 400: // finish all moves
1061
     {
1069
     {
1062
       st_synchronize();
1070
       st_synchronize();
1188
   if( (millis()-previous_millis_cmd) >  max_inactive_time ) 
1196
   if( (millis()-previous_millis_cmd) >  max_inactive_time ) 
1189
     if(max_inactive_time) 
1197
     if(max_inactive_time) 
1190
       kill(); 
1198
       kill(); 
1191
-  if( (millis()-previous_millis_cmd) >  stepper_inactive_time ) 
1192
-    if(stepper_inactive_time) 
1193
-    { 
1194
-      disable_x(); 
1195
-      disable_y(); 
1196
-      disable_z(); 
1197
-      disable_e(); 
1199
+  if(stepper_inactive_time)  
1200
+  if( (millis()-last_stepperdisabled_time) >  stepper_inactive_time ) 
1201
+  {
1202
+    if(previous_millis_cmd>last_stepperdisabled_time)
1203
+      last_stepperdisabled_time=previous_millis_cmd;
1204
+    else
1205
+    {
1206
+      enquecommand(DEFAULT_STEPPER_DEACTIVE_COMMAND); 
1207
+      last_stepperdisabled_time=millis();
1198
     }
1208
     }
1209
+  }
1199
   #ifdef EXTRUDER_RUNOUT_PREVENT
1210
   #ifdef EXTRUDER_RUNOUT_PREVENT
1200
     if( (millis()-previous_millis_cmd) >  EXTRUDER_RUNOUT_SECONDS*1000 ) 
1211
     if( (millis()-previous_millis_cmd) >  EXTRUDER_RUNOUT_SECONDS*1000 ) 
1201
     if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)
1212
     if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)

+ 26
- 2
Marlin/planner.cpp 查看文件

106
 //===========================================================================
106
 //===========================================================================
107
 //=============================private variables ============================
107
 //=============================private variables ============================
108
 //===========================================================================
108
 //===========================================================================
109
-
109
+#ifdef PREVENT_DANGEROUS_EXTRUDE
110
+  bool allow_cold_extrude=false;
111
+#endif
110
 #ifdef XY_FREQUENCY_LIMIT
112
 #ifdef XY_FREQUENCY_LIMIT
111
   // Used for the frequency limit
113
   // Used for the frequency limit
112
   static unsigned char old_direction_bits = 0;               // Old direction bits. Used for speed calculations
114
   static unsigned char old_direction_bits = 0;               // Old direction bits. Used for speed calculations
465
   target[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]);
467
   target[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]);
466
   target[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]);
468
   target[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]);
467
   target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]);     
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
   // Prepare to set up new block
488
   // Prepare to set up new block
471
   block_t *block = &block_buffer[block_buffer_head];
489
   block_t *block = &block_buffer[block_buffer_head];
786
  return (block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
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
+}

+ 2
- 0
Marlin/planner.h 查看文件

140
   else
140
   else
141
     return true;
141
     return true;
142
 }
142
 }
143
+
144
+void allow_cold_extrudes(bool allow);
143
 #endif
145
 #endif

Loading…
取消
儲存