Print progress enhancements (#14647)
This commit is contained in:
		
				
					committed by
					
						 Scott Lahteine
						Scott Lahteine
					
				
			
			
				
	
			
			
			
						parent
						
							ebb1a7dc1f
						
					
				
				
					commit
					27c487bab7
				
			| @@ -28,6 +28,9 @@ | |||||||
|  */ |  */ | ||||||
| void GcodeSuite::M117() { | void GcodeSuite::M117() { | ||||||
|  |  | ||||||
|   ui.set_status(parser.string_arg); |   if (parser.string_arg && parser.string_arg[0]) | ||||||
|  |     ui.set_status(parser.string_arg); | ||||||
|  |   else | ||||||
|  |     ui.reset_status(); | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -22,7 +22,7 @@ | |||||||
|  |  | ||||||
| #include "../../inc/MarlinConfig.h" | #include "../../inc/MarlinConfig.h" | ||||||
|  |  | ||||||
| #if ENABLED(LCD_SET_PROGRESS_MANUALLY) && EITHER(EXTENSIBLE_UI, ULTRA_LCD) | #if ENABLED(LCD_SET_PROGRESS_MANUALLY) | ||||||
|  |  | ||||||
| #include "../gcode.h" | #include "../gcode.h" | ||||||
| #include "../../lcd/ultralcd.h" | #include "../../lcd/ultralcd.h" | ||||||
| @@ -42,4 +42,4 @@ void GcodeSuite::M73() { | |||||||
|     ui.set_progress(parser.value_byte()); |     ui.set_progress(parser.value_byte()); | ||||||
| } | } | ||||||
|  |  | ||||||
| #endif // LCD_SET_PROGRESS_MANUALLY && (EXTENSIBLE_UI || ULTRA_LCD) | #endif // LCD_SET_PROGRESS_MANUALLY | ||||||
|   | |||||||
| @@ -26,6 +26,7 @@ | |||||||
|  |  | ||||||
| #include "../gcode.h" | #include "../gcode.h" | ||||||
| #include "../../sd/cardreader.h" | #include "../../sd/cardreader.h" | ||||||
|  | #include "../../lcd/ultralcd.h" | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * M23: Open a file |  * M23: Open a file | ||||||
| @@ -36,6 +37,10 @@ void GcodeSuite::M23() { | |||||||
|   // Simplify3D includes the size, so zero out all spaces (#7227) |   // Simplify3D includes the size, so zero out all spaces (#7227) | ||||||
|   for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0'; |   for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0'; | ||||||
|   card.openFile(parser.string_arg, true); |   card.openFile(parser.string_arg, true); | ||||||
|  |  | ||||||
|  |   #if ENABLED(LCD_SET_PROGRESS_MANUALLY) | ||||||
|  |     ui.set_progress(0); | ||||||
|  |   #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| #endif // SDSUPPORT | #endif // SDSUPPORT | ||||||
|   | |||||||
| @@ -125,7 +125,7 @@ void GcodeSuite::M109() { | |||||||
|         print_job_timer.start(); |         print_job_timer.start(); | ||||||
|     #endif |     #endif | ||||||
|  |  | ||||||
|     #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) |     #if HAS_DISPLAY | ||||||
|       if (thermalManager.isHeatingHotend(target_extruder) || !no_wait_for_cooling) |       if (thermalManager.isHeatingHotend(target_extruder) || !no_wait_for_cooling) | ||||||
|         thermalManager.set_heating_message(target_extruder); |         thermalManager.set_heating_message(target_extruder); | ||||||
|     #endif |     #endif | ||||||
|   | |||||||
| @@ -204,6 +204,10 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co | |||||||
|       lcd_z_fade_height = planner.z_fade_height; |       lcd_z_fade_height = planner.z_fade_height; | ||||||
|     #endif |     #endif | ||||||
|  |  | ||||||
|  |     #if ENABLED(LCD_SET_PROGRESS_MANUALLY) | ||||||
|  |       progress_reset(); | ||||||
|  |     #endif | ||||||
|  |  | ||||||
|     #if BOTH(DOUBLECLICK_FOR_Z_BABYSTEPPING, BABYSTEPPING) |     #if BOTH(DOUBLECLICK_FOR_Z_BABYSTEPPING, BABYSTEPPING) | ||||||
|       static millis_t doubleclick_expire_ms = 0; |       static millis_t doubleclick_expire_ms = 0; | ||||||
|       // Going to menu_main from status screen? Remember first click time. |       // Going to menu_main from status screen? Remember first click time. | ||||||
|   | |||||||
| @@ -1522,13 +1522,15 @@ void MarlinUI::update() { | |||||||
|     uint8_t MarlinUI::get_progress() { |     uint8_t MarlinUI::get_progress() { | ||||||
|       #if ENABLED(LCD_SET_PROGRESS_MANUALLY) |       #if ENABLED(LCD_SET_PROGRESS_MANUALLY) | ||||||
|         uint8_t &progress = progress_bar_percent; |         uint8_t &progress = progress_bar_percent; | ||||||
|  |         #define _PLIMIT(P) ((P) & 0x7F) | ||||||
|       #else |       #else | ||||||
|  |         #define _PLIMIT(P) P | ||||||
|         uint8_t progress = 0; |         uint8_t progress = 0; | ||||||
|       #endif |       #endif | ||||||
|       #if ENABLED(SDSUPPORT) |       #if ENABLED(SDSUPPORT) | ||||||
|         if (IS_SD_PRINTING()) progress = card.percentDone(); |         if (IS_SD_PRINTING()) progress = card.percentDone(); | ||||||
|       #endif |       #endif | ||||||
|       return progress; |       return _PLIMIT(progress); | ||||||
|     } |     } | ||||||
|   #endif |   #endif | ||||||
|  |  | ||||||
|   | |||||||
| @@ -298,6 +298,8 @@ public: | |||||||
|       #if ENABLED(LCD_SET_PROGRESS_MANUALLY) |       #if ENABLED(LCD_SET_PROGRESS_MANUALLY) | ||||||
|         static uint8_t progress_bar_percent; |         static uint8_t progress_bar_percent; | ||||||
|         static void set_progress(const uint8_t progress) { progress_bar_percent = _MIN(progress, 100); } |         static void set_progress(const uint8_t progress) { progress_bar_percent = _MIN(progress, 100); } | ||||||
|  |         static void set_progress_done() { set_progress(0x80 + 100); } | ||||||
|  |         static bool progress_reset() { if (progress_bar_percent & 0x80) set_progress(0); } | ||||||
|       #endif |       #endif | ||||||
|       static uint8_t get_progress(); |       static uint8_t get_progress(); | ||||||
|     #else |     #else | ||||||
|   | |||||||
| @@ -51,7 +51,7 @@ | |||||||
|   #include "../feature/bltouch.h" |   #include "../feature/bltouch.h" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) | #if HAS_DISPLAY | ||||||
|   #include "../lcd/ultralcd.h" |   #include "../lcd/ultralcd.h" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @@ -1044,7 +1044,7 @@ bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool | |||||||
|     if (zz) SERIAL_CHAR('Z'); |     if (zz) SERIAL_CHAR('Z'); | ||||||
|     SERIAL_ECHOLNPGM(" " MSG_FIRST); |     SERIAL_ECHOLNPGM(" " MSG_FIRST); | ||||||
|  |  | ||||||
|     #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) |     #if HAS_DISPLAY | ||||||
|       ui.status_printf_P(0, PSTR(MSG_HOME " %s%s%s " MSG_FIRST), xx ? MSG_X : "", yy ? MSG_Y : "", zz ? MSG_Z : ""); |       ui.status_printf_P(0, PSTR(MSG_HOME " %s%s%s " MSG_FIRST), xx ? MSG_X : "", yy ? MSG_Y : "", zz ? MSG_Z : ""); | ||||||
|     #endif |     #endif | ||||||
|     return true; |     return true; | ||||||
|   | |||||||
| @@ -2923,7 +2923,7 @@ void Temperature::isr() { | |||||||
|  |  | ||||||
|   #endif // AUTO_REPORT_TEMPERATURES |   #endif // AUTO_REPORT_TEMPERATURES | ||||||
|  |  | ||||||
|   #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) |   #if HAS_DISPLAY | ||||||
|     void Temperature::set_heating_message(const uint8_t e) { |     void Temperature::set_heating_message(const uint8_t e) { | ||||||
|       const bool heating = isHeatingHotend(e); |       const bool heating = isHeatingHotend(e); | ||||||
|       #if HOTENDS > 1 |       #if HOTENDS > 1 | ||||||
|   | |||||||
| @@ -785,7 +785,7 @@ class Temperature { | |||||||
|       #endif |       #endif | ||||||
|     #endif |     #endif | ||||||
|  |  | ||||||
|     #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) |     #if HAS_DISPLAY | ||||||
|       static void set_heating_message(const uint8_t e); |       static void set_heating_message(const uint8_t e); | ||||||
|     #endif |     #endif | ||||||
|  |  | ||||||
|   | |||||||
| @@ -982,7 +982,7 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) { | |||||||
|           singlenozzle_temp[active_extruder] = thermalManager.temp_hotend[0].target; |           singlenozzle_temp[active_extruder] = thermalManager.temp_hotend[0].target; | ||||||
|           if (singlenozzle_temp[tmp_extruder] && singlenozzle_temp[tmp_extruder] != singlenozzle_temp[active_extruder]) { |           if (singlenozzle_temp[tmp_extruder] && singlenozzle_temp[tmp_extruder] != singlenozzle_temp[active_extruder]) { | ||||||
|             thermalManager.setTargetHotend(singlenozzle_temp[tmp_extruder], 0); |             thermalManager.setTargetHotend(singlenozzle_temp[tmp_extruder], 0); | ||||||
|             #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) |             #if HAS_DISPLAY | ||||||
|               thermalManager.set_heating_message(0); |               thermalManager.set_heating_message(0); | ||||||
|             #endif |             #endif | ||||||
|             (void)thermalManager.wait_for_hotend(0, false);  // Wait for heating or cooling |             (void)thermalManager.wait_for_hotend(0, false);  // Wait for heating or cooling | ||||||
|   | |||||||
| @@ -1008,18 +1008,16 @@ void CardReader::printingHasFinished() { | |||||||
|     #endif |     #endif | ||||||
|  |  | ||||||
|     print_job_timer.stop(); |     print_job_timer.stop(); | ||||||
|     if (print_job_timer.duration() > 60) queue.inject_P(PSTR("M31")); |     queue.enqueue_now_P(print_job_timer.duration() > 60 ? PSTR("M31") : PSTR("M117")); | ||||||
|  |  | ||||||
|     #if ENABLED(SDCARD_SORT_ALPHA) |     #if ENABLED(SDCARD_SORT_ALPHA) | ||||||
|       presort(); |       presort(); | ||||||
|     #endif |     #endif | ||||||
|  |  | ||||||
|     #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) && ENABLED(LCD_SET_PROGRESS_MANUALLY) |     #if ENABLED(LCD_SET_PROGRESS_MANUALLY) | ||||||
|       ui.progress_bar_percent = 0; |       ui.set_progress_done(); | ||||||
|     #endif |     #endif | ||||||
|  |  | ||||||
|     ui.reset_status(); |  | ||||||
|  |  | ||||||
|     #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) |     #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) | ||||||
|       ui.reselect_last_file(); |       ui.reselect_last_file(); | ||||||
|     #endif |     #endif | ||||||
|   | |||||||
| @@ -31,7 +31,7 @@ | |||||||
|  |  | ||||||
| #include "Sd2Card_FlashDrive.h" | #include "Sd2Card_FlashDrive.h" | ||||||
|  |  | ||||||
| #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) | #if HAS_DISPLAY | ||||||
|   #include "../../lcd/ultralcd.h" |   #include "../../lcd/ultralcd.h" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @@ -63,7 +63,7 @@ void Sd2Card::idle() { | |||||||
|       SERIAL_ECHOPGM("Starting USB host..."); |       SERIAL_ECHOPGM("Starting USB host..."); | ||||||
|       if (!usb.start()) { |       if (!usb.start()) { | ||||||
|         SERIAL_ECHOPGM(" Failed. Retrying in 2s."); |         SERIAL_ECHOPGM(" Failed. Retrying in 2s."); | ||||||
|         #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) |         #if HAS_DISPLAY | ||||||
|           LCD_MESSAGEPGM("USB start failed"); |           LCD_MESSAGEPGM("USB start failed"); | ||||||
|         #endif |         #endif | ||||||
|         state = USB_HOST_DELAY_INIT; |         state = USB_HOST_DELAY_INIT; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user