added KILL_PIN support / cleaned up manage_inactivity function definition
This commit is contained in:
		| @@ -107,7 +107,7 @@ FORCE_INLINE void serialprintPGM(const char *str) | |||||||
| void get_command(); | void get_command(); | ||||||
| void process_commands(); | void process_commands(); | ||||||
|  |  | ||||||
| void manage_inactivity(byte debug); | void manage_inactivity(); | ||||||
|  |  | ||||||
| #if X_ENABLE_PIN > -1 | #if X_ENABLE_PIN > -1 | ||||||
|   #define  enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON) |   #define  enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON) | ||||||
|   | |||||||
| @@ -245,6 +245,14 @@ void enquecommand(const char *cmd) | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void setup_killpin() | ||||||
|  | { | ||||||
|  |   #if( KILL_PIN>-1 ) | ||||||
|  |     pinMode(KILL_PIN,INPUT); | ||||||
|  |     WRITE(KILL_PIN,HIGH); | ||||||
|  |   #endif | ||||||
|  | } | ||||||
|  |      | ||||||
| void setup_photpin() | void setup_photpin() | ||||||
| { | { | ||||||
|   #ifdef PHOTOGRAPH_PIN |   #ifdef PHOTOGRAPH_PIN | ||||||
| @@ -276,7 +284,8 @@ void suicide() | |||||||
| } | } | ||||||
|  |  | ||||||
| void setup() | void setup() | ||||||
| {  | { | ||||||
|  |   setup_killpin();  | ||||||
|   setup_powerhold(); |   setup_powerhold(); | ||||||
|   MYSERIAL.begin(BAUDRATE); |   MYSERIAL.begin(BAUDRATE); | ||||||
|   SERIAL_PROTOCOLLNPGM("start"); |   SERIAL_PROTOCOLLNPGM("start"); | ||||||
| @@ -365,7 +374,7 @@ void loop() | |||||||
|   } |   } | ||||||
|   //check heater every n milliseconds |   //check heater every n milliseconds | ||||||
|   manage_heater(); |   manage_heater(); | ||||||
|   manage_inactivity(1); |   manage_inactivity(); | ||||||
|   checkHitEndstops(); |   checkHitEndstops(); | ||||||
|   LCD_STATUS; |   LCD_STATUS; | ||||||
| } | } | ||||||
| @@ -653,8 +662,8 @@ void process_commands() | |||||||
|       previous_millis_cmd = millis(); |       previous_millis_cmd = millis(); | ||||||
|       while(millis()  < codenum ){ |       while(millis()  < codenum ){ | ||||||
|         manage_heater(); |         manage_heater(); | ||||||
|         manage_inactivity(1); |         manage_inactivity(); | ||||||
| 		LCD_STATUS; |         LCD_STATUS; | ||||||
|       } |       } | ||||||
|       break; |       break; | ||||||
|       #ifdef FWRETRACT   |       #ifdef FWRETRACT   | ||||||
| @@ -816,21 +825,20 @@ void process_commands() | |||||||
|        |        | ||||||
|       st_synchronize(); |       st_synchronize(); | ||||||
|       previous_millis_cmd = millis(); |       previous_millis_cmd = millis(); | ||||||
| 	  if (codenum > 0) |       if (codenum > 0){ | ||||||
| 	  { |  | ||||||
|         codenum += millis();  // keep track of when we started waiting |         codenum += millis();  // keep track of when we started waiting | ||||||
|         while(millis()  < codenum && !CLICKED){ |         while(millis()  < codenum && !CLICKED){ | ||||||
|           manage_heater(); |           manage_heater(); | ||||||
|           manage_inactivity(1); |           manage_inactivity(); | ||||||
| 		  LCD_STATUS; |           LCD_STATUS; | ||||||
| 		} |         } | ||||||
|       }else{ |       }else{ | ||||||
|         while(!CLICKED) { |         while(!CLICKED){ | ||||||
|           manage_heater(); |           manage_heater(); | ||||||
|           manage_inactivity(1); |           manage_inactivity(); | ||||||
| 		  LCD_STATUS; |           LCD_STATUS; | ||||||
| 		} |         } | ||||||
| 	  } |       } | ||||||
|     } |     } | ||||||
|     break; |     break; | ||||||
| #endif | #endif | ||||||
| @@ -1064,7 +1072,7 @@ void process_commands() | |||||||
|             codenum = millis(); |             codenum = millis(); | ||||||
|           } |           } | ||||||
|           manage_heater(); |           manage_heater(); | ||||||
|           manage_inactivity(1); |           manage_inactivity(); | ||||||
|           LCD_STATUS; |           LCD_STATUS; | ||||||
|         #ifdef TEMP_RESIDENCY_TIME |         #ifdef TEMP_RESIDENCY_TIME | ||||||
|             /* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time |             /* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time | ||||||
| @@ -1102,7 +1110,7 @@ void process_commands() | |||||||
|             codenum = millis();  |             codenum = millis();  | ||||||
|           } |           } | ||||||
|           manage_heater(); |           manage_heater(); | ||||||
|           manage_inactivity(1); |           manage_inactivity(); | ||||||
|           LCD_STATUS; |           LCD_STATUS; | ||||||
|         } |         } | ||||||
|         LCD_MESSAGEPGM(MSG_BED_DONE); |         LCD_MESSAGEPGM(MSG_BED_DONE); | ||||||
| @@ -1664,7 +1672,7 @@ void controllerFan() | |||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| void manage_inactivity(byte debug)  | void manage_inactivity()  | ||||||
| {  | {  | ||||||
|   if( (millis() - previous_millis_cmd) >  max_inactive_time )  |   if( (millis() - previous_millis_cmd) >  max_inactive_time )  | ||||||
|     if(max_inactive_time)  |     if(max_inactive_time)  | ||||||
| @@ -1682,6 +1690,10 @@ void manage_inactivity(byte debug) | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |   #if( KILL_PIN>-1 ) | ||||||
|  |     if( 0 == READ(KILL_PIN) ) | ||||||
|  |       kill(); | ||||||
|  |   #endif | ||||||
|   #ifdef CONTROLLERFAN_PIN |   #ifdef CONTROLLERFAN_PIN | ||||||
|     controllerFan(); //Check if fan should be turned on to cool stepper drivers down |     controllerFan(); //Check if fan should be turned on to cool stepper drivers down | ||||||
|   #endif |   #endif | ||||||
|   | |||||||
| @@ -501,7 +501,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa | |||||||
|   // Rest here until there is room in the buffer. |   // Rest here until there is room in the buffer. | ||||||
|   while(block_buffer_tail == next_buffer_head) {  |   while(block_buffer_tail == next_buffer_head) {  | ||||||
|     manage_heater();  |     manage_heater();  | ||||||
|     manage_inactivity(1);  |     manage_inactivity();  | ||||||
|     LCD_STATUS; |     LCD_STATUS; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -899,7 +899,7 @@ void st_synchronize() | |||||||
| { | { | ||||||
|     while( blocks_queued()) { |     while( blocks_queued()) { | ||||||
|     manage_heater(); |     manage_heater(); | ||||||
|     manage_inactivity(1); |     manage_inactivity(); | ||||||
|     LCD_STATUS; |     LCD_STATUS; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user