Browse Source

added KILL_PIN support / cleaned up manage_inactivity function definition

stohn 13 years ago
parent
commit
de0448343f
4 changed files with 32 additions and 20 deletions
  1. 1
    1
      Marlin/Marlin.h
  2. 29
    17
      Marlin/Marlin.pde
  3. 1
    1
      Marlin/planner.cpp
  4. 1
    1
      Marlin/stepper.cpp

+ 1
- 1
Marlin/Marlin.h View File

@@ -107,7 +107,7 @@ FORCE_INLINE void serialprintPGM(const char *str)
107 107
 void get_command();
108 108
 void process_commands();
109 109
 
110
-void manage_inactivity(byte debug);
110
+void manage_inactivity();
111 111
 
112 112
 #if X_ENABLE_PIN > -1
113 113
   #define  enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)

+ 29
- 17
Marlin/Marlin.pde View File

@@ -245,6 +245,14 @@ void enquecommand(const char *cmd)
245 245
   }
246 246
 }
247 247
 
248
+void setup_killpin()
249
+{
250
+  #if( KILL_PIN>-1 )
251
+    pinMode(KILL_PIN,INPUT);
252
+    WRITE(KILL_PIN,HIGH);
253
+  #endif
254
+}
255
+    
248 256
 void setup_photpin()
249 257
 {
250 258
   #ifdef PHOTOGRAPH_PIN
@@ -276,7 +284,8 @@ void suicide()
276 284
 }
277 285
 
278 286
 void setup()
279
-{ 
287
+{
288
+  setup_killpin(); 
280 289
   setup_powerhold();
281 290
   MYSERIAL.begin(BAUDRATE);
282 291
   SERIAL_PROTOCOLLNPGM("start");
@@ -365,7 +374,7 @@ void loop()
365 374
   }
366 375
   //check heater every n milliseconds
367 376
   manage_heater();
368
-  manage_inactivity(1);
377
+  manage_inactivity();
369 378
   checkHitEndstops();
370 379
   LCD_STATUS;
371 380
 }
@@ -653,8 +662,8 @@ void process_commands()
653 662
       previous_millis_cmd = millis();
654 663
       while(millis()  < codenum ){
655 664
         manage_heater();
656
-        manage_inactivity(1);
657
-		LCD_STATUS;
665
+        manage_inactivity();
666
+        LCD_STATUS;
658 667
       }
659 668
       break;
660 669
       #ifdef FWRETRACT  
@@ -816,21 +825,20 @@ void process_commands()
816 825
       
817 826
       st_synchronize();
818 827
       previous_millis_cmd = millis();
819
-	  if (codenum > 0)
820
-	  {
828
+      if (codenum > 0){
821 829
         codenum += millis();  // keep track of when we started waiting
822 830
         while(millis()  < codenum && !CLICKED){
823 831
           manage_heater();
824
-          manage_inactivity(1);
825
-		  LCD_STATUS;
826
-		}
832
+          manage_inactivity();
833
+          LCD_STATUS;
834
+        }
827 835
       }else{
828
-        while(!CLICKED) {
836
+        while(!CLICKED){
829 837
           manage_heater();
830
-          manage_inactivity(1);
831
-		  LCD_STATUS;
832
-		}
833
-	  }
838
+          manage_inactivity();
839
+          LCD_STATUS;
840
+        }
841
+      }
834 842
     }
835 843
     break;
836 844
 #endif
@@ -1064,7 +1072,7 @@ void process_commands()
1064 1072
             codenum = millis();
1065 1073
           }
1066 1074
           manage_heater();
1067
-          manage_inactivity(1);
1075
+          manage_inactivity();
1068 1076
           LCD_STATUS;
1069 1077
         #ifdef TEMP_RESIDENCY_TIME
1070 1078
             /* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
@@ -1102,7 +1110,7 @@ void process_commands()
1102 1110
             codenum = millis(); 
1103 1111
           }
1104 1112
           manage_heater();
1105
-          manage_inactivity(1);
1113
+          manage_inactivity();
1106 1114
           LCD_STATUS;
1107 1115
         }
1108 1116
         LCD_MESSAGEPGM(MSG_BED_DONE);
@@ -1664,7 +1672,7 @@ void controllerFan()
1664 1672
 }
1665 1673
 #endif
1666 1674
 
1667
-void manage_inactivity(byte debug) 
1675
+void manage_inactivity() 
1668 1676
 { 
1669 1677
   if( (millis() - previous_millis_cmd) >  max_inactive_time ) 
1670 1678
     if(max_inactive_time) 
@@ -1682,6 +1690,10 @@ void manage_inactivity(byte debug)
1682 1690
       }
1683 1691
     }
1684 1692
   }
1693
+  #if( KILL_PIN>-1 )
1694
+    if( 0 == READ(KILL_PIN) )
1695
+      kill();
1696
+  #endif
1685 1697
   #ifdef CONTROLLERFAN_PIN
1686 1698
     controllerFan(); //Check if fan should be turned on to cool stepper drivers down
1687 1699
   #endif

+ 1
- 1
Marlin/planner.cpp View File

@@ -501,7 +501,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
501 501
   // Rest here until there is room in the buffer.
502 502
   while(block_buffer_tail == next_buffer_head) { 
503 503
     manage_heater(); 
504
-    manage_inactivity(1); 
504
+    manage_inactivity(); 
505 505
     LCD_STATUS;
506 506
   }
507 507
 

+ 1
- 1
Marlin/stepper.cpp View File

@@ -899,7 +899,7 @@ void st_synchronize()
899 899
 {
900 900
     while( blocks_queued()) {
901 901
     manage_heater();
902
-    manage_inactivity(1);
902
+    manage_inactivity();
903 903
     LCD_STATUS;
904 904
   }
905 905
 }

Loading…
Cancel
Save