♻️ Clean up CrealityUI and MarlinUI (#22586)

This commit is contained in:
Scott Lahteine 2021-08-17 06:18:19 -05:00 committed by Scott Lahteine
parent 718227a94c
commit de7f6c425b
10 changed files with 1190 additions and 1058 deletions

View file

@ -1558,7 +1558,7 @@
*/ */
#if HAS_MARLINUI_U8GLIB #if HAS_MARLINUI_U8GLIB
// Show SD percentage next to the progress bar // Show SD percentage next to the progress bar
//#define DOGM_SD_PERCENT //#define SHOW_SD_PERCENT
// Save many cycles by drawing a hollow frame or no frame on the Info Screen // Save many cycles by drawing a hollow frame or no frame on the Info Screen
//#define XYZ_NO_FRAME //#define XYZ_NO_FRAME

View file

@ -577,6 +577,8 @@
#error "CUSTOM_USER_MENUS has been replaced by CUSTOM_MENU_MAIN and CUSTOM_MENU_CONFIG." #error "CUSTOM_USER_MENUS has been replaced by CUSTOM_MENU_MAIN and CUSTOM_MENU_CONFIG."
#elif defined(MKS_LCD12864) #elif defined(MKS_LCD12864)
#error "MKS_LCD12864 is now MKS_LCD12864A or MKS_LCD12864B." #error "MKS_LCD12864 is now MKS_LCD12864A or MKS_LCD12864B."
#elif defined(DOGM_SD_PERCENT)
#error "DOGM_SD_PERCENT is now SHOW_SD_PERCENT."
#elif defined(NEOPIXEL_BKGD_LED_INDEX) #elif defined(NEOPIXEL_BKGD_LED_INDEX)
#error "NEOPIXEL_BKGD_LED_INDEX is now NEOPIXEL_BKGD_INDEX_FIRST." #error "NEOPIXEL_BKGD_LED_INDEX is now NEOPIXEL_BKGD_INDEX_FIRST."
#elif defined(TEMP_SENSOR_1_AS_REDUNDANT) #elif defined(TEMP_SENSOR_1_AS_REDUNDANT)

View file

@ -354,12 +354,11 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) { void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) {
row_y1 = row * (MENU_FONT_HEIGHT) + 1; u8g_uint_t y1 = row * (MENU_FONT_HEIGHT) + 1, y2 = y1 + MENU_FONT_HEIGHT - 1;
row_y2 = row_y1 + MENU_FONT_HEIGHT - 1;
if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return; if (!PAGE_CONTAINS(y1 + 1, y2 + 2)) return;
lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), row_y2, 'E'); lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), y2, 'E');
lcd_put_wchar((char)('1' + extruder)); lcd_put_wchar((char)('1' + extruder));
lcd_put_wchar(' '); lcd_put_wchar(' ');
lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder))); lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));

View file

