Browse Source

Followup to progress override (#15488)

pull/1/head
LinFor 5 years ago
committed by Scott Lahteine
parent
commit
58f81f8e7e
  1. 2
      Marlin/src/lcd/extensible_ui/lib/dgus/DGUSDisplayDefinition.cpp
  2. 17
      Marlin/src/lcd/ultralcd.cpp
  3. 6
      Marlin/src/lcd/ultralcd.h

2
Marlin/src/lcd/extensible_ui/lib/dgus/DGUSDisplayDefinition.cpp

@ -200,7 +200,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
VPHELPER(VP_ZPos, &current_position.z, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>), VPHELPER(VP_ZPos, &current_position.z, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
// Print Progress. // Print Progress.
VPHELPER(VP_PrintProgress_Percentage, &ui.progress_bar_percent, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay ), VPHELPER(VP_PrintProgress_Percentage, &ui.progress_override, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay ),
// Print Time // Print Time
VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintTimeToDisplay ), VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendPrintTimeToDisplay ),

17
Marlin/src/lcd/ultralcd.cpp

@ -61,7 +61,7 @@
#endif #endif
#if ENABLED(LCD_SET_PROGRESS_MANUALLY) #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
uint8_t MarlinUI::progress_bar_percent; // = 0 uint8_t MarlinUI::progress_override; // = 0
#endif #endif
#if HAS_BUZZER #if HAS_BUZZER
@ -1539,16 +1539,15 @@ void MarlinUI::update() {
#if HAS_PRINT_PROGRESS #if HAS_PRINT_PROGRESS
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; const uint8_t p = progress_override & 0x7F;
#define _PLIMIT(P) ((P) & 0x7F)
#else #else
#define _PLIMIT(P) P constexpr uint8_t p = 0;
uint8_t progress = 0;
#endif #endif
#if ENABLED(SDSUPPORT) return (p
if (!_PLIMIT(progress)) progress = card.percentDone(); #if ENABLED(SDSUPPORT)
#endif ?: card.percentDone()
return _PLIMIT(progress); #endif
);
} }
#endif #endif

6
Marlin/src/lcd/ultralcd.h

@ -293,10 +293,10 @@ public:
#if HAS_PRINT_PROGRESS #if HAS_PRINT_PROGRESS
#if ENABLED(LCD_SET_PROGRESS_MANUALLY) #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
static uint8_t progress_bar_percent; static uint8_t progress_override;
static void set_progress(const uint8_t progress) { progress_bar_percent = _MIN(progress, 100); } static void set_progress(const uint8_t progress) { progress_override = _MIN(progress, 100); }
static void set_progress_done() { set_progress(0x80 + 100); } static void set_progress_done() { set_progress(0x80 + 100); }
static void progress_reset() { if (progress_bar_percent & 0x80) set_progress(0); } static void progress_reset() { if (progress_override & 0x80) set_progress(0); }
#endif #endif
static uint8_t get_progress(); static uint8_t get_progress();
#else #else

Loading…
Cancel
Save