瀏覽代碼

untestest commit, so I don't loose code.. features runout prevention addons

Bernhard 12 年之前
父節點
當前提交
651cde8b98
共有 4 個文件被更改,包括 80 次插入25 次删除
  1. 1
    1
      Marlin/Configuration.h
  2. 65
    21
      Marlin/Marlin.pde
  3. 9
    3
      Marlin/stepper.cpp
  4. 5
    0
      Marlin/temperature.cpp

+ 1
- 1
Marlin/Configuration.h 查看文件

@@ -248,7 +248,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
248 248
 #define SLOWDOWN
249 249
 
250 250
 //default stepper release if idle
251
-#define DEFAULT_STEPPER_DEACTIVE_TIME 60
251
+#define DEFAULT_STEPPER_DEACTIVE_TIME 1200
252 252
 #define DEFAULT_STEPPER_DEACTIVE_COMMAND "M84 X Y E"  //z stays  powered
253 253
 
254 254
 

+ 65
- 21
Marlin/Marlin.pde 查看文件

@@ -176,8 +176,10 @@ const int sensitive_pins[] = SENSITIVE_PINS; // Sensitive pin list for M42
176 176
 
177 177
 //Inactivity shutdown variables
178 178
 static unsigned long previous_millis_cmd = 0;
179
-static unsigned long max_inactive_time = 0;
180
-static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000;
179
+static unsigned long previous_millis_runoutprevent = 0;
180
+//static unsigned long previous_millis_beep = 0;
181
+static unsigned long max_inactive_time=0;
182
+static unsigned long stepper_inactive_time = 0;
181 183
 static unsigned long last_stepperdisabled_time=30*1000; //first release check after 30 seconds
182 184
 
183 185
 static unsigned long starttime=0;
@@ -243,6 +245,10 @@ void setup()
243 245
     fromsd[i] = false;
244 246
   }
245 247
   
248
+  max_inactive_time = DEFAULT_MAX_INACTIVE_TIME*1000;
249
+  stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000;
250
+
251
+  
246 252
   EEPROM_RetrieveSettings(); // loads data from EEPROM if available
247 253
 
248 254
   for(int8_t i=0; i < NUM_AXIS; i++)
@@ -415,6 +421,7 @@ FORCE_INLINE void get_command()
415 421
         SERIAL_ECHO_START;
416 422
         SERIAL_ECHOLN(time);
417 423
         LCD_MESSAGE(time);
424
+        st_synchronize();
418 425
         card.printingHasFinished();
419 426
         card.checkautostart(true);
420 427
         
