Add M401 - Wait for user on LCD button press
This commit is contained in:
		| @@ -107,6 +107,7 @@ | |||||||
| // M302 - Allow cold extrudes | // M302 - Allow cold extrudes | ||||||
| // M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C) | // M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C) | ||||||
| // M400 - Finish all moves | // M400 - Finish all moves | ||||||
|  | // M401 - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled) | ||||||
| // M500 - stores paramters in EEPROM | // M500 - stores paramters in EEPROM | ||||||
| // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).   | // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).   | ||||||
| // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to. | // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to. | ||||||
| @@ -596,6 +597,7 @@ void process_commands() | |||||||
|       while(millis()  < codenum ){ |       while(millis()  < codenum ){ | ||||||
|         manage_heater(); |         manage_heater(); | ||||||
|         manage_inactivity(1); |         manage_inactivity(1); | ||||||
|  | 		LCD_STATUS; | ||||||
|       } |       } | ||||||
|       break; |       break; | ||||||
|     case 28: //G28 Home all Axis one at a time |     case 28: //G28 Home all Axis one at a time | ||||||
| @@ -1259,11 +1261,37 @@ void process_commands() | |||||||
|       PID_autotune(temp); |       PID_autotune(temp); | ||||||
|     } |     } | ||||||
|     break; |     break; | ||||||
|     case 400: // finish all moves |     case 400: // M400 finish all moves | ||||||
|     { |     { | ||||||
|       st_synchronize(); |       st_synchronize(); | ||||||
|     } |     } | ||||||
|     break; |     break; | ||||||
|  | #ifdef ULTRA_LCD | ||||||
|  |     case 401: // M401 - Wait for user button press on LCD | ||||||
|  |     { | ||||||
|  |       LCD_MESSAGEPGM(MSG_USERWAIT); | ||||||
|  |       codenum = 0; | ||||||
|  |       if(code_seen('P')) codenum = code_value(); // milliseconds to wait | ||||||
|  |       if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait | ||||||
|  |        | ||||||
|  |       st_synchronize(); | ||||||
|  |       previous_millis_cmd = millis(); | ||||||
|  | 	  if (codenum > 0) | ||||||
|  | 	  { | ||||||
|  |         codenum += millis();  // keep track of when we started waiting | ||||||
|  |         while(millis()  < codenum && buttons == 0){ | ||||||
|  |           manage_heater(); | ||||||
|  |           manage_inactivity(1); | ||||||
|  | 		} | ||||||
|  |       }else{ | ||||||
|  |         while(buttons == 0) { | ||||||
|  |           manage_heater(); | ||||||
|  |           manage_inactivity(1); | ||||||
|  | 		} | ||||||
|  | 	  } | ||||||
|  |     } | ||||||
|  |     break; | ||||||
|  | #endif | ||||||
|     case 500: // Store settings in EEPROM |     case 500: // Store settings in EEPROM | ||||||
|     { |     { | ||||||
|         EEPROM_StoreSettings(); |         EEPROM_StoreSettings(); | ||||||
|   | |||||||
| @@ -86,6 +86,7 @@ | |||||||
| 	#define MSG_NO_CARD " No Card" | 	#define MSG_NO_CARD " No Card" | ||||||
| 	#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Something is wrong in the MenuStructure." | 	#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Something is wrong in the MenuStructure." | ||||||
| 	#define MSG_DWELL "Sleep..." | 	#define MSG_DWELL "Sleep..." | ||||||
|  | 	#define MSG_USERWAIT "Wait for user..." | ||||||
| 	#define MSG_NO_MOVE "No move." | 	#define MSG_NO_MOVE "No move." | ||||||
| 	#define MSG_PART_RELEASE "Partial Release" | 	#define MSG_PART_RELEASE "Partial Release" | ||||||
| 	#define MSG_KILLED "KILLED. " | 	#define MSG_KILLED "KILLED. " | ||||||
|   | |||||||
| @@ -13,6 +13,7 @@ | |||||||
|   #define LCD_UPDATE_INTERVAL 100 |   #define LCD_UPDATE_INTERVAL 100 | ||||||
|   #define STATUSTIMEOUT 15000 |   #define STATUSTIMEOUT 15000 | ||||||
|   extern LiquidCrystal lcd; |   extern LiquidCrystal lcd; | ||||||
|  |   extern volatile char buttons=0;  //the last checked buttons in a bit array. | ||||||
|    |    | ||||||
|   #ifdef NEWPANEL |   #ifdef NEWPANEL | ||||||
|     #define EN_C (1<<BLEN_C) |     #define EN_C (1<<BLEN_C) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user