@ -456,13 +456,13 @@ void MarlinUI::draw_status_screen() {
#endif #endif
#if HAS_PRINT_PROGRESS #if HAS_PRINT_PROGRESS
#if DISABLED(DOGM_SD_PERCENT) #if DISABLED(SHOW_SD_PERCENT)
#define _SD_INFO_X(len) (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH) / 2 - (len) * (MENU_FONT_WIDTH) / 2) #define _SD_INFO_X(len) (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH) / 2 - (len) * (MENU_FONT_WIDTH) / 2)
#else #else
#define _SD_INFO_X(len) (LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH)) #define _SD_INFO_X(len) (LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH))
#endif #endif
#if ENABLED(DOGM_SD_PERCENT) #if ENABLED(SHOW_SD_PERCENT)
static char progress_string[5]; static char progress_string[5];
#endif #endif
static uint8_t lastElapsed = 0xFF, lastProgress = 0xFF; static uint8_t lastElapsed = 0xFF, lastProgress = 0xFF;
@ -471,7 +471,7 @@ void MarlinUI::draw_status_screen() {
#if ENABLED(SHOW_REMAINING_TIME) #if ENABLED(SHOW_REMAINING_TIME)
static u8g_uint_t estimation_x_pos = 0; static u8g_uint_t estimation_x_pos = 0;
static char estimation_string[10]; static char estimation_string[10];
#if BOTH(DOGM_SD_PERCENT, ROTATE_PROGRESS_DISPLAY) #if BOTH(SHOW_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
static u8g_uint_t progress_x_pos = 0; static u8g_uint_t progress_x_pos = 0;
static uint8_t progress_state = 0; static uint8_t progress_state = 0;
static bool prev_blink = 0; static bool prev_blink = 0;
@ -526,7 +526,7 @@ void MarlinUI::draw_status_screen() {
progress_bar_solid_width = u8g_uint_t((PROGRESS_BAR_WIDTH - 2) * (progress / (PROGRESS_SCALE)) * 0.01f); progress_bar_solid_width = u8g_uint_t((PROGRESS_BAR_WIDTH - 2) * (progress / (PROGRESS_SCALE)) * 0.01f);
#if ENABLED(DOGM_SD_PERCENT) #if ENABLED(SHOW_SD_PERCENT)
if (progress == 0) { if (progress == 0) {
progress_string[0] = '\0'; progress_string[0] = '\0';
#if ENABLED(SHOW_REMAINING_TIME) #if ENABLED(SHOW_REMAINING_TIME)
@ -543,7 +543,7 @@ void MarlinUI::draw_status_screen() {
#endif #endif
} }
constexpr bool can_show_days = DISABLED(DOGM_SD_PERCENT) || ENABLED(ROTATE_PROGRESS_DISPLAY); constexpr bool can_show_days = DISABLED(SHOW_SD_PERCENT) || ENABLED(ROTATE_PROGRESS_DISPLAY);
if (ev != lastElapsed) { if (ev != lastElapsed) {
lastElapsed = ev; lastElapsed = ev;
const uint8_t len = elapsed.toDigital(elapsed_string, can_show_days && elapsed.value >= 60*60*24L); 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() {
else { else {
duration_t estimation = timeval; duration_t estimation = timeval;
const uint8_t len = estimation.toDigital(estimation_string, can_show_days && estimation.value >= 60*60*24L); const uint8_t len = estimation.toDigital(estimation_string, can_show_days && estimation.value >= 60*60*24L);
estimation_x_pos = _SD_INFO_X(len estimation_x_pos = _SD_INFO_X(len + !BOTH(SHOW_SD_PERCENT, ROTATE_PROGRESS_DISPLAY));
#if !BOTH(DOGM_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
+ 1
#endif
);
} }
} }
#endif #endif
@ -767,7 +763,7 @@ void MarlinUI::draw_status_screen() {
if (PAGE_CONTAINS(EXTRAS_BASELINE - INFO_FONT_ASCENT, EXTRAS_BASELINE - 1)) { if (PAGE_CONTAINS(EXTRAS_BASELINE - INFO_FONT_ASCENT, EXTRAS_BASELINE - 1)) {
#if ALL(DOGM_SD_PERCENT, SHOW_REMAINING_TIME, ROTATE_PROGRESS_DISPLAY) #if ALL(SHOW_SD_PERCENT, SHOW_REMAINING_TIME, ROTATE_PROGRESS_DISPLAY)
if (prev_blink != blink) { if (prev_blink != blink) {
prev_blink = blink; prev_blink = blink;
@ -789,13 +785,13 @@ void MarlinUI::draw_status_screen() {
lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string); lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
} }
#else // !DOGM_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY #else // !SHOW_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY
// //
// SD Percent Complete // SD Percent Complete
// //
#if ENABLED(DOGM_SD_PERCENT) #if ENABLED(SHOW_SD_PERCENT)
if (progress_string[0]) { if (progress_string[0]) {
lcd_put_u8str(55, EXTRAS_BASELINE, progress_string); // Percent complete lcd_put_u8str(55, EXTRAS_BASELINE, progress_string); // Percent complete
lcd_put_wchar('%'); lcd_put_wchar('%');
@ -815,7 +811,7 @@ void MarlinUI::draw_status_screen() {
#endif #endif
lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string); lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
#endif // !DOGM_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY #endif // !SHOW_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY
} }
#endif // HAS_PRINT_PROGRESS #endif // HAS_PRINT_PROGRESS

File diff suppressed because it is too large Load diff

View file

@ -163,18 +163,6 @@ typedef struct {
extern HMI_value_t HMI_ValueStruct; extern HMI_value_t HMI_ValueStruct;
extern HMI_Flag_t HMI_flag; extern HMI_Flag_t HMI_flag;
// Show ICO
void ICON_Print(bool show);
void ICON_Prepare(bool show);
void ICON_Control(bool show);
void ICON_Leveling(bool show);
void ICON_StartInfo(bool show);
void ICON_Setting(bool show);
void ICON_Pause(bool show);
void ICON_Continue(bool show);
void ICON_Stop(bool show);
#if HAS_HOTEND || HAS_HEATED_BED #if HAS_HOTEND || HAS_HEATED_BED
// Popup message window // Popup message window
void DWIN_Popup_Temperature(const bool toohigh); void DWIN_Popup_Temperature(const bool toohigh);
@ -261,7 +249,6 @@ void EachMomentUpdate();
void DWIN_HandleScreen(); void DWIN_HandleScreen();
void DWIN_StatusChanged(const char *text); void DWIN_StatusChanged(const char *text);
void DWIN_StatusChanged_P(PGM_P const pstr); void DWIN_StatusChanged_P(PGM_P const pstr);
void DWIN_Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool mode /* = false*/);
inline void DWIN_StartHoming() { HMI_flag.home_flag = true; } inline void DWIN_StartHoming() { HMI_flag.home_flag = true; }

View file

@ -31,6 +31,9 @@
#include <stdint.h> #include <stdint.h>
//#define USE_STRING_HEADINGS
//#define USE_STRING_TITLES
#define RECEIVED_NO_DATA 0x00 #define RECEIVED_NO_DATA 0x00
#define RECEIVED_SHAKE_HAND_ACK 0x01 #define RECEIVED_SHAKE_HAND_ACK 0x01
@ -42,17 +45,12 @@
#define DWIN_WIDTH 272 #define DWIN_WIDTH 272
#define DWIN_HEIGHT 480 #define DWIN_HEIGHT 480
// Character matrix width x height
//#define LCD_WIDTH ((DWIN_WIDTH) / 8)
//#define LCD_HEIGHT ((DWIN_HEIGHT) / 12)
// Picture ID // Picture ID
#define DWIN_Boot_Screen 0
#define Language_English 1 #define Language_English 1
#define Language_Chinese 2 #define Language_Chinese 2
// ICON ID // ICON ID
#define ICON 0x09 #define ICON 7 // Icon set file 7.ICO
#define ICON_LOGO 0 #define ICON_LOGO 0
#define ICON_Print_0 1 #define ICON_Print_0 1
@ -258,8 +256,7 @@ inline void DWIN_Draw_VLine(uint16_t color, uint16_t xStart, uint16_t yStart, ui
// color: Rectangle color // color: Rectangle color
// xStart/yStart: upper left point // xStart/yStart: upper left point
// xEnd/yEnd: lower right point // xEnd/yEnd: lower right point
void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color, void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd);
uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd);
// Draw a box // Draw a box
// mode: 0=frame, 1=fill, 2=XOR fill // mode: 0=frame, 1=fill, 2=XOR fill

View file

@ -273,8 +273,8 @@ namespace Language_en {
PROGMEM Language_Str MSG_MOVE_I = _UxGT("Move ") LCD_STR_I; PROGMEM Language_Str MSG_MOVE_I = _UxGT("Move ") LCD_STR_I;
PROGMEM Language_Str MSG_MOVE_J = _UxGT("Move ") LCD_STR_J; PROGMEM Language_Str MSG_MOVE_J = _UxGT("Move ") LCD_STR_J;
PROGMEM Language_Str MSG_MOVE_K = _UxGT("Move ") LCD_STR_K; PROGMEM Language_Str MSG_MOVE_K = _UxGT("Move ") LCD_STR_K;
PROGMEM Language_Str MSG_MOVE_E = _UxGT("Extruder"); PROGMEM Language_Str MSG_MOVE_E = _UxGT("Move Extruder");
PROGMEM Language_Str MSG_MOVE_EN = _UxGT("Extruder *"); PROGMEM Language_Str MSG_MOVE_EN = _UxGT("Move E*");
PROGMEM Language_Str MSG_HOTEND_TOO_COLD = _UxGT("Hotend too cold"); PROGMEM Language_Str MSG_HOTEND_TOO_COLD = _UxGT("Hotend too cold");
PROGMEM Language_Str MSG_MOVE_N_MM = _UxGT("Move %smm"); PROGMEM Language_Str MSG_MOVE_N_MM = _UxGT("Move %smm");
PROGMEM Language_Str MSG_MOVE_01MM = _UxGT("Move 0.1mm"); PROGMEM Language_Str MSG_MOVE_01MM = _UxGT("Move 0.1mm");
@ -336,13 +336,13 @@ namespace Language_en {
PROGMEM Language_Str MSG_SELECT_E = _UxGT("Select *"); PROGMEM Language_Str MSG_SELECT_E = _UxGT("Select *");
PROGMEM Language_Str MSG_ACC = _UxGT("Accel"); PROGMEM Language_Str MSG_ACC = _UxGT("Accel");
PROGMEM Language_Str MSG_JERK = _UxGT("Jerk"); PROGMEM Language_Str MSG_JERK = _UxGT("Jerk");
PROGMEM Language_Str MSG_VA_JERK = _UxGT("V") LCD_STR_A _UxGT("-Jerk"); PROGMEM Language_Str MSG_VA_JERK = _UxGT("Max ") LCD_STR_A _UxGT(" Jerk");
PROGMEM Language_Str MSG_VB_JERK = _UxGT("V") LCD_STR_B _UxGT("-Jerk"); PROGMEM Language_Str MSG_VB_JERK = _UxGT("Max ") LCD_STR_B _UxGT(" Jerk");
PROGMEM Language_Str MSG_VC_JERK = _UxGT("V") LCD_STR_C _UxGT("-Jerk"); PROGMEM Language_Str MSG_VC_JERK = _UxGT("Max ") LCD_STR_C _UxGT(" Jerk");
PROGMEM Language_Str MSG_VI_JERK = _UxGT("V") LCD_STR_I _UxGT("-Jerk"); PROGMEM Language_Str MSG_VI_JERK = _UxGT("Max ") LCD_STR_I _UxGT(" Jerk");
PROGMEM Language_Str MSG_VJ_JERK = _UxGT("V") LCD_STR_J _UxGT("-Jerk"); PROGMEM Language_Str MSG_VJ_JERK = _UxGT("Max ") LCD_STR_J _UxGT(" Jerk");
PROGMEM Language_Str MSG_VK_JERK = _UxGT("V") LCD_STR_K _UxGT("-Jerk"); PROGMEM Language_Str MSG_VK_JERK = _UxGT("Max ") LCD_STR_K _UxGT(" Jerk");
PROGMEM Language_Str MSG_VE_JERK = _UxGT("Ve-Jerk"); PROGMEM Language_Str MSG_VE_JERK = _UxGT("Max E Jerk");
PROGMEM Language_Str MSG_JUNCTION_DEVIATION = _UxGT("Junction Dev"); PROGMEM Language_Str MSG_JUNCTION_DEVIATION = _UxGT("Junction Dev");
PROGMEM Language_Str MSG_VELOCITY = _UxGT("Velocity"); PROGMEM Language_Str MSG_VELOCITY = _UxGT("Velocity");
PROGMEM Language_Str MSG_VMAX_A = _UxGT("Vmax ") LCD_STR_A; PROGMEM Language_Str MSG_VMAX_A = _UxGT("Vmax ") LCD_STR_A;

View file

@ -126,7 +126,7 @@ void menu_media_filelist() {
#endif #endif
} }
else if (card.isMounted()) else if (card.isMounted())
ACTION_ITEM_P(PSTR(LCD_STR_FOLDER ".."), lcd_sd_updir); ACTION_ITEM_P(PSTR(LCD_STR_FOLDER " .."), lcd_sd_updir);
if (ui.should_draw()) for (uint16_t i = 0; i < fileCnt; i++) { if (ui.should_draw()) for (uint16_t i = 0; i < fileCnt; i++) {
if (_menuLineNr == _thisItemNr) { if (_menuLineNr == _thisItemNr) {

View file

@ -11,7 +11,7 @@ set -e
# #
use_example_configs "Creality/Ender-3 V2/CrealityUI" use_example_configs "Creality/Ender-3 V2/CrealityUI"
opt_enable MARLIN_DEV_MODE opt_enable MARLIN_DEV_MODE
exec_test $1 $2 "Ender 3 v2" "$3" exec_test $1 $2 "Ender 3 v2 with CrealityUI" "$3"
use_example_configs "Creality/Ender-3 V2/CrealityUI" use_example_configs "Creality/Ender-3 V2/CrealityUI"
opt_disable CLASSIC_JERK opt_disable CLASSIC_JERK