@@ -1200,11 +1207,34 @@ void prepare_arc_move(char isclockwise) {
1200 1207
 
1201 1208
 void manage_inactivity(byte debug) 
1202 1209
 { 
1203
-  if( (millis()-previous_millis_cmd) >  max_inactive_time ) 
1210
+  unsigned long curtime=millis();
1211
+  SERIAL_ECHO_START;
1212
+  SERIAL_ECHO("MS");
1213
+  SERIAL_ECHO(millis());
1214
+  SERIAL_ECHO(" PREV_CMD");
1215
+  SERIAL_ECHO(previous_millis_cmd);
1216
+  SERIAL_ECHO(" maxinactive");
1217
+  SERIAL_ECHOLN(max_inactive_time );
1218
+  
1219
+  if( (curtime-previous_millis_cmd) >  max_inactive_time ) 
1204 1220
     if(max_inactive_time) 
1221
+    {
1222
+      LCD_MESSAGEPGM("Bored Shutdown.");
1223
+      SERIAL_ERROR_START;
1224
+      SERIAL_ERRORLNPGM("Bored Shutdown.");
1205 1225
       kill(); 
1226
+    }
1227
+    
1228
+  if( (curtime-previous_millis_cmd) >  DEFAULT_MAX_HOT_TIME*1000 ) 
1229
+    if(DEFAULT_MAX_HOT_TIME && (degHotend0()>HOTTEMP) ) 
1230
+    {
1231
+      LCD_MESSAGEPGM("Hot too long.");
1232
+      SERIAL_ECHO_START;
1233
+      SERIAL_ECHOLNPGM("Hot too long");
1234
+      disable_heater();
1235
+    }
1206 1236
   if(stepper_inactive_time)  
1207
-  if( (millis()-last_stepperdisabled_time) >  stepper_inactive_time ) 
1237
+  if( (curtime-last_stepperdisabled_time) >  stepper_inactive_time ) 
1208 1238
   {
1209 1239
     if(previous_millis_cmd>last_stepperdisabled_time)
1210 1240
       last_stepperdisabled_time=previous_millis_cmd;
@@ -1216,23 +1246,37 @@ void manage_inactivity(byte debug)
1216 1246
     }
1217 1247
   }
1218 1248
   #ifdef EXTRUDER_RUNOUT_PREVENT
1219
-    if( (millis()-previous_millis_cmd) >  EXTRUDER_RUNOUT_SECONDS*1000 ) 
1220
-    if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)
1249
+    if(!blocks_queued())
1250
+    if( (curtime-previous_millis_cmd) >  EXTRUDER_RUNOUT_SECONDS*1000 ) 
1221 1251
     {
1222
-     bool oldstatus=READ(E_ENABLE_PIN);
1223
-     enable_e();
1224
-     float oldepos=current_position[E_AXIS];
1225
-     float oldedes=destination[E_AXIS];
1226
-     plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], 
1227
-                      current_position[E_AXIS]+EXTRUDER_RUNOUT_EXTRUDE*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS], 
1228
-                      EXTRUDER_RUNOUT_SPEED/60.*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS], active_extruder);
1229
-     current_position[E_AXIS]=oldepos;
1230
-     destination[E_AXIS]=oldedes;
1231
-     plan_set_e_position(oldepos);
1232
-     previous_millis_cmd=millis();
1233
-     //enquecommand(DEFAULT_STEPPER_DEACTIVE_COMMAND);
1234
-     st_synchronize();
1235
-     WRITE(E_ENABLE_PIN,oldstatus);
1252
+      if(previous_millis_cmd>previous_millis_runoutprevent)
1253
+      {
1254
+       previous_millis_runoutprevent=previous_millis_cmd; 
1255
+      }
1256
+      
1257
+      if(degHotend0()>EXTRUDER_RUNOUT_MINTEMP)
1258
+      if((curtime-previous_millis_runoutprevent) >  EXTRUDER_RUNOUT_SECONDS*1000)
1259
+      {
1260
+        bool oldstatus=READ(E_ENABLE_PIN);
1261
+        enable_e();
1262
+        float oldepos=current_position[E_AXIS];
1263
+        float oldedes=destination[E_AXIS];
1264
+        plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], 
1265
+                          current_position[E_AXIS]+EXTRUDER_RUNOUT_EXTRUDE*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS], 
1266
+                          EXTRUDER_RUNOUT_SPEED/60.*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS], active_extruder);
1267
+        current_position[E_AXIS]=oldepos;
1268
+        destination[E_AXIS]=oldedes;
1269
+        plan_set_e_position(oldepos);
1270
+        
1271
+        while(current_block!=NULL || blocks_queued()) 
1272
+        {
1273
+          manage_heater();
1274
+          LCD_STATUS;
1275
+        }
1276
+        
1277
+        previous_millis_runoutprevent=millis();
1278
+        WRITE(E_ENABLE_PIN,oldstatus);
1279
+      }
1236 1280
     }
1237 1281
   #endif
1238 1282
   check_axes_activity();
@@ -1247,7 +1291,7 @@ void kill()
1247 1291
   disable_z();
1248 1292
   disable_e();
1249 1293
   
1250
-  if(PS_ON_PIN > -1) pinMode(PS_ON_PIN,INPUT);
1294
+  if(PS_ON_PIN > -1) pinMode(PS_ON_PIN,INPUT);  //Turn powersupply off
1251 1295
   SERIAL_ERROR_START;
1252 1296
   SERIAL_ERRORLNPGM("Printer halted. kill() called !!");
1253 1297
   LCD_MESSAGEPGM("KILLED. ");

+ 9
- 3
Marlin/stepper.cpp 查看文件

@@ -706,15 +706,21 @@ void st_init()
706 706
   sei();
707 707
 }
708 708
 
709
-
709
+#include "util/delay.h"
710 710
 // Block until all buffered steps are executed
711 711
 void st_synchronize()
712 712
 {
713
-    while( blocks_queued()) {
713
+    while(current_block!=NULL || blocks_queued()) {
714 714
     manage_heater();
715 715
     manage_inactivity(1);
716
-    LCD_STATUS;
716
+     LCD_STATUS;
717
+    //_delay_ms(100);
718
+    ;
717 719
   }
720
+//   _delay_ms(250);_delay_ms(250);_delay_ms(250);_delay_ms(250);
721
+//   _delay_ms(250);_delay_ms(250);_delay_ms(250);_delay_ms(250);
722
+//   _delay_ms(250);_delay_ms(250);_delay_ms(250);_delay_ms(250);
723
+//   _delay_ms(250);_delay_ms(250);_delay_ms(250);_delay_ms(250);
718 724
 }
719 725
 
720 726
 void st_set_position(const long &x, const long &y, const long &z, const long &e)

+ 5
- 0
Marlin/temperature.cpp 查看文件

@@ -451,6 +451,11 @@ void setWatch()
451 451
 
452 452
 void disable_heater()
453 453
 {
454
+  for(int i=0;i<EXTRUDERS;i++)
455
+   setTargetHotend(0,i);
456
+  setTargetBed(0);
457
+  
458
+
454 459
   #if TEMP_0_PIN > -1
455 460
   target_raw[0]=0;
456 461
    #if HEATER_0_PIN > -1  

Loading…
取消
儲存