Remaining Time for FTDI EVE, bp for ExtUI (#20549)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
		| @@ -1134,33 +1134,35 @@ | ||||
|  | ||||
| #endif // HAS_LCD_MENU | ||||
|  | ||||
| // Scroll a longer status message into view | ||||
| //#define STATUS_MESSAGE_SCROLLING | ||||
| #if HAS_DISPLAY | ||||
|   // The timeout (in ms) to return to the status screen from sub-menus | ||||
|   //#define LCD_TIMEOUT_TO_STATUS 15000 | ||||
|  | ||||
| // On the Info Screen, display XY with one decimal place when possible | ||||
| //#define LCD_DECIMAL_SMALL_XY | ||||
|   #if ENABLED(SHOW_BOOTSCREEN) | ||||
|     #define BOOTSCREEN_TIMEOUT 4000      // (ms) Total Duration to display the boot screen(s) | ||||
|   #endif | ||||
|  | ||||
| // The timeout (in ms) to return to the status screen from sub-menus | ||||
| //#define LCD_TIMEOUT_TO_STATUS 15000 | ||||
|   // Scroll a longer status message into view | ||||
|   //#define STATUS_MESSAGE_SCROLLING | ||||
|  | ||||
| // Add an 'M73' G-code to set the current percentage | ||||
| //#define LCD_SET_PROGRESS_MANUALLY | ||||
|   // On the Info Screen, display XY with one decimal place when possible | ||||
|   //#define LCD_DECIMAL_SMALL_XY | ||||
|  | ||||
| // Show the E position (filament used) during printing | ||||
| //#define LCD_SHOW_E_TOTAL | ||||
|   // Add an 'M73' G-code to set the current percentage | ||||
|   //#define LCD_SET_PROGRESS_MANUALLY | ||||
|  | ||||
| #if ENABLED(SHOW_BOOTSCREEN) | ||||
|   #define BOOTSCREEN_TIMEOUT 4000        // (ms) Total Duration to display the boot screen(s) | ||||
|   // Show the E position (filament used) during printing | ||||
|   //#define LCD_SHOW_E_TOTAL | ||||
| #endif | ||||
|  | ||||
| #if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) && ANY(HAS_MARLINUI_U8GLIB, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL) | ||||
| #if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) && ANY(HAS_MARLINUI_U8GLIB, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, EXTENSIBLE_UI) | ||||
|   //#define SHOW_REMAINING_TIME       // Display estimated time to completion | ||||
|   #if ENABLED(SHOW_REMAINING_TIME) | ||||
|     //#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 | ||||
|   #endif | ||||
|  | ||||
|   #if HAS_MARLINUI_U8GLIB | ||||
|   #if EITHER(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI) | ||||
|     //#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits | ||||
|   #endif | ||||
|  | ||||
|   | ||||
| @@ -3211,10 +3211,8 @@ static_assert(   _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2) | ||||
|   #undef _PIN_CONFLICT | ||||
| #endif | ||||
|  | ||||
| #if !HAS_MARLINUI_U8GLIB | ||||
|   #if ENABLED(PRINT_PROGRESS_SHOW_DECIMALS) | ||||
|     #error "PRINT_PROGRESS_SHOW_DECIMALS currently requires a Graphical LCD." | ||||
|   #endif | ||||
| #if NONE(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI) && ENABLED(PRINT_PROGRESS_SHOW_DECIMALS) | ||||
|   #error "PRINT_PROGRESS_SHOW_DECIMALS currently requires a Graphical LCD." | ||||
| #endif | ||||
|  | ||||
| #if HAS_ADC_BUTTONS && defined(ADC_BUTTON_DEBOUNCE_DELAY) && ADC_BUTTON_DEBOUNCE_DELAY < 16 | ||||
|   | ||||
| @@ -277,7 +277,7 @@ class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE, | ||||
|     static void draw_progress(draw_mode_t); | ||||
|     static void draw_interaction_buttons(draw_mode_t); | ||||
|     static void draw_status_message(draw_mode_t, const char * const); | ||||
|  | ||||
|     static void _format_time(char *outstr, uint32_t time); | ||||
|   public: | ||||
|     static void loadBitmaps(); | ||||
|     static void setStatusMessage(const char *); | ||||
|   | ||||
| @@ -33,9 +33,9 @@ using namespace FTDI; | ||||
| using namespace Theme; | ||||
|  | ||||
| #if ENABLED(TOUCH_UI_PORTRAIT) | ||||
|     #define GRID_ROWS 8 | ||||
|   #define GRID_ROWS 16 | ||||
| #else | ||||
|     #define GRID_ROWS 8 | ||||
|   #define GRID_ROWS 16 | ||||
| #endif | ||||
|  | ||||
| void StatusScreen::draw_axis_position(draw_mode_t what) { | ||||
| @@ -44,19 +44,19 @@ void StatusScreen::draw_axis_position(draw_mode_t what) { | ||||
|   #define GRID_COLS 3 | ||||
|  | ||||
|   #if ENABLED(TOUCH_UI_PORTRAIT) | ||||
|     #define X_LBL_POS  BTN_POS(1,5), BTN_SIZE(1,1) | ||||
|     #define Y_LBL_POS  BTN_POS(1,6), BTN_SIZE(1,1) | ||||
|     #define Z_LBL_POS  BTN_POS(1,7), BTN_SIZE(1,1) | ||||
|     #define X_VAL_POS  BTN_POS(2,5), BTN_SIZE(2,1) | ||||
|     #define Y_VAL_POS  BTN_POS(2,6), BTN_SIZE(2,1) | ||||
|     #define Z_VAL_POS  BTN_POS(2,7), BTN_SIZE(2,1) | ||||
|     #define X_LBL_POS  BTN_POS(1, 9), BTN_SIZE(1,2) | ||||
|     #define Y_LBL_POS  BTN_POS(1,11), BTN_SIZE(1,2) | ||||
|     #define Z_LBL_POS  BTN_POS(1,13), BTN_SIZE(1,2) | ||||
|     #define X_VAL_POS  BTN_POS(2, 9), BTN_SIZE(2,2) | ||||
|     #define Y_VAL_POS  BTN_POS(2,11), BTN_SIZE(2,2) | ||||
|     #define Z_VAL_POS  BTN_POS(2,13), BTN_SIZE(2,2) | ||||
|   #else | ||||
|     #define X_LBL_POS  BTN_POS(1,5), BTN_SIZE(1,1) | ||||
|     #define Y_LBL_POS  BTN_POS(2,5), BTN_SIZE(1,1) | ||||
|     #define Z_LBL_POS  BTN_POS(3,5), BTN_SIZE(1,1) | ||||
|     #define X_VAL_POS  BTN_POS(1,6), BTN_SIZE(1,1) | ||||
|     #define Y_VAL_POS  BTN_POS(2,6), BTN_SIZE(1,1) | ||||
|     #define Z_VAL_POS  BTN_POS(3,6), BTN_SIZE(1,1) | ||||
|     #define X_LBL_POS  BTN_POS(1, 9), BTN_SIZE(1,2) | ||||
|     #define Y_LBL_POS  BTN_POS(2, 9), BTN_SIZE(1,2) | ||||
|     #define Z_LBL_POS  BTN_POS(3, 9), BTN_SIZE(1,2) | ||||
|     #define X_VAL_POS  BTN_POS(1,11), BTN_SIZE(1,2) | ||||
|     #define Y_VAL_POS  BTN_POS(2,11), BTN_SIZE(1,2) | ||||
|     #define Z_VAL_POS  BTN_POS(3,11), BTN_SIZE(1,2) | ||||
|   #endif | ||||
|  | ||||
|   #define _UNION_POS(x1,y1,w1,h1,x2,y2,w2,h2) x1,y1,max(x1+w1,x2+w2)-x1,max(y1+h1,y2+h2)-y1 | ||||
| @@ -103,9 +103,9 @@ void StatusScreen::draw_axis_position(draw_mode_t what) { | ||||
|  | ||||
|     cmd.tag(6) | ||||
|        .font(Theme::font_medium) | ||||
|        .text  ( X_VAL_POS, x_str) | ||||
|        .text  ( Y_VAL_POS, y_str) | ||||
|        .text  ( Z_VAL_POS, z_str); | ||||
|        .text(X_VAL_POS, x_str) | ||||
|        .text(Y_VAL_POS, y_str) | ||||
|        .text(Z_VAL_POS, z_str); | ||||
|   } | ||||
|  | ||||
|   #undef GRID_COLS | ||||
| @@ -120,12 +120,12 @@ void StatusScreen::draw_axis_position(draw_mode_t what) { | ||||
| void StatusScreen::draw_temperature(draw_mode_t what) { | ||||
|   using namespace Theme; | ||||
|  | ||||
|   #define TEMP_RECT_1 BTN_POS(1,1), BTN_SIZE(4,2) | ||||
|   #define TEMP_RECT_2 BTN_POS(1,1), BTN_SIZE(8,1) | ||||
|   #define NOZ_1_POS   BTN_POS(1,1), BTN_SIZE(4,1) | ||||
|   #define NOZ_2_POS   BTN_POS(5,1), BTN_SIZE(4,1) | ||||
|   #define BED_POS     BTN_POS(1,2), BTN_SIZE(4,1) | ||||
|   #define FAN_POS     BTN_POS(5,2), BTN_SIZE(4,1) | ||||
|   #define TEMP_RECT_1 BTN_POS(1,1), BTN_SIZE(4,4) | ||||
|   #define TEMP_RECT_2 BTN_POS(1,1), BTN_SIZE(8,2) | ||||
|   #define NOZ_1_POS   BTN_POS(1,1), BTN_SIZE(4,2) | ||||
|   #define NOZ_2_POS   BTN_POS(5,1), BTN_SIZE(4,2) | ||||
|   #define BED_POS     BTN_POS(1,3), BTN_SIZE(4,2) | ||||
|   #define FAN_POS     BTN_POS(5,3), BTN_SIZE(4,2) | ||||
|  | ||||
|   #define _ICON_POS(x,y,w,h) x, y, w/4, h | ||||
|   #define _TEXT_POS(x,y,w,h) x + w/4, y, w - w/4, h | ||||
| @@ -164,17 +164,12 @@ void StatusScreen::draw_temperature(draw_mode_t what) { | ||||
|        .cmd (BITMAP_SIZE  (Fan_Icon_Info)) | ||||
|        .icon(ICON_POS(FAN_POS), Fan_Icon_Info, icon_scale); | ||||
|  | ||||
|     #if ENABLED(TOUCH_UI_USE_UTF8) | ||||
|       load_utf8_bitmaps(cmd); // Restore font bitmap handles | ||||
|     #endif | ||||
|     TERN_(TOUCH_UI_USE_UTF8, load_utf8_bitmaps(cmd)); // Restore font bitmap handles | ||||
|   } | ||||
|  | ||||
|   if (what & FOREGROUND) { | ||||
|     using namespace ExtUI; | ||||
|     char e0_str[20]; | ||||
|     char e1_str[20]; | ||||
|     char bed_str[20]; | ||||
|     char fan_str[20]; | ||||
|     char e0_str[20], e1_str[20], bed_str[20], fan_str[20]; | ||||
|  | ||||
|     sprintf_P(fan_str, PSTR("%-3d %%"), int8_t(getActualFan_percent(FAN0))); | ||||
|  | ||||
| @@ -188,7 +183,6 @@ void StatusScreen::draw_temperature(draw_mode_t what) { | ||||
|     else | ||||
|       format_temp_and_temp(e0_str, getActualTemp_celsius(H0), getTargetTemp_celsius(H0)); | ||||
|  | ||||
|  | ||||
|     #if HAS_MULTI_EXTRUDER | ||||
|       if (isHeaterIdle(H1)) | ||||
|         format_temp_and_idle(e1_str, getActualTemp_celsius(H1)); | ||||
| @@ -207,57 +201,114 @@ void StatusScreen::draw_temperature(draw_mode_t what) { | ||||
|   } | ||||
| } | ||||
|  | ||||
| void StatusScreen::_format_time(char *outstr, uint32_t time) { | ||||
|   const uint8_t hrs = time / 3600, | ||||
|                 min = (time / 60) % 60, | ||||
|                 sec = time % 60; | ||||
|   if (hrs) | ||||
|     sprintf_P(outstr, PSTR("%02d:%02d"), hrs, min); | ||||
|   else | ||||
|     sprintf_P(outstr, PSTR("%02d:%02ds"), min, sec); | ||||
| } | ||||
|  | ||||
| void StatusScreen::draw_progress(draw_mode_t what) { | ||||
|   using namespace ExtUI; | ||||
|   using namespace Theme; | ||||
|  | ||||
|   CommandProcessor cmd; | ||||
|  | ||||
|   #undef GRID_COLS | ||||
|   #if ENABLED(TOUCH_UI_PORTRAIT) | ||||
|     #define TIME_POS     BTN_POS(1,3), BTN_SIZE(4,1) | ||||
|     #define PROGRESS_POS BTN_POS(5,3), BTN_SIZE(4,1) | ||||
|     #define GRID_COLS 3 | ||||
|     #define PROGRESSZONE_POS BTN_POS(1,5), BTN_SIZE(3,2) | ||||
|     #define TIME_POS_X       BTN_X(1) | ||||
|     #define TIME_POS_W       BTN_W(1) | ||||
|     #define REMAINING_POS_X  BTN_X(2) | ||||
|     #define REMAINING_POS_W  BTN_W(1) | ||||
|     #define PROGRESS_POS_X   BTN_X(3) | ||||
|     #define PROGRESS_POS_W   BTN_W(1) | ||||
|     #define PROGRESSZONE_FIRSTLINE_Y BTN_Y(5) | ||||
|     #define PROGRESSBAR_POS  BTN_POS(1,6), BTN_SIZE(3,1) | ||||
|   #else | ||||
|     #define TIME_POS     BTN_POS(9,1), BTN_SIZE(4,1) | ||||
|     #define PROGRESS_POS BTN_POS(9,2), BTN_SIZE(4,1) | ||||
|     #define GRID_COLS 6 | ||||
|     #define PROGRESSZONE_POS BTN_POS(5,1), BTN_SIZE(2,4) | ||||
|     #if ENABLED(SHOW_REMAINING_TIME) | ||||
|       #define TIME_POS       BTN_POS(5,1), BTN_SIZE(1,2) | ||||
|       #define REMAINING_POS  BTN_POS(6,1), BTN_SIZE(1,2) | ||||
|     #else | ||||
|       #define TIME_POS       BTN_POS(5,1), BTN_SIZE(2,2) | ||||
|     #endif | ||||
|     #define PROGRESS_POS     BTN_POS(5,3), BTN_SIZE(2,2) | ||||
|     #define PROGRESSBAR_POS  BTN_POS(5,2), BTN_SIZE(2,2) | ||||
|   #endif | ||||
|  | ||||
|   if (what & BACKGROUND) { | ||||
|     cmd.tag(0).font(font_medium) | ||||
|        .fgcolor(progress).button(TIME_POS,     F(""), OPT_FLAT) | ||||
|                          .button(PROGRESS_POS, F(""), OPT_FLAT); | ||||
|        .fgcolor(progress).button(PROGRESSZONE_POS, F(""), OPT_FLAT); | ||||
|   } | ||||
|  | ||||
|   if (what & FOREGROUND) { | ||||
|     const uint32_t elapsed = getProgress_seconds_elapsed(); | ||||
|     const uint8_t hrs = elapsed/3600; | ||||
|     const uint8_t min = (elapsed/60)%60; | ||||
|     char elapsed_str[10]; | ||||
|     _format_time(elapsed_str, elapsed); | ||||
|  | ||||
|     #if ENABLED(SHOW_REMAINING_TIME) | ||||
|       const uint32_t remaining = getProgress_seconds_remaining(); | ||||
|       char remaining_str[10]; | ||||
|       _format_time(remaining_str, remaining); | ||||
|     #endif | ||||
|  | ||||
|     const uint16_t current_progress = TERN(HAS_PRINT_PROGRESS_PERMYRIAD, getProgress_permyriad(), getProgress_percent() * 100); | ||||
|     constexpr uint16_t progress_range = 10000U; | ||||
|  | ||||
|     const bool show_progress_bar = current_progress > 0 && current_progress < progress_range + 1; | ||||
|     if (show_progress_bar) { | ||||
|       cmd.tag(0).font(font_medium) | ||||
|         .bgcolor(progress) | ||||
|         .progress(PROGRESSBAR_POS, current_progress, progress_range, OPT_FLAT); | ||||
|     } | ||||
|  | ||||
|     char time_str[10]; | ||||
|     char progress_str[10]; | ||||
|     sprintf_P(progress_str, | ||||
|       #if ENABLED(PRINT_PROGRESS_SHOW_DECIMALS) | ||||
|         PSTR("%3d.%02d%%"), uint8_t(current_progress / 100), current_progress % 100 | ||||
|       #else | ||||
|         PSTR("%3d%%"), uint8_t(current_progress / 100) | ||||
|       #endif | ||||
|     ); | ||||
|  | ||||
|     sprintf_P(time_str,     PSTR(" %02d : %02d"), hrs, min); | ||||
|     sprintf_P(progress_str, PSTR("%-3d %%"),      getProgress_percent() ); | ||||
|  | ||||
|     cmd.font(font_medium) | ||||
|        .tag(7).text(TIME_POS, time_str) | ||||
|               .text(PROGRESS_POS, progress_str); | ||||
|     #if ENABLED(TOUCH_UI_PORTRAIT) | ||||
|       const uint16_t texts_pos_h = show_progress_bar ? (BTN_H(1)) : (BTN_H(2)); | ||||
|       cmd.font(font_medium) | ||||
|          .tag(7).text(TIME_POS_X, PROGRESSZONE_FIRSTLINE_Y, TIME_POS_W, texts_pos_h, elapsed_str) | ||||
|          #if ENABLED(SHOW_REMAINING_TIME) | ||||
|            .text(REMAINING_POS_X, PROGRESSZONE_FIRSTLINE_Y, REMAINING_POS_W, texts_pos_h, remaining_str) | ||||
|          #endif | ||||
|          .text(PROGRESS_POS_X, PROGRESSZONE_FIRSTLINE_Y, PROGRESS_POS_W, texts_pos_h, progress_str); | ||||
|     #else | ||||
|       cmd.font(font_medium) | ||||
|          .tag(7).text(TIME_POS, elapsed_str) | ||||
|          #if ENABLED(SHOW_REMAINING_TIME) | ||||
|            .text(REMAINING_POS, remaining_str) | ||||
|          #endif | ||||
|          .text(PROGRESS_POS, progress_str); | ||||
|     #endif | ||||
|   } | ||||
|  | ||||
|   #undef GRID_COLS | ||||
| } | ||||
|  | ||||
| #undef GRID_COLS | ||||
|  | ||||
|  | ||||
| void StatusScreen::draw_interaction_buttons(draw_mode_t what) { | ||||
|   #define GRID_COLS 4 | ||||
|   if (what & FOREGROUND) { | ||||
|     using namespace ExtUI; | ||||
|  | ||||
|   #if ENABLED(TOUCH_UI_PORTRAIT) | ||||
|     #define MEDIA_BTN_POS  BTN_POS(1,8), BTN_SIZE(2,1) | ||||
|     #define MENU_BTN_POS   BTN_POS(3,8), BTN_SIZE(2,1) | ||||
|     #define MEDIA_BTN_POS  BTN_POS(1,15), BTN_SIZE(2,2) | ||||
|     #define MENU_BTN_POS   BTN_POS(3,15), BTN_SIZE(2,2) | ||||
|   #else | ||||
|     #define MEDIA_BTN_POS  BTN_POS(1,7), BTN_SIZE(2,2) | ||||
|     #define MENU_BTN_POS   BTN_POS(3,7), BTN_SIZE(2,2) | ||||
|     #define MEDIA_BTN_POS  BTN_POS(1,13), BTN_SIZE(2,4) | ||||
|     #define MENU_BTN_POS   BTN_POS(3,13), BTN_SIZE(2,4) | ||||
|   #endif | ||||
|  | ||||
|     const bool has_media = isMediaInserted() && !isPrintingFromMedia(); | ||||
| @@ -278,9 +329,9 @@ void StatusScreen::draw_status_message(draw_mode_t what, const char* message) { | ||||
|   #define GRID_COLS 1 | ||||
|  | ||||
|   #if ENABLED(TOUCH_UI_PORTRAIT) | ||||
|     #define STATUS_POS  BTN_POS(1,4), BTN_SIZE(1,1) | ||||
|     #define STATUS_POS  BTN_POS(1,7), BTN_SIZE(1,2) | ||||
|   #else | ||||
|     #define STATUS_POS  BTN_POS(1,3), BTN_SIZE(1,2) | ||||
|     #define STATUS_POS  BTN_POS(1,5), BTN_SIZE(1,4) | ||||
|   #endif | ||||
|  | ||||
|   if (what & BACKGROUND) { | ||||
|   | ||||
| @@ -245,7 +245,7 @@ namespace ExtUI { | ||||
|   } | ||||
|  | ||||
|   #ifdef TOUCH_UI_LCD_TEMP_SCALING | ||||
|     #define GET_TEMP_ADJUSTMENT(A) float(A)/TOUCH_UI_LCD_TEMP_SCALING | ||||
|     #define GET_TEMP_ADJUSTMENT(A) (float(A) / (TOUCH_UI_LCD_TEMP_SCALING)) | ||||
|   #else | ||||
|     #define GET_TEMP_ADJUSTMENT(A) A | ||||
|   #endif | ||||
| @@ -807,10 +807,6 @@ namespace ExtUI { | ||||
|     #endif | ||||
|   #endif | ||||
|  | ||||
|   uint8_t getProgress_percent() { | ||||
|     return ui.get_progress_percent(); | ||||
|   } | ||||
|  | ||||
|   uint32_t getProgress_seconds_elapsed() { | ||||
|     const duration_t elapsed = print_job_timer.duration(); | ||||
|     return elapsed.value; | ||||
|   | ||||
| @@ -43,6 +43,7 @@ | ||||
|  ****************************************************************************/ | ||||
|  | ||||
| #include "../../inc/MarlinConfig.h" | ||||
| #include "../marlinui.h" | ||||
|  | ||||
| namespace ExtUI { | ||||
|  | ||||
| @@ -129,9 +130,19 @@ namespace ExtUI { | ||||
|   float getTravelAcceleration_mm_s2(); | ||||
|   float getFeedrate_percent(); | ||||
|   int16_t getFlowPercentage(const extruder_t); | ||||
|   uint8_t getProgress_percent(); | ||||
|  | ||||
|   inline uint8_t getProgress_percent() { return ui.get_progress_percent(); } | ||||
|  | ||||
|   #if HAS_PRINT_PROGRESS_PERMYRIAD | ||||
|     inline uint16_t getProgress_permyriad() { return ui.get_progress_permyriad(); } | ||||
|   #endif | ||||
|  | ||||
|   uint32_t getProgress_seconds_elapsed(); | ||||
|  | ||||
|   #if ENABLED(SHOW_REMAINING_TIME) | ||||
|     inline uint32_t getProgress_seconds_remaining() { return ui.get_remaining_time(); } | ||||
|   #endif | ||||
|  | ||||
|   #if HAS_LEVELING | ||||
|     bool getLevelingActive(); | ||||
|     void setLevelingActive(const bool); | ||||
|   | ||||
| @@ -57,6 +57,10 @@ | ||||
|   #define MULTI_MANUAL 1 | ||||
| #endif | ||||
|  | ||||
| #if HAS_DISPLAY | ||||
|   #include "../module/printcounter.h" | ||||
| #endif | ||||
|  | ||||
| #if HAS_WIRED_LCD | ||||
|  | ||||
|   #include "../MarlinCore.h" | ||||
| @@ -357,11 +361,20 @@ public: | ||||
|       static void set_progress(const progress_t p) { progress_override = _MIN(p, 100U * (PROGRESS_SCALE)); } | ||||
|       static void set_progress_done() { progress_override = (PROGRESS_MASK + 1U) + 100U * (PROGRESS_SCALE); } | ||||
|       static void progress_reset() { if (progress_override & (PROGRESS_MASK + 1U)) set_progress(0); } | ||||
|       #if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME) | ||||
|         static uint32_t remaining_time; | ||||
|         FORCE_INLINE static void set_remaining_time(const uint32_t r) { remaining_time = r; } | ||||
|         FORCE_INLINE static uint32_t get_remaining_time() { return remaining_time; } | ||||
|         FORCE_INLINE static void reset_remaining_time() { set_remaining_time(0); } | ||||
|       #if ENABLED(SHOW_REMAINING_TIME) | ||||
|         static inline uint32_t _calculated_remaining_time() { | ||||
|           const duration_t elapsed = print_job_timer.duration(); | ||||
|           const progress_t progress = _get_progress(); | ||||
|           return elapsed.value * (100 * (PROGRESS_SCALE) - progress) / progress; | ||||
|         } | ||||
|         #if ENABLED(USE_M73_REMAINING_TIME) | ||||
|           static uint32_t remaining_time; | ||||
|           FORCE_INLINE static void set_remaining_time(const uint32_t r) { remaining_time = r; } | ||||
|           FORCE_INLINE static uint32_t get_remaining_time() { return remaining_time ?: _calculated_remaining_time(); } | ||||
|           FORCE_INLINE static void reset_remaining_time() { set_remaining_time(0); } | ||||
|         #else | ||||
|           FORCE_INLINE static uint32_t get_remaining_time() { return _calculated_remaining_time(); } | ||||
|         #endif | ||||
|       #endif | ||||
|     #endif | ||||
|     static progress_t _get_progress(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user