SHOW_REMAINING_TIME for HD44780 character LCD (#19416)
This commit is contained in:
		
							parent
							
								
									7e56e6c4ea
								
							
						
					
					
						commit
						9cdb8ca244
					
				@ -1105,16 +1105,18 @@
 | 
				
			|||||||
  #define BOOTSCREEN_TIMEOUT 4000        // (ms) Total Duration to display the boot screen(s)
 | 
					  #define BOOTSCREEN_TIMEOUT 4000        // (ms) Total Duration to display the boot screen(s)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if HAS_GRAPHICAL_LCD && EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
 | 
					#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) && (HAS_GRAPHICAL_LCD || HAS_CHARACTER_LCD)
 | 
				
			||||||
  //#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
 | 
					 | 
				
			||||||
  //#define SHOW_REMAINING_TIME       // Display estimated time to completion
 | 
					  //#define SHOW_REMAINING_TIME       // Display estimated time to completion
 | 
				
			||||||
  #if ENABLED(SHOW_REMAINING_TIME)
 | 
					  #if ENABLED(SHOW_REMAINING_TIME)
 | 
				
			||||||
    //#define USE_M73_REMAINING_TIME  // Use remaining time from M73 command instead of estimation
 | 
					    //#define USE_M73_REMAINING_TIME  // Use remaining time from M73 command instead of estimation
 | 
				
			||||||
    //#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time
 | 
					    //#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time
 | 
				
			||||||
  #endif
 | 
					  #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #if HAS_GRAPHICAL_LCD
 | 
				
			||||||
 | 
					    //#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
 | 
				
			||||||
  #endif
 | 
					  #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if HAS_CHARACTER_LCD && EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
 | 
					  #if HAS_CHARACTER_LCD
 | 
				
			||||||
    //#define LCD_PROGRESS_BAR            // Show a progress bar on HD44780 LCDs for SD printing
 | 
					    //#define LCD_PROGRESS_BAR            // Show a progress bar on HD44780 LCDs for SD printing
 | 
				
			||||||
    #if ENABLED(LCD_PROGRESS_BAR)
 | 
					    #if ENABLED(LCD_PROGRESS_BAR)
 | 
				
			||||||
      #define PROGRESS_BAR_BAR_TIME 2000  // (ms) Amount of time to show the bar
 | 
					      #define PROGRESS_BAR_BAR_TIME 2000  // (ms) Amount of time to show the bar
 | 
				
			||||||
@ -1124,6 +1126,7 @@
 | 
				
			|||||||
      //#define LCD_PROGRESS_BAR_TEST     // Add a menu item to test the progress bar
 | 
					      //#define LCD_PROGRESS_BAR_TEST     // Add a menu item to test the progress bar
 | 
				
			||||||
    #endif
 | 
					    #endif
 | 
				
			||||||
  #endif
 | 
					  #endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if ENABLED(SDSUPPORT)
 | 
					#if ENABLED(SDSUPPORT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -692,8 +692,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
 | 
				
			|||||||
  #elif PROGRESS_MSG_EXPIRE < 0
 | 
					  #elif PROGRESS_MSG_EXPIRE < 0
 | 
				
			||||||
    #error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0."
 | 
					    #error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0."
 | 
				
			||||||
  #endif
 | 
					  #endif
 | 
				
			||||||
#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && NONE(HAS_GRAPHICAL_LCD, HAS_GRAPHICAL_TFT, EXTENSIBLE_UI)
 | 
					#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && NONE(HAS_GRAPHICAL_LCD, HAS_GRAPHICAL_TFT, HAS_CHARACTER_LCD, EXTENSIBLE_UI)
 | 
				
			||||||
  #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Graphical LCD, TFT, or EXTENSIBLE_UI."
 | 
					  #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Character LCD, Graphical LCD, TFT, or EXTENSIBLE_UI."
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !HAS_LCD_MENU && ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
 | 
					#if !HAS_LCD_MENU && ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
 | 
				
			||||||
@ -3055,8 +3055,6 @@ static_assert(   _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
 | 
				
			|||||||
#if !HAS_GRAPHICAL_LCD
 | 
					#if !HAS_GRAPHICAL_LCD
 | 
				
			||||||
  #if ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
 | 
					  #if ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
 | 
				
			||||||
    #error "PRINT_PROGRESS_SHOW_DECIMALS currently requires a Graphical LCD."
 | 
					    #error "PRINT_PROGRESS_SHOW_DECIMALS currently requires a Graphical LCD."
 | 
				
			||||||
  #elif ENABLED(SHOW_REMAINING_TIME)
 | 
					 | 
				
			||||||
    #error "SHOW_REMAINING_TIME currently requires a Graphical LCD."
 | 
					 | 
				
			||||||
  #endif
 | 
					  #endif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -845,10 +845,31 @@ void MarlinUI::draw_status_screen() {
 | 
				
			|||||||
      lcd_put_wchar('%');
 | 
					      lcd_put_wchar('%');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      char buffer[14];
 | 
					      char buffer[14];
 | 
				
			||||||
 | 
					      uint8_t timepos = 0;
 | 
				
			||||||
 | 
					      #if ENABLED(SHOW_REMAINING_TIME)
 | 
				
			||||||
 | 
					        const bool show_remain = TERN1(ROTATE_PROGRESS_DISPLAY, blink) && (printingIsActive() || marlin_state == MF_SD_COMPLETE);
 | 
				
			||||||
 | 
					        if (show_remain) {
 | 
				
			||||||
 | 
					          #if ENABLED(USE_M73_REMAINING_TIME)
 | 
				
			||||||
 | 
					            duration_t remaining = get_remaining_time();
 | 
				
			||||||
 | 
					          #else
 | 
				
			||||||
 | 
					            uint8_t progress = get_progress_percent();
 | 
				
			||||||
 | 
					            uint32_t elapsed = print_job_timer.duration();
 | 
				
			||||||
 | 
					            duration_t remaining = (progress > 0) ? ((elapsed * 25600 / progress) >> 8) - elapsed : 0;
 | 
				
			||||||
 | 
					          #endif
 | 
				
			||||||
 | 
					          const uint8_t len = remaining.toDigital(buffer);
 | 
				
			||||||
 | 
					          timepos = LCD_WIDTH - 1 - len;
 | 
				
			||||||
 | 
					          lcd_put_wchar(timepos, 2, 'R');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      #else
 | 
				
			||||||
 | 
					        constexpr bool show_remain = false;
 | 
				
			||||||
 | 
					      #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (!show_remain) {
 | 
				
			||||||
        duration_t elapsed = print_job_timer.duration();
 | 
					        duration_t elapsed = print_job_timer.duration();
 | 
				
			||||||
      const uint8_t len = elapsed.toDigital(buffer),
 | 
					        const uint8_t len = elapsed.toDigital(buffer);
 | 
				
			||||||
                    timepos = LCD_WIDTH - len - 1;
 | 
					        timepos = LCD_WIDTH - 1 - len;
 | 
				
			||||||
        lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
 | 
					        lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      lcd_put_u8str(buffer);
 | 
					      lcd_put_u8str(buffer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      #if LCD_WIDTH >= 20
 | 
					      #if LCD_WIDTH >= 20
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user