소스 검색

prevent too long extrudes, or too cold extrudes

Bernhard 12 년 전
부모
커밋
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,9 +20,6 @@
20 20
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
21 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 23
 // BASIC SETTINGS: select your board type, thermistor type, axis scaling, and endstop configuration
27 24
 
28 25
 //// 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
248 245
 #define DEFAULT_XYJERK                20.0    // (mm/sec)
249 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,6 +340,11 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
338 340
   #define AUTOTEMP_OLDWEIGHT 0.98
339 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 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,6 +110,7 @@
110 110
 // M206 - set additional homeing offset
111 111
 // M220 - set speed factor override percentage S:factor in percent
112 112
 // M301 - Set PID parameters P I and D
113
+// M302 - Allow cold extrudes
113 114
 // M400 - Finish all moves
114 115
 // M500 - stores paramters in EEPROM
115 116
 // 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
176 177
 //Inactivity shutdown variables
177 178
 static unsigned long previous_millis_cmd = 0;
178 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 183
 static unsigned long starttime=0;
182 184
 static unsigned long stoptime=0;
@@ -1057,6 +1059,12 @@ FORCE_INLINE void process_commands()
1057 1059
       }
1058 1060
       break;
1059 1061
     #endif //PIDTEMP
1062
+      
1063
+    case 302: // finish all moves
1064
+    {
1065
+      allow_cold_extrudes(true);
1066
+    }
1067
+    break;
1060 1068
     case 400: // finish all moves
1061 1069
     {
1062 1070
       st_synchronize();
@@ -1188,14 +1196,17 @@ void manage_inactivity(byte debug)
1188 1196
   if( (millis()-previous_millis_cmd) >  max_inactive_time ) 
1189 1197
     if(max_inactive_time) 
1190 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 1210
   #ifdef EXTRUDER_RUNOUT_PREVENT
1200 1211
     if( (millis()-previous_millis_cmd) >  EXTRUDER_RUNOUT_SECONDS*1000 ) 
1201 1212
     if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)

+ 26
- 2
Marlin/planner.cpp 파일 보기

@@ -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
+}

+ 2
- 0
Marlin/planner.h 파일 보기

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

Loading…
취소
저장