Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Nov 10, 2021
1 parent 54acebb commit aeba1d4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@

#endif // HAS_LCD_MENU

#if HAS_DISPLAY || ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#if EITHER(HAS_DISPLAY, DWIN_CREALITY_LCD_ENHANCED)
// The timeout (in ms) to return to the status screen from sub-menus
//#define LCD_TIMEOUT_TO_STATUS 15000

Expand All @@ -1292,13 +1292,13 @@
#endif

// Scroll a longer status message into view
#define STATUS_MESSAGE_SCROLLING
//#define STATUS_MESSAGE_SCROLLING

// On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY

// Add an 'M73' G-code to set the current percentage
#define LCD_SET_PROGRESS_MANUALLY
//#define LCD_SET_PROGRESS_MANUALLY

// Show the E position (filament used) during printing
//#define LCD_SHOW_E_TOTAL
Expand Down
8 changes: 6 additions & 2 deletions Marlin/src/lcd/e3v2/enhanced/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ void DWIN_DrawStatusMessage() {
const uint8_t max_status_chars = DWIN_WIDTH / DWINUI::fontWidth(DWINUI::font);

#if ENABLED(STATUS_MESSAGE_SCROLLING)

// Get the UTF8 character count of the string
uint8_t slen = utf8_strlen(ui.status_message);

Expand All @@ -670,20 +671,23 @@ void DWIN_DrawStatusMessage() {
if (rlen < max_status_chars) {
DWINUI::Draw_Char('.'); // Always at 1+ spaces left, draw a dot
uint8_t chars = max_status_chars - rlen; // Amount of space left in characters
if (--chars) { // Draw a second dot if there's space
if (--chars) { // Draw a second dot if there's space
DWINUI::Draw_Char('.');
if (--chars)
DWINUI::Draw_String(ui.status_message, chars); // Print a second copy of the message
DWINUI::Draw_String(ui.status_message, chars); // Print a second copy of the message
}
}
MarlinUI::advance_status_scroll();
}

#else

if (hash_changed) {
ui.status_message[max_status_chars] = 0;
DWIN_DrawStatusLine(HMI_data.StatusTxt_Color, HMI_data.StatusBg_Color, ui.status_message);
hash_changed = false;
}

#endif
}

Expand Down
18 changes: 7 additions & 11 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ MarlinUI ui;
constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;

#if HAS_STATUS_MESSAGE
#if BOTH(HAS_WIRED_LCD, STATUS_MESSAGE_SCROLLING) || BOTH(DWIN_CREALITY_LCD_ENHANCED, STATUS_MESSAGE_SCROLLING)
#if ENABLED(STATUS_MESSAGE_SCROLLING) && EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_ENHANCED)
uint8_t MarlinUI::status_scroll_offset; // = 0
#endif
char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1];
Expand Down Expand Up @@ -1482,11 +1482,9 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;

void MarlinUI::finish_status(const bool persist) {

#if HAS_WIRED_LCD
UNUSED(persist);

#if !(BASIC_PROGRESS_BAR && (PROGRESS_MSG_EXPIRE) > 0)
UNUSED(persist);
#endif
#if HAS_WIRED_LCD

#if BASIC_PROGRESS_BAR || BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
const millis_t ms = millis();
Expand All @@ -1503,12 +1501,10 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
next_filament_display = ms + 5000UL; // Show status message for 5s
#endif

TERN_(STATUS_MESSAGE_SCROLLING, status_scroll_offset = 0);
#else // HAS_WIRED_LCD
#if BOTH(DWIN_CREALITY_LCD_ENHANCED, STATUS_MESSAGE_SCROLLING)
status_scroll_offset = 0;
#endif
UNUSED(persist);
#endif

#if ENABLED(STATUS_MESSAGE_SCROLLING) && EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_ENHANCED)
status_scroll_offset = 0;
#endif

TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message));
Expand Down

0 comments on commit aeba1d4

Please sign in to comment.