Skip to content

Commit 09af42e

Browse files
authored
Clean up CrealityUI and MarlinUI (#22586)
1 parent 3e0d8e1 commit 09af42e

File tree

10 files changed

+948
-824
lines changed

10 files changed

+948
-824
lines changed

Marlin/Configuration_adv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@
15801580
*/
15811581
#if HAS_MARLINUI_U8GLIB
15821582
// Show SD percentage next to the progress bar
1583-
//#define DOGM_SD_PERCENT
1583+
//#define SHOW_SD_PERCENT
15841584

15851585
// Save many cycles by drawing a hollow frame or no frame on the Info Screen
15861586
//#define XYZ_NO_FRAME

Marlin/src/inc/SanityCheck.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,8 @@
577577
#error "CUSTOM_USER_MENUS has been replaced by CUSTOM_MENU_MAIN and CUSTOM_MENU_CONFIG."
578578
#elif defined(MKS_LCD12864)
579579
#error "MKS_LCD12864 is now MKS_LCD12864A or MKS_LCD12864B."
580+
#elif defined(DOGM_SD_PERCENT)
581+
#error "DOGM_SD_PERCENT is now SHOW_SD_PERCENT."
580582
#elif defined(NEOPIXEL_BKGD_LED_INDEX)
581583
#error "NEOPIXEL_BKGD_LED_INDEX is now NEOPIXEL_BKGD_INDEX_FIRST."
582584
#elif defined(TEMP_SENSOR_1_AS_REDUNDANT)

Marlin/src/lcd/dogm/marlinui_DOGM.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,11 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
354354
#if ENABLED(ADVANCED_PAUSE_FEATURE)
355355

356356
void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) {
357-
row_y1 = row * (MENU_FONT_HEIGHT) + 1;
358-
row_y2 = row_y1 + MENU_FONT_HEIGHT - 1;
357+
u8g_uint_t y1 = row * (MENU_FONT_HEIGHT) + 1, y2 = y1 + MENU_FONT_HEIGHT - 1;
359358

360-
if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return;
359+
if (!PAGE_CONTAINS(y1 + 1, y2 + 2)) return;
361360

362-
lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), row_y2, 'E');
361+
lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), y2, 'E');
363362
lcd_put_wchar((char)('1' + extruder));
364363
lcd_put_wchar(' ');
365364
lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));

Marlin/src/lcd/dogm/status_screen_DOGM.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,13 @@ void MarlinUI::draw_status_screen() {
456456
#endif
457457

458458
#if HAS_PRINT_PROGRESS
459-
#if DISABLED(DOGM_SD_PERCENT)
459+
#if DISABLED(SHOW_SD_PERCENT)
460460
#define _SD_INFO_X(len) (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH) / 2 - (len) * (MENU_FONT_WIDTH) / 2)
461461
#else
462462
#define _SD_INFO_X(len) (LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH))
463463
#endif
464464

465-
#if ENABLED(DOGM_SD_PERCENT)
465+
#if ENABLED(SHOW_SD_PERCENT)
466466
static char progress_string[5];
467467
#endif
468468
static uint8_t lastElapsed = 0xFF, lastProgress = 0xFF;
@@ -471,7 +471,7 @@ void MarlinUI::draw_status_screen() {
471471
#if ENABLED(SHOW_REMAINING_TIME)
472472
static u8g_uint_t estimation_x_pos = 0;
473473
static char estimation_string[10];
474-
#if BOTH(DOGM_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
474+
#if BOTH(SHOW_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
475475
static u8g_uint_t progress_x_pos = 0;
476476
static uint8_t progress_state = 0;
477477
static bool prev_blink = 0;
@@ -526,7 +526,7 @@ void MarlinUI::draw_status_screen() {
526526

527527
progress_bar_solid_width = u8g_uint_t((PROGRESS_BAR_WIDTH - 2) * (progress / (PROGRESS_SCALE)) * 0.01f);
528528

529-
#if ENABLED(DOGM_SD_PERCENT)
529+
#if ENABLED(SHOW_SD_PERCENT)
530530
if (progress == 0) {
531531
progress_string[0] = '\0';
532532
#if ENABLED(SHOW_REMAINING_TIME)
@@ -543,7 +543,7 @@ void MarlinUI::draw_status_screen() {
543543
#endif
544544
}
545545

546-
constexpr bool can_show_days = DISABLED(DOGM_SD_PERCENT) || ENABLED(ROTATE_PROGRESS_DISPLAY);
546+
constexpr bool can_show_days = DISABLED(SHOW_SD_PERCENT) || ENABLED(ROTATE_PROGRESS_DISPLAY);
547547
if (ev != lastElapsed) {
548548
lastElapsed = ev;
549549
const uint8_t len = elapsed.toDigital(elapsed_string, can_show_days && elapsed.value >= 60*60*24L);
@@ -564,11 +564,7 @@ void MarlinUI::draw_status_screen() {
564564
else {
565565
duration_t estimation = timeval;
566566
const uint8_t len = estimation.toDigital(estimation_string, can_show_days && estimation.value >= 60*60*24L);
567-
estimation_x_pos = _SD_INFO_X(len
568-
#if !BOTH(DOGM_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
569-
+ 1
570-
#endif
571-
);
567+
estimation_x_pos = _SD_INFO_X(len + !BOTH(SHOW_SD_PERCENT, ROTATE_PROGRESS_DISPLAY));
572568
}
573569
}
574570
#endif
@@ -767,7 +763,7 @@ void MarlinUI::draw_status_screen() {
767763

768764
if (PAGE_CONTAINS(EXTRAS_BASELINE - INFO_FONT_ASCENT, EXTRAS_BASELINE - 1)) {
769765

770-
#if ALL(DOGM_SD_PERCENT, SHOW_REMAINING_TIME, ROTATE_PROGRESS_DISPLAY)
766+
#if ALL(SHOW_SD_PERCENT, SHOW_REMAINING_TIME, ROTATE_PROGRESS_DISPLAY)
771767

772768
if (prev_blink != blink) {
773769
prev_blink = blink;
@@ -789,13 +785,13 @@ void MarlinUI::draw_status_screen() {
789785
lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
790786
}
791787

792-
#else // !DOGM_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY
788+
#else // !SHOW_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY
793789

794790
//
795791
// SD Percent Complete
796792
//
797793

798-
#if ENABLED(DOGM_SD_PERCENT)
794+
#if ENABLED(SHOW_SD_PERCENT)
799795
if (progress_string[0]) {
800796
lcd_put_u8str(55, EXTRAS_BASELINE, progress_string); // Percent complete
801797
lcd_put_wchar('%');
@@ -815,7 +811,7 @@ void MarlinUI::draw_status_screen() {
815811
#endif
816812
lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
817813

818-
#endif // !DOGM_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY
814+
#endif // !SHOW_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY
819815
}
820816

821817
#endif // HAS_PRINT_PROGRESS

0 commit comments

Comments
 (0)