♻️ Set Progress without LCD (#24767)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
EvilGremlin
2022-10-09 18:30:47 +03:00
committed by Scott Lahteine
parent b0f02b8f9e
commit 8481264566
34 changed files with 626 additions and 487 deletions

View File

@@ -79,11 +79,16 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
statusResetFunc_t MarlinUI::status_reset_callback; // = nullptr
#endif
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
MarlinUI::progress_t MarlinUI::progress_override; // = 0
#if ENABLED(USE_M73_REMAINING_TIME)
#if ENABLED(SET_PROGRESS_MANUALLY)
#if ENABLED(SET_PROGRESS_PERCENT)
MarlinUI::progress_t MarlinUI::progress_override; // = 0
#endif
#if ENABLED(SET_REMAINING_TIME)
uint32_t MarlinUI::remaining_time;
#endif
#if ENABLED(SET_INTERACTION_TIME)
uint32_t MarlinUI::interaction_time;
#endif
#endif
#if HAS_MULTI_LANGUAGE
@@ -153,7 +158,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
bool MarlinUI::lcd_clicked;
#endif
#if EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_JYERSUI)
#if LCD_WITH_BLINK
bool MarlinUI::get_blink() {
static uint8_t blink = 0;
@@ -1677,19 +1682,6 @@ void MarlinUI::init() {
print_job_timer.start(); // Also called by M24
}
#if HAS_PRINT_PROGRESS
MarlinUI::progress_t MarlinUI::_get_progress() {
return (
TERN0(LCD_SET_PROGRESS_MANUALLY, (progress_override & PROGRESS_MASK))
#if ENABLED(SDSUPPORT)
?: TERN(HAS_PRINT_PROGRESS_PERMYRIAD, card.permyriadDone(), card.percentDone())
#endif
);
}
#endif
#if HAS_TOUCH_BUTTONS
//
@@ -1723,6 +1715,38 @@ void MarlinUI::init() {
#endif // HAS_DISPLAY
#if HAS_PRINT_PROGRESS
MarlinUI::progress_t MarlinUI::_get_progress() {
return (
TERN0(SET_PROGRESS_PERCENT, (progress_override & PROGRESS_MASK))
#if ENABLED(SDSUPPORT)
?: TERN(HAS_PRINT_PROGRESS_PERMYRIAD, card.permyriadDone(), card.percentDone())
#endif
);
}
#if LCD_WITH_BLINK
typedef void (*PrintProgress_t)();
void MarlinUI::rotate_progress() { // Renew and redraw all enabled progress strings
const PrintProgress_t progFunc[] = {
OPTITEM(SHOW_PROGRESS_PERCENT, drawPercent)
OPTITEM(SHOW_ELAPSED_TIME, drawElapsed)
OPTITEM(SHOW_REMAINING_TIME, drawRemain)
OPTITEM(SHOW_INTERACTION_TIME, drawInter)
};
static bool prev_blink;
static uint8_t i;
if (prev_blink != get_blink()) {
prev_blink = get_blink();
if (++i >= COUNT(progFunc)) i = 0;
(*progFunc[i])();
}
}
#endif
#endif // HAS_PRINT_PROGRESS
#if ENABLED(SDSUPPORT)
#if ENABLED(EXTENSIBLE_UI)