Print progress enhancements (#14647)

This commit is contained in:
Marcio Teixeira
2019-07-17 02:12:39 -06:00
committed by Scott Lahteine
parent ebb1a7dc1f
commit 27c487bab7
13 changed files with 31 additions and 17 deletions

View File

@ -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;
#endif
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
progress_reset();
#endif
#if BOTH(DOUBLECLICK_FOR_Z_BABYSTEPPING, BABYSTEPPING)
static millis_t doubleclick_expire_ms = 0;
// Going to menu_main from status screen? Remember first click time.

View File

@ -1522,13 +1522,15 @@ void MarlinUI::update() {
uint8_t MarlinUI::get_progress() {
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
uint8_t &progress = progress_bar_percent;
#define _PLIMIT(P) ((P) & 0x7F)
#else
#define _PLIMIT(P) P
uint8_t progress = 0;
#endif
#if ENABLED(SDSUPPORT)
if (IS_SD_PRINTING()) progress = card.percentDone();
#endif
return progress;
return _PLIMIT(progress);
}
#endif

View File

@ -298,6 +298,8 @@ public:
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
static uint8_t progress_bar_percent;
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
static uint8_t get_progress();
#else