From 269c766f7fce4ebb5bb908acf281323ba3e40e95 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 30 Jun 2023 00:59:42 -0500 Subject: [PATCH 1/2] Apply case (various) --- Marlin/src/gcode/feature/powerloss/M1000.cpp | 2 +- Marlin/src/lcd/e3v2/common/dwin_color.h | 30 +- Marlin/src/lcd/e3v2/creality/dwin.cpp | 819 ++++++------- Marlin/src/lcd/e3v2/creality/dwin.h | 147 +-- Marlin/src/lcd/e3v2/creality/dwin_lcd.cpp | 2 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 1047 +++++++++-------- Marlin/src/lcd/e3v2/jyersui/dwin.h | 152 ++- Marlin/src/lcd/e3v2/marlinui/dwin_lcd.cpp | 2 +- Marlin/src/lcd/e3v2/marlinui/ui_common.cpp | 66 +- .../lcd/e3v2/marlinui/ui_status_480x272.cpp | 48 +- Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp | 12 +- Marlin/src/lcd/e3v2/proui/bedlevel_tools.h | 3 +- 12 files changed, 1189 insertions(+), 1141 deletions(-) diff --git a/Marlin/src/gcode/feature/powerloss/M1000.cpp b/Marlin/src/gcode/feature/powerloss/M1000.cpp index 56ef737145c2..1a1ebd517b3b 100644 --- a/Marlin/src/gcode/feature/powerloss/M1000.cpp +++ b/Marlin/src/gcode/feature/powerloss/M1000.cpp @@ -71,7 +71,7 @@ void GcodeSuite::M1000() { #elif HAS_DWIN_E3V2_BASIC recovery.dwin_flag = true; #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) // Temporary fix until it can be better implemented - jyersDWIN.popupHandler(Resume); + jyersDWIN.popupHandler(Popup_Resume); #elif ENABLED(EXTENSIBLE_UI) ExtUI::onPowerLossResume(); #else diff --git a/Marlin/src/lcd/e3v2/common/dwin_color.h b/Marlin/src/lcd/e3v2/common/dwin_color.h index d327f21a9384..8df4f95151ac 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_color.h +++ b/Marlin/src/lcd/e3v2/common/dwin_color.h @@ -27,18 +27,18 @@ #define GetGColor(color) ((color >> 5) & 0x3F) #define GetBColor(color) ((color >> 0) & 0x1F) -#define Color_White 0xFFFF -#define Color_Yellow RGB(0x1F,0x3F,0x00) -#define Color_Red RGB(0x1F,0x00,0x00) -#define Color_Error_Red 0xB000 // Error! -#define Color_Bg_Red 0xF00F // Red background color -#define Color_Bg_Window 0x31E8 // Popup background color -#define Color_Bg_Blue 0x1125 // Dark blue background color -#define Color_Bg_Black 0x0841 // Black background color -#define Color_IconBlue 0x45FA // Lighter blue that matches icons/accents -#define Popup_Text_Color 0xD6BA // Popup font background color -#define Line_Color 0x3A6A // Split line color -#define Rectangle_Color 0xEE2F // Blue square cursor color -#define Percent_Color 0xFE29 // Percentage color -#define BarFill_Color 0x10E4 // Fill color of progress bar -#define Select_Color 0x33BB // Selected color +#define COLOR_WHITE 0xFFFF +#define COLOR_YELLOW RGB(0x1F,0x3F,0x00) +#define COLOR_RED RGB(0x1F,0x00,0x00) +#define COLOR_ERROR_RED 0xB000 // Error! +#define COLOR_BG_RED 0xF00F // Red background color +#define COLOR_BG_WINDOW 0x31E8 // Popup background color +#define COLOR_BG_BLUE 0x1125 // Dark blue background color +#define COLOR_BG_BLACK 0x0841 // Black background color +#define COLOR_ICONBLUE 0x45FA // Lighter blue that matches icons/accents +#define COLOR_POPUP_TEXT 0xD6BA // Popup font background color +#define COLOR_LINE 0x3A6A // Split line color +#define COLOR_RECTANGLE 0xEE2F // Blue square cursor color +#define COLOR_PERCENT 0xFE29 // Percentage color +#define COLOR_BARFILL 0x10E4 // Fill color of progress bar +#define COLOR_SELECT 0x33BB // Selected color diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 7a28f1b77ef3..b21cc3085032 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -221,7 +221,7 @@ typedef struct { uint16_t x, y[2], w, h; } text_info_t; void iconButton(const bool here, const int iconid, const icon_info_t &ico, const text_info_t (&txt)[2]) { const bool cn = hmiIsChinese(); dwinIconShow(ICON, iconid + here, ico.x, ico.y); - if (here) dwinDrawRectangle(0, Color_White, ico.x, ico.y, ico.x + ico.w - 1, ico.y + ico.h - 1); + if (here) dwinDrawRectangle(0, COLOR_WHITE, ico.x, ico.y, ico.x + ico.w - 1, ico.y + ico.h - 1); dwinFrameAreaCopy(1, txt[cn].x, txt[cn].y[here], txt[cn].x + txt[cn].w - 1, txt[cn].y[here] + txt[cn].h - 1, ico.x + (ico.w - txt[cn].w) / 2, (ico.y + ico.h - 28) - txt[cn].h/2); } @@ -341,15 +341,15 @@ void iconStop() { } inline void clearTitleBar() { - dwinDrawBox(1, Color_Bg_Blue, 0, 0, DWIN_WIDTH, TITLE_HEIGHT); + dwinDrawBox(1, COLOR_BG_BLUE, 0, 0, DWIN_WIDTH, TITLE_HEIGHT); } void drawTitle(FSTR_P ftitle) { - dwinDrawString(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, ftitle); + dwinDrawString(false, DWIN_FONT_HEAD, COLOR_WHITE, COLOR_BG_BLUE, 14, 4, ftitle); } inline void clearMenuArea() { - dwinDrawBox(1, Color_Bg_Black, 0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - TITLE_HEIGHT); + dwinDrawBox(1, COLOR_BG_BLACK, 0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - TITLE_HEIGHT); } void clearMainWindow() { @@ -359,11 +359,11 @@ void clearMainWindow() { void clearPopupArea() { clearTitleBar(); - dwinDrawRectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, DWIN_HEIGHT); + dwinDrawRectangle(1, COLOR_BG_BLACK, 0, 31, DWIN_WIDTH, DWIN_HEIGHT); } void drawPopupBkgd105() { - dwinDrawRectangle(1, Color_Bg_Window, 14, 105, 258, 374); + dwinDrawRectangle(1, COLOR_BG_WINDOW, 14, 105, 258, 374); } void drawMoreIcon(const uint8_t line) { @@ -372,11 +372,11 @@ void drawMoreIcon(const uint8_t line) { void drawMenuCursor(const uint8_t line) { //dwinIconShow(ICON, ICON_Rectangle, 0, MBASE(line) - 18); - dwinDrawRectangle(1, Rectangle_Color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20); + dwinDrawRectangle(1, COLOR_RECTANGLE, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20); } void eraseMenuCursor(const uint8_t line) { - dwinDrawRectangle(1, Color_Bg_Black, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20); + dwinDrawRectangle(1, COLOR_BG_BLACK, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20); } void moveHighlight(const int16_t from, const uint16_t newline) { @@ -386,11 +386,11 @@ void moveHighlight(const int16_t from, const uint16_t newline) { void addMenuLine() { moveHighlight(1, MROWS); - dwinDrawLine(Line_Color, 16, MBASE(MROWS + 1) - 20, 256, MBASE(MROWS + 1) - 19); + dwinDrawLine(COLOR_LINE, 16, MBASE(MROWS + 1) - 20, 256, MBASE(MROWS + 1) - 19); } void scrollMenu(const uint8_t dir) { - dwinFrameAreaMove(1, dir, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); + dwinFrameAreaMove(1, dir, MLINE, COLOR_BG_BLACK, 0, 31, DWIN_WIDTH, 349); switch (dir) { case DWIN_SCROLL_DOWN: moveHighlight(-1, 0); break; case DWIN_SCROLL_UP: addMenuLine(); break; @@ -402,7 +402,7 @@ inline uint16_t nr_sd_menu_items() { } void eraseMenuText(const uint8_t line) { - dwinDrawRectangle(1, Color_Bg_Black, LBLX, MBASE(line) - 14, 271, MBASE(line) + 28); + dwinDrawRectangle(1, COLOR_BG_BLACK, LBLX, MBASE(line) - 14, 271, MBASE(line) + 28); } void drawMenuIcon(const uint8_t line, const uint8_t icon) { @@ -414,28 +414,28 @@ void _decorateMenuItem(const uint8_t line, const uint8_t icon, bool more) { if (more) drawMoreIcon(line); } void drawMenuItem(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) { - if (label) dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(line) - 1, (char*)label); + if (label) dwinDrawString(false, font8x16, COLOR_WHITE, COLOR_BG_BLACK, LBLX, MBASE(line) - 1, (char*)label); _decorateMenuItem(line, icon, more); } void drawMenuItem(const uint8_t line, const uint8_t icon=0, FSTR_P const flabel=nullptr, bool more=false) { - if (flabel) dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(line) - 1, flabel); + if (flabel) dwinDrawString(false, font8x16, COLOR_WHITE, COLOR_BG_BLACK, LBLX, MBASE(line) - 1, flabel); _decorateMenuItem(line, icon, more); } void drawMenuLine(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) { drawMenuItem(line, icon, label, more); - dwinDrawLine(Line_Color, 16, MBASE(line) + 33, 256, MBASE(line) + 34); + dwinDrawLine(COLOR_LINE, 16, MBASE(line) + 33, 256, MBASE(line) + 34); } void drawMenuLine(const uint8_t line, const uint8_t icon, FSTR_P const flabel, bool more=false) { drawMenuItem(line, icon, flabel, more); - dwinDrawLine(Line_Color, 16, MBASE(line) + 33, 256, MBASE(line) + 34); + dwinDrawLine(COLOR_LINE, 16, MBASE(line) + 33, 256, MBASE(line) + 34); } void drawCheckboxLine(const uint8_t line, const bool ison) { const uint16_t x = 225, y = EBASE(line) - 2; - dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, x + 5, y, ison ? F("X") : F(" ")); - dwinDrawRectangle(0, Color_White, x + 2, y + 2, x + 16, y + 16); + dwinDrawString(true, font8x16, COLOR_WHITE, COLOR_BG_BLACK, x + 5, y, ison ? F("X") : F(" ")); + dwinDrawRectangle(0, COLOR_WHITE, x + 2, y + 2, x + 16, y + 16); } // AreaCopy for a Menu Item @@ -567,43 +567,43 @@ void say_steps_per_mm_en(const uint8_t row) { } void dwinDrawLabel(const uint8_t row, char *string) { - dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(row), string); + dwinDrawString(true, font8x16, COLOR_WHITE, COLOR_BG_BLACK, LBLX, MBASE(row), string); } void dwinDrawLabel(const uint8_t row, FSTR_P title) { dwinDrawLabel(row, (char*)title); } -void dwinDrawSigned_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, int32_t value) { - dwinDrawString(true, size, Color_White, bColor, x - 8, y, value < 0 ? F("-") : F(" ")); - dwinDrawFloatValue(true, true, 0, size, Color_White, bColor, iNum, fNum, x, y, value < 0 ? -value : value); +void dwinDrawSignedFloat(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, int32_t value) { + dwinDrawString(true, size, COLOR_WHITE, bColor, x - 8, y, value < 0 ? F("-") : F(" ")); + dwinDrawFloatValue(true, true, 0, size, COLOR_WHITE, bColor, iNum, fNum, x, y, value < 0 ? -value : value); } void drawEditInteger3(const uint8_t row, const uint16_t value, const bool active=false) { - dwinDrawIntValue(true, true, 0, font8x16, Color_White, active ? Select_Color : Color_Bg_Black, 3, 220, EBASE(row), value); + dwinDrawIntValue(true, true, 0, font8x16, COLOR_WHITE, active ? COLOR_SELECT : COLOR_BG_BLACK, 3, 220, EBASE(row), value); } void drawEditInteger4(const uint8_t row, const uint16_t value, const bool active=false) { - dwinDrawIntValue(true, true, 0, font8x16, Color_White, active ? Select_Color : Color_Bg_Black, 4, 220 - 1 * 8, EBASE(row), value); + dwinDrawIntValue(true, true, 0, font8x16, COLOR_WHITE, active ? COLOR_SELECT : COLOR_BG_BLACK, 4, 220 - 1 * 8, EBASE(row), value); } void drawEditFloat3(const uint8_t row, const uint16_t value, const bool active=false) { - dwinDrawFloatValue(true, true, 0, font8x16, Color_White, active ? Select_Color : Color_Bg_Black, 3, UNITFDIGITS, 220 - UNITFDIGITS * 8, EBASE(row), (int32_t)value); + dwinDrawFloatValue(true, true, 0, font8x16, COLOR_WHITE, active ? COLOR_SELECT : COLOR_BG_BLACK, 3, UNITFDIGITS, 220 - UNITFDIGITS * 8, EBASE(row), (int32_t)value); } void drawEditSignedFloat2(const uint8_t row, const float value, const bool active=false) { - dwinDrawSigned_Float(font8x16, active ? Select_Color : Color_Bg_Black, 2, UNITFDIGITS + 1, 220 + 8 - UNITFDIGITS * 8, EBASE(row), value); + dwinDrawSignedFloat(font8x16, active ? COLOR_SELECT : COLOR_BG_BLACK, 2, UNITFDIGITS + 1, 220 + 8 - UNITFDIGITS * 8, EBASE(row), value); } void drawEditSignedFloat3(const uint8_t row, const float value, const bool active=false) { - dwinDrawSigned_Float(font8x16, active ? Select_Color : Color_Bg_Black, 3, UNITFDIGITS, 220 - UNITFDIGITS * 8, EBASE(row), value); + dwinDrawSignedFloat(font8x16, active ? COLOR_SELECT : COLOR_BG_BLACK, 3, UNITFDIGITS, 220 - UNITFDIGITS * 8, EBASE(row), value); } void drawStatInt(const uint16_t xpos, const uint16_t ypos, const uint16_t value) { - dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, xpos, ypos, value); + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, COLOR_WHITE, COLOR_BG_BLACK, 3, xpos, ypos, value); } void drawStatFloat(const uint16_t xpos, const uint16_t ypos, const float value) { - dwinDrawFloatValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 2, 2, xpos, ypos, value); + dwinDrawFloatValue(true, true, 0, DWIN_FONT_STAT, COLOR_WHITE, COLOR_BG_BLACK, 2, 2, xpos, ypos, value); } // @@ -731,7 +731,7 @@ void itemPrepareLang(const uint8_t row) { itemAreaCopy(1, 194, 96, 206, row); // "LCD Language" #endif } - dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, 226, EBASE(row), hmiIsChinese() ? F("CN") : F("EN")); + dwinDrawString(false, font8x16, COLOR_WHITE, COLOR_BG_BLACK, 226, EBASE(row), hmiIsChinese() ? F("CN") : F("EN")); drawMenuIcon(row, ICON_Language); } @@ -1069,8 +1069,8 @@ void drawMotionMenu() { dwinFrameAreaCopy(1, 189, 389, 271, 402, 95, 310); } else { - dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature")); - dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too high")); + dwinDrawString(true, font8x16, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, 36, 300, F("Nozzle or Bed temperature")); + dwinDrawString(true, font8x16, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, 92, 300, F("is too high")); } } else { @@ -1080,8 +1080,8 @@ void drawMotionMenu() { dwinFrameAreaCopy(1, 189, 389, 271, 402, 95, 310); } else { - dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature")); - dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too low")); + dwinDrawString(true, font8x16, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, 36, 300, F("Nozzle or Bed temperature")); + dwinDrawString(true, font8x16, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, 92, 300, F("is too low")); } } } @@ -1089,7 +1089,7 @@ void drawMotionMenu() { #endif void drawPopupBkgd60() { - dwinDrawRectangle(1, Color_Bg_Window, 14, 60, 258, 330); + dwinDrawRectangle(1, COLOR_BG_WINDOW, 14, 60, 258, 330); } #if HAS_HOTEND @@ -1104,7 +1104,7 @@ void drawPopupBkgd60() { dwinIconShow(ICON, ICON_Confirm_C, 86, 280); } else { - dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, 20, 235, F("Nozzle is too cold")); + dwinDrawString(true, font8x16, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, 20, 235, F("Nozzle is too cold")); dwinIconShow(ICON, ICON_Confirm_E, 86, 280); } } @@ -1121,9 +1121,9 @@ void popupWindowResume() { dwinIconShow(ICON, ICON_Continue_C, 146, 307); } else { - dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 14) / 2, 115, F("Continue Print")); - dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 192, F("It looks like the last")); - dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 212, F("file was interrupted.")); + dwinDrawString(true, font8x16, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, (272 - 8 * 14) / 2, 115, F("Continue Print")); + dwinDrawString(true, font8x16, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, (272 - 8 * 22) / 2, 192, F("It looks like the last")); + dwinDrawString(true, font8x16, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, (272 - 8 * 22) / 2, 212, F("file was interrupted.")); dwinIconShow(ICON, ICON_Cancel_E, 26, 307); dwinIconShow(ICON, ICON_Continue_E, 146, 307); } @@ -1139,8 +1139,8 @@ void popupWindowHome(const bool parking/*=false*/) { dwinFrameAreaCopy(1, 0, 389, 150, 402, 61, 280); } else { - dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * (parking ? 7 : 10)) / 2, 230, parking ? F("Parking") : F("Homing XYZ")); - dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done.")); + dwinDrawString(true, font8x16, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, (272 - 8 * (parking ? 7 : 10)) / 2, 230, parking ? F("Parking") : F("Homing XYZ")); + dwinDrawString(true, font8x16, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, (272 - 8 * 23) / 2, 260, F("Please wait until done.")); } } @@ -1155,8 +1155,8 @@ void popupWindowHome(const bool parking/*=false*/) { dwinFrameAreaCopy(1, 0, 389, 150, 402, 61, 280); } else { - dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 13) / 2, 230, GET_TEXT_F(MSG_BED_LEVELING)); - dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done.")); + dwinDrawString(true, font8x16, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, (272 - 8 * 13) / 2, 230, GET_TEXT_F(MSG_BED_LEVELING)); + dwinDrawString(true, font8x16, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, (272 - 8 * 23) / 2, 260, F("Please wait until done.")); } } @@ -1164,8 +1164,8 @@ void popupWindowHome(const bool parking/*=false*/) { void drawSelectHighlight(const bool sel) { hmiFlag.select_flag = sel; - const uint16_t c1 = sel ? Select_Color : Color_Bg_Window, - c2 = sel ? Color_Bg_Window : Select_Color; + const uint16_t c1 = sel ? COLOR_SELECT : COLOR_BG_WINDOW, + c2 = sel ? COLOR_BG_WINDOW : COLOR_SELECT; dwinDrawRectangle(0, c1, 25, 279, 126, 318); dwinDrawRectangle(0, c1, 24, 278, 127, 319); dwinDrawRectangle(0, c2, 145, 279, 246, 318); @@ -1183,8 +1183,8 @@ void popupwindowPauseOrStop() { dwinIconShow(ICON, ICON_Cancel_C, 146, 280); } else { - if (select_print.now == PRINT_PAUSE_RESUME) dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 11) / 2, 150, GET_TEXT_F(MSG_PAUSE_PRINT)); - else if (select_print.now == PRINT_STOP) dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 10) / 2, 150, GET_TEXT_F(MSG_STOP_PRINT)); + if (select_print.now == PRINT_PAUSE_RESUME) dwinDrawString(true, font8x16, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, (272 - 8 * 11) / 2, 150, GET_TEXT_F(MSG_PAUSE_PRINT)); + else if (select_print.now == PRINT_STOP) dwinDrawString(true, font8x16, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, (272 - 8 * 10) / 2, 150, GET_TEXT_F(MSG_STOP_PRINT)); dwinIconShow(ICON, ICON_Confirm_E, 26, 280); dwinIconShow(ICON, ICON_Cancel_E, 146, 280); } @@ -1208,28 +1208,28 @@ void drawPrintingScreen() { void drawPrintProgressBar() { constexpr uint16_t y = 93, h = 21; dwinIconShow(ICON, ICON_Bar, 15, 93); - dwinDrawRectangle(1, BarFill_Color, 16 + _card_percent * 240 / 100, y, 256, y + h - 1); - dwinDrawIntValue(true, true, 0, font8x16, Percent_Color, Color_Bg_Black, 2, 117, y + 40, _card_percent); - dwinDrawString(false, font8x16, Percent_Color, Color_Bg_Black, 133, y + 40, F("%")); + dwinDrawRectangle(1, COLOR_BARFILL, 16 + _card_percent * 240 / 100, y, 256, y + h - 1); + dwinDrawIntValue(true, true, 0, font8x16, COLOR_PERCENT, COLOR_BG_BLACK, 2, 117, y + 40, _card_percent); + dwinDrawString(false, font8x16, COLOR_PERCENT, COLOR_BG_BLACK, 133, y + 40, F("%")); } void drawPrintProgressElapsed() { constexpr uint16_t x = 45, y = 192; duration_t elapsed = print_job_timer.duration(); // Print timer - dwinDrawIntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, x, y, elapsed.value / 3600); - dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, x + 8 * 2, y, F(":")); - dwinDrawIntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, x + 8 * 3, y, (elapsed.value % 3600) / 60); + dwinDrawIntValue(true, true, 1, font8x16, COLOR_WHITE, COLOR_BG_BLACK, 2, x, y, elapsed.value / 3600); + dwinDrawString(false, font8x16, COLOR_WHITE, COLOR_BG_BLACK, x + 8 * 2, y, F(":")); + dwinDrawIntValue(true, true, 1, font8x16, COLOR_WHITE, COLOR_BG_BLACK, 2, x + 8 * 3, y, (elapsed.value % 3600) / 60); } void drawPrintProgressRemain() { constexpr uint16_t x = 179, y = 192; - dwinDrawIntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, x, y, _remain_time / 3600); - dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, x + 8 * 2, y, F(":")); - dwinDrawIntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, x + 8 * 3, y, (_remain_time % 3600) / 60); + dwinDrawIntValue(true, true, 1, font8x16, COLOR_WHITE, COLOR_BG_BLACK, 2, x, y, _remain_time / 3600); + dwinDrawString(false, font8x16, COLOR_WHITE, COLOR_BG_BLACK, x + 8 * 2, y, F(":")); + dwinDrawIntValue(true, true, 1, font8x16, COLOR_WHITE, COLOR_BG_BLACK, 2, x + 8 * 3, y, (_remain_time % 3600) / 60); } void gotoPrintProcess() { - checkkey = PrintProcess; + checkkey = ID_PrintProcess; clearMainWindow(); drawPrintingScreen(); @@ -1241,7 +1241,7 @@ void gotoPrintProcess() { // Copy into filebuf string before entry char * const name = card.longest_filename(); const int8_t npos = _MAX(0U, DWIN_WIDTH - strlen(name) * MENU_CHR_W) / 2; - dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, npos, 60, name); + dwinDrawString(false, font8x16, COLOR_WHITE, COLOR_BG_BLACK, npos, 60, name); dwinIconShow(ICON, ICON_PrintTime, 17, 163); dwinIconShow(ICON, ICON_RemainTime, 150, 161); @@ -1252,7 +1252,7 @@ void gotoPrintProcess() { } void gotoMainMenu() { - checkkey = MainMenu; + checkkey = ID_MainMenu; clearMainWindow(); @@ -1285,51 +1285,63 @@ void hmiPlanMove(const feedRate_t fr_mm_s) { void hmiMoveDone(const AxisEnum axis) { encoderRate.enabled = false; planner.synchronize(); - checkkey = AxisMove; + checkkey = ID_AxisMove; dwinUpdateLCD(); } -void hmiMoveX() { - EncoderState encoder_diffState = encoderReceiveAnalyze(); - if (encoder_diffState == ENCODER_DIFF_NO) return; - if (applyEncoder(encoder_diffState, hmiValues.Move_X_scaled)) { - drawEditFloat3(1, hmiValues.Move_X_scaled); - return hmiMoveDone(X_AXIS); +#if HAS_X_AXIS + + void hmiMoveX() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); + if (encoder_diffState == ENCODER_DIFF_NO) return; + if (applyEncoder(encoder_diffState, hmiValues.moveScaled.x)) { + drawEditFloat3(1, hmiValues.moveScaled.x); + return hmiMoveDone(X_AXIS); + } + LIMIT(hmiValues.moveScaled.x, (X_MIN_POS) * MINUNITMULT, (X_MAX_POS) * MINUNITMULT); + current_position.x = hmiValues.moveScaled.x / MINUNITMULT; + drawEditFloat3(1, hmiValues.moveScaled.x, true); + dwinUpdateLCD(); + hmiPlanMove(homing_feedrate(X_AXIS)); } - LIMIT(hmiValues.Move_X_scaled, (X_MIN_POS) * MINUNITMULT, (X_MAX_POS) * MINUNITMULT); - current_position.x = hmiValues.Move_X_scaled / MINUNITMULT; - drawEditFloat3(1, hmiValues.Move_X_scaled, true); - dwinUpdateLCD(); - hmiPlanMove(homing_feedrate(X_AXIS)); -} -void hmiMoveY() { - EncoderState encoder_diffState = encoderReceiveAnalyze(); - if (encoder_diffState == ENCODER_DIFF_NO) return; - if (applyEncoder(encoder_diffState, hmiValues.Move_Y_scaled)) { - drawEditFloat3(2, hmiValues.Move_Y_scaled); - return hmiMoveDone(Y_AXIS); +#endif + +#if HAS_Y_AXIS + + void hmiMoveY() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); + if (encoder_diffState == ENCODER_DIFF_NO) return; + if (applyEncoder(encoder_diffState, hmiValues.moveScaled.y)) { + drawEditFloat3(2, hmiValues.moveScaled.y); + return hmiMoveDone(Y_AXIS); + } + LIMIT(hmiValues.moveScaled.y, (Y_MIN_POS) * MINUNITMULT, (Y_MAX_POS) * MINUNITMULT); + current_position.y = hmiValues.moveScaled.y / MINUNITMULT; + drawEditFloat3(2, hmiValues.moveScaled.y, true); + dwinUpdateLCD(); + hmiPlanMove(homing_feedrate(Y_AXIS)); } - LIMIT(hmiValues.Move_Y_scaled, (Y_MIN_POS) * MINUNITMULT, (Y_MAX_POS) * MINUNITMULT); - current_position.y = hmiValues.Move_Y_scaled / MINUNITMULT; - drawEditFloat3(2, hmiValues.Move_Y_scaled, true); - dwinUpdateLCD(); - hmiPlanMove(homing_feedrate(Y_AXIS)); -} -void hmiMoveZ() { - EncoderState encoder_diffState = encoderReceiveAnalyze(); - if (encoder_diffState == ENCODER_DIFF_NO) return; - if (applyEncoder(encoder_diffState, hmiValues.Move_Z_scaled)) { - drawEditFloat3(3, hmiValues.Move_Z_scaled); - return hmiMoveDone(Z_AXIS); +#endif + +#if HAS_Z_AXIS + + void hmiMoveZ() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); + if (encoder_diffState == ENCODER_DIFF_NO) return; + if (applyEncoder(encoder_diffState, hmiValues.moveScaled.z)) { + drawEditFloat3(3, hmiValues.moveScaled.z); + return hmiMoveDone(Z_AXIS); + } + LIMIT(hmiValues.moveScaled.z, (Z_MIN_POS) * MINUNITMULT, (Z_MAX_POS) * MINUNITMULT); + current_position.z = hmiValues.moveScaled.z / MINUNITMULT; + drawEditFloat3(3, hmiValues.moveScaled.z, true); + dwinUpdateLCD(); + hmiPlanMove(homing_feedrate(Z_AXIS)); } - LIMIT(hmiValues.Move_Z_scaled, (Z_MIN_POS) * MINUNITMULT, (Z_MAX_POS) * MINUNITMULT); - current_position.z = hmiValues.Move_Z_scaled / MINUNITMULT; - drawEditFloat3(3, hmiValues.Move_Z_scaled, true); - dwinUpdateLCD(); - hmiPlanMove(homing_feedrate(Z_AXIS)); -} + +#endif #if HAS_HOTEND @@ -1337,14 +1349,14 @@ void hmiMoveZ() { static float last_E_scaled = 0; EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (applyEncoder(encoder_diffState, hmiValues.Move_E_scaled)) { - last_E_scaled = hmiValues.Move_E_scaled; + if (applyEncoder(encoder_diffState, hmiValues.moveScaled.e)) { + last_E_scaled = hmiValues.moveScaled.e; drawEditSignedFloat3(4, last_E_scaled); return hmiMoveDone(E_AXIS); } - LIMIT(hmiValues.Move_E_scaled, last_E_scaled - (EXTRUDE_MAXLENGTH) * MINUNITMULT, last_E_scaled + (EXTRUDE_MAXLENGTH) * MINUNITMULT); - current_position.e = hmiValues.Move_E_scaled / MINUNITMULT; - drawEditSignedFloat3(4, hmiValues.Move_E_scaled, true); + LIMIT(hmiValues.moveScaled.e, last_E_scaled - (EXTRUDE_MAXLENGTH) * MINUNITMULT, last_E_scaled + (EXTRUDE_MAXLENGTH) * MINUNITMULT); + current_position.e = hmiValues.moveScaled.e / MINUNITMULT; + drawEditSignedFloat3(4, hmiValues.moveScaled.e, true); dwinUpdateLCD(); hmiPlanMove(MMM_TO_MMS(FEEDRATE_E)); } @@ -1367,7 +1379,7 @@ void hmiMoveZ() { probe.offset.z = dwin_zoffset; TERN_(EEPROM_SETTINGS, settings.save()); #endif - checkkey = hmiValues.show_mode == -4 ? Prepare : Tune; + checkkey = hmiValues.show_mode == -4 ? ID_Prepare : ID_Tune; drawEditSignedFloat2(zoff_line, TERN(HAS_BED_PROBE, BABY_Z_VAR * 100, hmiValues.offset_value)); dwinUpdateLCD(); return; @@ -1400,19 +1412,19 @@ void hmiMoveZ() { #endif default: temp_line = TUNE_CASE_TEMP + MROWS - index_tune; } - if (applyEncoder(encoder_diffState, hmiValues.E_Temp)) { + if (applyEncoder(encoder_diffState, hmiValues.tempE)) { encoderRate.enabled = false; #if HAS_PREHEAT if (hmiValues.show_mode == -2) { - checkkey = PLAPreheat; - ui.material_preset[0].hotend_temp = hmiValues.E_Temp; + checkkey = ID_PLAPreheat; + ui.material_preset[0].hotend_temp = hmiValues.tempE; drawEditInteger3(temp_line, ui.material_preset[0].hotend_temp); return; } #if PREHEAT_COUNT > 1 if (hmiValues.show_mode == -3) { - checkkey = ABSPreheat; - ui.material_preset[1].hotend_temp = hmiValues.E_Temp; + checkkey = ID_ABSPreheat; + ui.material_preset[1].hotend_temp = hmiValues.tempE; drawEditInteger3(temp_line, ui.material_preset[1].hotend_temp); return; } @@ -1420,17 +1432,17 @@ void hmiMoveZ() { #endif if (hmiValues.show_mode == -1) // Temperature - checkkey = TemperatureID; + checkkey = ID_TemperatureID; else - checkkey = Tune; - drawEditInteger3(temp_line, hmiValues.E_Temp); - thermalManager.setTargetHotend(hmiValues.E_Temp, 0); + checkkey = ID_Tune; + drawEditInteger3(temp_line, hmiValues.tempE); + thermalManager.setTargetHotend(hmiValues.tempE, 0); return; } - // E_Temp limit - LIMIT(hmiValues.E_Temp, HEATER_0_MINTEMP, thermalManager.hotend_max_target(0)); - // E_Temp value - drawEditInteger3(temp_line, hmiValues.E_Temp, true); + // tempE limit + LIMIT(hmiValues.tempE, HEATER_0_MINTEMP, thermalManager.hotend_max_target(0)); + // tempE value + drawEditInteger3(temp_line, hmiValues.tempE, true); } #endif // HAS_HOTEND @@ -1451,33 +1463,33 @@ void hmiMoveZ() { #endif default: bed_line = TUNE_CASE_BED + MROWS - index_tune; } - if (applyEncoder(encoder_diffState, hmiValues.Bed_Temp)) { + if (applyEncoder(encoder_diffState, hmiValues.tempBed)) { encoderRate.enabled = false; #if HAS_PREHEAT if (hmiValues.show_mode == -2) { - checkkey = PLAPreheat; - ui.material_preset[0].bed_temp = hmiValues.Bed_Temp; + checkkey = ID_PLAPreheat; + ui.material_preset[0].bed_temp = hmiValues.tempBed; drawEditInteger3(bed_line, ui.material_preset[0].bed_temp); return; } #if PREHEAT_COUNT > 1 if (hmiValues.show_mode == -3) { - checkkey = ABSPreheat; - ui.material_preset[1].bed_temp = hmiValues.Bed_Temp; + checkkey = ID_ABSPreheat; + ui.material_preset[1].bed_temp = hmiValues.tempBed; drawEditInteger3(bed_line, ui.material_preset[1].bed_temp); return; } #endif #endif - checkkey = hmiValues.show_mode == -1 ? TemperatureID : Tune; - drawEditInteger3(bed_line, hmiValues.Bed_Temp); - thermalManager.setTargetBed(hmiValues.Bed_Temp); + checkkey = hmiValues.show_mode == -1 ? ID_TemperatureID : ID_Tune; + drawEditInteger3(bed_line, hmiValues.tempBed); + thermalManager.setTargetBed(hmiValues.tempBed); return; } - // Bed_Temp limit - LIMIT(hmiValues.Bed_Temp, BED_MINTEMP, BED_MAX_TARGET); - // Bed_Temp value - drawEditInteger3(bed_line, hmiValues.Bed_Temp, true); + // tempBed limit + LIMIT(hmiValues.tempBed, BED_MINTEMP, BED_MAX_TARGET); + // tempBed value + drawEditInteger3(bed_line, hmiValues.tempBed, true); } #endif // HAS_HEATED_BED @@ -1495,31 +1507,31 @@ void hmiMoveZ() { default: fan_line = TUNE_CASE_FAN + MROWS - index_tune; } - if (applyEncoder(encoder_diffState, hmiValues.Fan_speed)) { + if (applyEncoder(encoder_diffState, hmiValues.fanSpeed)) { encoderRate.enabled = false; if (hmiValues.show_mode == -2) { - checkkey = PLAPreheat; - ui.material_preset[0].fan_speed = hmiValues.Fan_speed; + checkkey = ID_PLAPreheat; + ui.material_preset[0].fan_speed = hmiValues.fanSpeed; drawEditInteger3(fan_line, ui.material_preset[0].fan_speed); return; } #if PREHEAT_COUNT > 1 if (hmiValues.show_mode == -3) { - checkkey = ABSPreheat; - ui.material_preset[1].fan_speed = hmiValues.Fan_speed; + checkkey = ID_ABSPreheat; + ui.material_preset[1].fan_speed = hmiValues.fanSpeed; drawEditInteger3(fan_line, ui.material_preset[1].fan_speed); return; } #endif - checkkey = hmiValues.show_mode == -1 ? TemperatureID : Tune; - drawEditInteger3(fan_line, hmiValues.Fan_speed); - thermalManager.set_fan_speed(0, hmiValues.Fan_speed); + checkkey = hmiValues.show_mode == -1 ? ID_TemperatureID : ID_Tune; + drawEditInteger3(fan_line, hmiValues.fanSpeed); + thermalManager.set_fan_speed(0, hmiValues.fanSpeed); return; } - // Fan_speed limit - LIMIT(hmiValues.Fan_speed, 0, 255); - // Fan_speed value - drawEditInteger3(fan_line, hmiValues.Fan_speed, true); + // fanSpeed limit + LIMIT(hmiValues.fanSpeed, 0, 255); + // fanSpeed value + drawEditInteger3(fan_line, hmiValues.fanSpeed, true); } #endif // HAS_PREHEAT && HAS_FAN @@ -1527,17 +1539,17 @@ void hmiMoveZ() { void hmiPrintSpeed() { EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (applyEncoder(encoder_diffState, hmiValues.print_speed)) { - checkkey = Tune; + if (applyEncoder(encoder_diffState, hmiValues.printSpeed)) { + checkkey = ID_Tune; encoderRate.enabled = false; - feedrate_percentage = hmiValues.print_speed; - drawEditInteger3(select_tune.now + MROWS - index_tune, hmiValues.print_speed); + feedrate_percentage = hmiValues.printSpeed; + drawEditInteger3(select_tune.now + MROWS - index_tune, hmiValues.printSpeed); return; } - // print_speed limit - LIMIT(hmiValues.print_speed, MIN_PRINT_SPEED, MAX_PRINT_SPEED); - // print_speed value - drawEditInteger3(select_tune.now + MROWS - index_tune, hmiValues.print_speed, true); + // printSpeed limit + LIMIT(hmiValues.printSpeed, MIN_PRINT_SPEED, MAX_PRINT_SPEED); + // printSpeed value + drawEditInteger3(select_tune.now + MROWS - index_tune, hmiValues.printSpeed, true); } #define LAST_AXIS TERN(HAS_HOTEND, E_AXIS, Z_AXIS) @@ -1545,37 +1557,37 @@ void hmiPrintSpeed() { void hmiMaxFeedspeedXYZE() { EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (applyEncoder(encoder_diffState, hmiValues.Max_Feedspeed)) { - checkkey = MaxSpeed; + if (applyEncoder(encoder_diffState, hmiValues.maxFeedSpeed)) { + checkkey = ID_MaxSpeed; encoderRate.enabled = false; if (WITHIN(hmiFlag.feedspeed_axis, X_AXIS, LAST_AXIS)) - planner.set_max_feedrate(hmiFlag.feedspeed_axis, hmiValues.Max_Feedspeed); - drawEditInteger4(select_speed.now, hmiValues.Max_Feedspeed); + planner.set_max_feedrate(hmiFlag.feedspeed_axis, hmiValues.maxFeedSpeed); + drawEditInteger4(select_speed.now, hmiValues.maxFeedSpeed); return; } // MaxFeedspeed limit if (WITHIN(hmiFlag.feedspeed_axis, X_AXIS, LAST_AXIS)) - LIMIT(hmiValues.Max_Feedspeed, min_feedrate_edit_values[hmiFlag.feedspeed_axis], max_feedrate_edit_values[hmiFlag.feedspeed_axis]); + LIMIT(hmiValues.maxFeedSpeed, min_feedrate_edit_values[hmiFlag.feedspeed_axis], max_feedrate_edit_values[hmiFlag.feedspeed_axis]); // MaxFeedspeed value - drawEditInteger4(select_speed.now, hmiValues.Max_Feedspeed, true); + drawEditInteger4(select_speed.now, hmiValues.maxFeedSpeed, true); } void hmiMaxAccelerationXYZE() { EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (applyEncoder(encoder_diffState, hmiValues.Max_Acceleration)) { - checkkey = MaxAcceleration; + if (applyEncoder(encoder_diffState, hmiValues.maxAcceleration)) { + checkkey = ID_MaxAcceleration; encoderRate.enabled = false; if (WITHIN(hmiFlag.acc_axis, X_AXIS, LAST_AXIS)) - planner.set_max_acceleration(hmiFlag.acc_axis, hmiValues.Max_Acceleration); - drawEditInteger4(select_acc.now, hmiValues.Max_Acceleration); + planner.set_max_acceleration(hmiFlag.acc_axis, hmiValues.maxAcceleration); + drawEditInteger4(select_acc.now, hmiValues.maxAcceleration); return; } // MaxAcceleration limit if (WITHIN(hmiFlag.acc_axis, X_AXIS, LAST_AXIS)) - LIMIT(hmiValues.Max_Acceleration, min_acceleration_edit_values[hmiFlag.acc_axis], max_acceleration_edit_values[hmiFlag.acc_axis]); + LIMIT(hmiValues.maxAcceleration, min_acceleration_edit_values[hmiFlag.acc_axis], max_acceleration_edit_values[hmiFlag.acc_axis]); // MaxAcceleration value - drawEditInteger4(select_acc.now, hmiValues.Max_Acceleration, true); + drawEditInteger4(select_acc.now, hmiValues.maxAcceleration, true); } #if HAS_CLASSIC_JERK @@ -1583,19 +1595,19 @@ void hmiMaxAccelerationXYZE() { void hmiMaxJerkXYZE() { EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (applyEncoder(encoder_diffState, hmiValues.Max_Jerk_scaled)) { - checkkey = MaxJerk; + if (applyEncoder(encoder_diffState, hmiValues.maxJerkScaled)) { + checkkey = ID_MaxJerk; encoderRate.enabled = false; if (WITHIN(hmiFlag.jerk_axis, X_AXIS, LAST_AXIS)) - planner.set_max_jerk(hmiFlag.jerk_axis, hmiValues.Max_Jerk_scaled / MINUNITMULT); - drawEditFloat3(select_jerk.now, hmiValues.Max_Jerk_scaled); + planner.set_max_jerk(hmiFlag.jerk_axis, hmiValues.maxJerkScaled / MINUNITMULT); + drawEditFloat3(select_jerk.now, hmiValues.maxJerkScaled); return; } // MaxJerk limit if (WITHIN(hmiFlag.jerk_axis, X_AXIS, LAST_AXIS)) - LIMIT(hmiValues.Max_Jerk_scaled, min_jerk_edit_values[hmiFlag.jerk_axis] * MINUNITMULT, max_jerk_edit_values[hmiFlag.jerk_axis] * MINUNITMULT); + LIMIT(hmiValues.maxJerkScaled, min_jerk_edit_values[hmiFlag.jerk_axis] * MINUNITMULT, max_jerk_edit_values[hmiFlag.jerk_axis] * MINUNITMULT); // MaxJerk value - drawEditFloat3(select_jerk.now, hmiValues.Max_Jerk_scaled, true); + drawEditFloat3(select_jerk.now, hmiValues.maxJerkScaled, true); } #endif // HAS_CLASSIC_JERK @@ -1603,19 +1615,19 @@ void hmiMaxAccelerationXYZE() { void hmiStepXYZE() { EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (applyEncoder(encoder_diffState, hmiValues.Max_Step_scaled)) { - checkkey = Step; + if (applyEncoder(encoder_diffState, hmiValues.maxStepScaled)) { + checkkey = ID_Step; encoderRate.enabled = false; if (WITHIN(hmiFlag.step_axis, X_AXIS, LAST_AXIS)) - planner.settings.axis_steps_per_mm[hmiFlag.step_axis] = hmiValues.Max_Step_scaled / MINUNITMULT; - drawEditFloat3(select_step.now, hmiValues.Max_Step_scaled); + planner.settings.axis_steps_per_mm[hmiFlag.step_axis] = hmiValues.maxStepScaled / MINUNITMULT; + drawEditFloat3(select_step.now, hmiValues.maxStepScaled); return; } // Step limit if (WITHIN(hmiFlag.step_axis, X_AXIS, LAST_AXIS)) - LIMIT(hmiValues.Max_Step_scaled, min_steps_edit_values[hmiFlag.step_axis] * MINUNITMULT, max_steps_edit_values[hmiFlag.step_axis] * MINUNITMULT); + LIMIT(hmiValues.maxStepScaled, min_steps_edit_values[hmiFlag.step_axis] * MINUNITMULT, max_steps_edit_values[hmiFlag.step_axis] * MINUNITMULT); // Step value - drawEditFloat3(select_step.now, hmiValues.Max_Step_scaled, true); + drawEditFloat3(select_step.now, hmiValues.maxStepScaled, true); } // Draw X, Y, Z and blink if in an un-homed or un-trusted state @@ -1631,11 +1643,11 @@ void _update_axis_value(const AxisEnum axis, const uint16_t x, const uint16_t y, if (force || changed || draw_qmark || draw_empty) { if (blink && draw_qmark) - dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, x, y, F("???.?")); + dwinDrawString(true, font8x16, COLOR_WHITE, COLOR_BG_BLACK, x, y, F("???.?")); else if (blink && draw_empty) - dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, x, y, F(" ")); + dwinDrawString(true, font8x16, COLOR_WHITE, COLOR_BG_BLACK, x, y, F(" ")); else - dwinDrawFloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, x, y, p); + dwinDrawFloatValue(true, true, 0, font8x16, COLOR_WHITE, COLOR_BG_BLACK, 3, 1, x, y, p); } } @@ -1653,7 +1665,7 @@ void _draw_xyz_position(const bool force) { //SERIAL_EOL(); } -void update_variable() { +void updateVariable() { #if HAS_HOTEND static celsius_t _hotendtemp = 0, _hotendtarget = 0; const celsius_t hc = thermalManager.wholeDegHotend(0), @@ -1678,7 +1690,7 @@ void update_variable() { if (_new_fanspeed) _fanspeed = thermalManager.fan_speed[0]; #endif - if (checkkey == Tune) { + if (checkkey == ID_Tune) { // Tune page temperature update #if HAS_HOTEND if (_new_hotend_target) @@ -1693,7 +1705,7 @@ void update_variable() { drawEditInteger3(TUNE_CASE_FAN + MROWS - index_tune, _fanspeed); #endif } - else if (checkkey == TemperatureID) { + else if (checkkey == ID_TemperatureID) { // Temperature page temperature update #if HAS_HOTEND if (_new_hotend_target) drawEditInteger3(TEMP_CASE_TEMP, _hotendtarget); @@ -1746,11 +1758,11 @@ void update_variable() { _offset = BABY_Z_VAR; if (BABY_Z_VAR < 0) { drawStatFloat(207, 417, -_offset); - dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F("-")); + dwinDrawString(true, font8x16, COLOR_WHITE, COLOR_BG_BLACK, 205, 419, F("-")); } else { drawStatFloat(207, 417, _offset); - dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F(" ")); + dwinDrawString(true, font8x16, COLOR_WHITE, COLOR_BG_BLACK, 205, 419, F(" ")); } } @@ -1893,8 +1905,8 @@ void redrawSDList() { TERN_(SCROLL_LONG_FILENAMES, initSDItemShift()); } else { - dwinDrawRectangle(1, Color_Bg_Red, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); - dwinDrawString(false, font16x32, Color_Yellow, Color_Bg_Red, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), F("No Media")); + dwinDrawRectangle(1, COLOR_BG_RED, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); + dwinDrawString(false, font16x32, COLOR_YELLOW, COLOR_BG_RED, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), F("No Media")); } } @@ -1921,15 +1933,15 @@ void hmiSDCardUpdate() { DWIN_lcd_sd_status = card.isMounted(); //SERIAL_ECHOLNPGM("HMI_SDCardUpdate: ", DWIN_lcd_sd_status); if (DWIN_lcd_sd_status) { - if (checkkey == SelectFile) + if (checkkey == ID_SelectFile) redrawSDList(); } else { // clean file icon - if (checkkey == SelectFile) { + if (checkkey == ID_SelectFile) { redrawSDList(); } - else if (checkkey == PrintProcess || checkkey == Tune || printingIsActive()) { + else if (checkkey == ID_PrintProcess || checkkey == ID_Tune || printingIsActive()) { // TODO: Move card removed abort handling // to CardReader::manage_media. card.abortFilePrintSoon(); @@ -1947,29 +1959,29 @@ void hmiSDCardUpdate() { // void drawStatusArea(const bool with_update) { - dwinDrawRectangle(1, Color_Bg_Black, 0, STATUS_Y, DWIN_WIDTH, DWIN_HEIGHT - 1); + dwinDrawRectangle(1, COLOR_BG_BLACK, 0, STATUS_Y, DWIN_WIDTH, DWIN_HEIGHT - 1); #if HAS_HOTEND dwinIconShow(ICON, ICON_HotendTemp, 10, 383); drawStatInt(28, 384, thermalManager.wholeDegHotend(0)); - dwinDrawString(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); + dwinDrawString(false, DWIN_FONT_STAT, COLOR_WHITE, COLOR_BG_BLACK, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); drawStatInt(25 + 4 * STAT_CHR_W + 6, 384, thermalManager.degTargetHotend(0)); dwinIconShow(ICON, ICON_StepE, 112, 417); drawStatInt(116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); - dwinDrawString(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); + dwinDrawString(false, DWIN_FONT_STAT, COLOR_WHITE, COLOR_BG_BLACK, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); #endif #if HAS_HEATED_BED dwinIconShow(ICON, ICON_BedTemp, 10, 416); drawStatInt(28, 417, thermalManager.wholeDegBed()); - dwinDrawString(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); + dwinDrawString(false, DWIN_FONT_STAT, COLOR_WHITE, COLOR_BG_BLACK, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); drawStatInt(25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed()); #endif dwinIconShow(ICON, ICON_Speed, 113, 383); drawStatInt(116 + 2 * STAT_CHR_W, 384, feedrate_percentage); - dwinDrawString(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 384, F("%")); + dwinDrawString(false, DWIN_FONT_STAT, COLOR_WHITE, COLOR_BG_BLACK, 116 + 5 * STAT_CHR_W + 2, 384, F("%")); #if HAS_FAN dwinIconShow(ICON, ICON_FanSpeed, 187, 383); @@ -1982,14 +1994,14 @@ void drawStatusArea(const bool with_update) { if (BABY_Z_VAR < 0) { drawStatFloat(207, 417, -BABY_Z_VAR * 100); - dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F("-")); + dwinDrawString(true, font8x16, COLOR_WHITE, COLOR_BG_BLACK, 205, 419, F("-")); } else { drawStatFloat(207, 417, BABY_Z_VAR * 100); - dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F(" ")); + dwinDrawString(true, font8x16, COLOR_WHITE, COLOR_BG_BLACK, 205, 419, F(" ")); } - dwinDrawRectangle(1, Line_Color, 0, 449, DWIN_WIDTH, 451); + dwinDrawRectangle(1, COLOR_LINE, 0, 449, DWIN_WIDTH, 451); dwinIconShow(ICON, ICON_MaxSpeedX, 10, 456); dwinIconShow(ICON, ICON_MaxSpeedY, 95, 456); @@ -2010,8 +2022,8 @@ void hmiStartFrame(const bool with_update) { void drawInfoMenu() { clearMainWindow(); - dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(MACHINE_SIZE) * MENU_CHR_W) / 2, 122, F(MACHINE_SIZE)); - dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(SHORT_BUILD_VERSION) * MENU_CHR_W) / 2, 195, F(SHORT_BUILD_VERSION)); + dwinDrawString(false, font8x16, COLOR_WHITE, COLOR_BG_BLACK, (DWIN_WIDTH - strlen(MACHINE_SIZE) * MENU_CHR_W) / 2, 122, F(MACHINE_SIZE)); + dwinDrawString(false, font8x16, COLOR_WHITE, COLOR_BG_BLACK, (DWIN_WIDTH - strlen(SHORT_BUILD_VERSION) * MENU_CHR_W) / 2, 195, F(SHORT_BUILD_VERSION)); if (hmiIsChinese()) { dwinFrameTitleCopy(30, 17, 28, 13); // "Info" @@ -2031,12 +2043,12 @@ void drawInfoMenu() { dwinFrameAreaCopy(1, 146, 151, 254, 161, 82, 175); // "Firmware Version" dwinFrameAreaCopy(1, 1, 164, 96, 175, 89, 248); // "Contact details" } - dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(CORP_WEBSITE) * MENU_CHR_W) / 2, 268, F(CORP_WEBSITE)); + dwinDrawString(false, font8x16, COLOR_WHITE, COLOR_BG_BLACK, (DWIN_WIDTH - strlen(CORP_WEBSITE) * MENU_CHR_W) / 2, 268, F(CORP_WEBSITE)); drawBackFirst(); for (uint8_t i = 0; i < 3; ++i) { dwinIconShow(ICON, ICON_PrintSize + i, 26, 99 + i * 73); - dwinDrawLine(Line_Color, 16, MBASE(2) + i * 73, 256, 156 + i * 73); + dwinDrawLine(COLOR_LINE, 16, MBASE(2) + i * 73, 256, 156 + i * 73); } } @@ -2084,19 +2096,19 @@ void hmiMainMenu() { else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_page.now) { case PAGE_PRINT: - checkkey = SelectFile; + checkkey = ID_SelectFile; drawPrintFileMenu(); break; case PAGE_PREPARE: - checkkey = Prepare; + checkkey = ID_Prepare; select_prepare.reset(); index_prepare = MROWS; drawPrepareMenu(); break; case PAGE_CONTROL: - checkkey = Control; + checkkey = ID_Control; select_control.reset(); index_control = MROWS; drawControlMenu(); @@ -2104,10 +2116,10 @@ void hmiMainMenu() { case PAGE_INFO_LEVELING: #if HAS_ONESTEP_LEVELING - checkkey = Leveling; + checkkey = ID_Leveling; hmiLeveling(); #else - checkkey = Info; + checkkey = ID_Info; drawInfoMenu(); #endif break; @@ -2273,7 +2285,7 @@ void hmiPrinting() { else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_print.now) { case PRINT_SETUP: - checkkey = Tune; + checkkey = ID_Tune; hmiValues.show_mode = 0; select_tune.reset(); index_tune = MROWS; @@ -2299,14 +2311,14 @@ void hmiPrinting() { } else { hmiFlag.select_flag = true; - checkkey = Print_window; + checkkey = ID_PrintWindow; popupwindowPauseOrStop(); } break; case PRINT_STOP: hmiFlag.select_flag = true; - checkkey = Print_window; + checkkey = ID_PrintWindow; popupwindowPauseOrStop(); break; @@ -2335,7 +2347,7 @@ void hmiPauseOrStop() { } else if (select_print.now == PRINT_STOP) { if (hmiFlag.select_flag) { - checkkey = Back_Main; + checkkey = ID_BackMain; wait_for_heatup = wait_for_user = false; // Stop waiting for heating/user card.abortFilePrintSoon(); // Let the main loop handle SD abort dwin_abort_flag = true; // Reset feedrate, return to Home @@ -2518,7 +2530,7 @@ void itemHomeOffs_X(const uint8_t row) { #endif } drawMenuLine(row, ICON_HomeOffset); - drawEditSignedFloat3(row, hmiValues.Home_OffX_scaled); + drawEditSignedFloat3(row, hmiValues.homeOffsScaled.x); } void itemHomeOffs_Y(const uint8_t row) { @@ -2533,7 +2545,7 @@ void itemHomeOffs_Y(const uint8_t row) { #endif } drawMenuLine(row, ICON_HomeOffset); - drawEditSignedFloat3(row, hmiValues.Home_OffY_scaled); + drawEditSignedFloat3(row, hmiValues.homeOffsScaled.y); } void itemHomeOffs_Z(const uint8_t row) { @@ -2548,7 +2560,7 @@ void itemHomeOffs_Z(const uint8_t row) { #endif } drawMenuLine(row, ICON_HomeOffset); - drawEditSignedFloat3(row, hmiValues.Home_OffZ_scaled); + drawEditSignedFloat3(row, hmiValues.homeOffsScaled.z); } void drawHomeOffMenu() { @@ -2593,8 +2605,8 @@ void drawHomeOffMenu() { #endif } - drawEditSignedFloat3(1, hmiValues.Probe_OffX_scaled); - drawEditSignedFloat3(2, hmiValues.Probe_OffY_scaled); + drawEditSignedFloat3(1, hmiValues.probeOffsScaled.x); + drawEditSignedFloat3(2, hmiValues.probeOffsScaled.y); if (select_item.now != CASE_BACK) drawMenuCursor(select_item.now); } @@ -2673,7 +2685,7 @@ void hmiPrepare() { gotoMainMenu(); break; case PREPARE_CASE_MOVE: - checkkey = AxisMove; + checkkey = ID_AxisMove; select_axis.reset(); drawMoveMenu(); @@ -2681,15 +2693,15 @@ void hmiPrepare() { drawEditFloat3(2, current_position.y * MINUNITMULT); drawEditFloat3(3, current_position.z * MINUNITMULT); #if HAS_HOTEND - hmiValues.Move_E_scaled = current_position.e * MINUNITMULT; - drawEditSignedFloat3(4, hmiValues.Move_E_scaled); + hmiValues.moveScaled.e = current_position.e * MINUNITMULT; + drawEditSignedFloat3(4, hmiValues.moveScaled.e); #endif break; case PREPARE_CASE_DISA: queue.inject(F("M84")); break; case PREPARE_CASE_HOME: // Homing - checkkey = Last_Prepare; + checkkey = ID_LastPrepare; index_prepare = MROWS; queue.inject_P(G28_STR); // G28 will set home_flag popupWindowHome(); @@ -2698,7 +2710,7 @@ void hmiPrepare() { #if HAS_ZOFFSET_ITEM case PREPARE_CASE_ZOFF: #if ANY(HAS_BED_PROBE, BABYSTEPPING) - checkkey = Homeoffset; + checkkey = ID_HomeOffset; hmiValues.show_mode = -4; hmiValues.offset_value = BABY_Z_VAR * 100; drawEditSignedFloat2(PREPARE_CASE_ZOFF + MROWS - index_prepare, hmiValues.offset_value, true); @@ -2879,13 +2891,13 @@ void hmiControl() { gotoMainMenu(); break; case CONTROL_CASE_TEMP: - checkkey = TemperatureID; + checkkey = ID_TemperatureID; hmiValues.show_mode = -1; select_temp.reset(); drawTemperatureMenu(); break; case CONTROL_CASE_MOVE: - checkkey = Motion; + checkkey = ID_Motion; select_motion.reset(); drawMotionMenu(); break; @@ -2904,12 +2916,12 @@ void hmiControl() { break; #endif case CONTROL_CASE_ADVSET: - checkkey = AdvSet; + checkkey = ID_AdvSet; select_advset.reset(); drawAdvancedSettingsMenu(); break; case CONTROL_CASE_INFO: - checkkey = Info; + checkkey = ID_Info; drawInfoMenu(); break; default: break; @@ -2937,11 +2949,11 @@ void hmiAxisMove() { if (hmiFlag.cold_flag) { if (encoder_diffState == ENCODER_DIFF_ENTER) { hmiFlag.cold_flag = false; - hmiValues.Move_E_scaled = current_position.e * MINUNITMULT; + hmiValues.moveScaled.e = current_position.e * MINUNITMULT; drawMoveMenu(); - drawEditFloat3(1, hmiValues.Move_X_scaled); - drawEditFloat3(2, hmiValues.Move_Y_scaled); - drawEditFloat3(3, hmiValues.Move_Z_scaled); + TERN_(HAS_X_AXIS, drawEditFloat3(1, hmiValues.moveScaled.x)); + TERN_(HAS_Y_AXIS, drawEditFloat3(2, hmiValues.moveScaled.y)); + TERN_(HAS_Z_AXIS, drawEditFloat3(3, hmiValues.moveScaled.z)); drawEditSignedFloat3(4, 0); dwinUpdateLCD(); } @@ -2959,45 +2971,52 @@ void hmiAxisMove() { else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_axis.now) { case CASE_BACK: - checkkey = Prepare; + checkkey = ID_Prepare; select_prepare.set(1); index_prepare = MROWS; drawPrepareMenu(); break; - case 1: // X axis move - checkkey = Move_X; - hmiValues.Move_X_scaled = current_position.x * MINUNITMULT; - drawEditFloat3(1, hmiValues.Move_X_scaled, true); - encoderRate.enabled = true; - break; - case 2: // Y axis move - checkkey = Move_Y; - hmiValues.Move_Y_scaled = current_position.y * MINUNITMULT; - drawEditFloat3(2, hmiValues.Move_Y_scaled, true); - encoderRate.enabled = true; - break; - case 3: // Z axis move - checkkey = Move_Z; - hmiValues.Move_Z_scaled = current_position.z * MINUNITMULT; - drawEditFloat3(3, hmiValues.Move_Z_scaled, true); - encoderRate.enabled = true; - break; - #if HAS_HOTEND - case 4: // Extruder - #if ENABLED(PREVENT_COLD_EXTRUSION) - if (thermalManager.tooColdToExtrude(0)) { - hmiFlag.cold_flag = true; - popupWindowETempTooLow(); - dwinUpdateLCD(); - return; - } - #endif - checkkey = Extruder; - hmiValues.Move_E_scaled = current_position.e * MINUNITMULT; - drawEditSignedFloat3(4, hmiValues.Move_E_scaled, true); - encoderRate.enabled = true; - break; - #endif + + #if HAS_X_AXIS + case 1: // X axis move + checkkey = ID_MoveX; + hmiValues.moveScaled.x = current_position.x * MINUNITMULT; + drawEditFloat3(1, hmiValues.moveScaled.x, true); + encoderRate.enabled = true; + break; + #endif + #if HAS_Y_AXIS + case 2: // Y axis move + checkkey = ID_MoveY; + hmiValues.moveScaled.y = current_position.y * MINUNITMULT; + drawEditFloat3(2, hmiValues.moveScaled.y, true); + encoderRate.enabled = true; + break; + #endif + #if HAS_Z_AXIS + case 3: // Z axis move + checkkey = ID_MoveZ; + hmiValues.moveScaled.z = current_position.z * MINUNITMULT; + drawEditFloat3(3, hmiValues.moveScaled.z, true); + encoderRate.enabled = true; + break; + #endif + #if HAS_HOTEND + case 4: // Extruder + #if ENABLED(PREVENT_COLD_EXTRUSION) + if (thermalManager.tooColdToExtrude(0)) { + hmiFlag.cold_flag = true; + popupWindowETempTooLow(); + dwinUpdateLCD(); + return; + } + #endif + checkkey = ID_Extruder; + hmiValues.moveScaled.e = current_position.e * MINUNITMULT; + drawEditSignedFloat3(4, hmiValues.moveScaled.e, true); + encoderRate.enabled = true; + break; + #endif } } dwinUpdateLCD(); @@ -3018,39 +3037,39 @@ void hmiTemperature() { else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_temp.now) { case CASE_BACK: - checkkey = Control; + checkkey = ID_Control; select_control.set(1); index_control = MROWS; drawControlMenu(); break; #if HAS_HOTEND case TEMP_CASE_TEMP: - checkkey = ETemp; - hmiValues.E_Temp = thermalManager.degTargetHotend(0); - drawEditInteger3(1, hmiValues.E_Temp, true); + checkkey = ID_ETemp; + hmiValues.tempE = thermalManager.degTargetHotend(0); + drawEditInteger3(1, hmiValues.tempE, true); encoderRate.enabled = true; break; #endif #if HAS_HEATED_BED case TEMP_CASE_BED: - checkkey = BedTemp; - hmiValues.Bed_Temp = thermalManager.degTargetBed(); - drawEditInteger3(2, hmiValues.Bed_Temp, true); + checkkey = ID_BedTemp; + hmiValues.tempBed = thermalManager.degTargetBed(); + drawEditInteger3(2, hmiValues.tempBed, true); encoderRate.enabled = true; break; #endif #if HAS_FAN case TEMP_CASE_FAN: - checkkey = FanSpeed; - hmiValues.Fan_speed = thermalManager.fan_speed[0]; - drawEditInteger3(3, hmiValues.Fan_speed, true); + checkkey = ID_FanSpeed; + hmiValues.fanSpeed = thermalManager.fan_speed[0]; + drawEditInteger3(3, hmiValues.fanSpeed, true); encoderRate.enabled = true; break; #endif #if HAS_PREHEAT case TEMP_CASE_PLA: { - checkkey = PLAPreheat; + checkkey = ID_PLAPreheat; select_PLA.reset(); hmiValues.show_mode = -2; @@ -3129,7 +3148,7 @@ void hmiTemperature() { #if PREHEAT_COUNT > 1 case TEMP_CASE_ABS: { // ABS preheat setting - checkkey = ABSPreheat; + checkkey = ID_ABSPreheat; select_ABS.reset(); hmiValues.show_mode = -3; @@ -3448,30 +3467,30 @@ void hmiMotion() { else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_motion.now) { case CASE_BACK: - checkkey = Control; + checkkey = ID_Control; select_control.set(CONTROL_CASE_MOVE); index_control = MROWS; drawControlMenu(); break; case MOTION_CASE_RATE: - checkkey = MaxSpeed; + checkkey = ID_MaxSpeed; select_speed.reset(); drawMaxSpeedMenu(); break; case MOTION_CASE_ACCEL: - checkkey = MaxAcceleration; + checkkey = ID_MaxAcceleration; select_acc.reset(); drawMaxAccelMenu(); break; #if HAS_CLASSIC_JERK case MOTION_CASE_JERK: - checkkey = MaxJerk; + checkkey = ID_MaxJerk; select_jerk.reset(); drawMaxJerkMenu(); break; #endif case MOTION_CASE_STEPS: - checkkey = Step; + checkkey = ID_Step; select_step.reset(); drawStepsMenu(); break; @@ -3523,7 +3542,7 @@ void hmiAdvSet() { else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_advset.now) { case CASE_BACK: - checkkey = Control; + checkkey = ID_Control; select_control.set(CONTROL_CASE_ADVSET); index_control = CONTROL_CASE_ADVSET; drawControlMenu(); @@ -3531,21 +3550,21 @@ void hmiAdvSet() { #if HAS_HOME_OFFSET case ADVSET_CASE_HOMEOFF: - checkkey = HomeOff; + checkkey = ID_HomeOff; select_item.reset(); - hmiValues.Home_OffX_scaled = home_offset.x * 10; - hmiValues.Home_OffY_scaled = home_offset.y * 10; - hmiValues.Home_OffZ_scaled = home_offset.z * 10; + hmiValues.homeOffsScaled.x = home_offset.x * 10; + hmiValues.homeOffsScaled.y = home_offset.y * 10; + hmiValues.homeOffsScaled.z = home_offset.z * 10; drawHomeOffMenu(); break; #endif #if HAS_ONESTEP_LEVELING case ADVSET_CASE_PROBEOFF: - checkkey = ProbeOff; + checkkey = ID_ProbeOff; select_item.reset(); - hmiValues.Probe_OffX_scaled = probe.offset.x * 10; - hmiValues.Probe_OffY_scaled = probe.offset.y * 10; + hmiValues.probeOffsScaled.x = probe.offset.x * 10; + hmiValues.probeOffsScaled.y = probe.offset.y * 10; drawProbeOffMenu(); break; #endif @@ -3591,23 +3610,23 @@ void hmiAdvSet() { else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_item.now) { case CASE_BACK: - checkkey = AdvSet; + checkkey = ID_AdvSet; select_advset.set(ADVSET_CASE_HOMEOFF); drawAdvancedSettingsMenu(); break; case 1: // Home Offset X - checkkey = HomeOffX; - drawEditSignedFloat3(1, hmiValues.Home_OffX_scaled, true); + checkkey = ID_HomeOffX; + drawEditSignedFloat3(1, hmiValues.homeOffsScaled.x, true); encoderRate.enabled = true; break; case 2: // Home Offset Y - checkkey = HomeOffY; - drawEditSignedFloat3(2, hmiValues.Home_OffY_scaled, true); + checkkey = ID_HomeOffY; + drawEditSignedFloat3(2, hmiValues.homeOffsScaled.y, true); encoderRate.enabled = true; break; case 3: // Home Offset Z - checkkey = HomeOffZ; - drawEditSignedFloat3(3, hmiValues.Home_OffZ_scaled, true); + checkkey = ID_HomeOffZ; + drawEditSignedFloat3(3, hmiValues.homeOffsScaled.z, true); encoderRate.enabled = true; break; default: break; @@ -3621,7 +3640,7 @@ void hmiAdvSet() { if (encoder_diffState == ENCODER_DIFF_NO) return; if (applyEncoder(encoder_diffState, posScaled)) { - checkkey = HomeOff; + checkkey = ID_HomeOff; encoderRate.enabled = false; set_home_offset(axis, posScaled / 10); drawEditSignedFloat3(select_item.now, posScaled); @@ -3631,9 +3650,9 @@ void hmiAdvSet() { drawEditSignedFloat3(select_item.now, posScaled, true); } - void hmiHomeOffX() { hmiHomeOffN(X_AXIS, hmiValues.Home_OffX_scaled, -500, 500); } - void hmiHomeOffY() { hmiHomeOffN(Y_AXIS, hmiValues.Home_OffY_scaled, -500, 500); } - void hmiHomeOffZ() { hmiHomeOffN(Z_AXIS, hmiValues.Home_OffZ_scaled, -20, 20); } + void hmiHomeOffX() { hmiHomeOffN(X_AXIS, hmiValues.homeOffsScaled.x, -500, 500); } + void hmiHomeOffY() { hmiHomeOffN(Y_AXIS, hmiValues.homeOffsScaled.y, -500, 500); } + void hmiHomeOffZ() { hmiHomeOffN(Z_AXIS, hmiValues.homeOffsScaled.z, -20, 20); } #endif // HAS_HOME_OFFSET @@ -3654,18 +3673,18 @@ void hmiAdvSet() { else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_item.now) { case CASE_BACK: - checkkey = AdvSet; + checkkey = ID_AdvSet; select_advset.set(ADVSET_CASE_PROBEOFF); drawAdvancedSettingsMenu(); break; case 1: // Probe Offset X - checkkey = ProbeOffX; - drawEditSignedFloat3(1, hmiValues.Probe_OffX_scaled, true); + checkkey = ID_ProbeOffX; + drawEditSignedFloat3(1, hmiValues.probeOffsScaled.x, true); encoderRate.enabled = true; break; case 2: // Probe Offset Y - checkkey = ProbeOffY; - drawEditSignedFloat3(2, hmiValues.Probe_OffY_scaled, true); + checkkey = ID_ProbeOffY; + drawEditSignedFloat3(2, hmiValues.probeOffsScaled.y, true); encoderRate.enabled = true; break; } @@ -3678,7 +3697,7 @@ void hmiAdvSet() { if (encoder_diffState == ENCODER_DIFF_NO) return; if (applyEncoder(encoder_diffState, posScaled)) { - checkkey = ProbeOff; + checkkey = ID_ProbeOff; encoderRate.enabled = false; offset_ref = posScaled / 10; drawEditSignedFloat3(select_item.now, posScaled); @@ -3688,8 +3707,8 @@ void hmiAdvSet() { drawEditSignedFloat3(select_item.now, posScaled, true); } - void hmiProbeOffX() { hmiProbeOffN(hmiValues.Probe_OffX_scaled, probe.offset.x); } - void hmiProbeOffY() { hmiProbeOffN(hmiValues.Probe_OffY_scaled, probe.offset.y); } + void hmiProbeOffX() { hmiProbeOffN(hmiValues.probeOffsScaled.x, probe.offset.x); } + void hmiProbeOffY() { hmiProbeOffN(hmiValues.probeOffsScaled.y, probe.offset.y); } #endif // HAS_ONESTEP_LEVELING @@ -3699,7 +3718,7 @@ void hmiInfo() { if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_ENTER) { #if HAS_ONESTEP_LEVELING - checkkey = Control; + checkkey = ID_Control; select_control.set(CONTROL_CASE_INFO); drawControlMenu(); #else @@ -3745,39 +3764,39 @@ void hmiTune() { } break; case TUNE_CASE_SPEED: // Print speed - checkkey = PrintSpeed; - hmiValues.print_speed = feedrate_percentage; - drawEditInteger3(TUNE_CASE_SPEED + MROWS - index_tune, hmiValues.print_speed, true); + checkkey = ID_PrintSpeed; + hmiValues.printSpeed = feedrate_percentage; + drawEditInteger3(TUNE_CASE_SPEED + MROWS - index_tune, hmiValues.printSpeed, true); encoderRate.enabled = true; break; #if HAS_HOTEND case TUNE_CASE_TEMP: // Nozzle temp - checkkey = ETemp; - hmiValues.E_Temp = thermalManager.degTargetHotend(0); - drawEditInteger3(TUNE_CASE_TEMP + MROWS - index_tune, hmiValues.E_Temp, true); + checkkey = ID_ETemp; + hmiValues.tempE = thermalManager.degTargetHotend(0); + drawEditInteger3(TUNE_CASE_TEMP + MROWS - index_tune, hmiValues.tempE, true); encoderRate.enabled = true; break; #endif #if HAS_HEATED_BED case TUNE_CASE_BED: // Bed temp - checkkey = BedTemp; - hmiValues.Bed_Temp = thermalManager.degTargetBed(); - drawEditInteger3(TUNE_CASE_BED + MROWS - index_tune, hmiValues.Bed_Temp, true); + checkkey = ID_BedTemp; + hmiValues.tempBed = thermalManager.degTargetBed(); + drawEditInteger3(TUNE_CASE_BED + MROWS - index_tune, hmiValues.tempBed, true); encoderRate.enabled = true; break; #endif #if HAS_FAN case TUNE_CASE_FAN: // Fan speed - checkkey = FanSpeed; - hmiValues.Fan_speed = thermalManager.fan_speed[0]; - drawEditInteger3(TUNE_CASE_FAN + MROWS - index_tune, hmiValues.Fan_speed, true); + checkkey = ID_FanSpeed; + hmiValues.fanSpeed = thermalManager.fan_speed[0]; + drawEditInteger3(TUNE_CASE_FAN + MROWS - index_tune, hmiValues.fanSpeed, true); encoderRate.enabled = true; break; #endif #if HAS_ZOFFSET_ITEM case TUNE_CASE_ZOFF: // Z-offset #if ANY(HAS_BED_PROBE, BABYSTEPPING) - checkkey = Homeoffset; + checkkey = ID_HomeOffset; hmiValues.offset_value = BABY_Z_VAR * 100; drawEditSignedFloat2(TUNE_CASE_ZOFF + MROWS - index_tune, hmiValues.offset_value, true); encoderRate.enabled = true; @@ -3811,31 +3830,31 @@ void hmiTune() { else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_PLA.now) { case CASE_BACK: - checkkey = TemperatureID; + checkkey = ID_TemperatureID; select_temp.now = TEMP_CASE_PLA; hmiValues.show_mode = -1; drawTemperatureMenu(); break; #if HAS_HOTEND case PREHEAT_CASE_TEMP: - checkkey = ETemp; - hmiValues.E_Temp = ui.material_preset[0].hotend_temp; + checkkey = ID_ETemp; + hmiValues.tempE = ui.material_preset[0].hotend_temp; drawEditInteger3(PREHEAT_CASE_TEMP, ui.material_preset[0].hotend_temp, true); encoderRate.enabled = true; break; #endif #if HAS_HEATED_BED case PREHEAT_CASE_BED: - checkkey = BedTemp; - hmiValues.Bed_Temp = ui.material_preset[0].bed_temp; + checkkey = ID_BedTemp; + hmiValues.tempBed = ui.material_preset[0].bed_temp; drawEditInteger3(PREHEAT_CASE_BED, ui.material_preset[0].bed_temp, true); encoderRate.enabled = true; break; #endif #if HAS_FAN case PREHEAT_CASE_FAN: - checkkey = FanSpeed; - hmiValues.Fan_speed = ui.material_preset[0].fan_speed; + checkkey = ID_FanSpeed; + hmiValues.fanSpeed = ui.material_preset[0].fan_speed; drawEditInteger3(PREHEAT_CASE_FAN, ui.material_preset[0].fan_speed, true); encoderRate.enabled = true; break; @@ -3868,31 +3887,31 @@ void hmiTune() { else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_ABS.now) { case CASE_BACK: - checkkey = TemperatureID; + checkkey = ID_TemperatureID; select_temp.now = TEMP_CASE_ABS; hmiValues.show_mode = -1; drawTemperatureMenu(); break; #if HAS_HOTEND case PREHEAT_CASE_TEMP: - checkkey = ETemp; - hmiValues.E_Temp = ui.material_preset[1].hotend_temp; + checkkey = ID_ETemp; + hmiValues.tempE = ui.material_preset[1].hotend_temp; drawEditInteger3(PREHEAT_CASE_TEMP, ui.material_preset[1].hotend_temp, true); encoderRate.enabled = true; break; #endif #if HAS_HEATED_BED case PREHEAT_CASE_BED: - checkkey = BedTemp; - hmiValues.Bed_Temp = ui.material_preset[1].bed_temp; + checkkey = ID_BedTemp; + hmiValues.tempBed = ui.material_preset[1].bed_temp; drawEditInteger3(PREHEAT_CASE_BED, ui.material_preset[1].bed_temp, true); encoderRate.enabled = true; break; #endif #if HAS_FAN case PREHEAT_CASE_FAN: - checkkey = FanSpeed; - hmiValues.Fan_speed = ui.material_preset[1].fan_speed; + checkkey = ID_FanSpeed; + hmiValues.fanSpeed = ui.material_preset[1].fan_speed; drawEditInteger3(PREHEAT_CASE_FAN, ui.material_preset[1].fan_speed, true); encoderRate.enabled = true; break; @@ -3926,14 +3945,14 @@ void hmiMaxSpeed() { } else if (encoder_diffState == ENCODER_DIFF_ENTER) { if (WITHIN(select_speed.now, 1, 4)) { - checkkey = MaxSpeed_value; + checkkey = ID_MaxSpeedValue; hmiFlag.feedspeed_axis = AxisEnum(select_speed.now - 1); - hmiValues.Max_Feedspeed = planner.settings.max_feedrate_mm_s[hmiFlag.feedspeed_axis]; - drawEditInteger4(select_speed.now, hmiValues.Max_Feedspeed, true); + hmiValues.maxFeedSpeed = planner.settings.max_feedrate_mm_s[hmiFlag.feedspeed_axis]; + drawEditInteger4(select_speed.now, hmiValues.maxFeedSpeed, true); encoderRate.enabled = true; } else { // Back - checkkey = Motion; + checkkey = ID_Motion; select_motion.now = MOTION_CASE_RATE; drawMotionMenu(); } @@ -3955,14 +3974,14 @@ void hmiMaxAcceleration() { } else if (encoder_diffState == ENCODER_DIFF_ENTER) { if (WITHIN(select_acc.now, 1, 4)) { - checkkey = MaxAcceleration_value; + checkkey = ID_MaxAccelerationValue; hmiFlag.acc_axis = AxisEnum(select_acc.now - 1); - hmiValues.Max_Acceleration = planner.settings.max_acceleration_mm_per_s2[hmiFlag.acc_axis]; - drawEditInteger4(select_acc.now, hmiValues.Max_Acceleration, true); + hmiValues.maxAcceleration = planner.settings.max_acceleration_mm_per_s2[hmiFlag.acc_axis]; + drawEditInteger4(select_acc.now, hmiValues.maxAcceleration, true); encoderRate.enabled = true; } else { // Back - checkkey = Motion; + checkkey = ID_Motion; select_motion.now = MOTION_CASE_ACCEL; drawMotionMenu(); } @@ -3985,14 +4004,14 @@ void hmiMaxAcceleration() { } else if (encoder_diffState == ENCODER_DIFF_ENTER) { if (WITHIN(select_jerk.now, 1, 4)) { - checkkey = MaxJerk_value; + checkkey = ID_MaxJerkValue; hmiFlag.jerk_axis = AxisEnum(select_jerk.now - 1); - hmiValues.Max_Jerk_scaled = planner.max_jerk[hmiFlag.jerk_axis] * MINUNITMULT; - drawEditFloat3(select_jerk.now, hmiValues.Max_Jerk_scaled, true); + hmiValues.maxJerkScaled = planner.max_jerk[hmiFlag.jerk_axis] * MINUNITMULT; + drawEditFloat3(select_jerk.now, hmiValues.maxJerkScaled, true); encoderRate.enabled = true; } else { // Back - checkkey = Motion; + checkkey = ID_Motion; select_motion.now = MOTION_CASE_JERK; drawMotionMenu(); } @@ -4015,14 +4034,14 @@ void hmiStep() { } else if (encoder_diffState == ENCODER_DIFF_ENTER) { if (WITHIN(select_step.now, 1, 4)) { - checkkey = Step_value; + checkkey = ID_StepValue; hmiFlag.step_axis = AxisEnum(select_step.now - 1); - hmiValues.Max_Step_scaled = planner.settings.axis_steps_per_mm[hmiFlag.step_axis] * MINUNITMULT; - drawEditFloat3(select_step.now, hmiValues.Max_Step_scaled, true); + hmiValues.maxStepScaled = planner.settings.axis_steps_per_mm[hmiFlag.step_axis] * MINUNITMULT; + drawEditFloat3(select_step.now, hmiValues.maxStepScaled, true); encoderRate.enabled = true; } else { // Back - checkkey = Motion; + checkkey = ID_Motion; select_motion.now = MOTION_CASE_STEPS; drawMotionMenu(); } @@ -4035,7 +4054,7 @@ void hmiInit() { for (uint16_t t = 0; t <= 100; t += 2) { dwinIconShow(ICON, ICON_Bar, 15, 260); - dwinDrawRectangle(1, Color_Bg_Black, 15 + t * 242 / 100, 260, 257, 280); + dwinDrawRectangle(1, COLOR_BG_BLACK, 15 + t * 242 / 100, 260, 257, 280); dwinUpdateLCD(); delay(20); } @@ -4062,13 +4081,13 @@ void eachMomentUpdate() { const millis_t ms = millis(); if (ELAPSED(ms, next_var_update_ms)) { next_var_update_ms = ms + DWIN_VAR_UPDATE_INTERVAL; - update_variable(); + updateVariable(); } if (PENDING(ms, next_rts_update_ms)) return; next_rts_update_ms = ms + DWIN_SCROLL_UPDATE_INTERVAL; - if (checkkey == PrintProcess) { + if (checkkey == ID_PrintProcess) { // if print done if (hmiFlag.print_finish && !hmiFlag.done_confirm_flag) { hmiFlag.print_finish = false; @@ -4083,7 +4102,7 @@ void eachMomentUpdate() { drawPrintProgressBar(); // show print done confirm - dwinDrawRectangle(1, Color_Bg_Black, 0, 250, DWIN_WIDTH - 1, STATUS_Y); + dwinDrawRectangle(1, COLOR_BG_BLACK, 0, 250, DWIN_WIDTH - 1, STATUS_Y); dwinIconShow(ICON, hmiIsChinese() ? ICON_Confirm_C : ICON_Confirm_E, 86, 283); } else if (hmiFlag.pause_flag != printingIsPaused()) { @@ -4104,7 +4123,7 @@ void eachMomentUpdate() { queue.inject(F("G1 F1200 X0 Y0")); } - if (card.isPrinting() && checkkey == PrintProcess) { // Print process + if (card.isPrinting() && checkkey == ID_PrintProcess) { // Print process const uint8_t card_pct = card.percentDone(); static uint8_t last_cardpercentValue = 101; if (last_cardpercentValue != card_pct) { // print percent @@ -4135,7 +4154,7 @@ void eachMomentUpdate() { } else if (dwin_abort_flag && !hmiFlag.home_flag) { // Print Stop dwin_abort_flag = false; - hmiValues.print_speed = feedrate_percentage = 100; + hmiValues.printSpeed = feedrate_percentage = 100; dwin_zoffset = BABY_Z_VAR; select_page.set(0); gotoMainMenu(); @@ -4146,10 +4165,10 @@ void eachMomentUpdate() { auto update_selection = [&](const bool sel) { hmiFlag.select_flag = sel; - const uint16_t c1 = sel ? Color_Bg_Window : Select_Color; + const uint16_t c1 = sel ? COLOR_BG_WINDOW : COLOR_SELECT; dwinDrawRectangle(0, c1, 25, 306, 126, 345); dwinDrawRectangle(0, c1, 24, 305, 127, 346); - const uint16_t c2 = sel ? Select_Color : Color_Bg_Window; + const uint16_t c2 = sel ? COLOR_SELECT : COLOR_BG_WINDOW; dwinDrawRectangle(0, c2, 145, 306, 246, 345); dwinDrawRectangle(0, c2, 144, 305, 247, 346); }; @@ -4159,7 +4178,7 @@ void eachMomentUpdate() { char * const name = card.longest_filename(); const int8_t npos = _MAX(0U, DWIN_WIDTH - strlen(name) * (MENU_CHR_W)) / 2; - dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, npos, 252, name); + dwinDrawString(true, font8x16, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, npos, 252, name); dwinUpdateLCD(); bool recovery_flag = true; @@ -4193,65 +4212,65 @@ void eachMomentUpdate() { void dwinHandleScreen() { switch (checkkey) { - case MainMenu: hmiMainMenu(); break; - case SelectFile: hmiSelectFile(); break; - case Prepare: hmiPrepare(); break; - case Control: hmiControl(); break; - case Leveling: break; - case PrintProcess: hmiPrinting(); break; - case Print_window: hmiPauseOrStop(); break; - case AxisMove: hmiAxisMove(); break; - case TemperatureID: hmiTemperature(); break; - case Motion: hmiMotion(); break; - case AdvSet: hmiAdvSet(); break; + case ID_MainMenu: hmiMainMenu(); break; + case ID_SelectFile: hmiSelectFile(); break; + case ID_Prepare: hmiPrepare(); break; + case ID_Control: hmiControl(); break; + case ID_Leveling: break; + case ID_PrintProcess: hmiPrinting(); break; + case ID_PrintWindow: hmiPauseOrStop(); break; + case ID_AxisMove: hmiAxisMove(); break; + case ID_TemperatureID: hmiTemperature(); break; + case ID_Motion: hmiMotion(); break; + case ID_AdvSet: hmiAdvSet(); break; #if HAS_HOME_OFFSET - case HomeOff: hmiHomeOff(); break; - case HomeOffX: hmiHomeOffX(); break; - case HomeOffY: hmiHomeOffY(); break; - case HomeOffZ: hmiHomeOffZ(); break; + case ID_HomeOff: hmiHomeOff(); break; + case ID_HomeOffX: hmiHomeOffX(); break; + case ID_HomeOffY: hmiHomeOffY(); break; + case ID_HomeOffZ: hmiHomeOffZ(); break; #endif #if HAS_ONESTEP_LEVELING - case ProbeOff: hmiProbeOff(); break; - case ProbeOffX: hmiProbeOffX(); break; - case ProbeOffY: hmiProbeOffY(); break; + case ID_ProbeOff: hmiProbeOff(); break; + case ID_ProbeOffX: hmiProbeOffX(); break; + case ID_ProbeOffY: hmiProbeOffY(); break; #endif - case Info: hmiInfo(); break; - case Tune: hmiTune(); break; + case ID_Info: hmiInfo(); break; + case ID_Tune: hmiTune(); break; #if HAS_PREHEAT - case PLAPreheat: hmiPLAPreheatSetting(); break; + case ID_PLAPreheat: hmiPLAPreheatSetting(); break; #if PREHEAT_COUNT > 1 - case ABSPreheat: hmiABSPreheatSetting(); break; + case ID_ABSPreheat: hmiABSPreheatSetting(); break; #endif #endif - case MaxSpeed: hmiMaxSpeed(); break; - case MaxAcceleration: hmiMaxAcceleration(); break; + case ID_MaxSpeed: hmiMaxSpeed(); break; + case ID_MaxAcceleration: hmiMaxAcceleration(); break; #if HAS_CLASSIC_JERK - case MaxJerk: hmiMaxJerk(); break; + case ID_MaxJerk: hmiMaxJerk(); break; #endif - case Step: hmiStep(); break; - case Move_X: hmiMoveX(); break; - case Move_Y: hmiMoveY(); break; - case Move_Z: hmiMoveZ(); break; + case ID_Step: hmiStep(); break; + case ID_MoveX: hmiMoveX(); break; + case ID_MoveY: hmiMoveY(); break; + case ID_MoveZ: hmiMoveZ(); break; #if HAS_HOTEND - case Extruder: hmiMoveE(); break; - case ETemp: hmiETemp(); break; + case ID_Extruder: hmiMoveE(); break; + case ID_ETemp: hmiETemp(); break; #endif #if ANY(HAS_BED_PROBE, BABYSTEPPING) - case Homeoffset: hmiZoffset(); break; + case ID_HomeOffset: hmiZoffset(); break; #endif #if HAS_HEATED_BED - case BedTemp: hmiBedTemp(); break; + case ID_BedTemp: hmiBedTemp(); break; #endif #if HAS_PREHEAT && HAS_FAN - case FanSpeed: hmiFanSpeed(); break; + case ID_FanSpeed: hmiFanSpeed(); break; #endif - case PrintSpeed: hmiPrintSpeed(); break; - case MaxSpeed_value: hmiMaxFeedspeedXYZE(); break; - case MaxAcceleration_value: hmiMaxAccelerationXYZE(); break; + case ID_PrintSpeed: hmiPrintSpeed(); break; + case ID_MaxSpeedValue: hmiMaxFeedspeedXYZE(); break; + case ID_MaxAccelerationValue: hmiMaxAccelerationXYZE(); break; #if HAS_CLASSIC_JERK - case MaxJerk_value: hmiMaxJerkXYZE(); break; + case ID_MaxJerkValue: hmiMaxJerkXYZE(); break; #endif - case Step_value: hmiStepXYZE(); break; + case ID_StepValue: hmiStepXYZE(); break; default: break; } } @@ -4259,27 +4278,27 @@ void dwinHandleScreen() { void dwinHomingDone() { hmiFlag.home_flag = false; dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z); - if (checkkey == Last_Prepare) { - checkkey = Prepare; + if (checkkey == ID_LastPrepare) { + checkkey = ID_Prepare; select_prepare.now = PREPARE_CASE_HOME; index_prepare = MROWS; drawPrepareMenu(); } - else if (checkkey == Back_Main) { - hmiValues.print_speed = feedrate_percentage = 100; + else if (checkkey == ID_BackMain) { + hmiValues.printSpeed = feedrate_percentage = 100; planner.finish_and_disable(); gotoMainMenu(); } } void dwinLevelingDone() { - if (checkkey == Leveling) gotoMainMenu(); + if (checkkey == ID_Leveling) gotoMainMenu(); } void dwinStatusChanged(const char * const cstr/*=nullptr*/) { - dwinDrawRectangle(1, Color_Bg_Blue, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 24); + dwinDrawRectangle(1, COLOR_BG_BLUE, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 24); const int8_t x = _MAX(0U, DWIN_WIDTH - strlen(cstr) * MENU_CHR_W) / 2; - dwinDrawString(false, font8x16, Color_White, Color_Bg_Blue, x, STATUS_Y + 3, cstr); + dwinDrawString(false, font8x16, COLOR_WHITE, COLOR_BG_BLUE, x, STATUS_Y + 3, cstr); dwinUpdateLCD(); } diff --git a/Marlin/src/lcd/e3v2/creality/dwin.h b/Marlin/src/lcd/e3v2/creality/dwin.h index 0e2d42eee91c..17a7a965ee39 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.h +++ b/Marlin/src/lcd/e3v2/creality/dwin.h @@ -34,69 +34,56 @@ enum processID : uint8_t { // Process ID - MainMenu, - SelectFile, - Prepare, - Control, - Leveling, - PrintProcess, - AxisMove, - TemperatureID, - Motion, - Info, - Tune, + ID_MainMenu, + ID_SelectFile, + ID_Prepare, + ID_Control, + ID_Leveling, + ID_PrintProcess, + ID_AxisMove, + ID_TemperatureID, + ID_Motion, + ID_Info, + ID_Tune, #if HAS_PREHEAT - PLAPreheat, + ID_PLAPreheat, #if PREHEAT_COUNT > 1 - ABSPreheat, + ID_ABSPreheat, #endif #endif - MaxSpeed, - MaxSpeed_value, - MaxAcceleration, - MaxAcceleration_value, - MaxJerk, - MaxJerk_value, - Step, - Step_value, - HomeOff, - HomeOffX, - HomeOffY, - HomeOffZ, + ID_MaxSpeed, ID_MaxSpeedValue, + ID_MaxAcceleration, ID_MaxAccelerationValue, + ID_MaxJerk, ID_MaxJerkValue, + ID_Step, ID_StepValue, + ID_HomeOff, ID_HomeOffX, ID_HomeOffY, ID_HomeOffZ, // Last Process ID - Last_Prepare, + ID_LastPrepare, // Advance Settings - AdvSet, - ProbeOff, - ProbeOffX, - ProbeOffY, + ID_AdvSet, + ID_ProbeOff, ID_ProbeOffX, ID_ProbeOffY, // Back Process ID - Back_Main, - Back_Print, + ID_BackMain, ID_BackPrint, // Date variable ID - Move_X, - Move_Y, - Move_Z, + ID_MoveX, ID_MoveY, ID_MoveZ, #if HAS_HOTEND - Extruder, - ETemp, + ID_Extruder, + ID_ETemp, #endif - Homeoffset, + ID_HomeOffset, #if HAS_HEATED_BED - BedTemp, + ID_BedTemp, #endif #if HAS_FAN - FanSpeed, + ID_FanSpeed, #endif - PrintSpeed, + ID_PrintSpeed, // Window ID - Print_window, - Popup_Window + ID_PrintWindow, ID_PopupWindow }; extern uint8_t checkkey; @@ -107,32 +94,54 @@ extern millis_t dwin_heat_time; typedef struct { #if HAS_HOTEND - celsius_t E_Temp = 0; + celsius_t tempE = 0; #endif #if HAS_HEATED_BED - celsius_t Bed_Temp = 0; + celsius_t tempBed = 0; #endif #if HAS_FAN - int16_t Fan_speed = 0; + int16_t fanSpeed = 0; #endif - int16_t print_speed = 100; - float Max_Feedspeed = 0; - float Max_Acceleration = 0; - float Max_Jerk_scaled = 0; - float Max_Step_scaled = 0; - float Move_X_scaled = 0; - float Move_Y_scaled = 0; - float Move_Z_scaled = 0; - #if HAS_HOTEND - float Move_E_scaled = 0; - #endif - float offset_value = 0; - int8_t show_mode = 0; // -1: Temperature control 0: Printing temperature - float Home_OffX_scaled = 0; - float Home_OffY_scaled = 0; - float Home_OffZ_scaled = 0; - float Probe_OffX_scaled = 0; - float Probe_OffY_scaled = 0; + int16_t printSpeed = 100; + float maxFeedSpeed = 0; + float maxAcceleration = 0; + float maxJerkScaled = 0; + float maxStepScaled = 0; + float offset_value = 0; + int8_t show_mode = 0; // -1: Temperature control 0: Printing temperature + struct { + #if HAS_X_AXIS + float x = 0; + #endif + #if HAS_Y_AXIS + float y = 0; + #endif + #if HAS_Z_AXIS + float z = 0; + #endif + #if HAS_HOTEND + float e = 0; + #endif + } moveScaled; + struct { + #if HAS_X_AXIS + float x = 0; + #endif + #if HAS_Y_AXIS + float y = 0; + #endif + #if HAS_Z_AXIS + float z = 0; + #endif + } homeOffsScaled; + struct { + #if HAS_X_AXIS + float x = 0; + #endif + #if HAS_Y_AXIS + float y = 0; + #endif + } probeOffsScaled; } hmi_value_t; #define DWIN_CHINESE 123 @@ -198,19 +207,13 @@ void hmiMaxJerkXYZE(); void hmiStepXYZE(); void hmiSetLanguageCache(); -void update_variable(); -void dwinDrawSigned_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value); +void updateVariable(); +void dwinDrawSignedFloat(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value); // SD Card void hmiSDCardInit(); void hmiSDCardUpdate(); -// Main Process -void Icon_print(bool value); -void Icon_control(bool value); -void Icon_temperature(bool value); -void Icon_leveling(bool value); - // Other void drawStatusArea(const bool with_update); // Status Area void hmiStartFrame(const bool with_update); // Prepare the menu view diff --git a/Marlin/src/lcd/e3v2/creality/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/creality/dwin_lcd.cpp index 7a0587df4310..649e1b4771c7 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin_lcd.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin_lcd.cpp @@ -47,7 +47,7 @@ void dwinStartup() { if (dwinHandshake()) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error."); dwinFrameSetDir(1); #if DISABLED(SHOW_BOOTSCREEN) - dwinFrameClear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here + dwinFrameClear(COLOR_BG_BLACK); // MarlinUI handles the bootscreen so just clear here #endif dwinJPGShowAndCache(3); dwinUpdateLCD(); diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 22ff4b8a0037..479b548d33c1 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -169,10 +169,10 @@ enum SelectItem : uint8_t { PRINT_COUNT }; -uint8_t active_menu = MainMenu, last_menu = MainMenu; +uint8_t active_menu = ID_MainMenu, last_menu = ID_MainMenu; uint8_t selection = 0, last_selection = 0; uint8_t scrollpos = 0; -uint8_t process = Main, last_process = Main; +uint8_t process = Proc_Main, last_process = Proc_Main; PopupID popup, last_popup; void (*funcpointer)() = nullptr; @@ -329,7 +329,7 @@ class TextScroller { planner.synchronize(); } else { - jyersDWIN.popupHandler(MoveWait); + jyersDWIN.popupHandler(Popup_MoveWait); gcode.process_subcommands_now(TS(F("G0F300Z"), p_float_t(current_position.z, 3))); gcode.process_subcommands_now(TS(F("G42 F4000 I"), mesh_x, 'J', mesh_y)); planner.synchronize(); @@ -366,13 +366,13 @@ class TextScroller { const float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); // Clear background from previous selection and select new square - dwinDrawRectangle(1, Color_Bg_Black, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); + dwinDrawRectangle(1, COLOR_BG_BLACK, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); if (selected >= 0) { const auto selected_y = selected / (GRID_MAX_POINTS_X); const auto selected_x = selected - (GRID_MAX_POINTS_X) * selected_y; const auto start_y_px = padding_y_top + selected_y * cell_height_px; const auto start_x_px = padding_x + selected_x * cell_width_px; - dwinDrawRectangle(1, Color_White, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px); + dwinDrawRectangle(1, COLOR_WHITE, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px); } // Draw value square grid @@ -382,7 +382,7 @@ class TextScroller { const auto start_y_px = padding_y_top + (GRID_MAX_POINTS_Y - y - 1) * cell_height_px; const auto end_y_px = start_y_px + cell_height_px - 1 - gridline_width; dwinDrawRectangle(1, // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/ - isnan(bedlevel.z_values[x][y]) ? Color_Grey : ( // gray if undefined + isnan(bedlevel.z_values[x][y]) ? COLOR_GREY : ( // gray if undefined (bedlevel.z_values[x][y] < 0 ? (uint16_t)round(0x1F * -bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_min)) << 11 : // red if mesh point value is negative (uint16_t)round(0x3F * bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_max)) << 5) | // green if mesh point value is positive @@ -397,7 +397,7 @@ class TextScroller { if (viewer_print_value) { int8_t offset_x, offset_y = cell_height_px / 2 - 6; if (isnan(bedlevel.z_values[x][y])) { // undefined - dwinDrawString(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); + dwinDrawString(false, font6x12, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); } else { // has value MString<12> msg; @@ -407,8 +407,8 @@ class TextScroller { msg.setf(F("%02i"), uint16_t(abs(bedlevel.z_values[x][y] - int16_t(bedlevel.z_values[x][y])) * 100)); offset_x = cell_width_px / 2 - 3 * msg.length() - 2; if (!(GRID_MAX_POINTS_X < 10)) - dwinDrawString(false, font6x12, Color_White, Color_Bg_Blue, start_x_px - 2 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, F(".")); - dwinDrawString(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + 1 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, msg); + dwinDrawString(false, font6x12, COLOR_WHITE, COLOR_BG_BLUE, start_x_px - 2 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, F(".")); + dwinDrawString(false, font6x12, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + 1 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, msg); } safe_delay(10); LCD_SERIAL.flushTX(); @@ -455,67 +455,67 @@ constexpr const char * const JyersDWIN::preheat_modes[3]; // 2=Menu area // 1=Title bar void JyersDWIN::clearScreen(const uint8_t e/*=3*/) { - if (e == 1 || e == 3 || e == 4) dwinDrawRectangle(1, getColor(eeprom_settings.menu_top_bg, Color_Bg_Blue, false), 0, 0, DWIN_WIDTH, TITLE_HEIGHT); // Clear Title Bar - if (e == 2 || e == 3) dwinDrawRectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, STATUS_Y); // Clear Menu Area - if (e == 4) dwinDrawRectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, DWIN_HEIGHT); // Clear Popup Area + if (e == 1 || e == 3 || e == 4) dwinDrawRectangle(1, getColor(eeprom_settings.menu_top_bg, COLOR_BG_BLUE, false), 0, 0, DWIN_WIDTH, TITLE_HEIGHT); // Clear Title Bar + if (e == 2 || e == 3) dwinDrawRectangle(1, COLOR_BG_BLACK, 0, 31, DWIN_WIDTH, STATUS_Y); // Clear Menu Area + if (e == 4) dwinDrawRectangle(1, COLOR_BG_BLACK, 0, 31, DWIN_WIDTH, DWIN_HEIGHT); // Clear Popup Area } void JyersDWIN::drawFloat(const_float_t value, const uint8_t row, const bool selected/*=false*/, const uint8_t minunit/*=10*/) { const uint8_t digits = (uint8_t)floor(log10(abs(value))) + log10(minunit) + (minunit > 1); - const uint16_t bColor = selected ? Select_Color : Color_Bg_Black; + const uint16_t bColor = selected ? COLOR_SELECT : COLOR_BG_BLACK; const uint16_t xpos = 240 - (digits * 8); - dwinDrawRectangle(1, Color_Bg_Black, 194, MBASE(row), 234 - (digits * 8), MBASE(row) + 16); + dwinDrawRectangle(1, COLOR_BG_BLACK, 194, MBASE(row), 234 - (digits * 8), MBASE(row) + 16); if (isnan(value)) - dwinDrawString(true, DWIN_FONT_MENU, Color_White, bColor, xpos - 8, MBASE(row), F(" NaN")); + dwinDrawString(true, DWIN_FONT_MENU, COLOR_WHITE, bColor, xpos - 8, MBASE(row), F(" NaN")); else { - dwinDrawFloatValue(true, true, 0, DWIN_FONT_MENU, Color_White, bColor, digits - log10(minunit) + 1, log10(minunit), xpos, MBASE(row), (value < 0 ? -value : value)); - dwinDrawString(true, DWIN_FONT_MENU, Color_White, bColor, xpos - 8, MBASE(row), value < 0 ? F("-") : F(" ")); + dwinDrawFloatValue(true, true, 0, DWIN_FONT_MENU, COLOR_WHITE, bColor, digits - log10(minunit) + 1, log10(minunit), xpos, MBASE(row), (value < 0 ? -value : value)); + dwinDrawString(true, DWIN_FONT_MENU, COLOR_WHITE, bColor, xpos - 8, MBASE(row), value < 0 ? F("-") : F(" ")); } } void JyersDWIN::drawOption(const uint8_t value, const char * const * options, const uint8_t row, const bool selected/*=false*/, const bool color/*=false*/) { - const uint16_t bColor = selected ? Select_Color : Color_Bg_Black, - tColor = color ? getColor(value, Color_White, false) : Color_White; + const uint16_t bColor = selected ? COLOR_SELECT : COLOR_BG_BLACK, + tColor = color ? getColor(value, COLOR_WHITE, false) : COLOR_WHITE; dwinDrawRectangle(1, bColor, 202, MBASE(row) + 14, 258, MBASE(row) - 2); dwinDrawString(false, DWIN_FONT_MENU, tColor, bColor, 202, MBASE(row) - 1, options[value]); } uint16_t JyersDWIN::getColor(const uint8_t color, const uint16_t original, const bool light/*=false*/) { switch (color) { - case White: return light ? Color_Light_White : Color_White; - case Green: return light ? Color_Light_Green : Color_Green; - case Cyan: return light ? Color_Light_Cyan : Color_Cyan; - case Blue: return light ? Color_Light_Blue : Color_Blue; - case Magenta: return light ? Color_Light_Magenta : Color_Magenta; - case Red: return light ? Color_Light_Red : Color_Red; - case Orange: return light ? Color_Light_Orange : Color_Orange; - case Yellow: return light ? Color_Light_Yellow : Color_Yellow; - case Brown: return light ? Color_Light_Brown : Color_Brown; - case Black: return Color_Black; + case White: return light ? COLOR_LIGHT_WHITE : COLOR_WHITE; + case Green: return light ? COLOR_LIGHT_GREEN : COLOR_GREEN; + case Cyan: return light ? COLOR_LIGHT_CYAN : COLOR_CYAN; + case Blue: return light ? COLOR_LIGHT_BLUE : COLOR_BLUE; + case Magenta: return light ? COLOR_LIGHT_MAGENTA : COLOR_MAGENTA; + case Red: return light ? COLOR_LIGHT_RED : COLOR_RED; + case Orange: return light ? COLOR_LIGHT_ORANGE : COLOR_ORANGE; + case Yellow: return light ? COLOR_LIGHT_YELLOW : COLOR_YELLOW; + case Brown: return light ? COLOR_LIGHT_BROWN : COLOR_BROWN; + case Black: return COLOR_BLACK; case Default: return original; } - return Color_White; + return COLOR_WHITE; } void JyersDWIN::drawTitle(const char * const ctitle) { - dwinDrawString(false, DWIN_FONT_HEAD, getColor(eeprom_settings.menu_top_txt, Color_White, false), Color_Bg_Blue, (DWIN_WIDTH - strlen(ctitle) * STAT_CHR_W) / 2, 5, ctitle); + dwinDrawString(false, DWIN_FONT_HEAD, getColor(eeprom_settings.menu_top_txt, COLOR_WHITE, false), COLOR_BG_BLUE, (DWIN_WIDTH - strlen(ctitle) * STAT_CHR_W) / 2, 5, ctitle); } void JyersDWIN::drawTitle(FSTR_P const ftitle) { - dwinDrawString(false, DWIN_FONT_HEAD, getColor(eeprom_settings.menu_top_txt, Color_White, false), Color_Bg_Blue, (DWIN_WIDTH - strlen_P(FTOP(ftitle)) * STAT_CHR_W) / 2, 5, ftitle); + dwinDrawString(false, DWIN_FONT_HEAD, getColor(eeprom_settings.menu_top_txt, COLOR_WHITE, false), COLOR_BG_BLUE, (DWIN_WIDTH - strlen_P(FTOP(ftitle)) * STAT_CHR_W) / 2, 5, ftitle); } void _decorateMenuItem(uint8_t row, uint8_t icon, bool more) { if (icon) dwinIconShow(ICON, icon, 26, MBASE(row) - 3); // Draw Menu Icon if (more) dwinIconShow(ICON, ICON_More, 226, MBASE(row) - 3); // Draw More Arrow - dwinDrawLine(jyersDWIN.getColor(jyersDWIN.eeprom_settings.menu_split_line, Line_Color, true), 16, MBASE(row) + 33, 256, MBASE(row) + 33); // Draw Menu Line + dwinDrawLine(jyersDWIN.getColor(jyersDWIN.eeprom_settings.menu_split_line, COLOR_LINE, true), 16, MBASE(row) + 33, 256, MBASE(row) + 33); // Draw Menu Line } void JyersDWIN::drawMenuItem(const uint8_t row, const uint8_t icon/*=0*/, const char * const label1, const char * const label2, const bool more/*=false*/, const bool centered/*=false*/) { const uint8_t label_offset_y = label2 ? MENU_CHR_H * 3 / 5 : 0, label1_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1U/5, (DWIN_WIDTH - LBLX - (label1 ? strlen(label1) : 0) * MENU_CHR_W) / 2), label2_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1U/5, (DWIN_WIDTH - LBLX - (label2 ? strlen(label2) : 0) * MENU_CHR_W) / 2); - if (label1) dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label1_offset_x, MBASE(row) - 1 - label_offset_y, label1); // Draw Label - if (label2) dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label2_offset_x, MBASE(row) - 1 + label_offset_y, label2); // Draw Label + if (label1) dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLACK, label1_offset_x, MBASE(row) - 1 - label_offset_y, label1); // Draw Label + if (label2) dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLACK, label2_offset_x, MBASE(row) - 1 + label_offset_y, label2); // Draw Label _decorateMenuItem(row, icon, more); } @@ -523,8 +523,8 @@ void JyersDWIN::drawMenuItem(const uint8_t row, const uint8_t icon/*=0*/, FSTR_P const uint8_t label_offset_y = flabel2 ? MENU_CHR_H * 3 / 5 : 0, label1_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1U/5, (DWIN_WIDTH - LBLX - (flabel1 ? strlen_P(FTOP(flabel1)) : 0) * MENU_CHR_W) / 2), label2_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1U/5, (DWIN_WIDTH - LBLX - (flabel2 ? strlen_P(FTOP(flabel2)) : 0) * MENU_CHR_W) / 2); - if (flabel1) dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label1_offset_x, MBASE(row) - 1 - label_offset_y, flabel1); // Draw Label - if (flabel2) dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label2_offset_x, MBASE(row) - 1 + label_offset_y, flabel2); // Draw Label + if (flabel1) dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLACK, label1_offset_x, MBASE(row) - 1 - label_offset_y, flabel1); // Draw Label + if (flabel2) dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLACK, label2_offset_x, MBASE(row) - 1 + label_offset_y, flabel2); // Draw Label _decorateMenuItem(row, icon, more); } @@ -532,15 +532,15 @@ void JyersDWIN::drawCheckbox(const uint8_t row, const bool value) { #if ENABLED(DWIN_CREALITY_LCD_CUSTOM_ICONS) // Draw appropriate checkbox icon dwinIconShow(ICON, (value ? ICON_Checkbox_T : ICON_Checkbox_F), 226, MBASE(row) - 3); #else // Draw a basic checkbox using rectangles and lines - dwinDrawRectangle(1, Color_Bg_Black, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); - dwinDrawRectangle(0, Color_White, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); + dwinDrawRectangle(1, COLOR_BG_BLACK, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); + dwinDrawRectangle(0, COLOR_WHITE, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); if (value) { - dwinDrawLine(Check_Color, 227, MBASE(row) - 3 + 11, 226 + 8, MBASE(row) - 3 + 17); - dwinDrawLine(Check_Color, 227 + 8, MBASE(row) - 3 + 17, 226 + 19, MBASE(row) - 3 + 1); - dwinDrawLine(Check_Color, 227, MBASE(row) - 3 + 12, 226 + 8, MBASE(row) - 3 + 18); - dwinDrawLine(Check_Color, 227 + 8, MBASE(row) - 3 + 18, 226 + 19, MBASE(row) - 3 + 2); - dwinDrawLine(Check_Color, 227, MBASE(row) - 3 + 13, 226 + 8, MBASE(row) - 3 + 19); - dwinDrawLine(Check_Color, 227 + 8, MBASE(row) - 3 + 19, 226 + 19, MBASE(row) - 3 + 3); + dwinDrawLine(COLOR_CHECKBOX, 227, MBASE(row) - 3 + 11, 226 + 8, MBASE(row) - 3 + 17); + dwinDrawLine(COLOR_CHECKBOX, 227 + 8, MBASE(row) - 3 + 17, 226 + 19, MBASE(row) - 3 + 1); + dwinDrawLine(COLOR_CHECKBOX, 227, MBASE(row) - 3 + 12, 226 + 8, MBASE(row) - 3 + 18); + dwinDrawLine(COLOR_CHECKBOX, 227 + 8, MBASE(row) - 3 + 18, 226 + 19, MBASE(row) - 3 + 2); + dwinDrawLine(COLOR_CHECKBOX, 227, MBASE(row) - 3 + 13, 226 + 8, MBASE(row) - 3 + 19); + dwinDrawLine(COLOR_CHECKBOX, 227 + 8, MBASE(row) - 3 + 19, 226 + 19, MBASE(row) - 3 + 3); } #endif } @@ -548,27 +548,27 @@ void JyersDWIN::drawCheckbox(const uint8_t row, const bool value) { void JyersDWIN::drawMenu(const uint8_t menu, const uint8_t select/*=0*/, const uint8_t scroll/*=0*/) { if (active_menu != menu) { last_menu = active_menu; - if (process == Menu) last_selection = selection; + if (process == Proc_Menu) last_selection = selection; } selection = _MIN(select, getMenuSize(menu)); scrollpos = scroll; if (selection - scrollpos > MROWS) scrollpos = selection - MROWS; // i.e., NOLESS(scrollpos, selection - MROWS); - process = Menu; + process = Proc_Menu; active_menu = menu; clearScreen(); drawTitle(getMenuTitle(menu)); for (uint8_t i = 0; i < TROWS; ++i) menuItemHandler(menu, i + scrollpos); - dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, COLOR_RECTANGLE), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); } void JyersDWIN::redrawMenu(const bool lastproc/*=true*/, const bool lastsel/*=false*/, const bool lastmenu/*=false*/) { switch (lastproc ? last_process : process) { - case Menu: + case Proc_Menu: drawMenu(lastmenu ? last_menu : active_menu, lastsel ? last_selection : selection, lastmenu ? 0 : scrollpos); break; - case Main: drawMainMenu(lastsel ? last_selection : selection); break; - case Print: drawPrintScreen(); break; - case File: drawSDList(); break; + case Proc_Main: drawMainMenu(lastsel ? last_selection : selection); break; + case Proc_Print: drawPrintScreen(); break; + case Proc_File: drawSDList(); break; default: break; } } @@ -585,60 +585,60 @@ void JyersDWIN::redrawScreen() { void JyersDWIN::mainMenuIcons() { if (selection == 0) { dwinIconShow(ICON, ICON_Print_1, 17, 130); - dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 17, 130, 126, 229); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 52, 200, F("Print")); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, COLOR_WHITE), 17, 130, 126, 229); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 52, 200, F("Print")); } else { dwinIconShow(ICON, ICON_Print_0, 17, 130); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 52, 200, F("Print")); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 52, 200, F("Print")); } if (selection == 1) { dwinIconShow(ICON, ICON_Prepare_1, 145, 130); - dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 145, 130, 254, 229); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 170, 200, F("Prepare")); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, COLOR_WHITE), 145, 130, 254, 229); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 170, 200, F("Prepare")); } else { dwinIconShow(ICON, ICON_Prepare_0, 145, 130); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 170, 200, F("Prepare")); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 170, 200, F("Prepare")); } if (selection == 2) { dwinIconShow(ICON, ICON_Control_1, 17, 246); - dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 17, 246, 126, 345); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 43, 317, F("Control")); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, COLOR_WHITE), 17, 246, 126, 345); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 43, 317, F("Control")); } else { dwinIconShow(ICON, ICON_Control_0, 17, 246); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 43, 317, F("Control")); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 43, 317, F("Control")); } #if HAS_ABL_OR_UBL if (selection == 3) { dwinIconShow(ICON, ICON_Leveling_1, 145, 246); - dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 145, 246, 254, 345); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 179, 317, F("Level")); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, COLOR_WHITE), 145, 246, 254, 345); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 179, 317, F("Level")); } else { dwinIconShow(ICON, ICON_Leveling_0, 145, 246); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 179, 317, F("Level")); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 179, 317, F("Level")); } #else if (selection == 3) { dwinIconShow(ICON, ICON_Info_1, 145, 246); - dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 145, 246, 254, 345); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 181, 317, F("Info")); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, COLOR_WHITE), 145, 246, 254, 345); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 181, 317, F("Info")); } else { dwinIconShow(ICON, ICON_Info_0, 145, 246); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 181, 317, F("Info")); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 181, 317, F("Info")); } #endif } void JyersDWIN::drawMainMenu(const uint8_t select/*=0*/) { - process = Main; - active_menu = MainMenu; + process = Proc_Main; + active_menu = ID_MainMenu; selection = select; clearScreen(); - drawTitle(getMenuTitle(MainMenu)); + drawTitle(getMenuTitle(ID_MainMenu)); SERIAL_ECHOPGM("\nDWIN handshake "); dwinIconShow(ICON, ICON_LOGO, 71, 72); mainMenuIcons(); @@ -647,57 +647,57 @@ void JyersDWIN::drawMainMenu(const uint8_t select/*=0*/) { void JyersDWIN::printScreenIcons() { if (selection == 0) { dwinIconShow(ICON, ICON_Setup_1, 8, 252); - dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 8, 252, 87, 351); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 30, 322, F("Tune")); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, COLOR_WHITE), 8, 252, 87, 351); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 30, 322, F("Tune")); } else { dwinIconShow(ICON, ICON_Setup_0, 8, 252); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 30, 322, F("Tune")); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 30, 322, F("Tune")); } if (selection == 2) { dwinIconShow(ICON, ICON_Stop_1, 184, 252); - dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 184, 252, 263, 351); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 205, 322, F("Stop")); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, COLOR_WHITE), 184, 252, 263, 351); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 205, 322, F("Stop")); } else { dwinIconShow(ICON, ICON_Stop_0, 184, 252); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 205, 322, F("Stop")); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 205, 322, F("Stop")); } if (paused) { if (selection == 1) { dwinIconShow(ICON, ICON_Continue_1, 96, 252); - dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 96, 252, 175, 351); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Print")); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, COLOR_WHITE), 96, 252, 175, 351); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 114, 322, F("Print")); } else { dwinIconShow(ICON, ICON_Continue_0, 96, 252); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Print")); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 114, 322, F("Print")); } } else { if (selection == 1) { dwinIconShow(ICON, ICON_Pause_1, 96, 252); - dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 96, 252, 175, 351); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Pause")); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, COLOR_WHITE), 96, 252, 175, 351); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 114, 322, F("Pause")); } else { dwinIconShow(ICON, ICON_Pause_0, 96, 252); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Pause")); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLUE, 114, 322, F("Pause")); } } } void JyersDWIN::drawPrintScreen() { - process = Print; + process = Proc_Print; selection = 0; clearScreen(); - dwinDrawRectangle(1, Color_Bg_Black, 8, 352, DWIN_WIDTH - 8, 376); + dwinDrawRectangle(1, COLOR_BG_BLACK, 8, 352, DWIN_WIDTH - 8, 376); drawTitle("Printing..."); printScreenIcons(); dwinIconShow(ICON, ICON_PrintTime, 14, 171); dwinIconShow(ICON, ICON_RemainTime, 147, 169); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, 41, 163, F("Elapsed")); - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, 176, 163, F("Remaining")); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLACK, 41, 163, F("Elapsed")); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLACK, 176, 163, F("Remaining")); updateStatusBar(true); drawPrintProgressBar(); drawPrintProgressElapsed(); @@ -709,60 +709,60 @@ void JyersDWIN::drawPrintFilename(const bool reset/*=false*/) { typedef TextScroller<30> Scroller; static Scroller scroller; if (reset) scroller.reset(); - if (process == Print) { + if (process == Proc_Print) { Scroller::Buffer buf; size_t outlen = 0; const char* outstr = scroller.scroll(outlen, buf, filename); - dwinDrawRectangle(1, Color_Bg_Black, 8, 50, DWIN_WIDTH - 8, 80); + dwinDrawRectangle(1, COLOR_BG_BLACK, 8, 50, DWIN_WIDTH - 8, 80); const int8_t npos = (DWIN_WIDTH - outlen * MENU_CHR_W) / 2; - dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, npos, 60, outstr); + dwinDrawString(false, DWIN_FONT_MENU, COLOR_WHITE, COLOR_BG_BLACK, npos, 60, outstr); } } void JyersDWIN::drawPrintProgressBar() { uint8_t printpercent = sdprint ? card.percentDone() : (ui._get_progress() / 100); dwinIconShow(ICON, ICON_Bar, 15, 93); - dwinDrawRectangle(1, BarFill_Color, 16 + printpercent * 240 / 100, 93, 256, 113); - dwinDrawIntValue(true, true, 0, DWIN_FONT_MENU, getColor(eeprom_settings.progress_percent, Percent_Color), Color_Bg_Black, 3, 109, 133, printpercent); - dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_percent, Percent_Color), Color_Bg_Black, 133, 133, F("%")); + dwinDrawRectangle(1, COLOR_BARFILL, 16 + printpercent * 240 / 100, 93, 256, 113); + dwinDrawIntValue(true, true, 0, DWIN_FONT_MENU, getColor(eeprom_settings.progress_percent, COLOR_PERCENT), COLOR_BG_BLACK, 3, 109, 133, printpercent); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_percent, COLOR_PERCENT), COLOR_BG_BLACK, 133, 133, F("%")); } #if ENABLED(SET_REMAINING_TIME) void JyersDWIN::drawPrintProgressRemain() { uint16_t remainingtime = ui.get_remaining_time(); - dwinDrawIntValue(true, true, 1, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 176, 187, remainingtime / 3600); - dwinDrawIntValue(true, true, 1, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 200, 187, (remainingtime % 3600) / 60); + dwinDrawIntValue(true, true, 1, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, COLOR_WHITE), COLOR_BG_BLACK, 2, 176, 187, remainingtime / 3600); + dwinDrawIntValue(true, true, 1, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, COLOR_WHITE), COLOR_BG_BLACK, 2, 200, 187, (remainingtime % 3600) / 60); if (eeprom_settings.time_format_textual) { - dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 192, 187, F("h")); - dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 216, 187, F("m")); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, COLOR_WHITE), COLOR_BG_BLACK, 192, 187, F("h")); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, COLOR_WHITE), COLOR_BG_BLACK, 216, 187, F("m")); } else - dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 192, 187, F(":")); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, COLOR_WHITE), COLOR_BG_BLACK, 192, 187, F(":")); } #endif void JyersDWIN::drawPrintProgressElapsed() { duration_t elapsed = print_job_timer.duration(); - dwinDrawIntValue(true, true, 1, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 42, 187, elapsed.value / 3600); - dwinDrawIntValue(true, true, 1, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 66, 187, (elapsed.value % 3600) / 60); + dwinDrawIntValue(true, true, 1, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, COLOR_WHITE), COLOR_BG_BLACK, 2, 42, 187, elapsed.value / 3600); + dwinDrawIntValue(true, true, 1, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, COLOR_WHITE), COLOR_BG_BLACK, 2, 66, 187, (elapsed.value % 3600) / 60); if (eeprom_settings.time_format_textual) { - dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 58, 187, F("h")); - dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 82, 187, F("m")); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, COLOR_WHITE), COLOR_BG_BLACK, 58, 187, F("h")); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, COLOR_WHITE), COLOR_BG_BLACK, 82, 187, F("m")); } else - dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 58, 187, F(":")); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, COLOR_WHITE), COLOR_BG_BLACK, 58, 187, F(":")); } void JyersDWIN::drawPrintConfirm() { drawPrintScreen(); - process = Confirm; - popup = Complete; - dwinDrawRectangle(1, Color_Bg_Black, 8, 252, 263, 351); + process = Proc_Confirm; + popup = Popup_Complete; + dwinDrawRectangle(1, COLOR_BG_BLACK, 8, 252, 263, 351); dwinIconShow(ICON, ICON_Confirm_E, 87, 283); - dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 86, 282, 187, 321); - dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 85, 281, 188, 322); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, COLOR_WHITE), 86, 282, 187, 321); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, COLOR_WHITE), 85, 281, 188, 322); } void JyersDWIN::drawSDItem(const uint8_t item, const uint8_t row) { @@ -791,22 +791,22 @@ void JyersDWIN::drawSDList(const bool removed/*=false*/) { drawTitle("Select File"); selection = 0; scrollpos = 0; - process = File; + process = Proc_File; if (card.isMounted() && !removed) { for (uint8_t i = 0; i < _MIN(card.get_num_items() + 1, TROWS); ++i) drawSDItem(i, i); } else { drawMenuItem(0, ICON_Back, F("Back")); - dwinDrawRectangle(1, Color_Bg_Red, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); - dwinDrawString(false, font16x32, Color_Yellow, Color_Bg_Red, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), F("No Media")); + dwinDrawRectangle(1, COLOR_BG_RED, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); + dwinDrawString(false, font16x32, COLOR_YELLOW, COLOR_BG_RED, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), F("No Media")); } - dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(0) - 18, 14, MBASE(0) + 33); + dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, COLOR_RECTANGLE), 0, MBASE(0) - 18, 14, MBASE(0) + 33); } void JyersDWIN::drawStatusArea(const bool icons/*=false*/) { - if (icons) dwinDrawRectangle(1, Color_Bg_Black, 0, STATUS_Y, DWIN_WIDTH, DWIN_HEIGHT - 1); + if (icons) dwinDrawRectangle(1, COLOR_BG_BLACK, 0, STATUS_Y, DWIN_WIDTH, DWIN_HEIGHT - 1); #if HAS_HOTEND static float hotend = -1; @@ -815,26 +815,26 @@ void JyersDWIN::drawStatusArea(const bool icons/*=false*/) { hotend = -1; hotendtarget = -1; dwinIconShow(ICON, ICON_HotendTemp, 10, 383); - dwinDrawString(false, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); + dwinDrawString(false, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); } if (thermalManager.temp_hotend[0].celsius != hotend) { hotend = thermalManager.temp_hotend[0].celsius; - dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 28, 384, thermalManager.temp_hotend[0].celsius); - dwinDrawDegreeSymbol(getColor(eeprom_settings.status_area_text, Color_White), 25 + 3 * STAT_CHR_W + 5, 386); + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 28, 384, thermalManager.temp_hotend[0].celsius); + dwinDrawDegreeSymbol(getColor(eeprom_settings.status_area_text, COLOR_WHITE), 25 + 3 * STAT_CHR_W + 5, 386); } if (thermalManager.temp_hotend[0].target != hotendtarget) { hotendtarget = thermalManager.temp_hotend[0].target; - dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.temp_hotend[0].target); - dwinDrawDegreeSymbol(getColor(eeprom_settings.status_area_text, Color_White), 25 + 4 * STAT_CHR_W + 39, 386); + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.temp_hotend[0].target); + dwinDrawDegreeSymbol(getColor(eeprom_settings.status_area_text, COLOR_WHITE), 25 + 4 * STAT_CHR_W + 39, 386); } if (icons) { flow = -1; dwinIconShow(ICON, ICON_StepE, 112, 417); - dwinDrawString(false, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); + dwinDrawString(false, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); } if (planner.flow_percentage[0] != flow) { flow = planner.flow_percentage[0]; - dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); } #endif @@ -845,17 +845,17 @@ void JyersDWIN::drawStatusArea(const bool icons/*=false*/) { bed = -1; bedtarget = -1; dwinIconShow(ICON, ICON_BedTemp, 10, 416); - dwinDrawString(false, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); + dwinDrawString(false, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); } if (thermalManager.temp_bed.celsius != bed) { bed = thermalManager.temp_bed.celsius; - dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 28, 417, thermalManager.temp_bed.celsius); - dwinDrawDegreeSymbol(getColor(eeprom_settings.status_area_text, Color_White), 25 + 3 * STAT_CHR_W + 5, 419); + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 28, 417, thermalManager.temp_bed.celsius); + dwinDrawDegreeSymbol(getColor(eeprom_settings.status_area_text, COLOR_WHITE), 25 + 3 * STAT_CHR_W + 5, 419); } if (thermalManager.temp_bed.target != bedtarget) { bedtarget = thermalManager.temp_bed.target; - dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.temp_bed.target); - dwinDrawDegreeSymbol(getColor(eeprom_settings.status_area_text, Color_White), 25 + 4 * STAT_CHR_W + 39, 419); + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.temp_bed.target); + dwinDrawDegreeSymbol(getColor(eeprom_settings.status_area_text, COLOR_WHITE), 25 + 4 * STAT_CHR_W + 39, 419); } #endif @@ -867,7 +867,7 @@ void JyersDWIN::drawStatusArea(const bool icons/*=false*/) { } if (thermalManager.fan_speed[0] != fan) { fan = thermalManager.fan_speed[0]; - dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]); + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]); } #endif @@ -880,8 +880,8 @@ void JyersDWIN::drawStatusArea(const bool icons/*=false*/) { } if (zoffsetvalue != offset) { offset = zoffsetvalue; - dwinDrawFloatValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 2, 2, 207, 417, (zoffsetvalue < 0 ? -zoffsetvalue : zoffsetvalue)); - dwinDrawString(true, DWIN_FONT_MENU, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 205, 419, zoffsetvalue < 0 ? F("-") : F(" ")); + dwinDrawFloatValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 2, 2, 207, 417, (zoffsetvalue < 0 ? -zoffsetvalue : zoffsetvalue)); + dwinDrawString(true, DWIN_FONT_MENU, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 205, 419, zoffsetvalue < 0 ? F("-") : F(" ")); } #endif @@ -889,11 +889,11 @@ void JyersDWIN::drawStatusArea(const bool icons/*=false*/) { if (icons) { feedrate = -1; dwinIconShow(ICON, ICON_Speed, 113, 383); - dwinDrawString(false, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 384, F("%")); + dwinDrawString(false, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 116 + 5 * STAT_CHR_W + 2, 384, F("%")); } if (feedrate_percentage != feedrate) { feedrate = feedrate_percentage; - dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 116 + 2 * STAT_CHR_W, 384, feedrate_percentage); + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 116 + 2 * STAT_CHR_W, 384, feedrate_percentage); } static float x = -1, y = -1, z = -1; @@ -903,7 +903,7 @@ void JyersDWIN::drawStatusArea(const bool icons/*=false*/) { update_z = (current_position.z != z || axis_should_home(Z_AXIS) || update_z); if (icons) { x = y = z = -1; - dwinDrawLine(getColor(eeprom_settings.coordinates_split_line, Line_Color, true), 16, 450, 256, 450); + dwinDrawLine(getColor(eeprom_settings.coordinates_split_line, COLOR_LINE, true), 16, 450, 256, 450); dwinIconShow(ICON, ICON_MaxSpeedX, 10, 456); dwinIconShow(ICON, ICON_MaxSpeedY, 95, 456); dwinIconShow(ICON, ICON_MaxSpeedZ, 180, 456); @@ -911,60 +911,60 @@ void JyersDWIN::drawStatusArea(const bool icons/*=false*/) { if (update_x) { x = current_position.x; if ((update_x = axis_should_home(X_AXIS) && ui.get_blink())) - dwinDrawString(true, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 35, 459, F(" -?- ")); + dwinDrawString(true, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, COLOR_WHITE), COLOR_BG_BLACK, 35, 459, F(" -?- ")); else - dwinDrawFloatValue(true, true, 0, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 3, 1, 35, 459, current_position.x); + dwinDrawFloatValue(true, true, 0, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 1, 35, 459, current_position.x); } if (update_y) { y = current_position.y; if ((update_y = axis_should_home(Y_AXIS) && ui.get_blink())) - dwinDrawString(true, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 120, 459, F(" -?- ")); + dwinDrawString(true, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, COLOR_WHITE), COLOR_BG_BLACK, 120, 459, F(" -?- ")); else - dwinDrawFloatValue(true, true, 0, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 3, 1, 120, 459, current_position.y); + dwinDrawFloatValue(true, true, 0, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 1, 120, 459, current_position.y); } if (update_z) { z = current_position.z; if ((update_z = axis_should_home(Z_AXIS) && ui.get_blink())) - dwinDrawString(true, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 205, 459, F(" -?- ")); + dwinDrawString(true, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, COLOR_WHITE), COLOR_BG_BLACK, 205, 459, F(" -?- ")); else - dwinDrawFloatValue(true, true, 0, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 3, 2, 205, 459, current_position.z >= 0 ? current_position.z : 0); + dwinDrawFloatValue(true, true, 0, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 2, 205, 459, current_position.z >= 0 ? current_position.z : 0); } dwinUpdateLCD(); } void JyersDWIN::drawPopup(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, uint8_t mode, uint8_t icon/*=0*/) { - if (process != Confirm && process != Popup && process != Wait) last_process = process; - if ((process == Menu || process == Wait) && mode == Popup) last_selection = selection; + if (process != Proc_Confirm && process != Proc_Popup && process != Proc_Wait) last_process = process; + if ((process == Proc_Menu || process == Proc_Wait) && mode == Proc_Popup) last_selection = selection; process = mode; clearScreen(); - dwinDrawRectangle(0, Color_White, 13, 59, 259, 351); - dwinDrawRectangle(1, Color_Bg_Window, 14, 60, 258, 350); - const uint8_t ypos = (mode == Popup || mode == Confirm) ? 150 : 230; + dwinDrawRectangle(0, COLOR_WHITE, 13, 59, 259, 351); + dwinDrawRectangle(1, COLOR_BG_WINDOW, 14, 60, 258, 350); + const uint8_t ypos = (mode == Proc_Popup || mode == Proc_Confirm) ? 150 : 230; if (icon > 0) dwinIconShow(ICON, icon, 101, 105); - dwinDrawString(true, DWIN_FONT_MENU, Popup_Text_Color, Color_Bg_Window, (272 - 8 * strlen_P(FTOP(line1))) / 2, ypos, line1); - dwinDrawString(true, DWIN_FONT_MENU, Popup_Text_Color, Color_Bg_Window, (272 - 8 * strlen_P(FTOP(line2))) / 2, ypos + 30, line2); - dwinDrawString(true, DWIN_FONT_MENU, Popup_Text_Color, Color_Bg_Window, (272 - 8 * strlen_P(FTOP(line3))) / 2, ypos + 60, line3); - if (mode == Popup) { + dwinDrawString(true, DWIN_FONT_MENU, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, (272 - 8 * strlen_P(FTOP(line1))) / 2, ypos, line1); + dwinDrawString(true, DWIN_FONT_MENU, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, (272 - 8 * strlen_P(FTOP(line2))) / 2, ypos + 30, line2); + dwinDrawString(true, DWIN_FONT_MENU, COLOR_POPUP_TEXT, COLOR_BG_WINDOW, (272 - 8 * strlen_P(FTOP(line3))) / 2, ypos + 60, line3); + if (mode == Proc_Popup) { selection = 0; - dwinDrawRectangle(1, Confirm_Color, 26, 280, 125, 317); - dwinDrawRectangle(1, Cancel_Color, 146, 280, 245, 317); - dwinDrawString(false, DWIN_FONT_STAT, Color_White, Color_Bg_Window, 39, 290, F("Confirm")); - dwinDrawString(false, DWIN_FONT_STAT, Color_White, Color_Bg_Window, 165, 290, F("Cancel")); + dwinDrawRectangle(1, COLOR_CONFIRM, 26, 280, 125, 317); + dwinDrawRectangle(1, COLOR_CANCEL, 146, 280, 245, 317); + dwinDrawString(false, DWIN_FONT_STAT, COLOR_WHITE, COLOR_BG_WINDOW, 39, 290, F("Confirm")); + dwinDrawString(false, DWIN_FONT_STAT, COLOR_WHITE, COLOR_BG_WINDOW, 165, 290, F("Cancel")); popupSelect(); } - else if (mode == Confirm) { - dwinDrawRectangle(1, Confirm_Color, 87, 280, 186, 317); - dwinDrawString(false, DWIN_FONT_STAT, Color_White, Color_Bg_Window, 96, 290, F("Continue")); + else if (mode == Proc_Confirm) { + dwinDrawRectangle(1, COLOR_CONFIRM, 87, 280, 186, 317); + dwinDrawString(false, DWIN_FONT_STAT, COLOR_WHITE, COLOR_BG_WINDOW, 96, 290, F("Continue")); } } void MarlinUI::kill_screen(FSTR_P const error, FSTR_P const) { - jyersDWIN.drawPopup(F("Printer Kill Reason:"), error, F("Restart Required"), Wait, ICON_BLTouch); + jyersDWIN.drawPopup(F("Printer Kill Reason:"), error, F("Restart Required"), Proc_Wait, ICON_BLTouch); } void JyersDWIN::popupSelect() { - const uint16_t c1 = selection ? Color_Bg_Window : getColor(eeprom_settings.highlight_box, Color_White), - c2 = selection ? getColor(eeprom_settings.highlight_box, Color_White) : Color_Bg_Window; + const uint16_t c1 = selection ? COLOR_BG_WINDOW : getColor(eeprom_settings.highlight_box, COLOR_WHITE), + c2 = selection ? getColor(eeprom_settings.highlight_box, COLOR_WHITE) : COLOR_BG_WINDOW; dwinDrawRectangle(0, c1, 25, 279, 126, 318); dwinDrawRectangle(0, c1, 24, 278, 127, 319); dwinDrawRectangle(0, c2, 145, 279, 246, 318); @@ -986,15 +986,15 @@ void JyersDWIN::updateStatusBar(const bool refresh/*=false*/) { const char* dispmsg = scroller.scroll(len, buf, statusmsg, &new_msg); if (new_msg) { new_msg = false; - if (process == Print) { - dwinDrawRectangle(1, Color_Grey, 8, 214, DWIN_WIDTH - 8, 238); + if (process == Proc_Print) { + dwinDrawRectangle(1, COLOR_GREY, 8, 214, DWIN_WIDTH - 8, 238); const int8_t npos = (DWIN_WIDTH - len * MENU_CHR_W) / 2; - dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.status_bar_text, Color_White), Color_Bg_Black, npos, 219, dispmsg); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.status_bar_text, COLOR_WHITE), COLOR_BG_BLACK, npos, 219, dispmsg); } else { - dwinDrawRectangle(1, Color_Bg_Black, 8, 352, DWIN_WIDTH - 8, 376); + dwinDrawRectangle(1, COLOR_BG_BLACK, 8, 352, DWIN_WIDTH - 8, 376); const int8_t npos = (DWIN_WIDTH - len * MENU_CHR_W) / 2; - dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.status_bar_text, Color_White), Color_Bg_Black, npos, 357, dispmsg); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.status_bar_text, COLOR_WHITE), COLOR_BG_BLACK, npos, 357, dispmsg); } } } @@ -1023,7 +1023,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(TempMenu, sel); + drawMenu(ID_TempMenu, sel); break; #if HAS_HOTEND case PREHEAT_SUBMENU_HOTEND: @@ -1061,7 +1061,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #endif switch (menu) { - case Prepare: + case ID_Prepare: #define PREPARE_BACK 0 #define PREPARE_MOVE (PREPARE_BACK + 1) @@ -1086,7 +1086,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Axis, F("Move"), nullptr, true); else - drawMenu(Move); + drawMenu(ID_Move); break; case PREPARE_DISABLE: if (draw) @@ -1098,21 +1098,21 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_SetHome, F("Homing"), nullptr, true); else - drawMenu(HomeMenu); + drawMenu(ID_HomeMenu); break; case PREPARE_MANUALLEVEL: if (draw) drawMenuItem(row, ICON_PrintSize, F("Manual Leveling"), nullptr, true); else { if (axes_should_home()) { - popupHandler(Home); + popupHandler(Popup_Home); gcode.home_all_axes(true); } #if HAS_LEVELING level_state = planner.leveling_active; set_bed_leveling_enabled(false); #endif - drawMenu(ManualLevel); + drawMenu(ID_ManualLevel); } break; @@ -1125,7 +1125,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra level_state = planner.leveling_active; set_bed_leveling_enabled(false); #endif - drawMenu(ZOffset); + drawMenu(ID_ZOffset); } break; #endif @@ -1135,7 +1135,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Temperature, F("Preheat"), nullptr, true); else - drawMenu(Preheat); + drawMenu(ID_Preheat); break; #endif @@ -1156,7 +1156,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Version, F(CUSTOM_MENU_CONFIG_TITLE)); else - drawMenu(MenuCustom); + drawMenu(ID_MenuCustom); break; #endif @@ -1171,16 +1171,16 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra } else { #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - drawMenu(ChangeFilament); + drawMenu(ID_ChangeFilament); #else if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) - popupHandler(ETemp); + popupHandler(Popup_ETemp); else { if (thermalManager.temp_hotend[0].is_below_target(2)) { - popupHandler(Heating); + popupHandler(Popup_Heating); thermalManager.wait_for_hotend(0); } - popupHandler(FilChange); + popupHandler(Popup_FilChange); gcode.process_subcommands_now(TS(F("M600 B1 R"), thermalManager.temp_hotend[0].target)); } #endif @@ -1190,7 +1190,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra } break; - case HomeMenu: + case ID_HomeMenu: #define HOME_BACK 0 #define HOME_ALL (HOME_BACK + 1) @@ -1205,13 +1205,13 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Prepare, PREPARE_HOME); + drawMenu(ID_Prepare, PREPARE_HOME); break; case HOME_ALL: if (draw) drawMenuItem(row, ICON_Homing, F("Home All")); else { - popupHandler(Home); + popupHandler(Popup_Home); gcode.home_all_axes(true); redrawMenu(); } @@ -1220,7 +1220,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_MoveX, F("Home X")); else { - popupHandler(Home); + popupHandler(Popup_Home); gcode.process_subcommands_now(F("G28 X")); planner.synchronize(); redrawMenu(); @@ -1230,7 +1230,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_MoveY, F("Home Y")); else { - popupHandler(Home); + popupHandler(Popup_Home); gcode.process_subcommands_now(F("G28 Y")); planner.synchronize(); redrawMenu(); @@ -1240,7 +1240,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_MoveZ, F("Home Z")); else { - popupHandler(Home); + popupHandler(Popup_Home); gcode.process_subcommands_now(F("G28 Z")); planner.synchronize(); redrawMenu(); @@ -1257,7 +1257,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra } break; - case Move: + case ID_Move: #define MOVE_BACK 0 #define MOVE_X (MOVE_BACK + 1) @@ -1277,7 +1277,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra probe_deployed = false; probe.set_deployed(probe_deployed); #endif - drawMenu(Prepare, PREPARE_MOVE); + drawMenu(ID_Prepare, PREPARE_MOVE); } break; case MOVE_X: @@ -1315,11 +1315,11 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra } else { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) { - popupHandler(ETemp); + popupHandler(Popup_ETemp); } else { if (thermalManager.temp_hotend[0].is_below_target(2)) { - popupHandler(Heating); + popupHandler(Popup_Heating); thermalManager.wait_for_hotend(0); redrawMenu(); } @@ -1357,7 +1357,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra break; } break; - case ManualLevel: { + case ID_ManualLevel: { #define MLEVEL_BACK 0 #define MLEVEL_PROBE (MLEVEL_BACK + ENABLED(HAS_BED_PROBE)) @@ -1385,7 +1385,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra drawMenuItem(row, ICON_Back, F("Back")); else { TERN_(HAS_LEVELING, set_bed_leveling_enabled(level_state)); - drawMenu(Prepare, PREPARE_MANUALLEVEL); + drawMenu(ID_Prepare, PREPARE_MANUALLEVEL); } break; @@ -1399,7 +1399,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra use_probe ^= true; drawCheckbox(row, use_probe); if (use_probe) { - popupHandler(Level); + popupHandler(Popup_Level); const struct { xy_pos_t p; ProbePtRaise r; } points[] = { { { probe_x_min, probe_y_min }, PROBE_PT_RAISE }, { { probe_x_min, probe_y_max }, PROBE_PT_RAISE }, @@ -1423,14 +1423,14 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_AxisBL, F("Bottom Left")); else { - popupHandler(MoveWait); + popupHandler(Popup_MoveWait); if (use_probe) { #if HAS_BED_PROBE gcode.process_subcommands_now( TS(F("G0F4000\nG0Z10\nG0X"), p_float_t(probe_x_min, 3), 'Y', p_float_t(probe_y_min, 3)) ); planner.synchronize(); - popupHandler(ManualProbing); + popupHandler(Popup_ManualProbing); #endif } else { @@ -1446,14 +1446,14 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_AxisTL, F("Top Left")); else { - popupHandler(MoveWait); + popupHandler(Popup_MoveWait); if (use_probe) { #if HAS_BED_PROBE gcode.process_subcommands_now( TS(F("G0F4000\nG0Z10\nG0X"), p_float_t(probe_x_min, 3), 'Y', p_float_t(probe_y_max, 3)) ); planner.synchronize(); - popupHandler(ManualProbing); + popupHandler(Popup_ManualProbing); #endif } else { @@ -1469,14 +1469,14 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_AxisTR, F("Top Right")); else { - popupHandler(MoveWait); + popupHandler(Popup_MoveWait); if (use_probe) { #if HAS_BED_PROBE gcode.process_subcommands_now( TS(F("G0F4000\nG0Z10\nG0X"), p_float_t(probe_x_max, 3), 'Y', p_float_t(probe_y_max, 3), F("\nG0F300Z"), p_float_t(mlev_z_pos, 3)) ); planner.synchronize(); - popupHandler(ManualProbing); + popupHandler(Popup_ManualProbing); #endif } else { @@ -1492,14 +1492,14 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_AxisBR, F("Bottom Right")); else { - popupHandler(MoveWait); + popupHandler(Popup_MoveWait); if (use_probe) { #if HAS_BED_PROBE gcode.process_subcommands_now( TS(F("G0F4000\nG0Z10\nG0X"), p_float_t(probe_x_max, 3), 'Y', p_float_t(probe_y_min, 3)) ); planner.synchronize(); - popupHandler(ManualProbing); + popupHandler(Popup_ManualProbing); #endif } else { @@ -1515,14 +1515,14 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_AxisC, F("Center")); else { - popupHandler(MoveWait); + popupHandler(Popup_MoveWait); if (use_probe) { #if HAS_BED_PROBE gcode.process_subcommands_now( TS(F("G0F4000\nG0Z10\nG0X"), p_float_t((X_MAX_POS) / 2.0f - probe.offset.x, 3), 'Y', p_float_t((Y_MAX_POS) / 2.0f - probe.offset.y, 3)) ); planner.synchronize(); - popupHandler(ManualProbing); + popupHandler(Popup_ManualProbing); #endif } else { @@ -1547,7 +1547,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra } break; #if HAS_ZOFFSET_ITEM - case ZOffset: + case ID_ZOffset: #define ZOFFSET_BACK 0 #define ZOFFSET_HOME (ZOFFSET_BACK + 1) @@ -1565,16 +1565,16 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra else { liveadjust = false; TERN_(HAS_LEVELING, set_bed_leveling_enabled(level_state)); - drawMenu(Prepare, PREPARE_ZOFFSET); + drawMenu(ID_Prepare, PREPARE_ZOFFSET); } break; case ZOFFSET_HOME: if (draw) drawMenuItem(row, ICON_Homing, F("Home Z Axis")); else { - popupHandler(Home); + popupHandler(Popup_Home); gcode.process_subcommands_now(F("G28Z")); - popupHandler(MoveWait); + popupHandler(Popup_MoveWait); #if ENABLED(Z_SAFE_HOMING) planner.synchronize(); gcode.process_subcommands_now( @@ -1596,10 +1596,10 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra else { if (!liveadjust) { if (axes_should_home()) { - popupHandler(Home); + popupHandler(Popup_Home); gcode.home_all_axes(true); } - popupHandler(MoveWait); + popupHandler(Popup_MoveWait); #if ENABLED(Z_SAFE_HOMING) planner.synchronize(); gcode.process_subcommands_now( @@ -1665,7 +1665,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #endif #if HAS_PREHEAT - case Preheat: { + case ID_Preheat: { #define PREHEAT_MODE (PREHEAT_BACK + 1) #define PREHEAT_1 (PREHEAT_MODE + 1) #define PREHEAT_2 (PREHEAT_1 + (PREHEAT_COUNT >= 2)) @@ -1685,7 +1685,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Prepare, PREPARE_PREHEAT); + drawMenu(ID_Prepare, PREPARE_PREHEAT); break; case PREHEAT_MODE: @@ -1709,7 +1709,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #endif // HAS_PREHEAT #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - case ChangeFilament: + case ID_ChangeFilament: #define CHANGEFIL_BACK 0 #define CHANGEFIL_LOAD (CHANGEFIL_BACK + 1) @@ -1722,20 +1722,20 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Prepare, PREPARE_CHANGEFIL); + drawMenu(ID_Prepare, PREPARE_CHANGEFIL); break; case CHANGEFIL_LOAD: if (draw) drawMenuItem(row, ICON_WriteEEPROM, GET_TEXT_F(MSG_FILAMENTLOAD)); else { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) - popupHandler(ETemp); + popupHandler(Popup_ETemp); else { if (thermalManager.temp_hotend[0].is_below_target(2)) { - popupHandler(Heating); + popupHandler(Popup_Heating); thermalManager.wait_for_hotend(0); } - popupHandler(FilLoad); + popupHandler(Popup_FilLoad); gcode.process_subcommands_now(F("M701")); planner.synchronize(); redrawMenu(); @@ -1747,14 +1747,14 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra drawMenuItem(row, ICON_ReadEEPROM, GET_TEXT_F(MSG_FILAMENTUNLOAD)); else { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) { - popupHandler(ETemp); + popupHandler(Popup_ETemp); } else { if (thermalManager.temp_hotend[0].is_below_target(2)) { - popupHandler(Heating); + popupHandler(Popup_Heating); thermalManager.wait_for_hotend(0); } - popupHandler(FilLoad, true); + popupHandler(Popup_FilLoad, true); gcode.process_subcommands_now(F("M702")); planner.synchronize(); redrawMenu(); @@ -1766,13 +1766,13 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra drawMenuItem(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE)); else { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) - popupHandler(ETemp); + popupHandler(Popup_ETemp); else { if (thermalManager.temp_hotend[0].is_below_target(2)) { - popupHandler(Heating); + popupHandler(Popup_Heating); thermalManager.wait_for_hotend(0); } - popupHandler(FilChange); + popupHandler(Popup_FilChange); gcode.process_subcommands_now(TS(F("M600B1R"), thermalManager.temp_hotend[0].target)); } } @@ -1783,7 +1783,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #if HAS_CUSTOM_MENU - case MenuCustom: + case ID_MenuCustom: #define CUSTOM_MENU_BACK 0 #define CUSTOM_MENU_1 1 @@ -1798,7 +1798,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Prepare, PREPARE_CUSTOM_MENU); + drawMenu(ID_Prepare, PREPARE_CUSTOM_MENU); break; #if CUSTOM_MENU_COUNT >= 1 @@ -1806,7 +1806,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Info, F(CONFIG_MENU_ITEM_1_DESC)); else { - popupHandler(Custom); + popupHandler(Popup_Custom); //queue.inject(F(CONFIG_MENU_ITEM_1_GCODE)); // Old code gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_1_GCODE)); planner.synchronize(); @@ -1826,7 +1826,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Info, F(CONFIG_MENU_ITEM_2_DESC)); else { - popupHandler(Custom); + popupHandler(Popup_Custom); gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_2_GCODE)); planner.synchronize(); redrawMenu(); @@ -1845,7 +1845,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Info, F(CONFIG_MENU_ITEM_3_DESC)); else { - popupHandler(Custom); + popupHandler(Popup_Custom); gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_3_GCODE)); planner.synchronize(); redrawMenu(); @@ -1864,7 +1864,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Info, F(CONFIG_MENU_ITEM_4_DESC)); else { - popupHandler(Custom); + popupHandler(Popup_Custom); gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_4_GCODE)); planner.synchronize(); redrawMenu(); @@ -1883,7 +1883,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Info, F(CONFIG_MENU_ITEM_5_DESC)); else { - popupHandler(Custom); + popupHandler(Popup_Custom); gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_5_GCODE)); planner.synchronize(); redrawMenu(); @@ -1901,7 +1901,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #endif // HAS_CUSTOM_MENU - case Control: + case ID_Control: #define CONTROL_BACK 0 #define CONTROL_TEMP (CONTROL_BACK + 1) @@ -1925,25 +1925,25 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Temperature, F("Temperature"), nullptr, true); else - drawMenu(TempMenu); + drawMenu(ID_TempMenu); break; case CONTROL_MOTION: if (draw) drawMenuItem(row, ICON_Motion, F("Motion"), nullptr, true); else - drawMenu(Motion); + drawMenu(ID_Motion); break; case CONTROL_VISUAL: if (draw) drawMenuItem(row, ICON_PrintSize, F("Visual"), nullptr, true); else - drawMenu(Visual); + drawMenu(ID_Visual); break; case CONTROL_ADVANCED: if (draw) drawMenuItem(row, ICON_Version, F("Advanced"), nullptr, true); else - drawMenu(Advanced); + drawMenu(ID_Advanced); break; #if ENABLED(EEPROM_SETTINGS) case CONTROL_SAVE: @@ -1971,12 +1971,12 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Info, F("Info")); else - drawMenu(Info); + drawMenu(ID_Info); break; } break; - case TempMenu: + case ID_TempMenu: #define TEMP_BACK 0 #define TEMP_HOTEND (TEMP_BACK + ENABLED(HAS_HOTEND)) @@ -1996,7 +1996,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Control, CONTROL_TEMP); + drawMenu(ID_Control, CONTROL_TEMP); break; #if HAS_HOTEND case TEMP_HOTEND: @@ -2033,7 +2033,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Step, F("PID"), nullptr, true); else - drawMenu(PID); + drawMenu(ID_PID); break; #endif #if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) @@ -2041,14 +2041,14 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Step, F("MPC"), nullptr, true); else - drawMenu(MPC); + drawMenu(ID_MPC); break; #endif #define _TEMP_PREHEAT_CASE(N) \ case TEMP_PREHEAT##N: { \ if (draw) drawMenuItem(row, ICON_Step, F(PREHEAT_## N ##_LABEL), nullptr, true); \ - else drawMenu(Preheat##N); \ + else drawMenu(ID_Preheat##N); \ } break; REPEAT_1(PREHEAT_COUNT, _TEMP_PREHEAT_CASE) @@ -2056,7 +2056,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra break; #if ANY(PIDTEMP, PIDTEMPBED) - case PID: + case ID_PID: #define PID_BACK 0 #define PID_HOTEND (PID_BACK + ENABLED(PIDTEMP)) @@ -2071,14 +2071,14 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(TempMenu, TEMP_PID); + drawMenu(ID_TempMenu, TEMP_PID); break; #if ENABLED(PIDTEMP) case PID_HOTEND: if (draw) drawMenuItem(row, ICON_HotendTemp, F("Hotend"), nullptr, true); else - drawMenu(HotendPID); + drawMenu(ID_HotendPID); break; #endif #if ENABLED(PIDTEMPBED) @@ -2086,7 +2086,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_BedTemp, F("Bed"), nullptr, true); else - drawMenu(BedPID); + drawMenu(ID_BedPID); break; #endif case PID_CYCLES: @@ -2102,7 +2102,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #endif // PIDTEMP || PIDTEMPBED #if ENABLED(PIDTEMP) - case HotendPID: + case ID_HotendPID: #define HOTENDPID_BACK 0 #define HOTENDPID_TUNE (HOTENDPID_BACK + 1) @@ -2119,13 +2119,13 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(PID, PID_HOTEND); + drawMenu(ID_PID, PID_HOTEND); break; case HOTENDPID_TUNE: if (draw) drawMenuItem(row, ICON_HotendTemp, F("Autotune")); else { - popupHandler(PIDWait); + popupHandler(Popup_PIDWait); gcode.process_subcommands_now(TS(F("M303E0C"), PID_cycles, 'S', PID_e_temp, 'U')); planner.synchronize(); redrawMenu(); @@ -2168,7 +2168,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #endif // PIDTEMP #if ENABLED(PIDTEMPBED) - case BedPID: + case ID_BedPID: #define BEDPID_BACK 0 #define BEDPID_TUNE (BEDPID_BACK + 1) @@ -2185,13 +2185,13 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(PID, PID_BED); + drawMenu(ID_PID, PID_BED); break; case BEDPID_TUNE: if (draw) drawMenuItem(row, ICON_HotendTemp, F("Autotune")); else { - popupHandler(PIDWait); + popupHandler(Popup_PIDWait); gcode.process_subcommands_now(TS(F("M303E-1C"), PID_cycles, 'S', PID_bed_temp, 'U')); planner.synchronize(); redrawMenu(); @@ -2234,7 +2234,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #endif // PIDTEMPBED #if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) - case MPC: + case ID_MPC: #define MPCMENU_BACK 0 #define MPCMENU_AUTOTUNE (MPCMENU_BACK + ENABLED(MPC_AUTOTUNE_MENU)) @@ -2250,7 +2250,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(TempMenu, TEMP_MPC); + drawMenu(ID_TempMenu, TEMP_MPC); break; #if ENABLED(MPC_AUTOTUNE_MENU) @@ -2258,7 +2258,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_HotendTemp, F("Autotune")); else { - popupHandler(MPCWait); + popupHandler(Popup_MPCWait); thermalManager.MPC_autotune(active_extruder, Temperature::MPCTuningType::AUTO); redrawMenu(); } @@ -2322,11 +2322,11 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #endif // MPC_EDIT_MENU || MPC_AUTOTUNE_MENU #if HAS_PREHEAT - #define _PREHEAT_SUBMENU_CASE(N) case Preheat##N: preheat_submenu((N) - 1, item, TEMP_PREHEAT##N); break; + #define _PREHEAT_SUBMENU_CASE(N) case ID_Preheat##N: preheat_submenu((N) - 1, item, TEMP_PREHEAT##N); break; REPEAT_1(PREHEAT_COUNT, _PREHEAT_SUBMENU_CASE) #endif - case Motion: + case ID_Motion: #define MOTION_BACK 0 #define MOTION_HOMEOFFSETS (MOTION_BACK + 1) @@ -2342,39 +2342,39 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Control, CONTROL_MOTION); + drawMenu(ID_Control, CONTROL_MOTION); break; case MOTION_HOMEOFFSETS: if (draw) drawMenuItem(row, ICON_SetHome, F("Home Offsets"), nullptr, true); else - drawMenu(HomeOffsets); + drawMenu(ID_HomeOffsets); break; case MOTION_SPEED: if (draw) drawMenuItem(row, ICON_MaxSpeed, F("Max Speed"), nullptr, true); else - drawMenu(MaxSpeed); + drawMenu(ID_MaxSpeed); break; case MOTION_ACCEL: if (draw) drawMenuItem(row, ICON_MaxAccelerated, F("Max Acceleration"), nullptr, true); else - drawMenu(MaxAcceleration); + drawMenu(ID_MaxAcceleration); break; #if HAS_CLASSIC_JERK case MOTION_JERK: if (draw) drawMenuItem(row, ICON_MaxJerk, F("Max Jerk"), nullptr, true); else - drawMenu(MaxJerk); + drawMenu(ID_MaxJerk); break; #endif case MOTION_STEPS: if (draw) drawMenuItem(row, ICON_Step, F("Steps/mm"), nullptr, true); else - drawMenu(Steps); + drawMenu(ID_Steps); break; #if HAS_HOTEND case MOTION_FLOW: @@ -2389,7 +2389,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra } break; - case HomeOffsets: + case ID_HomeOffsets: #define HOMEOFFSETS_BACK 0 #define HOMEOFFSETS_XOFFSET (HOMEOFFSETS_BACK + 1) @@ -2401,7 +2401,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Motion, MOTION_HOMEOFFSETS); + drawMenu(ID_Motion, MOTION_HOMEOFFSETS); break; case HOMEOFFSETS_XOFFSET: if (draw) { @@ -2421,7 +2421,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra break; } break; - case MaxSpeed: + case ID_MaxSpeed: #define SPEED_BACK 0 #define SPEED_X (SPEED_BACK + 1) @@ -2435,7 +2435,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Motion, MOTION_SPEED); + drawMenu(ID_Motion, MOTION_SPEED); break; #if HAS_X_AXIS case SPEED_X: @@ -2483,7 +2483,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra } break; - case MaxAcceleration: + case ID_MaxAcceleration: #define ACCEL_BACK 0 #define ACCEL_X (ACCEL_BACK + 1) @@ -2497,7 +2497,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Motion, MOTION_ACCEL); + drawMenu(ID_Motion, MOTION_ACCEL); break; case ACCEL_X: if (draw) { @@ -2536,7 +2536,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra } break; #if HAS_CLASSIC_JERK - case MaxJerk: + case ID_MaxJerk: #define JERK_BACK 0 #define JERK_X (JERK_BACK + 1) @@ -2550,7 +2550,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Motion, MOTION_JERK); + drawMenu(ID_Motion, MOTION_JERK); break; #if HAS_X_AXIS case JERK_X: @@ -2595,7 +2595,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra } break; #endif - case Steps: + case ID_Steps: #define STEPS_BACK 0 #define STEPS_X (STEPS_BACK + 1) @@ -2609,7 +2609,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Motion, MOTION_STEPS); + drawMenu(ID_Motion, MOTION_STEPS); break; #if HAS_X_AXIS case STEPS_X: @@ -2654,7 +2654,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra } break; - case Visual: + case ID_Visual: #define VISUAL_BACK 0 #define VISUAL_BACKLIGHT (VISUAL_BACK + 1) @@ -2668,7 +2668,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Control, CONTROL_VISUAL); + drawMenu(ID_Control, CONTROL_VISUAL); break; case VISUAL_BACKLIGHT: if (draw) @@ -2698,12 +2698,12 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_MaxSpeed, F("UI Color Settings"), nullptr, true); else - drawMenu(ColorSettings); + drawMenu(ID_ColorSettings); break; } break; - case ColorSettings: + case ID_ColorSettings: #define COLORSETTINGS_BACK 0 #define COLORSETTINGS_CURSOR (COLORSETTINGS_BACK + 1) @@ -2724,7 +2724,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Visual, VISUAL_COLOR_THEMES); + drawMenu(ID_Visual, VISUAL_COLOR_THEMES); break; case COLORSETTINGS_CURSOR: if (draw) { @@ -2817,7 +2817,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra } // switch (item) break; - case Advanced: + case ID_Advanced: #define ADVANCED_BACK 0 #define ADVANCED_BEEPER (ADVANCED_BACK + ENABLED(SOUND_MENU_ITEM)) @@ -2838,7 +2838,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Control, CONTROL_ADVANCED); + drawMenu(ID_Control, CONTROL_ADVANCED); break; #if ENABLED(SOUND_MENU_ITEM) @@ -2859,7 +2859,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_StepX, F("Probe"), nullptr, true); else - drawMenu(ProbeMenu); + drawMenu(ID_ProbeMenu); break; #endif @@ -2868,7 +2868,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Motion, F("TMC Drivers"), nullptr, true); else - drawMenu(TMCMenu); + drawMenu(ID_TMCMenu); break; #endif @@ -2964,7 +2964,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra break; #if HAS_BED_PROBE - case ProbeMenu: + case ID_ProbeMenu: #define PROBE_BACK 0 #define PROBE_XOFFSET (PROBE_BACK + 1) @@ -2980,7 +2980,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Advanced, ADVANCED_PROBE); + drawMenu(ID_Advanced, ADVANCED_PROBE); break; case PROBE_XOFFSET: @@ -3021,7 +3021,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #endif // HAS_PROBE_MENU #if HAS_TRINAMIC_CONFIG - case TMCMenu: + case ID_TMCMenu: #define TMC_BACK 0 #define TMC_STEPPER_CURRENT_X (TMC_BACK + AXIS_IS_TMC(X)) @@ -3036,7 +3036,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Advanced, ADVANCED_TMC); + drawMenu(ID_Advanced, ADVANCED_TMC); break; #if AXIS_IS_TMC(X) @@ -3099,8 +3099,8 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra break; #endif // HAS_TRINAMIC_CONFIG - case InfoMain: - case Info: + case ID_InfoMain: + case ID_Info: #define INFO_BACK 0 #define INFO_PRINTCOUNT (INFO_BACK + ENABLED(PRINTCOUNTER)) @@ -3138,8 +3138,8 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra drawMenuItem(INFO_CONTACT, ICON_Contact, F(CORP_WEBSITE), nullptr, false, true); } else { - if (menu == Info) - drawMenu(Control, CONTROL_INFO); + if (menu == ID_Info) + drawMenu(ID_Control, CONTROL_INFO); else drawMainMenu(3); } @@ -3148,7 +3148,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra break; #if HAS_MESH - case Leveling: + case ID_Leveling: #define LEVELING_BACK 0 #define LEVELING_ACTIVE (LEVELING_BACK + 1) @@ -3178,7 +3178,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (!planner.leveling_active) { set_bed_leveling_enabled(!planner.leveling_active); if (!planner.leveling_active) { - confirmHandler(LevelError); + confirmHandler(Popup_LevelError); break; } } @@ -3193,12 +3193,12 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra drawMenuItem(row, ICON_Tilt, F("Autotilt Current Mesh")); else { if (bedlevel.storage_slot < 0) { - popupHandler(MeshSlot); + popupHandler(Popup_MeshSlot); break; } - popupHandler(Home); + popupHandler(Popup_Home); gcode.home_all_axes(true); - popupHandler(Level); + popupHandler(Popup_Level); if (mesh_conf.tilt_grid > 1) { gcode.process_subcommands_now(TS(F("G29J"), mesh_conf.tilt_grid)); } @@ -3213,42 +3213,42 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Mesh, F("Create New Mesh")); else { - popupHandler(Home); + popupHandler(Popup_Home); gcode.home_all_axes(true); #if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(PREHEAT_BEFORE_LEVELING) - popupHandler(Heating); + popupHandler(Popup_Heating); probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, LEVELING_BED_TEMP); #endif #if HAS_BED_PROBE - popupHandler(Level); + popupHandler(Popup_Level); gcode.process_subcommands_now(F("G29P0\nG29P1")); gcode.process_subcommands_now(F("G29P3\nG29P3\nG29P3\nG29P3\nG29P3\nG29P3\nG29P3\nG29P3\nG29P3\nG29P3\nG29P3\nG29P3\nG29P3\nG29P3\nG29P3\nM420S1")); planner.synchronize(); updateStatus("Probed all reachable points"); - popupHandler(SaveLevel); + popupHandler(Popup_SaveLevel); #else level_state = planner.leveling_active; set_bed_leveling_enabled(false); mesh_conf.goto_mesh_value = true; mesh_conf.mesh_x = mesh_conf.mesh_y = 0; - popupHandler(MoveWait); + popupHandler(Popup_MoveWait); mesh_conf.manual_mesh_move(); - drawMenu(UBLMesh); + drawMenu(ID_UBLMesh); #endif #elif HAS_BED_PROBE - popupHandler(Level); + popupHandler(Popup_Level); gcode.process_subcommands_now(F("G29")); planner.synchronize(); - popupHandler(SaveLevel); + popupHandler(Popup_SaveLevel); #else level_state = planner.leveling_active; set_bed_leveling_enabled(false); gridpoint = 1; - popupHandler(MoveWait); + popupHandler(Popup_MoveWait); gcode.process_subcommands_now(F("G29")); planner.synchronize(); - drawMenu(ManualMesh); + drawMenu(ID_ManualMesh); #endif } break; @@ -3258,25 +3258,25 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra else { #if ENABLED(AUTO_BED_LEVELING_BILINEAR) if (!leveling_is_valid()) { - confirmHandler(InvalidMesh); + confirmHandler(Popup_InvalidMesh); break; } #endif #if ENABLED(AUTO_BED_LEVELING_UBL) if (bedlevel.storage_slot < 0) { - popupHandler(MeshSlot); + popupHandler(Popup_MeshSlot); break; } #endif if (axes_should_home()) { - popupHandler(Home); + popupHandler(Popup_Home); gcode.home_all_axes(true); } level_state = planner.leveling_active; set_bed_leveling_enabled(false); mesh_conf.goto_mesh_value = false; #if ENABLED(PREHEAT_BEFORE_LEVELING) - popupHandler(Heating); + popupHandler(Popup_Heating); #if HAS_HOTEND if (thermalManager.degTargetHotend(0) < LEVELING_NOZZLE_TEMP) thermalManager.setTargetHotend(LEVELING_NOZZLE_TEMP, 0); @@ -3288,9 +3288,9 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra TERN_(HAS_HOTEND, thermalManager.wait_for_hotend(0)); TERN_(HAS_HEATED_BED, thermalManager.wait_for_bed_heating()); #endif - popupHandler(MoveWait); + popupHandler(Popup_MoveWait); mesh_conf.manual_mesh_move(); - drawMenu(LevelManual); + drawMenu(ID_LevelManual); } break; case LEVELING_VIEW: @@ -3299,18 +3299,18 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra else { #if ENABLED(AUTO_BED_LEVELING_UBL) if (bedlevel.storage_slot < 0) { - popupHandler(MeshSlot); + popupHandler(Popup_MeshSlot); break; } #endif - drawMenu(LevelView); + drawMenu(ID_LevelView); } break; case LEVELING_SETTINGS: if (draw) drawMenuItem(row, ICON_Step, F("Leveling Settings"), nullptr, true); else - drawMenu(LevelSettings); + drawMenu(ID_LevelSettings); break; #if ENABLED(AUTO_BED_LEVELING_UBL) case LEVELING_SLOT: @@ -3326,7 +3326,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra drawMenuItem(row, ICON_ReadEEPROM, F("Load Mesh")); else { if (bedlevel.storage_slot < 0) { - popupHandler(MeshSlot); + popupHandler(Popup_MeshSlot); break; } gcode.process_subcommands_now(F("G29 L")); @@ -3339,7 +3339,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra drawMenuItem(row, ICON_WriteEEPROM, F("Save Mesh")); else { if (bedlevel.storage_slot < 0) { - popupHandler(MeshSlot); + popupHandler(Popup_MeshSlot); break; } gcode.process_subcommands_now(F("G29 S")); @@ -3351,7 +3351,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra } break; - case LevelView: + case ID_LevelView: #define LEVELING_VIEW_BACK 0 #define LEVELING_VIEW_MESH (LEVELING_VIEW_BACK + 1) @@ -3364,13 +3364,13 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Leveling, LEVELING_VIEW); + drawMenu(ID_Leveling, LEVELING_VIEW); break; case LEVELING_VIEW_MESH: if (draw) drawMenuItem(row, ICON_PrintSize, GET_TEXT_F(MSG_MESH_VIEW), nullptr, true); else - drawMenu(MeshViewer); + drawMenu(ID_MeshViewer); break; case LEVELING_VIEW_TEXT: if (draw) { @@ -3395,7 +3395,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra } break; - case LevelSettings: + case ID_LevelSettings: #define LEVELING_SETTINGS_BACK 0 #define LEVELING_SETTINGS_FADE (LEVELING_SETTINGS_BACK + 1) @@ -3410,7 +3410,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_Back, F("Back")); else - drawMenu(Leveling, LEVELING_SETTINGS); + drawMenu(ID_Leveling, LEVELING_SETTINGS); break; case LEVELING_SETTINGS_FADE: if (draw) { @@ -3459,7 +3459,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra } break; - case MeshViewer: + case ID_MeshViewer: #define MESHVIEW_BACK 0 #define MESHVIEW_TOTAL MESHVIEW_BACK @@ -3470,13 +3470,13 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra mesh_conf.setMeshViewerStatus(); } else if (!mesh_conf.drawing_mesh) { - drawMenu(LevelView, LEVELING_VIEW_MESH); + drawMenu(ID_LevelView, LEVELING_VIEW_MESH); updateStatus(""); } } break; - case LevelManual: + case ID_LevelManual: #define LEVELING_M_BACK 0 #define LEVELING_M_X (LEVELING_M_BACK + 1) @@ -3496,7 +3496,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra else { set_bed_leveling_enabled(level_state); TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.refresh_bed_level()); - drawMenu(Leveling, LEVELING_MANUAL); + drawMenu(ID_Leveling, LEVELING_MANUAL); } break; case LEVELING_M_X: @@ -3592,7 +3592,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #endif // HAS_MESH #if ENABLED(AUTO_BED_LEVELING_UBL) && !HAS_BED_PROBE - case UBLMesh: + case ID_UBLMesh: #define UBL_M_BACK 0 #define UBL_M_NEXT (UBL_M_BACK + 1) @@ -3608,7 +3608,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra drawMenuItem(row, ICON_Back, F("Back")); else { set_bed_leveling_enabled(level_state); - drawMenu(Leveling, LEVELING_GET_MESH); + drawMenu(ID_Leveling, LEVELING_GET_MESH); } break; case UBL_M_NEXT: @@ -3632,7 +3632,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra gcode.process_subcommands_now(F("G29 S")); planner.synchronize(); audioFeedback(true); - drawMenu(Leveling, LEVELING_GET_MESH); + drawMenu(ID_Leveling, LEVELING_GET_MESH); } } break; @@ -3691,7 +3691,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #endif // AUTO_BED_LEVELING_UBL && !HAS_BED_PROBE #if ENABLED(PROBE_MANUALLY) - case ManualMesh: + case ID_ManualMesh: #define MMESH_BACK 0 #define MMESH_NEXT (MMESH_BACK + 1) @@ -3709,7 +3709,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra gcode.process_subcommands_now(F("G29 A")); planner.synchronize(); set_bed_leveling_enabled(level_state); - drawMenu(Leveling, LEVELING_GET_MESH); + drawMenu(ID_Leveling, LEVELING_GET_MESH); } break; case MMESH_NEXT: @@ -3720,7 +3720,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra drawMenuItem(row, ICON_More, F("Save Mesh")); } else if (gridpoint < GRID_MAX_POINTS) { - popupHandler(MoveWait); + popupHandler(Popup_MoveWait); gcode.process_subcommands_now(F("G29")); planner.synchronize(); gridpoint++; @@ -3730,7 +3730,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra gcode.process_subcommands_now(F("G29")); planner.synchronize(); audioFeedback(settings.save()); - drawMenu(Leveling, LEVELING_GET_MESH); + drawMenu(ID_Leveling, LEVELING_GET_MESH); } break; case MMESH_OFFSET: @@ -3791,7 +3791,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra break; #endif // PROBE_MANUALLY - case Tune: + case ID_Tune: #define TUNE_BACK 0 #define TUNE_SPEED (TUNE_BACK + 1) @@ -3899,7 +3899,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE)); else - popupHandler(ConfFilChange); + popupHandler(Popup_ConfFilChange); break; #endif @@ -3935,7 +3935,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #if HAS_PREHEAT && HAS_HOTEND - case PreheatHotend: + case ID_PreheatHotend: #define PREHEATHOTEND_BACK 0 #define PREHEATHOTEND_CONTINUE (PREHEATHOTEND_BACK + 1) @@ -3961,30 +3961,30 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_SetEndTemp, F("Continue")); else { - popupHandler(Heating); + popupHandler(Popup_Heating); thermalManager.wait_for_hotend(0); switch (last_menu) { - case Prepare: - popupHandler(FilChange); + case ID_Prepare: + popupHandler(Popup_FilChange); gcode.process_subcommands_now(TS(F("M600 B1 R"), thermalManager.temp_hotend[0].target)); break; #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - case ChangeFilament: + case ID_ChangeFilament: switch (last_selection) { case CHANGEFIL_LOAD: - popupHandler(FilLoad); + popupHandler(Popup_FilLoad); gcode.process_subcommands_now(F("M701")); planner.synchronize(); redrawMenu(true, true, true); break; case CHANGEFIL_UNLOAD: - popupHandler(FilLoad, true); + popupHandler(Popup_FilLoad, true); gcode.process_subcommands_now(F("M702")); planner.synchronize(); redrawMenu(true, true, true); break; case CHANGEFIL_CHANGE: - popupHandler(FilChange); + popupHandler(Popup_FilChange); gcode.process_subcommands_now(TS(F("M600 B1 R"), thermalManager.temp_hotend[0].target)); break; } @@ -4023,158 +4023,159 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra FSTR_P JyersDWIN::getMenuTitle(const uint8_t menu) { switch (menu) { - case MainMenu: return GET_TEXT_F(MSG_MAIN_MENU); - case Prepare: return GET_TEXT_F(MSG_PREPARE); - case HomeMenu: return F("Homing Menu"); - case Move: return GET_TEXT_F(MSG_MOVE_AXIS); - case ManualLevel: return GET_TEXT_F(MSG_BED_TRAMMING_MANUAL); + case ID_MainMenu: return GET_TEXT_F(MSG_MAIN_MENU); + case ID_Prepare: return GET_TEXT_F(MSG_PREPARE); + case ID_HomeMenu: return F("Homing Menu"); + case ID_Move: return GET_TEXT_F(MSG_MOVE_AXIS); + case ID_ManualLevel: return GET_TEXT_F(MSG_BED_TRAMMING_MANUAL); #if HAS_ZOFFSET_ITEM - case ZOffset: return GET_TEXT_F(MSG_ZPROBE_ZOFFSET); + case ID_ZOffset: return GET_TEXT_F(MSG_ZPROBE_ZOFFSET); #endif #if HAS_PREHEAT - case Preheat: return F("Preheat"); + case ID_Preheat: return F("Preheat"); #endif #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - case ChangeFilament: return GET_TEXT_F(MSG_FILAMENTCHANGE); + case ID_ChangeFilament: return GET_TEXT_F(MSG_FILAMENTCHANGE); #endif #if HAS_CUSTOM_MENU - case MenuCustom: + case ID_MenuCustom: #ifdef CUSTOM_MENU_CONFIG_TITLE return F(CUSTOM_MENU_CONFIG_TITLE); #else return GET_TEXT_F(MSG_CUSTOM_COMMANDS); #endif #endif - case Control: return GET_TEXT_F(MSG_CONTROL); - case TempMenu: return GET_TEXT_F(MSG_TEMPERATURE); + case ID_Control: return GET_TEXT_F(MSG_CONTROL); + case ID_TempMenu: return GET_TEXT_F(MSG_TEMPERATURE); #if ANY(PIDTEMP, PIDTEMPBED) - case PID: return F("PID Menu"); + case ID_PID: return F("PID Menu"); #endif #if ENABLED(PIDTEMP) - case HotendPID: return F("Hotend PID Settings"); + case ID_HotendPID: return F("Hotend PID Settings"); #endif #if ENABLED(PIDTEMPBED) - case BedPID: return F("Bed PID Settings"); + case ID_BedPID: return F("Bed PID Settings"); #endif #if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) - case MPC: return F("MPC Menu"); + case ID_MPC: return F("MPC Menu"); #endif #if HAS_PREHEAT - #define _PREHEAT_TITLE_CASE(N) case Preheat##N: return F(PREHEAT_## N ##_LABEL " Settings"); + #define _PREHEAT_TITLE_CASE(N) case ID_Preheat##N: return F(PREHEAT_## N ##_LABEL " Settings"); REPEAT_1(PREHEAT_COUNT, _PREHEAT_TITLE_CASE) #endif - case Motion: return F("Motion Settings"); - case HomeOffsets: return F("Home Offsets"); - case MaxSpeed: return F("Max Speed"); - case MaxAcceleration: return F("Max Acceleration"); + case ID_Motion: return F("Motion Settings"); + case ID_HomeOffsets: return F("Home Offsets"); + case ID_MaxSpeed: return F("Max Speed"); + case ID_MaxAcceleration: return F("Max Acceleration"); #if HAS_CLASSIC_JERK - case MaxJerk: return F("Max Jerk"); + case ID_MaxJerk: return F("Max Jerk"); #endif - case Steps: return GET_TEXT_F(MSG_STEPS_PER_MM); - case Visual: return F("Visual Settings"); - case Advanced: return GET_TEXT_F(MSG_ADVANCED_SETTINGS); + case ID_Steps: return GET_TEXT_F(MSG_STEPS_PER_MM); + case ID_Visual: return F("Visual Settings"); + case ID_Advanced: return GET_TEXT_F(MSG_ADVANCED_SETTINGS); #if HAS_BED_PROBE - case ProbeMenu: return F("Bed Probe"); + case ID_ProbeMenu: return F("Bed Probe"); #endif #if HAS_TRINAMIC_CONFIG - case TMCMenu: return GET_TEXT_F(MSG_TMC_DRIVERS); + case ID_TMCMenu: return GET_TEXT_F(MSG_TMC_DRIVERS); #endif - case ColorSettings: return F("UI Color Settings"); - case Info: return F("Info"); - case InfoMain: return F("Info"); + case ID_ColorSettings: return F("UI Color Settings"); + case ID_Info: return F("Info"); + case ID_InfoMain: return F("Info"); #if HAS_MESH - case Leveling: return F("Leveling"); - case LevelView: return GET_TEXT_F(MSG_MESH_VIEW); - case LevelSettings: return F("Leveling Settings"); - case MeshViewer: return GET_TEXT_F(MSG_MESH_VIEW); - case LevelManual: return F("Manual Tuning"); + case ID_Leveling: return F("Leveling"); + case ID_LevelView: return GET_TEXT_F(MSG_MESH_VIEW); + case ID_LevelSettings: return F("Leveling Settings"); + case ID_MeshViewer: return GET_TEXT_F(MSG_MESH_VIEW); + case ID_LevelManual: return F("Manual Tuning"); #endif #if ENABLED(AUTO_BED_LEVELING_UBL) && !HAS_BED_PROBE - case UBLMesh: return F("UBL Bed Leveling"); + case ID_UBLMesh: return F("UBL Bed Leveling"); #endif #if ENABLED(PROBE_MANUALLY) - case ManualMesh: return GET_TEXT_F(MSG_MANUAL_LEVELING); + case ID_ManualMesh: return GET_TEXT_F(MSG_MANUAL_LEVELING); #endif - case Tune: return GET_TEXT_F(MSG_TUNE); - case PreheatHotend: return GET_TEXT_F(MSG_PREHEAT_HOTEND); + case ID_Tune: return GET_TEXT_F(MSG_TUNE); + case ID_PreheatHotend: return GET_TEXT_F(MSG_PREHEAT_HOTEND); } return F(""); } uint8_t JyersDWIN::getMenuSize(const uint8_t menu) { switch (menu) { - case Prepare: return PREPARE_TOTAL; - case HomeMenu: return HOME_TOTAL; - case Move: return MOVE_TOTAL; - case ManualLevel: return MLEVEL_TOTAL; + case ID_Prepare: return PREPARE_TOTAL; + case ID_HomeMenu: return HOME_TOTAL; + case ID_Move: return MOVE_TOTAL; + case ID_ManualLevel: return MLEVEL_TOTAL; #if HAS_ZOFFSET_ITEM - case ZOffset: return ZOFFSET_TOTAL; + case ID_ZOffset: return ZOFFSET_TOTAL; #endif #if HAS_PREHEAT - case Preheat: return PREHEAT_TOTAL; + case ID_Preheat: return PREHEAT_TOTAL; #endif #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - case ChangeFilament: return CHANGEFIL_TOTAL; + case ID_ChangeFilament: return CHANGEFIL_TOTAL; #endif #if HAS_CUSTOM_MENU - case MenuCustom: return CUSTOM_MENU_TOTAL; + case ID_MenuCustom: return CUSTOM_MENU_TOTAL; #endif - case Control: return CONTROL_TOTAL; - case TempMenu: return TEMP_TOTAL; + case ID_Control: return CONTROL_TOTAL; + case ID_TempMenu: return TEMP_TOTAL; #if ANY(PIDTEMP, PIDTEMPBED) - case PID: return PID_TOTAL; + case ID_PID: return PID_TOTAL; #endif #if ENABLED(PIDTEMP) - case HotendPID: return HOTENDPID_TOTAL; + case ID_HotendPID: return HOTENDPID_TOTAL; #endif #if ENABLED(PIDTEMPBED) - case BedPID: return BEDPID_TOTAL; + case ID_BedPID: return BEDPID_TOTAL; #endif #if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) - case MPC: return MPCMENU_TOTAL; + case ID_MPC: return MPCMENU_TOTAL; #endif #if HAS_PREHEAT - case Preheat1 ... CAT(Preheat, PREHEAT_COUNT): + case ID_Preheat1 ... CAT(ID_Preheat, PREHEAT_COUNT): return PREHEAT_SUBMENU_TOTAL; #endif - case Motion: return MOTION_TOTAL; - case HomeOffsets: return HOMEOFFSETS_TOTAL; - case MaxSpeed: return SPEED_TOTAL; - case MaxAcceleration: return ACCEL_TOTAL; + case ID_Motion: return MOTION_TOTAL; + case ID_HomeOffsets: return HOMEOFFSETS_TOTAL; + case ID_MaxSpeed: return SPEED_TOTAL; + case ID_MaxAcceleration: return ACCEL_TOTAL; #if HAS_CLASSIC_JERK - case MaxJerk: return JERK_TOTAL; + case ID_MaxJerk: return JERK_TOTAL; #endif - case Steps: return STEPS_TOTAL; - case Visual: return VISUAL_TOTAL; - case Advanced: return ADVANCED_TOTAL; + case ID_Steps: return STEPS_TOTAL; + case ID_Visual: return VISUAL_TOTAL; + case ID_Advanced: return ADVANCED_TOTAL; #if HAS_BED_PROBE - case ProbeMenu: return PROBE_TOTAL; + case ID_ProbeMenu: return PROBE_TOTAL; #endif #if HAS_TRINAMIC_CONFIG - case TMCMenu: return TMC_TOTAL; + case ID_TMCMenu: return TMC_TOTAL; + case ID_TMCMenu: return TMC_TOTAL; #endif - case Info: return INFO_TOTAL; - case InfoMain: return INFO_TOTAL; + case ID_Info: return INFO_TOTAL; + case ID_InfoMain: return INFO_TOTAL; #if ENABLED(AUTO_BED_LEVELING_UBL) && !HAS_BED_PROBE - case UBLMesh: return UBL_M_TOTAL; + case ID_UBLMesh: return UBL_M_TOTAL; #endif #if ENABLED(PROBE_MANUALLY) - case ManualMesh: return MMESH_TOTAL; + case ID_ManualMesh: return MMESH_TOTAL; #endif #if HAS_MESH - case Leveling: return LEVELING_TOTAL; - case LevelView: return LEVELING_VIEW_TOTAL; - case LevelSettings: return LEVELING_SETTINGS_TOTAL; - case MeshViewer: return MESHVIEW_TOTAL; - case LevelManual: return LEVELING_M_TOTAL; + case ID_Leveling: return LEVELING_TOTAL; + case ID_LevelView: return LEVELING_VIEW_TOTAL; + case ID_LevelSettings: return LEVELING_SETTINGS_TOTAL; + case ID_MeshViewer: return MESHVIEW_TOTAL; + case ID_LevelManual: return LEVELING_M_TOTAL; #endif - case Tune: return TUNE_TOTAL; + case ID_Tune: return TUNE_TOTAL; #if HAS_PREHEAT && HAS_HOTEND - case PreheatHotend: return PREHEATHOTEND_TOTAL; + case ID_PreheatHotend: return PREHEATHOTEND_TOTAL; #endif - case ColorSettings: return COLORSETTINGS_TOTAL; + case ID_ColorSettings: return COLORSETTINGS_TOTAL; } return 0; } @@ -4186,27 +4187,27 @@ uint8_t JyersDWIN::getMenuSize(const uint8_t menu) { void JyersDWIN::popupHandler(const PopupID popupid, const bool option/*=false*/) { popup = last_popup = popupid; switch (popupid) { - case Pause: drawPopup(F("Pause Print"), F(""), F(""), Popup); break; - case Stop: drawPopup(F("Stop Print"), F(""), F(""), Popup); break; - case Resume: drawPopup(F("Resume Print?"), F("Looks Like the last"), F("print was interrupted."), Popup); break; - case ConfFilChange: drawPopup(F("Confirm Filament Change"), F(""), F(""), Popup); break; - case PurgeMore: drawPopup(F("Purge more filament?"), F("(Cancel to finish process)"), F(""), Popup); break; - case SaveLevel: drawPopup(F("Leveling Complete"), F("Save to EEPROM?"), F(""), Popup); break; - case MeshSlot: drawPopup(F("Mesh slot not selected"), F("(Confirm to select slot 0)"), F(""), Popup); break; - case ETemp: drawPopup(F("Nozzle is too cold"), F("Open Preheat Menu?"), F(""), Popup); break; - case ManualProbing: drawPopup(F("Manual Probing"), F("(Confirm to probe)"), F("(cancel to exit)"), Popup); break; - case Level: drawPopup(F("Auto Bed Leveling"), F("Please wait until done."), F(""), Wait, ICON_AutoLeveling); break; - case Home: drawPopup(option ? F("Parking") : F("Homing"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; - case MoveWait: drawPopup(F("Moving to Point"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; - case Heating: drawPopup(F("Heating"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; - case FilLoad: drawPopup(option ? F("Unloading Filament") : F("Loading Filament"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; - case FilChange: drawPopup(F("Filament Change"), F("Please wait for prompt."), F(""), Wait, ICON_BLTouch); break; - case TempWarn: drawPopup(option ? F("Nozzle temp too low!") : F("Nozzle temp too high!"), F(""), F(""), Wait, option ? ICON_TempTooLow : ICON_TempTooHigh); break; - case Runout: drawPopup(F("Filament Runout"), F(""), F(""), Wait, ICON_BLTouch); break; - case PIDWait: drawPopup(F("PID Autotune"), F("in process"), F("Please wait until done."), Wait, ICON_BLTouch); break; - case MPCWait: drawPopup(F("MPC Autotune"), F("in process"), F("Please wait until done."), Wait, ICON_BLTouch); break; - case Resuming: drawPopup(F("Resuming Print"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; - case Custom: drawPopup(F("Running Custom GCode"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; + case Popup_Pause: drawPopup(F("Pause Print"), F(""), F(""), Proc_Popup); break; + case Popup_Stop: drawPopup(F("Stop Print"), F(""), F(""), Proc_Popup); break; + case Popup_Resume: drawPopup(F("Resume Print?"), F("Looks Like the last"), F("print was interrupted."), Proc_Popup); break; + case Popup_ConfFilChange: drawPopup(F("Confirm Filament Change"), F(""), F(""), Proc_Popup); break; + case Popup_PurgeMore: drawPopup(F("Purge more filament?"), F("(Cancel to finish process)"), F(""), Proc_Popup); break; + case Popup_SaveLevel: drawPopup(F("Leveling Complete"), F("Save to EEPROM?"), F(""), Proc_Popup); break; + case Popup_MeshSlot: drawPopup(F("Mesh slot not selected"), F("(Confirm to select slot 0)"), F(""), Proc_Popup); break; + case Popup_ETemp: drawPopup(F("Nozzle is too cold"), F("Open Preheat Menu?"), F(""), Proc_Popup); break; + case Popup_ManualProbing: drawPopup(F("Manual Probing"), F("(Confirm to probe)"), F("(cancel to exit)"), Proc_Popup); break; + case Popup_Level: drawPopup(F("Auto Bed Leveling"), F("Please wait until done."), F(""), Proc_Wait, ICON_AutoLeveling); break; + case Popup_Home: drawPopup(option ? F("Parking") : F("Homing"), F("Please wait until done."), F(""), Proc_Wait, ICON_BLTouch); break; + case Popup_MoveWait: drawPopup(F("Moving to Point"), F("Please wait until done."), F(""), Proc_Wait, ICON_BLTouch); break; + case Popup_Heating: drawPopup(F("Heating"), F("Please wait until done."), F(""), Proc_Wait, ICON_BLTouch); break; + case Popup_FilLoad: drawPopup(option ? F("Unloading Filament") : F("Loading Filament"), F("Please wait until done."), F(""), Proc_Wait, ICON_BLTouch); break; + case Popup_FilChange: drawPopup(F("Filament Change"), F("Please wait for prompt."), F(""), Proc_Wait, ICON_BLTouch); break; + case Popup_TempWarn: drawPopup(option ? F("Nozzle temp too low!") : F("Nozzle temp too high!"), F(""), F(""), Proc_Wait, option ? ICON_TempTooLow : ICON_TempTooHigh); break; + case Popup_Runout: drawPopup(F("Filament Runout"), F(""), F(""), Proc_Wait, ICON_BLTouch); break; + case Popup_PIDWait: drawPopup(F("PID Autotune"), F("in process"), F("Please wait until done."), Proc_Wait, ICON_BLTouch); break; + case Popup_MPCWait: drawPopup(F("MPC Autotune"), F("in process"), F("Please wait until done."), Proc_Wait, ICON_BLTouch); break; + case Popup_Resuming: drawPopup(F("Resuming Print"), F("Please wait until done."), F(""), Proc_Wait, ICON_BLTouch); break; + case Popup_Custom: drawPopup(F("Running Custom GCode"), F("Please wait until done."), F(""), Proc_Wait, ICON_BLTouch); break; default: break; } } @@ -4214,11 +4215,11 @@ void JyersDWIN::popupHandler(const PopupID popupid, const bool option/*=false*/) void JyersDWIN::confirmHandler(PopupID popupid) { popup = popupid; switch (popupid) { - case FilInsert: drawPopup(F("Insert Filament"), F("Press to Continue"), F(""), Confirm); break; - case HeaterTime: drawPopup(F("Heater Timed Out"), F("Press to Reheat"), F(""), Confirm); break; - case UserInput: drawPopup(F("Waiting for Input"), F("Press to Continue"), F(""), Confirm); break; - case LevelError: drawPopup(F("Couldn't enable Leveling"), F("(Valid mesh must exist)"), F(""), Confirm); break; - case InvalidMesh: drawPopup(F("Valid mesh must exist"), F("before tuning can be"), F("performed"), Confirm); break; + case Popup_FilInsert: drawPopup(F("Insert Filament"), F("Press to Continue"), F(""), Proc_Confirm); break; + case Popup_HeaterTime: drawPopup(F("Heater Timed Out"), F("Press to Reheat"), F(""), Proc_Confirm); break; + case Popup_UserInput: drawPopup(F("Waiting for Input"), F("Press to Continue"), F(""), Proc_Confirm); break; + case Popup_LevelError: drawPopup(F("Couldn't enable Leveling"), F("(Valid mesh must exist)"), F(""), Proc_Confirm); break; + case Popup_InvalidMesh: drawPopup(F("Valid mesh must exist"), F("before tuning can be"), F("performed"), Proc_Confirm); break; default: break; } } @@ -4241,9 +4242,9 @@ void JyersDWIN::mainMenuControl() { else if (encoder_diffState == ENCODER_DIFF_ENTER) switch (selection) { case PAGE_PRINT: card.mount(); drawSDList(); break; - case PAGE_PREPARE: drawMenu(Prepare); break; - case PAGE_CONTROL: drawMenu(Control); break; - case PAGE_INFO_LEVELING: drawMenu(TERN(HAS_MESH, Leveling, InfoMain)); break; + case PAGE_PREPARE: drawMenu(ID_Prepare); break; + case PAGE_CONTROL: drawMenu(ID_Control); break; + case PAGE_INFO_LEVELING: drawMenu(TERN(HAS_MESH, ID_Leveling, ID_InfoMain)); break; } dwinUpdateLCD(); } @@ -4252,24 +4253,24 @@ void JyersDWIN::menuControl() { EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_CW && selection < getMenuSize(active_menu)) { - dwinDrawRectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, COLOR_BG_BLACK, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); selection++; // Select Down if (selection > scrollpos + MROWS) { scrollpos++; - dwinFrameAreaMove(1, 2, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); + dwinFrameAreaMove(1, 2, MLINE, COLOR_BG_BLACK, 0, 31, DWIN_WIDTH, 349); menuItemHandler(active_menu, selection); } - dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, COLOR_RECTANGLE), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); } else if (encoder_diffState == ENCODER_DIFF_CCW && selection > 0) { - dwinDrawRectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, COLOR_BG_BLACK, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); selection--; // Select Up if (selection < scrollpos) { scrollpos--; - dwinFrameAreaMove(1, 3, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); + dwinFrameAreaMove(1, 3, MLINE, COLOR_BG_BLACK, 0, 31, DWIN_WIDTH, 349); menuItemHandler(active_menu, selection); } - dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, COLOR_RECTANGLE), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); } else if (encoder_diffState == ENCODER_DIFF_ENTER) menuItemHandler(active_menu, selection, false); @@ -4284,18 +4285,18 @@ void JyersDWIN::valueControl() { else if (encoder_diffState == ENCODER_DIFF_CCW) tempvalue -= encoderRate.encoderMoveValue; else if (encoder_diffState == ENCODER_DIFF_ENTER) { - process = Menu; + process = Proc_Menu; encoderRate.enabled = false; drawFloat(tempvalue / valueunit, selection - scrollpos, false, valueunit); dwinUpdateLCD(); - if (active_menu == ZOffset && liveadjust) { + if (active_menu == ID_ZOffset && liveadjust) { planner.synchronize(); current_position.z += (tempvalue / valueunit - zoffsetvalue); planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); current_position.z = 0; sync_plan_position(); } - else if (active_menu == Tune && selection == TUNE_ZOFFSET) { + else if (active_menu == ID_Tune && selection == TUNE_ZOFFSET) { gcode.process_subcommands_now(TS(F("M290Z"), p_float_t((tempvalue / valueunit - zoffsetvalue), 3))); } if (TERN0(PIDTEMP, valuepointer == &thermalManager.temp_hotend[0].pid.Ki) || TERN0(PIDTEMPBED, valuepointer == &thermalManager.temp_bed.pid.Ki)) @@ -4311,18 +4312,18 @@ void JyersDWIN::valueControl() { case 5: *(int8_t*)valuepointer = tempvalue / valueunit; break; } switch (active_menu) { - case Move: + case ID_Move: planner.synchronize(); planner.buffer_line(current_position, manual_feedrate_mm_s[selection - 1], active_extruder); break; #if HAS_MESH - case ManualMesh: + case ID_ManualMesh: planner.synchronize(); planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); planner.synchronize(); break; - case UBLMesh: mesh_conf.manual_mesh_move(true); break; - case LevelManual: mesh_conf.manual_mesh_move(selection == LEVELING_M_OFFSET); break; + case ID_UBLMesh: mesh_conf.manual_mesh_move(true); break; + case ID_LevelManual: mesh_conf.manual_mesh_move(selection == LEVELING_M_OFFSET); break; #endif } if (funcpointer) funcpointer(); @@ -4331,7 +4332,7 @@ void JyersDWIN::valueControl() { LIMIT(tempvalue, valuemin * valueunit, valuemax * valueunit); drawFloat(tempvalue / valueunit, selection - scrollpos, true, valueunit); dwinUpdateLCD(); - if (active_menu == Move && livemove) { + if (active_menu == ID_Move && livemove) { *(float*)valuepointer = tempvalue / valueunit; planner.buffer_line(current_position, manual_feedrate_mm_s[selection - 1], active_extruder); } @@ -4345,7 +4346,7 @@ void JyersDWIN::optionControl() { else if (encoder_diffState == ENCODER_DIFF_CCW) tempvalue -= encoderRate.encoderMoveValue; else if (encoder_diffState == ENCODER_DIFF_ENTER) { - process = Menu; + process = Proc_Menu; encoderRate.enabled = false; if (valuepointer == &color_names) { switch (selection) { @@ -4392,7 +4393,7 @@ void JyersDWIN::fileControl() { time = millis() + 200; Scroller::Buffer buf; const char* const name = scroller.scroll(pos, buf, filename); - dwinDrawRectangle(1, Color_Bg_Black, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); + dwinDrawRectangle(1, COLOR_BG_BLACK, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); drawMenuItem(selection - scrollpos, card.flag.filenameIsDir ? ICON_More : ICON_File, name); dwinUpdateLCD(); } @@ -4400,37 +4401,37 @@ void JyersDWIN::fileControl() { return; } if (encoder_diffState == ENCODER_DIFF_CW && selection < card.get_num_items()) { - dwinDrawRectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, COLOR_BG_BLACK, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); if (selection > 0) { - dwinDrawRectangle(1, Color_Bg_Black, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); + dwinDrawRectangle(1, COLOR_BG_BLACK, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); drawSDItem(selection, selection - scrollpos); } scroller.reset(); selection++; // Select Down if (selection > scrollpos + MROWS) { scrollpos++; - dwinFrameAreaMove(1, 2, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); + dwinFrameAreaMove(1, 2, MLINE, COLOR_BG_BLACK, 0, 31, DWIN_WIDTH, 349); drawSDItem(selection, selection - scrollpos); } - dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, COLOR_RECTANGLE), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); } else if (encoder_diffState == ENCODER_DIFF_CCW && selection > 0) { - dwinDrawRectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); - dwinDrawRectangle(1, Color_Bg_Black, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); + dwinDrawRectangle(1, COLOR_BG_BLACK, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, COLOR_BG_BLACK, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); drawSDItem(selection, selection - scrollpos); scroller.reset(); selection--; // Select Up if (selection < scrollpos) { scrollpos--; - dwinFrameAreaMove(1, 3, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); + dwinFrameAreaMove(1, 3, MLINE, COLOR_BG_BLACK, 0, 31, DWIN_WIDTH, 349); drawSDItem(selection, selection - scrollpos); } - dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, COLOR_RECTANGLE), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { if (selection == 0) { if (card.flag.workDirIsRoot) { - process = Main; + process = Proc_Main; drawMainMenu(); } else { @@ -4466,7 +4467,7 @@ void JyersDWIN::printScreenControl() { else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (selection) { case PRINT_SETUP: - drawMenu(Tune); + drawMenu(ID_Tune); updateStatusBar(true); break; case PRINT_PAUSE_RESUME: @@ -4494,9 +4495,9 @@ void JyersDWIN::printScreenControl() { drawPrintScreen(); } else - popupHandler(Pause); + popupHandler(Popup_Pause); break; - case PRINT_STOP: popupHandler(Stop); break; + case PRINT_STOP: popupHandler(Popup_Stop); break; } } dwinUpdateLCD(); @@ -4515,14 +4516,14 @@ void JyersDWIN::popupControl() { } else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (popup) { - case Pause: + case Popup_Pause: if (selection == 0) { if (sdprint) { #if ENABLED(POWER_LOSS_RECOVERY) if (recovery.enabled) recovery.save(true); #endif #if ENABLED(PARK_HEAD_ON_PAUSE) - popupHandler(Home, true); + popupHandler(Popup_Home, true); #if HAS_MEDIA if (IS_SD_PRINTING()) card.pauseSDPrint(); #endif @@ -4543,7 +4544,7 @@ void JyersDWIN::popupControl() { } drawPrintScreen(); break; - case Stop: + case Popup_Stop: if (selection == 0) { if (sdprint) { ui.abort_print(); @@ -4556,7 +4557,7 @@ void JyersDWIN::popupControl() { else drawPrintScreen(); break; - case Resume: + case Popup_Resume: if (selection == 0) queue.inject(F("M1000")); else { @@ -4566,11 +4567,11 @@ void JyersDWIN::popupControl() { break; #if HAS_HOTEND - case ETemp: + case Popup_ETemp: if (selection == 0) { thermalManager.setTargetHotend(EXTRUDE_MINTEMP, 0); TERN_(HAS_FAN, thermalManager.set_fan_speed(0, MAX_FAN_SPEED)); - drawMenu(PreheatHotend); + drawMenu(ID_PreheatHotend); } else redrawMenu(true, true, false); @@ -4578,7 +4579,7 @@ void JyersDWIN::popupControl() { #endif #if HAS_BED_PROBE - case ManualProbing: + case Popup_ManualProbing: if (selection == 0) { const float dif = probe.probe_at_point(current_position.x, current_position.y, PROBE_PT_STOW, 0, false) - corner_avg; updateStatus(TS(F("Corner is "), p_float_t(abs(dif), 3), "mm ", dif > 0 ? F("high") : F("low"))); @@ -4591,37 +4592,37 @@ void JyersDWIN::popupControl() { #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) - case ConfFilChange: + case Popup_ConfFilChange: if (selection == 0) { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) - popupHandler(ETemp); + popupHandler(Popup_ETemp); else { if (thermalManager.temp_hotend[0].is_below_target(2)) { - popupHandler(Heating); + popupHandler(Popup_Heating); thermalManager.wait_for_hotend(0); } - popupHandler(FilChange); + popupHandler(Popup_FilChange); gcode.process_subcommands_now(TS(F("M600B1R"), thermalManager.temp_hotend[0].target)); } } else redrawMenu(true, true, false); break; - case PurgeMore: + case Popup_PurgeMore: if (selection == 0) { pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; - popupHandler(FilChange); + popupHandler(Popup_FilChange); } else { pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; - if (printing) popupHandler(Resuming); - else redrawMenu(true, true, active_menu == PreheatHotend); + if (printing) popupHandler(Popup_Resuming); + else redrawMenu(true, true, active_menu == ID_PreheatHotend); } break; #endif // ADVANCED_PAUSE_FEATURE #if HAS_MESH - case SaveLevel: + case Popup_SaveLevel: if (selection == 0) { #if ENABLED(AUTO_BED_LEVELING_UBL) gcode.process_subcommands_now(F("G29 S")); @@ -4631,12 +4632,12 @@ void JyersDWIN::popupControl() { audioFeedback(settings.save()); #endif } - drawMenu(Leveling, LEVELING_GET_MESH); + drawMenu(ID_Leveling, LEVELING_GET_MESH); break; #endif #if ENABLED(AUTO_BED_LEVELING_UBL) - case MeshSlot: + case Popup_MeshSlot: if (selection == 0) bedlevel.storage_slot = 0; redrawMenu(true, true); break; @@ -4652,15 +4653,15 @@ void JyersDWIN::confirmControl() { if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (popup) { - case Complete: + case Popup_Complete: drawMainMenu(); break; - case FilInsert: - popupHandler(FilChange); + case Popup_FilInsert: + popupHandler(Popup_FilChange); wait_for_user = false; break; - case HeaterTime: - popupHandler(Heating); + case Popup_HeaterTime: + popupHandler(Popup_Heating); wait_for_user = false; break; default: @@ -4687,7 +4688,7 @@ void JyersDWIN::setupValue(const_float_t value, const_float_t min, const_float_t valuemax = max; valueunit = unit; valuetype = type; - process = Value; + process = Proc_Value; encoderRate.enabled = true; drawFloat(tempvalue / unit, selection - scrollpos, true, valueunit); } @@ -4728,7 +4729,7 @@ void JyersDWIN::modifyOption(const uint8_t value, const char * const * options, valuepointer = const_cast(options); valuemin = 0; valuemax = max; - process = Option; + process = Proc_Option; encoderRate.enabled = true; drawOption(value, options, selection - scrollpos, true); } @@ -4785,14 +4786,14 @@ void JyersDWIN::update() { stateUpdate(); screenUpdate(); switch (process) { - case Main: mainMenuControl(); break; - case Menu: menuControl(); break; - case Value: valueControl(); break; - case Option: optionControl(); break; - case File: fileControl(); break; - case Print: printScreenControl(); break; - case Popup: popupControl(); break; - case Confirm: confirmControl(); break; + case Proc_Main: mainMenuControl(); break; + case Proc_Menu: menuControl(); break; + case Proc_Value: valueControl(); break; + case Proc_Option: optionControl(); break; + case Proc_File: fileControl(); break; + case Proc_Print: printScreenControl(); break; + case Proc_Popup: popupControl(); break; + case Proc_Confirm: confirmControl(); break; } } @@ -4809,18 +4810,18 @@ void JyersDWIN::stateUpdate() { } if (print_job_timer.isPaused() != paused) { paused = print_job_timer.isPaused(); - if (process == Print) printScreenIcons(); - if (process == Wait && !paused) redrawMenu(true, true); + if (process == Proc_Print) printScreenIcons(); + if (process == Proc_Wait && !paused) redrawMenu(true, true); } - if (wait_for_user && !(process == Confirm) && !print_job_timer.isPaused()) - confirmHandler(UserInput); + if (wait_for_user && !(process == Proc_Confirm) && !print_job_timer.isPaused()) + confirmHandler(Popup_UserInput); #if ENABLED(ADVANCED_PAUSE_FEATURE) - if (process == Popup && popup == PurgeMore) { + if (process == Proc_Popup && popup == Popup_PurgeMore) { if (pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE) - popupHandler(FilChange); + popupHandler(Popup_FilChange); else if (pause_menu_response == PAUSE_RESPONSE_RESUME_PRINT) { - if (printing) popupHandler(Resuming); - else redrawMenu(true, true, active_menu == PreheatHotend); + if (printing) popupHandler(Popup_Resuming); + else redrawMenu(true, true, active_menu == ID_PreheatHotend); } } #endif @@ -4828,7 +4829,7 @@ void JyersDWIN::stateUpdate() { static bool ranout = false; if (runout.filament_ran_out != ranout) { ranout = runout.filament_ran_out; - if (ranout) popupHandler(Runout); + if (ranout) popupHandler(Popup_Runout); } #endif } @@ -4839,7 +4840,7 @@ void JyersDWIN::screenUpdate() { if (ELAPSED(ms, scrltime)) { scrltime = ms + 200; updateStatusBar(); - if (process == Print) drawPrintFilename(); + if (process == Proc_Print) drawPrintFilename(); } static millis_t statustime = 0; @@ -4851,7 +4852,7 @@ void JyersDWIN::screenUpdate() { static millis_t printtime = 0; if (ELAPSED(ms, printtime)) { printtime = ms + 1000; - if (process == Print) { + if (process == Proc_Print) { drawPrintProgressBar(); drawPrintProgressElapsed(); TERN_(SET_REMAINING_TIME, drawPrintProgressRemain()); @@ -4861,7 +4862,7 @@ void JyersDWIN::screenUpdate() { static bool mounted = card.isMounted(); if (mounted != card.isMounted()) { mounted = card.isMounted(); - if (process == File) + if (process == Proc_File) drawSDList(); } @@ -4895,14 +4896,14 @@ void JyersDWIN::screenUpdate() { #endif #endif // HAS_ZOFFSET_ITEM - if (process == Menu || process == Value) { + if (process == Proc_Menu || process == Proc_Value) { switch (active_menu) { - case TempMenu: + case ID_TempMenu: #if HAS_HOTEND if (thermalManager.temp_hotend[0].target != hotendtarget) { hotendtarget = thermalManager.temp_hotend[0].target; if (scrollpos <= TEMP_HOTEND && TEMP_HOTEND <= scrollpos + MROWS) { - if (process != Value || selection != TEMP_HOTEND - scrollpos) + if (process != Proc_Value || selection != TEMP_HOTEND - scrollpos) drawFloat(thermalManager.temp_hotend[0].target, TEMP_HOTEND - scrollpos, false, 1); } } @@ -4911,7 +4912,7 @@ void JyersDWIN::screenUpdate() { if (thermalManager.temp_bed.target != bedtarget) { bedtarget = thermalManager.temp_bed.target; if (scrollpos <= TEMP_BED && TEMP_BED <= scrollpos + MROWS) { - if (process != Value || selection != TEMP_HOTEND - scrollpos) + if (process != Proc_Value || selection != TEMP_HOTEND - scrollpos) drawFloat(thermalManager.temp_bed.target, TEMP_BED - scrollpos, false, 1); } } @@ -4920,18 +4921,18 @@ void JyersDWIN::screenUpdate() { if (thermalManager.fan_speed[0] != fanspeed) { fanspeed = thermalManager.fan_speed[0]; if (scrollpos <= TEMP_FAN && TEMP_FAN <= scrollpos + MROWS) { - if (process != Value || selection != TEMP_HOTEND - scrollpos) + if (process != Proc_Value || selection != TEMP_HOTEND - scrollpos) drawFloat(thermalManager.fan_speed[0], TEMP_FAN - scrollpos, false, 1); } } #endif break; - case Tune: + case ID_Tune: #if HAS_HOTEND if (thermalManager.temp_hotend[0].target != hotendtarget) { hotendtarget = thermalManager.temp_hotend[0].target; if (scrollpos <= TUNE_HOTEND && TUNE_HOTEND <= scrollpos + MROWS) { - if (process != Value || selection != TEMP_HOTEND - scrollpos) + if (process != Proc_Value || selection != TEMP_HOTEND - scrollpos) drawFloat(thermalManager.temp_hotend[0].target, TUNE_HOTEND - scrollpos, false, 1); } } @@ -4940,7 +4941,7 @@ void JyersDWIN::screenUpdate() { if (thermalManager.temp_bed.target != bedtarget) { bedtarget = thermalManager.temp_bed.target; if (scrollpos <= TUNE_BED && TUNE_BED <= scrollpos + MROWS) { - if (process != Value || selection != TEMP_HOTEND - scrollpos) + if (process != Proc_Value || selection != TEMP_HOTEND - scrollpos) drawFloat(thermalManager.temp_bed.target, TUNE_BED - scrollpos, false, 1); } } @@ -4949,7 +4950,7 @@ void JyersDWIN::screenUpdate() { if (thermalManager.fan_speed[0] != fanspeed) { fanspeed = thermalManager.fan_speed[0]; if (scrollpos <= TUNE_FAN && TUNE_FAN <= scrollpos + MROWS) { - if (process != Value || selection != TEMP_HOTEND - scrollpos) + if (process != Proc_Value || selection != TEMP_HOTEND - scrollpos) drawFloat(thermalManager.fan_speed[0], TUNE_FAN - scrollpos, false, 1); } } @@ -5017,7 +5018,7 @@ void MarlinUI::init_lcd() { encoderConfiguration(); for (uint16_t t = 0; t <= 100; t += 2) { dwinIconShow(ICON, ICON_Bar, 15, 260); - dwinDrawRectangle(1, Color_Bg_Black, 15 + t * 242 / 100, 260, 257, 280); + dwinDrawRectangle(1, COLOR_BG_BLACK, 15 + t * 242 / 100, 260, 257, 280); dwinUpdateLCD(); delay(20); } @@ -5030,10 +5031,10 @@ void MarlinUI::init_lcd() { #if ENABLED(ADVANCED_PAUSE_FEATURE) void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) { switch (message) { - case PAUSE_MESSAGE_INSERT: jyersDWIN.confirmHandler(FilInsert); break; + case PAUSE_MESSAGE_INSERT: jyersDWIN.confirmHandler(Popup_FilInsert); break; case PAUSE_MESSAGE_PURGE: - case PAUSE_MESSAGE_OPTION: jyersDWIN.popupHandler(PurgeMore); break; - case PAUSE_MESSAGE_HEAT: jyersDWIN.confirmHandler(HeaterTime); break; + case PAUSE_MESSAGE_OPTION: jyersDWIN.popupHandler(Popup_PurgeMore); break; + case PAUSE_MESSAGE_HEAT: jyersDWIN.confirmHandler(Popup_HeaterTime); break; case PAUSE_MESSAGE_WAITING: jyersDWIN.drawPrintScreen(); break; default: break; } diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.h b/Marlin/src/lcd/e3v2/jyersui/dwin.h index 98af1c4cbd0b..17b6176f3d88 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.h +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.h @@ -38,61 +38,87 @@ //#define DWIN_CREALITY_LCD_CUSTOM_ICONS enum processID : uint8_t { - Main, Print, Menu, Value, Option, File, Popup, Confirm, Wait + Proc_Main, Proc_Print, Proc_Menu, Proc_Value, Proc_Option, + Proc_File, Proc_Popup, Proc_Confirm, Proc_Wait }; enum PopupID : uint8_t { - Pause, Stop, Resume, SaveLevel, ETemp, ConfFilChange, PurgeMore, MeshSlot, - Level, Home, MoveWait, Heating, FilLoad, FilChange, TempWarn, Runout, PIDWait, MPCWait, Resuming, ManualProbing, - FilInsert, HeaterTime, UserInput, LevelError, InvalidMesh, UI, Complete, Custom + Popup_Pause, + Popup_Stop, + Popup_Resume, + Popup_SaveLevel, + Popup_ETemp, + Popup_ConfFilChange, + Popup_PurgeMore, + Popup_MeshSlot, + Popup_Level, + Popup_Home, + Popup_MoveWait, + Popup_Heating, + Popup_FilLoad, + Popup_FilChange, + Popup_TempWarn, + Popup_Runout, + Popup_PIDWait, + Popup_MPCWait, + Popup_Resuming, + Popup_ManualProbing, + Popup_FilInsert, + Popup_HeaterTime, + Popup_UserInput, + Popup_LevelError, + Popup_InvalidMesh, + Popup_UI, + Popup_Complete, + Popup_Custom }; enum menuID : uint8_t { - MainMenu, - Prepare, - Move, - HomeMenu, - ManualLevel, - ZOffset, - Preheat, - ChangeFilament, - MenuCustom, - Control, - TempMenu, - PID, - HotendPID, - BedPID, + ID_MainMenu, + ID_Prepare, + ID_Move, + ID_HomeMenu, + ID_ManualLevel, + ID_ZOffset, + ID_Preheat, + ID_ChangeFilament, + ID_MenuCustom, + ID_Control, + ID_TempMenu, + ID_PID, + ID_HotendPID, + ID_BedPID, #if HAS_PREHEAT - #define _PREHEAT_ID(N) Preheat##N, + #define _PREHEAT_ID(N) ID_Preheat##N, REPEAT_1(PREHEAT_COUNT, _PREHEAT_ID) #endif #if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) - MPC, + ID_MPC, #endif - Motion, - HomeOffsets, - MaxSpeed, - MaxAcceleration, - MaxJerk, - Steps, - Visual, - ColorSettings, - Advanced, - ProbeMenu, + ID_Motion, + ID_HomeOffsets, + ID_MaxSpeed, + ID_MaxAcceleration, + ID_MaxJerk, + ID_Steps, + ID_Visual, + ID_ColorSettings, + ID_Advanced, + ID_ProbeMenu, #if HAS_TRINAMIC_CONFIG - TMCMenu, + ID_TMCMenu, #endif - Info, - Leveling, - LevelManual, - LevelView, - MeshViewer, - LevelSettings, - ManualMesh, - UBLMesh, - InfoMain, - Tune, - PreheatHotend + ID_Info, + ID_Leveling, + ID_LevelManual, + ID_LevelView, + ID_MeshViewer, + ID_LevelSettings, + ID_ManualMesh, + ID_UBLMesh, + ID_InfoMain, + ID_Tune, + ID_PreheatHotend }; // Custom icons @@ -129,27 +155,27 @@ enum colorID : uint8_t { }; #define Custom_Colors 10 -#define Color_Aqua RGB(0x00,0x3F,0x1F) -#define Color_Light_White 0xBDD7 -#define Color_Green RGB(0x00,0x3F,0x00) -#define Color_Light_Green 0x3460 -#define Color_Cyan 0x07FF -#define Color_Light_Cyan 0x04F3 -#define Color_Blue 0x015F -#define Color_Light_Blue 0x3A6A -#define Color_Magenta 0xF81F -#define Color_Light_Magenta 0x9813 -#define Color_Light_Red 0x8800 -#define Color_Orange 0xFA20 -#define Color_Light_Orange 0xFBC0 -#define Color_Light_Yellow 0x8BE0 -#define Color_Brown 0xCC27 -#define Color_Light_Brown 0x6204 -#define Color_Black 0x0000 -#define Color_Grey 0x18E3 -#define Check_Color 0x4E5C // Check-box check color -#define Confirm_Color 0x34B9 -#define Cancel_Color 0x3186 +#define COLOR_AQUA RGB(0x00,0x3F,0x1F) +#define COLOR_LIGHT_WHITE 0xBDD7 +#define COLOR_GREEN RGB(0x00,0x3F,0x00) +#define COLOR_LIGHT_GREEN 0x3460 +#define COLOR_CYAN 0x07FF +#define COLOR_LIGHT_CYAN 0x04F3 +#define COLOR_BLUE 0x015F +#define COLOR_LIGHT_BLUE 0x3A6A +#define COLOR_MAGENTA 0xF81F +#define COLOR_LIGHT_MAGENTA 0x9813 +#define COLOR_LIGHT_RED 0x8800 +#define COLOR_ORANGE 0xFA20 +#define COLOR_LIGHT_ORANGE 0xFBC0 +#define COLOR_LIGHT_YELLOW 0x8BE0 +#define COLOR_BROWN 0xCC27 +#define COLOR_LIGHT_BROWN 0x6204 +#define COLOR_BLACK 0x0000 +#define COLOR_GREY 0x18E3 +#define COLOR_CHECKBOX 0x4E5C // Check-box check color +#define COLOR_CONFIRM 0x34B9 +#define COLOR_CANCEL 0x3186 class JyersDWIN { public: diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.cpp index b6c26d4fe1ae..13c6de548029 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.cpp @@ -45,7 +45,7 @@ void dwinStartup() { const bool success = dwinHandshake(); if (success) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error."); dwinFrameSetDir(TERN(DWIN_MARLINUI_LANDSCAPE, 0, 1)); - dwinFrameClear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here + dwinFrameClear(COLOR_BG_BLACK); // MarlinUI handles the bootscreen so just clear here dwinJPGShowAndCache(3); dwinUpdateLCD(); } diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index 3cf89e7b3e0f..ebfb10c8c040 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -48,7 +48,7 @@ // DWIN printing specifies the font on each string operation // but we'll make the font modal for Marlin -dwin_font_t dwin_font = { font8x16, 8, 16, Color_White, Color_Bg_Black, true }; +dwin_font_t dwin_font = { font8x16, 8, 16, COLOR_WHITE, COLOR_BG_BLACK, true }; void MarlinUI::set_font(const uint8_t font_nr) { if (font_nr != dwin_font.index) { dwin_font.index = font_nr; @@ -84,7 +84,7 @@ void MarlinUI::init_lcd() { dwinStartup(); } void MarlinUI::clear_lcd() { dwinIconAnimationControl(0x0000); // disable all icon animations dwinJPGShowAndCache(3); - dwinFrameClear(Color_Bg_Black); + dwinFrameClear(COLOR_BG_BLACK); dwinUpdateLCD(); did_first_redraw = false; @@ -109,7 +109,7 @@ void MarlinUI::clear_lcd() { #define VERSION_Y 84 #endif - dwinDrawString(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string())); + dwinDrawString(false, font10x20, COLOR_YELLOW, COLOR_BG_BLACK, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string())); TERN_(SHOW_CUSTOM_BOOTSCREEN, safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT)); clear_lcd(); @@ -126,7 +126,7 @@ void MarlinUI::clear_lcd() { dwinIconShow(BOOT_ICON, ICON_MarlinURL, INFO_CENTER - 100 / 2, 152); dwinIconShow(BOOT_ICON, ICON_Copyright, INFO_CENTER - 126 / 2, 200); #endif - dwinDrawString(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string())); + dwinDrawString(false, font10x20, COLOR_YELLOW, COLOR_BG_BLACK, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string())); dwinUpdateLCD(); } @@ -140,14 +140,14 @@ void MarlinUI::clear_lcd() { // The kill screen is displayed for unrecoverable conditions void MarlinUI::draw_kill_screen() { set_font(DWIN_FONT_ALERT); - dwinFrameClear(Color_Bg_Black); - dwin_font.fg = Color_Error_Red; + dwinFrameClear(COLOR_BG_BLACK); + dwin_font.fg = COLOR_ERROR_RED; dwin_font.solid = false; - dwinDrawRectangle(1, Color_Bg_Window, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20); + dwinDrawRectangle(1, COLOR_BG_WINDOW, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20); // make the frame a few pixels thick - dwinDrawRectangle(0, Color_Yellow, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20); - dwinDrawRectangle(0, Color_Yellow, 21, 21, LCD_PIXEL_WIDTH - 21, LCD_PIXEL_HEIGHT - 21); - dwinDrawRectangle(0, Color_Yellow, 22, 22, LCD_PIXEL_WIDTH - 22, LCD_PIXEL_HEIGHT - 22); + dwinDrawRectangle(0, COLOR_YELLOW, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20); + dwinDrawRectangle(0, COLOR_YELLOW, 21, 21, LCD_PIXEL_WIDTH - 21, LCD_PIXEL_HEIGHT - 21); + dwinDrawRectangle(0, COLOR_YELLOW, 22, 22, LCD_PIXEL_WIDTH - 22, LCD_PIXEL_HEIGHT - 22); uint8_t cx = (LCD_PIXEL_WIDTH / dwin_font.width / 2), cy = (LCD_PIXEL_HEIGHT / dwin_font.height / 2); @@ -178,8 +178,8 @@ void MarlinUI::draw_kill_screen() { void MarlinUI::draw_status_message(const bool blink) { set_font(DWIN_FONT_STAT); dwin_font.solid = true; - dwin_font.fg = Color_White; - dwin_font.bg = Color_Bg_Black; + dwin_font.fg = COLOR_WHITE; + dwin_font.bg = COLOR_BG_BLACK; lcd_moveto_xy(0, LCD_PIXEL_HEIGHT - (STAT_FONT_HEIGHT) - 1); constexpr uint8_t max_status_chars = (LCD_PIXEL_WIDTH) / (STAT_FONT_WIDTH); @@ -267,7 +267,7 @@ void MarlinUI::draw_status_message(const bool blink) { void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) { dwin_font.solid = false; - dwin_font.fg = Color_White; + dwin_font.fg = COLOR_WHITE; dwin_string.set('E'); dwin_string.add('1' + extruder); dwin_string.add(' '); @@ -293,10 +293,10 @@ void MarlinUI::draw_status_message(const bool blink) { dwinDrawBox(1, Color_Bg_Heading, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1); else { #if ENABLED(MENU_HOLLOW_FRAME) - dwinDrawBox(1, Color_Bg_Black, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1); - if (sel) dwinDrawBox(0, Select_Color, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1); + dwinDrawBox(1, COLOR_BG_BLACK, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1); + if (sel) dwinDrawBox(0, COLOR_SELECT, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1); #else - dwinDrawBox(1, sel ? Select_Color : Color_Bg_Black, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1); + dwinDrawBox(1, sel ? COLOR_SELECT : COLOR_BG_BLACK, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1); #endif } @@ -311,7 +311,7 @@ void MarlinUI::draw_status_message(const bool blink) { if (mark_as_selected(row, (bool)(style & SS_INVERT), true)) { ui.set_font(DWIN_FONT_MENU); dwin_font.solid = false; - dwin_font.fg = Color_White; + dwin_font.fg = COLOR_WHITE; dwin_string.set(); @@ -356,7 +356,7 @@ void MarlinUI::draw_status_message(const bool blink) { if (mark_as_selected(row, sel)) { ui.set_font(DWIN_FONT_MENU); dwin_font.solid = false; - dwin_font.fg = Color_White; + dwin_font.fg = COLOR_WHITE; dwin_string.set(ftpl, itemIndex, itemStringC, itemStringF); @@ -377,7 +377,7 @@ void MarlinUI::draw_status_message(const bool blink) { if (mark_as_selected(row, sel)) { ui.set_font(DWIN_FONT_MENU); dwin_font.solid = false; - dwin_font.fg = Color_White; + dwin_font.fg = COLOR_WHITE; const uint8_t vallen = (pgm ? utf8_strlen_P(inStr) : utf8_strlen(S(inStr))); @@ -388,7 +388,7 @@ void MarlinUI::draw_status_message(const bool blink) { lcd_put_dwin_string(); if (vallen) { - dwin_font.fg = Color_Yellow; + dwin_font.fg = COLOR_YELLOW; dwin_string.set(inStr); lcd_moveto(LCD_WIDTH - vallen - 1, row); lcd_put_dwin_string(); @@ -410,7 +410,7 @@ void MarlinUI::draw_status_message(const bool blink) { // Assume the label is alpha-numeric (with a descender) const uint16_t row = (LCD_HEIGHT / 2) - 1; - dwin_font.fg = Color_White; + dwin_font.fg = COLOR_WHITE; dwin_font.solid = true; lcd_moveto((LCD_WIDTH - labellen + !!vallen) / 2, row); lcd_put_dwin_string(); @@ -420,7 +420,7 @@ void MarlinUI::draw_status_message(const bool blink) { dwin_string.set(value); const dwin_coord_t by = (row * MENU_LINE_HEIGHT) + MENU_FONT_HEIGHT + EXTRA_ROW_HEIGHT / 2; - dwinDrawString(true, font16x32, Color_Yellow, Color_Bg_Black, (LCD_PIXEL_WIDTH - vallen * 16) / 2, by, S(dwin_string.string())); + dwinDrawString(true, font16x32, COLOR_YELLOW, COLOR_BG_BLACK, (LCD_PIXEL_WIDTH - vallen * 16) / 2, by, S(dwin_string.string())); if (ui.can_show_slider()) { @@ -430,11 +430,11 @@ void MarlinUI::draw_status_message(const bool blink) { slider_y = by + 32 + 4, amount = ui.encoderPosition * slider_length / maxEditValue; - dwinDrawRectangle(1, Color_Bg_Window, slider_x - 1, slider_y - 1, slider_x - 1 + slider_length + 2 - 1, slider_y - 1 + slider_height + 2 - 1); + dwinDrawRectangle(1, COLOR_BG_WINDOW, slider_x - 1, slider_y - 1, slider_x - 1 + slider_length + 2 - 1, slider_y - 1 + slider_height + 2 - 1); if (amount > 0) - dwinDrawBox(1, BarFill_Color, slider_x, slider_y, amount, slider_height); + dwinDrawBox(1, COLOR_BARFILL, slider_x, slider_y, amount, slider_height); if (amount < slider_length) - dwinDrawBox(1, Color_Bg_Black, slider_x + amount, slider_y, slider_length - amount, slider_height); + dwinDrawBox(1, COLOR_BG_BLACK, slider_x + amount, slider_y, slider_length - amount, slider_height); } } } @@ -445,7 +445,7 @@ void MarlinUI::draw_status_message(const bool blink) { col = yesopt ? LCD_WIDTH - mar - len : mar, row = (LCD_HEIGHT >= 8 ? LCD_HEIGHT / 2 + 3 : LCD_HEIGHT - 1); lcd_moveto(col, row); - dwinDrawBox(1, inv ? Select_Color : Color_Bg_Black, cursor.x - dwin_font.width, cursor.y + 1, dwin_font.width * (len + 2), dwin_font.height + 2); + dwinDrawBox(1, inv ? COLOR_SELECT : COLOR_BG_BLACK, cursor.x - dwin_font.width, cursor.y + 1, dwin_font.width * (len + 2), dwin_font.height + 2); lcd_put_u8str(col, row, fstr); } @@ -455,7 +455,7 @@ void MarlinUI::draw_status_message(const bool blink) { ) { ui.set_font(DWIN_FONT_MENU); dwin_font.solid = false; - dwin_font.fg = Color_White; + dwin_font.fg = COLOR_WHITE; ui.draw_select_screen_prompt(pref, string, suff); if (no) draw_boxed_string(false, no, !yesno); if (yes) draw_boxed_string(true, yes, yesno); @@ -507,9 +507,9 @@ void MarlinUI::draw_status_message(const bool blink) { // Clear the Mesh Map // First draw the bigger box in White so we have a border around the mesh map box - dwinDrawRectangle(1, Color_White, x_offset - 2, y_offset - 2, x_offset + 2 + x_map_pixels, y_offset + 2 + y_map_pixels); + dwinDrawRectangle(1, COLOR_WHITE, x_offset - 2, y_offset - 2, x_offset + 2 + x_map_pixels, y_offset + 2 + y_map_pixels); // Now actually clear the mesh map box - dwinDrawRectangle(1, Color_Bg_Black, x_offset, y_offset, x_offset + x_map_pixels, y_offset + y_map_pixels); + dwinDrawRectangle(1, COLOR_BG_BLACK, x_offset, y_offset, x_offset + x_map_pixels, y_offset + y_map_pixels); // Fill in the Specified Mesh Point @@ -517,7 +517,7 @@ void MarlinUI::draw_status_message(const bool blink) { // invert the Y to get it to plot in the right location. const dwin_coord_t by = y_offset + y_plot_inv * pixels_per_y_mesh_pnt; - dwinDrawRectangle(1, Select_Color, + dwinDrawRectangle(1, COLOR_SELECT, x_offset + (x_plot * pixels_per_x_mesh_pnt), by, x_offset + (x_plot * pixels_per_x_mesh_pnt) + pixels_per_x_mesh_pnt, by + pixels_per_y_mesh_pnt ); @@ -527,12 +527,12 @@ void MarlinUI::draw_status_message(const bool blink) { dwin_coord_t y = y_offset + pixels_per_y_mesh_pnt / 2; for (uint8_t j = 0; j < (GRID_MAX_POINTS_Y); j++, y += pixels_per_y_mesh_pnt) for (uint8_t i = 0, x = sx; i < (GRID_MAX_POINTS_X); i++, x += pixels_per_x_mesh_pnt) - dwinDrawPoint(Color_White, 1, 1, x, y); + dwinDrawPoint(COLOR_WHITE, 1, 1, x, y); // Put Relevant Text on Display // Show X and Y positions at top of screen - dwin_font.fg = Color_White; + dwin_font.fg = COLOR_WHITE; dwin_font.solid = true; const xy_pos_t pos = { bedlevel.get_mesh_x(x_plot), bedlevel.get_mesh_y(y_plot) }, lpos = pos.asLogical(); @@ -586,7 +586,7 @@ void MarlinUI::draw_status_message(const bool blink) { const int nozzle = (LCD_PIXEL_WIDTH / 2) - 20; // Draw a representation of the nozzle - dwinDrawBox(1, Color_Bg_Black, nozzle + 3, 8, 48, 52); // 'clear' the area where the nozzle is drawn in case it was moved up/down + dwinDrawBox(1, COLOR_BG_BLACK, nozzle + 3, 8, 48, 52); // 'clear' the area where the nozzle is drawn in case it was moved up/down dwinIconShow(ICON, ICON_HotendOff, nozzle + 3, 10 - dir); dwinIconShow(ICON, ICON_BedLine, nozzle, 10 + 36); diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp index 381aea6b17da..c0b7ba90eccc 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp @@ -72,7 +72,7 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink, const bool x_redraw = !ui.did_first_redraw || old_is_printing != print_job_timer.isRunning(); if (x_redraw) { dwin_string.set('X' + axis); - dwinDrawString(true, font16x32, Color_IconBlue, Color_Bg_Black, + dwinDrawString(true, font16x32, COLOR_ICONBLUE, COLOR_BG_BLACK, #if ENABLED(DWIN_MARLINUI_PORTRAIT) x + (utf8_strlen(value) * 14 - 14) / 2, y + 2 #else @@ -96,7 +96,7 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink, if (TERN0(LCD_SHOW_E_TOTAL, x_redraw && axis == X_AXIS)) dwin_string.add(F(" ")); - dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, + dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, #if ENABLED(DWIN_MARLINUI_PORTRAIT) x, y + 32 #else @@ -117,26 +117,26 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink, if (e_redraw) { // Extra spaces to erase previous value dwin_string.set(F("E ")); - dwinDrawString(true, font16x32, Color_IconBlue, Color_Bg_Black, x + (4 * 14 / 2) - 7, y + 2, S(dwin_string.string())); + dwinDrawString(true, font16x32, COLOR_ICONBLUE, COLOR_BG_BLACK, x + (4 * 14 / 2) - 7, y + 2, S(dwin_string.string())); } dwin_string.set(ui16tostr5rj(value / scale)); - dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + 32, S(dwin_string.string())); + dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, x, y + 32, S(dwin_string.string())); // Extra spaces to erase previous value - dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, x + (5 * 14), y + 32, S(scale == 1 ? "mm " : "cm ")); + dwinDrawString(true, font14x28, COLOR_ICONBLUE, COLOR_BG_BLACK, x + (5 * 14), y + 32, S(scale == 1 ? "mm " : "cm ")); #else // !DWIN_MARLINUI_PORTRAIT if (e_redraw) { dwin_string.set(F("E ")); - dwinDrawString(true, font16x32, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string())); + dwinDrawString(true, font16x32, COLOR_ICONBLUE, COLOR_BG_BLACK, x, y, S(dwin_string.string())); } dwin_string.set(ui16tostr5rj(value / scale)); - dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x + 32, y + 4, S(dwin_string.string())); + dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, x + 32, y + 4, S(dwin_string.string())); - dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, x + (32 + 70), y + 4, S(scale == 1 ? "mm " : "cm ")); + dwinDrawString(true, font14x28, COLOR_ICONBLUE, COLOR_BG_BLACK, x + (32 + 70), y + 4, S(scale == 1 ? "mm " : "cm ")); #endif // !DWIN_MARLINUI_PORTRAIT } @@ -154,13 +154,13 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink, dwinIconAnimation(0, fan_on, ICON, ICON_Fan0, ICON_Fan3, x + fanx, y, 25); dwin_string.set(i8tostr3rj(thermalManager.scaledFanSpeedPercent(0))); dwin_string.add('%'); - dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); + dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); } else { dwinIconAnimationControl(0x0000); // disable all icon animations (this is the only one) dwinIconShow(ICON, ICON_Fan0, x + fanx, y); dwin_string.set(F(" ")); - dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); + dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); } } #endif @@ -230,7 +230,7 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x if (t_draw) { dwin_string.set(i16tostr3rj(tt + 0.5)); dwin_string.add(LCD_STR_DEGREE); - dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y, S(dwin_string.string())); + dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, x, y, S(dwin_string.string())); } // Draw heater icon with on / off / leveled states @@ -243,7 +243,7 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x if (c_draw) { dwin_string.set(i16tostr3rj(tc + 0.5)); dwin_string.add(LCD_STR_DEGREE); - dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + 70, S(dwin_string.string())); + dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, x, y + 70, S(dwin_string.string())); } } @@ -253,12 +253,12 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x FORCE_INLINE void _draw_feedrate_status(const char *value, uint16_t x, uint16_t y) { if (!ui.did_first_redraw) { dwin_string.set(LCD_STR_FEEDRATE); - dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string())); + dwinDrawString(true, font14x28, COLOR_ICONBLUE, COLOR_BG_BLACK, x, y, S(dwin_string.string())); } dwin_string.set(value); dwin_string.add('%'); - dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x + 14, y, S(dwin_string.string())); + dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, x + 14, y, S(dwin_string.string())); } /** @@ -281,7 +281,7 @@ void MarlinUI::draw_status_screen() { ); // Draw a frame around the x/y/z values - dwinDrawRectangle(0, Select_Color, + dwinDrawRectangle(0, COLOR_SELECT, #if ENABLED(DWIN_MARLINUI_PORTRAIT) 0, 193, LCD_PIXEL_WIDTH - 1, 260 #else @@ -358,7 +358,7 @@ void MarlinUI::draw_status_screen() { time.toDigital(buffer); dwin_string.add(prefix); dwin_string.add(buffer); - dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, (LCD_PIXEL_WIDTH - ((dwin_string.length + 1) * 14)), 290, S(dwin_string.string())); + dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, (LCD_PIXEL_WIDTH - ((dwin_string.length + 1) * 14)), 290, S(dwin_string.string())); #else @@ -367,23 +367,23 @@ void MarlinUI::draw_status_screen() { time.toDigital(buffer); dwin_string.set(' '); dwin_string.add(buffer); - dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, 230, 170, S(dwin_string.string())); + dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, 230, 170, S(dwin_string.string())); #if ENABLED(SHOW_REMAINING_TIME) if (print_job_timer.isRunning()) { time = get_remaining_time(); - dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(" R ")); + dwinDrawString(true, font14x28, COLOR_ICONBLUE, COLOR_BG_BLACK, 336, 170, S(" R ")); if (print_job_timer.isPaused() && blink) dwin_string.set(F(" ")); else { time.toDigital(buffer); dwin_string.set(buffer); } - dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, 378, 170, S(dwin_string.string())); + dwinDrawString(true, font14x28, COLOR_WHITE, COLOR_BG_BLACK, 378, 170, S(dwin_string.string())); } else if (!ui.did_first_redraw || old_is_printing != print_job_timer.isRunning()) { dwin_string.set(F(" ")); - dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(dwin_string.string())); + dwinDrawString(true, font14x28, COLOR_ICONBLUE, COLOR_BG_BLACK, 336, 170, S(dwin_string.string())); } #endif #endif @@ -403,7 +403,7 @@ void MarlinUI::draw_status_screen() { const progress_t progress = TERN(HAS_PRINT_PROGRESS_PERMYRIAD, get_progress_permyriad, get_progress_percent)(); if (!ui.did_first_redraw) - dwinDrawRectangle(0, Select_Color, pb_left, pb_top, pb_right, pb_bottom); // Outline + dwinDrawRectangle(0, COLOR_SELECT, pb_left, pb_top, pb_right, pb_bottom); // Outline static uint16_t old_solid = 50; const uint16_t pb_solid = (pb_width - 2) * (progress / (PROGRESS_SCALE)) * 0.01f; @@ -411,16 +411,16 @@ void MarlinUI::draw_status_screen() { if (p_draw) { //if (pb_solid) - dwinDrawRectangle(1, Select_Color, pb_left + 1, pb_top + 1, pb_left + pb_solid, pb_bottom - 1); // Fill the solid part + dwinDrawRectangle(1, COLOR_SELECT, pb_left + 1, pb_top + 1, pb_left + pb_solid, pb_bottom - 1); // Fill the solid part //if (pb_solid < old_solid) - dwinDrawRectangle(1, Color_Bg_Black, pb_left + 1 + pb_solid, pb_top + 1, pb_right - 1, pb_bottom - 1); // Erase the rest + dwinDrawRectangle(1, COLOR_BG_BLACK, pb_left + 1 + pb_solid, pb_top + 1, pb_right - 1, pb_bottom - 1); // Erase the rest #if ENABLED(SHOW_PROGRESS_PERCENT) dwin_string.set(TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(progress), ui8tostr3rj(progress / (PROGRESS_SCALE)))); dwin_string.add('%'); dwinDrawString( - false, font16x32, Percent_Color, Color_Bg_Black, + false, font16x32, COLOR_PERCENT, COLOR_BG_BLACK, pb_left + (pb_width - dwin_string.length * 16) / 2, pb_top + (pb_height - 32) / 2 - 1, S(dwin_string.string()) diff --git a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp index d4e2262be17f..4ab98b17116e 100644 --- a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp +++ b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp @@ -224,13 +224,13 @@ bool BedLevelToolsClass::meshvalidate() { const float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); // Clear background from previous selection and select new square - dwinDrawRectangle(1, Color_Bg_Black, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); + dwinDrawRectangle(1, COLOR_BG_BLACK, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); if (selected >= 0) { const auto selected_y = selected / (GRID_MAX_POINTS_X); const auto selected_x = selected - (GRID_MAX_POINTS_X) * selected_y; const auto start_y_px = padding_y_top + selected_y * cell_height_px; const auto start_x_px = padding_x + selected_x * cell_width_px; - dwinDrawRectangle(1, Color_White, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px); + dwinDrawRectangle(1, COLOR_WHITE, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px); } // Draw value square grid @@ -240,7 +240,7 @@ bool BedLevelToolsClass::meshvalidate() { const auto start_y_px = padding_y_top + ((GRID_MAX_POINTS_Y) - y - 1) * cell_height_px; const auto end_y_px = start_y_px + cell_height_px - 1 - gridline_width; dwinDrawRectangle(1, // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/ - isnan(bedlevel.z_values[x][y]) ? Color_Grey : ( // gray if undefined + isnan(bedlevel.z_values[x][y]) ? COLOR_GREY : ( // gray if undefined (bedlevel.z_values[x][y] < 0 ? (uint16_t)round(0x1F * -bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_min)) << 11 : // red if mesh point value is negative (uint16_t)round(0x3F * bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_max)) << 5) | // green if mesh point value is positive @@ -257,7 +257,7 @@ bool BedLevelToolsClass::meshvalidate() { if (viewer_print_value) { int8_t offset_x, offset_y = cell_height_px / 2 - fs; if (isnan(bedlevel.z_values[x][y])) { // undefined - dwinDrawString(false, meshfont, Color_White, Color_Bg_Blue, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); + dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); } else { // has value if (GRID_MAX_POINTS_X < (ENABLED(TJC_DISPLAY) ? 8 : 10)) @@ -266,8 +266,8 @@ bool BedLevelToolsClass::meshvalidate() { sprintf_P(buf, PSTR("%02i"), (uint16_t)(abs(bedlevel.z_values[x][y] - (int16_t)bedlevel.z_values[x][y]) * 100)); offset_x = cell_width_px / 2 - (fs/2) * (strlen(buf)) - 2; if (!(GRID_MAX_POINTS_X < (ENABLED(TJC_DISPLAY) ? 8 : 10))) - dwinDrawString(false, meshfont, Color_White, Color_Bg_Blue, start_x_px - 2 + offset_x, start_y_px + offset_y, F(".")); - dwinDrawString(false, meshfont, Color_White, Color_Bg_Blue, start_x_px + 1 + offset_x, start_y_px + offset_y, buf); + dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px - 2 + offset_x, start_y_px + offset_y, F(".")); + dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + 1 + offset_x, start_y_px + offset_y, buf); } safe_delay(10); LCD_SERIAL.flushTX(); diff --git a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h index 67beddec613e..40652cfc419f 100644 --- a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h +++ b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h @@ -57,8 +57,7 @@ class BedLevelToolsClass { static bool viewer_print_value; #endif static bool goto_mesh_value; - static uint8_t mesh_x; - static uint8_t mesh_y; + static uint8_t mesh_x, mesh_y; static uint8_t tilt_grid; #if ENABLED(AUTO_BED_LEVELING_UBL) From 1999869f603556242117cbb95891d1d27e48f70c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 30 Jun 2023 00:58:39 -0500 Subject: [PATCH 2/2] Apply case (ProUI) --- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 4 +- Marlin/src/feature/runout.cpp | 2 +- Marlin/src/gcode/bedlevel/abl/G29.cpp | 4 +- Marlin/src/gcode/bedlevel/mbl/G29.cpp | 6 +- Marlin/src/gcode/bedlevel/ubl/M421.cpp | 4 +- Marlin/src/gcode/config/M302.cpp | 2 +- Marlin/src/gcode/control/M997.cpp | 2 +- Marlin/src/gcode/lcd/M0_M1.cpp | 4 +- Marlin/src/gcode/sd/M1001.cpp | 2 - Marlin/src/gcode/stats/M75-M78.cpp | 2 +- Marlin/src/gcode/temp/M303.cpp | 6 +- Marlin/src/inc/Conditionals_post.h | 6 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 20 +- Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp | 68 +- Marlin/src/lcd/e3v2/proui/bedlevel_tools.h | 32 +- Marlin/src/lcd/e3v2/proui/dwin.cpp | 2874 +++++++++--------- Marlin/src/lcd/e3v2/proui/dwin.h | 349 ++- Marlin/src/lcd/e3v2/proui/dwin_defines.h | 42 +- Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp | 16 +- Marlin/src/lcd/e3v2/proui/dwin_lcd.h | 16 +- Marlin/src/lcd/e3v2/proui/dwin_popup.cpp | 30 +- Marlin/src/lcd/e3v2/proui/dwin_popup.h | 42 +- Marlin/src/lcd/e3v2/proui/dwinui.cpp | 140 +- Marlin/src/lcd/e3v2/proui/dwinui.h | 342 +-- Marlin/src/lcd/e3v2/proui/endstop_diag.cpp | 28 +- Marlin/src/lcd/e3v2/proui/endstop_diag.h | 8 +- Marlin/src/lcd/e3v2/proui/gcode_preview.cpp | 16 +- Marlin/src/lcd/e3v2/proui/lockscreen.cpp | 34 +- Marlin/src/lcd/e3v2/proui/lockscreen.h | 4 +- Marlin/src/lcd/e3v2/proui/menus.cpp | 412 +-- Marlin/src/lcd/e3v2/proui/menus.h | 198 +- Marlin/src/lcd/e3v2/proui/meshviewer.cpp | 68 +- Marlin/src/lcd/e3v2/proui/meshviewer.h | 14 +- Marlin/src/lcd/e3v2/proui/plot.cpp | 24 +- Marlin/src/lcd/e3v2/proui/plot.h | 4 +- Marlin/src/lcd/e3v2/proui/printstats.cpp | 40 +- Marlin/src/lcd/e3v2/proui/printstats.h | 12 +- Marlin/src/lcd/marlinui.cpp | 2 +- Marlin/src/module/motion.h | 2 +- Marlin/src/module/probe.cpp | 2 +- Marlin/src/module/settings.cpp | 8 +- Marlin/src/module/stepper.cpp | 2 +- Marlin/src/module/temperature.cpp | 20 +- 43 files changed, 2456 insertions(+), 2457 deletions(-) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 3b8ee33730f3..6f5187cc9f39 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -759,7 +759,7 @@ void unified_bed_leveling::shift_mesh_height() { TERN_(HAS_MARLINUI_MENU, ui.capture()); TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart()); - TERN_(DWIN_LCD_PROUI, DWIN_LevelingStart()); + TERN_(DWIN_LCD_PROUI, dwinLevelingStart()); save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained grid_count_t count = GRID_MAX_POINTS; @@ -820,7 +820,7 @@ void unified_bed_leveling::shift_mesh_height() { ); TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone()); - TERN_(DWIN_LCD_PROUI, DWIN_LevelingDone()); + TERN_(DWIN_LCD_PROUI, dwinLevelingDone()); } #endif // HAS_BED_PROBE diff --git a/Marlin/src/feature/runout.cpp b/Marlin/src/feature/runout.cpp index a1d4d259b768..db325dee7a08 100644 --- a/Marlin/src/feature/runout.cpp +++ b/Marlin/src/feature/runout.cpp @@ -88,7 +88,7 @@ void event_filament_runout(const uint8_t extruder) { #endif TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getTool(extruder))); - TERN_(DWIN_LCD_PROUI, DWIN_FilamentRunout(extruder)); + TERN_(DWIN_LCD_PROUI, dwinFilamentRunout(extruder)); #if ANY(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS, MULTI_FILAMENT_SENSOR) const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, extruder); diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 5632c6e46721..5ecb6af66c58 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -429,7 +429,7 @@ G29_TYPE GcodeSuite::G29() { if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> 3-point Leveling"); points[0].z = points[1].z = points[2].z = 0; // Probe at 3 arbitrary points #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) - TERN_(DWIN_LCD_PROUI, DWIN_LevelingStart()); + TERN_(DWIN_LCD_PROUI, dwinLevelingStart()); #endif TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart()); @@ -440,7 +440,7 @@ G29_TYPE GcodeSuite::G29() { #if ENABLED(PREHEAT_BEFORE_LEVELING) if (!abl.dryrun) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, #if ALL(DWIN_LCD_PROUI, HAS_HEATED_BED) - HMI_data.BedLevT + hmiData.bedLevT #else LEVELING_BED_TEMP #endif diff --git a/Marlin/src/gcode/bedlevel/mbl/G29.cpp b/Marlin/src/gcode/bedlevel/mbl/G29.cpp index 4bc9ba777a09..c5e02b91f9bd 100644 --- a/Marlin/src/gcode/bedlevel/mbl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/mbl/G29.cpp @@ -143,7 +143,7 @@ void GcodeSuite::G29() { queue.inject(F("G29S2")); TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart()); - TERN_(DWIN_LCD_PROUI, DWIN_LevelingStart()); + TERN_(DWIN_LCD_PROUI, dwinLevelingStart()); return; } @@ -169,7 +169,7 @@ void GcodeSuite::G29() { // Save Z for the previous mesh position bedlevel.set_zigzag_z(mbl_probe_index - 1, current_position.z); TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, current_position.z)); - TERN_(DWIN_LCD_PROUI, DWIN_MeshUpdate(_MIN(mbl_probe_index, GRID_MAX_POINTS), int(GRID_MAX_POINTS), current_position.z)); + TERN_(DWIN_LCD_PROUI, dwinMeshUpdate(_MIN(mbl_probe_index, GRID_MAX_POINTS), int(GRID_MAX_POINTS), current_position.z)); SET_SOFT_ENDSTOP_LOOSE(false); } // If there's another point to sample, move there with optional lift. @@ -236,7 +236,7 @@ void GcodeSuite::G29() { if (parser.seenval('Z')) { bedlevel.z_values[ix][iy] = parser.value_linear_units(); TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, bedlevel.z_values[ix][iy])); - TERN_(DWIN_LCD_PROUI, DWIN_MeshUpdate(ix, iy, bedlevel.z_values[ix][iy])); + TERN_(DWIN_LCD_PROUI, dwinMeshUpdate(ix, iy, bedlevel.z_values[ix][iy])); } else return echo_not_entered('Z'); diff --git a/Marlin/src/gcode/bedlevel/ubl/M421.cpp b/Marlin/src/gcode/bedlevel/ubl/M421.cpp index ff74f4c6f744..3a5aa8cb038c 100644 --- a/Marlin/src/gcode/bedlevel/ubl/M421.cpp +++ b/Marlin/src/gcode/bedlevel/ubl/M421.cpp @@ -66,10 +66,10 @@ void GcodeSuite::M421() { else if (!WITHIN(ij.x, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(ij.y, 0, GRID_MAX_POINTS_Y - 1)) SERIAL_ERROR_MSG(STR_ERR_MESH_XY); else { - float &zval = bedlevel.z_values[ij.x][ij.y]; // Altering this Mesh Point + float &zval = bedlevel.z_values[ij.x][ij.y]; // Altering this Mesh Point zval = hasN ? NAN : parser.value_linear_units() + (hasQ ? zval : 0); // N=NAN, Z=NEWVAL, or Q=ADDVAL TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ij.x, ij.y, zval)); // Ping ExtUI in case it's showing the mesh - TERN_(DWIN_LCD_PROUI, DWIN_MeshUpdate(ij.x, ij.y, zval)); + TERN_(DWIN_LCD_PROUI, dwinMeshUpdate(ij.x, ij.y, zval)); } } diff --git a/Marlin/src/gcode/config/M302.cpp b/Marlin/src/gcode/config/M302.cpp index 26e5a468cabc..3373e143251c 100644 --- a/Marlin/src/gcode/config/M302.cpp +++ b/Marlin/src/gcode/config/M302.cpp @@ -51,7 +51,7 @@ void GcodeSuite::M302() { if (seen_S) { thermalManager.extrude_min_temp = parser.value_celsius(); thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0); - TERN_(DWIN_LCD_PROUI, HMI_data.ExtMinT = thermalManager.extrude_min_temp); + TERN_(DWIN_LCD_PROUI, hmiData.extMinT = thermalManager.extrude_min_temp); } if (parser.seen('P')) diff --git a/Marlin/src/gcode/control/M997.cpp b/Marlin/src/gcode/control/M997.cpp index 74ed8b0d073e..5ac0ba23bbca 100644 --- a/Marlin/src/gcode/control/M997.cpp +++ b/Marlin/src/gcode/control/M997.cpp @@ -33,7 +33,7 @@ */ void GcodeSuite::M997() { - TERN_(DWIN_LCD_PROUI, DWIN_RebootScreen()); + TERN_(DWIN_LCD_PROUI, dwinRebootScreen()); flashFirmware(parser.intval('S')); diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index 4e4625e9483d..fcab61b59d92 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -73,9 +73,9 @@ void GcodeSuite::M0_M1() { ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_USERWAIT)); #elif ENABLED(DWIN_LCD_PROUI) if (parser.string_arg) - DWIN_Popup_Confirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT)); + dwinPopupConfirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT)); else - DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT_F(MSG_STOPPED), GET_TEXT_F(MSG_USERWAIT)); + dwinPopupConfirm(ICON_BLTouch, GET_TEXT_F(MSG_STOPPED), GET_TEXT_F(MSG_USERWAIT)); #else if (parser.string_arg) { diff --git a/Marlin/src/gcode/sd/M1001.cpp b/Marlin/src/gcode/sd/M1001.cpp index c49909646eaa..a00ca6122845 100644 --- a/Marlin/src/gcode/sd/M1001.cpp +++ b/Marlin/src/gcode/sd/M1001.cpp @@ -49,8 +49,6 @@ #if ENABLED(EXTENSIBLE_UI) #include "../../lcd/extui/ui_api.h" -#elif ENABLED(DWIN_LCD_PROUI) - #include "../../lcd/e3v2/proui/dwin.h" #endif #if ENABLED(HOST_ACTION_COMMANDS) diff --git a/Marlin/src/gcode/stats/M75-M78.cpp b/Marlin/src/gcode/stats/M75-M78.cpp index 2ff04797eb28..bced97351dac 100644 --- a/Marlin/src/gcode/stats/M75-M78.cpp +++ b/Marlin/src/gcode/stats/M75-M78.cpp @@ -39,7 +39,7 @@ void GcodeSuite::M75() { startOrResumeJob(); #if ENABLED(DWIN_LCD_PROUI) - if (!IS_SD_PRINTING()) DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT)); + if (!IS_SD_PRINTING()) dwinPrintHeader(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT)); #endif } diff --git a/Marlin/src/gcode/temp/M303.cpp b/Marlin/src/gcode/temp/M303.cpp index 48eebaa0e4d8..f9f3abc5bd4e 100644 --- a/Marlin/src/gcode/temp/M303.cpp +++ b/Marlin/src/gcode/temp/M303.cpp @@ -31,7 +31,7 @@ #if ENABLED(EXTENSIBLE_UI) #include "../../lcd/extui/ui_api.h" -#elif ENABLED(DWIN_LCD_PROUI) +#elif ENABLED(PROUI_PID_TUNE) #include "../../lcd/e3v2/proui/dwin.h" #endif @@ -69,7 +69,7 @@ void GcodeSuite::M303() { SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_BAD_HEATER_ID); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_HEATER_ID)); - TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_BAD_HEATER_ID)); + TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_BAD_HEATER_ID)); return; } @@ -79,7 +79,7 @@ void GcodeSuite::M303() { const celsius_t temp = seenS ? parser.value_celsius() : default_temp; const bool u = parser.boolval('U'); - TERN_(DWIN_PID_TUNE, DWIN_StartM303(seenC, c, seenS, hid, temp)); + TERN_(PROUI_PID_TUNE, dwinStartM303(seenC, c, seenS, hid, temp)); IF_DISABLED(BUSY_WHILE_HEATING, KEEPALIVE_STATE(NOT_BUSY)); diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 664d4cd54413..8cc3f6bc2db8 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2386,10 +2386,10 @@ #if ENABLED(DWIN_LCD_PROUI) #if ANY(PIDTEMP, PIDTEMPBED) - #define DWIN_PID_TUNE 1 + #define PROUI_PID_TUNE 1 #endif - #if ANY(DWIN_PID_TUNE, MPC_AUTOTUNE) && DISABLED(DISABLE_TUNING_GRAPH) - #define SHOW_TUNING_GRAPH 1 + #if ANY(PROUI_PID_TUNE, MPC_AUTOTUNE) && DISABLED(DISABLE_TUNING_GRAPH) + #define PROUI_TUNING_GRAPH 1 #endif #endif diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 479b548d33c1..7139f3cdf9a4 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -265,14 +265,14 @@ class TextScroller { #if ENABLED(AUTO_BED_LEVELING_UBL) uint8_t tilt_grid = 1; - void manual_value_update(bool undefined=false) { + void manualValueUpdate(bool undefined=false) { gcode.process_subcommands_now( TS(F("M421I"), mesh_x, 'J', mesh_y, 'Z', p_float_t(current_position.z, 3), undefined ? "N" : "") ); planner.synchronize(); } - bool create_plane_from_mesh() { + bool createPlaneFromMesh() { struct linear_fit_data lsf_results; incremental_LSF_reset(&lsf_results); GRID_LOOP(x, y) { @@ -312,7 +312,7 @@ class TextScroller { #else - void manual_value_update() { + void manualValueUpdate() { gcode.process_subcommands_now( TS(F("G29I"), mesh_x, 'J', mesh_y, 'Z', p_float_t(current_position.z, 3)) ); @@ -340,7 +340,7 @@ class TextScroller { } } - float get_max_value() { + float getMaxValue() { float max = __FLT_MIN__; GRID_LOOP(x, y) { if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] > max) @@ -349,7 +349,7 @@ class TextScroller { return max; } - float get_min_value() { + float getMinValue() { float min = __FLT_MAX__; GRID_LOOP(x, y) { if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] < min) @@ -363,7 +363,7 @@ class TextScroller { const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x, cell_width_px = total_width_px / (GRID_MAX_POINTS_X), cell_height_px = total_width_px / (GRID_MAX_POINTS_Y); - const float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); + const float v_max = abs(getMaxValue()), v_min = abs(getMinValue()), range = _MAX(v_min, v_max); // Clear background from previous selection and select new square dwinDrawRectangle(1, COLOR_BG_BLACK, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); @@ -418,8 +418,8 @@ class TextScroller { void setMeshViewerStatus() { // TODO: draw gradient with values as a legend instead float v1, v2, - v_min = abs(get_min_value()), - v_max = abs(get_max_value()); + v_min = abs(getMinValue()), + v_max = abs(getMaxValue()); if (viewer_asymmetric_range) { if (v_min > 3e+10F) v_min = 0.0000001; if (v_max > 3e+10F) v_max = 0.0000001; @@ -3437,7 +3437,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_ResumeEEPROM, F("Convert Mesh to Plane")); else { - if (mesh_conf.create_plane_from_mesh()) break; + if (mesh_conf.createPlaneFromMesh()) break; gcode.process_subcommands_now(F("M420 S1")); planner.synchronize(); audioFeedback(true); @@ -3582,7 +3582,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_ResumeEEPROM, F("Clear Point Value")); else { - mesh_conf.manual_value_update(true); + mesh_conf.manualValueUpdate(true); redrawMenu(false); } break; diff --git a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp index 4ab98b17116e..bd2f8a88e6a6 100644 --- a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp +++ b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp @@ -63,22 +63,22 @@ #include "dwin_popup.h" #include "bedlevel_tools.h" -BedLevelToolsClass bedLevelTools; +BedLevelTools bedLevelTools; #if ENABLED(USE_GRID_MESHVIEWER) - bool BedLevelToolsClass::viewer_asymmetric_range = false; - bool BedLevelToolsClass::viewer_print_value = false; + bool BedLevelTools::viewer_asymmetric_range = false; + bool BedLevelTools::viewer_print_value = false; #endif -bool BedLevelToolsClass::goto_mesh_value = false; -uint8_t BedLevelToolsClass::mesh_x = 0; -uint8_t BedLevelToolsClass::mesh_y = 0; -uint8_t BedLevelToolsClass::tilt_grid = 1; +bool BedLevelTools::goto_mesh_value = false; +uint8_t BedLevelTools::mesh_x = 0; +uint8_t BedLevelTools::mesh_y = 0; +uint8_t BedLevelTools::tilt_grid = 1; bool drawing_mesh = false; #if ENABLED(AUTO_BED_LEVELING_UBL) - void BedLevelToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined/*=false*/) { + void BedLevelTools::manualValueUpdate(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined/*=false*/) { MString cmd; cmd.set(F("M421 I"), mesh_x, 'J', mesh_y, 'Z', p_float_t(current_position.z, 3)); if (undefined) cmd += F(" N"); @@ -86,7 +86,7 @@ bool drawing_mesh = false; planner.synchronize(); } - bool BedLevelToolsClass::create_plane_from_mesh() { + bool BedLevelTools::createPlaneFromMesh() { struct linear_fit_data lsf_results; incremental_LSF_reset(&lsf_results); GRID_LOOP(x, y) { @@ -126,7 +126,7 @@ bool drawing_mesh = false; #else - void BedLevelToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y) { + void BedLevelTools::manualValueUpdate(const uint8_t mesh_x, const uint8_t mesh_y) { gcode.process_subcommands_now( TS(F("G29 I"), mesh_x, 'J', mesh_y, 'Z', p_float_t(current_position.z, 3)) ); @@ -135,7 +135,7 @@ bool drawing_mesh = false; #endif -void BedLevelToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove/*=false*/) { +void BedLevelTools::manualMove(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove/*=false*/) { gcode.process_subcommands_now(F("G28O")); if (zmove) { planner.synchronize(); @@ -144,48 +144,48 @@ void BedLevelToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y, planner.synchronize(); } else { - DWIN_Show_Popup(ICON_BLTouch, F("Moving to Point"), F("Please wait until done.")); - HMI_SaveProcessID(NothingToDo); + dwinShowPopup(ICON_BLTouch, F("Moving to Point"), F("Please wait until done.")); + hmiSaveProcessID(ID_NothingToDo); gcode.process_subcommands_now(TS(F("G0 F300 Z"), p_float_t(Z_CLEARANCE_BETWEEN_PROBES, 3))); gcode.process_subcommands_now(TS(F("G42 F4000 I"), mesh_x, F(" J"), mesh_y)); planner.synchronize(); current_position.z = goto_mesh_value ? bedlevel.z_values[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); planner.synchronize(); - HMI_ReturnScreen(); + hmiReturnScreen(); } } // Move / Probe methods. As examples, not yet used. -void BedLevelToolsClass::MoveToXYZ() { - bedLevelTools.goto_mesh_value = true; - bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, false); +void BedLevelTools::moveToXYZ() { + goto_mesh_value = true; + manualMove(mesh_x, mesh_y, false); } -void BedLevelToolsClass::MoveToXY() { - bedLevelTools.goto_mesh_value = false; - bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, false); +void BedLevelTools::moveToXY() { + goto_mesh_value = false; + manualMove(mesh_x, mesh_y, false); } -void BedLevelToolsClass::MoveToZ() { - bedLevelTools.goto_mesh_value = true; - bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, true); +void BedLevelTools::moveToZ() { + goto_mesh_value = true; + manualMove(mesh_x, mesh_y, true); } -void BedLevelToolsClass::ProbeXY() { +void BedLevelTools::probeXY() { gcode.process_subcommands_now( MString( F("G28O\nG0Z"), uint16_t(Z_CLEARANCE_DEPLOY_PROBE), - F("\nG30X"), p_float_t(bedlevel.get_mesh_x(bedLevelTools.mesh_x), 2), - F("Y"), p_float_t(bedlevel.get_mesh_y(bedLevelTools.mesh_y), 2) + F("\nG30X"), p_float_t(bedlevel.get_mesh_x(mesh_x), 2), + F("Y"), p_float_t(bedlevel.get_mesh_y(mesh_y), 2) ) ); } -void BedLevelToolsClass::mesh_reset() { +void BedLevelTools::meshReset() { ZERO(bedlevel.z_values); TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.refresh_bed_level()); } // Accessors -float BedLevelToolsClass::get_max_value() { +float BedLevelTools::getMaxValue() { float max = __FLT_MAX__ * -1; GRID_LOOP(x, y) { if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] > max) @@ -194,7 +194,7 @@ float BedLevelToolsClass::get_max_value() { return max; } -float BedLevelToolsClass::get_min_value() { +float BedLevelTools::getMinValue() { float min = __FLT_MAX__; GRID_LOOP(x, y) { if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] < min) @@ -204,7 +204,7 @@ float BedLevelToolsClass::get_min_value() { } // Return 'true' if mesh is good and within LCD limits -bool BedLevelToolsClass::meshvalidate() { +bool BedLevelTools::meshValidate() { GRID_LOOP(x, y) { const float v = bedlevel.z_values[x][y]; if (isnan(v) || !WITHIN(v, UBL_Z_OFFSET_MIN, UBL_Z_OFFSET_MAX)) return false; @@ -216,12 +216,12 @@ bool BedLevelToolsClass::meshvalidate() { constexpr uint8_t meshfont = TERN(TJC_DISPLAY, font8x16, font6x12); - void BedLevelToolsClass::Draw_Bed_Mesh(int16_t selected/*=-1*/, uint8_t gridline_width/*=1*/, uint16_t padding_x/*=8*/, uint16_t padding_y_top/*=(40 + 53 - 7)*/) { + void BedLevelTools::drawBedMesh(int16_t selected/*=-1*/, uint8_t gridline_width/*=1*/, uint16_t padding_x/*=8*/, uint16_t padding_y_top/*=(40 + 53 - 7)*/) { drawing_mesh = true; const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x; const uint16_t cell_width_px = total_width_px / (GRID_MAX_POINTS_X); const uint16_t cell_height_px = total_width_px / (GRID_MAX_POINTS_Y); - const float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); + const float v_max = abs(getMaxValue()), v_min = abs(getMinValue()), range = _MAX(v_min, v_max); // Clear background from previous selection and select new square dwinDrawRectangle(1, COLOR_BG_BLACK, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); @@ -275,8 +275,8 @@ bool BedLevelToolsClass::meshvalidate() { } } - void BedLevelToolsClass::Set_Mesh_Viewer_Status() { // TODO: draw gradient with values as a legend instead - float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); + void BedLevelTools::setMeshViewerStatus() { // TODO: draw gradient with values as a legend instead + float v_max = abs(getMaxValue()), v_min = abs(getMinValue()), range = _MAX(v_min, v_max); if (v_min > 3e+10f) v_min = 0.0000001; if (v_max > 3e+10f) v_max = 0.0000001; if (range > 3e+10f) range = 0.0000001; diff --git a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h index 40652cfc419f..2e9b66aa30d2 100644 --- a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h +++ b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h @@ -50,7 +50,7 @@ #define UBL_Z_OFFSET_MIN -3.0 #define UBL_Z_OFFSET_MAX 3.0 -class BedLevelToolsClass { +class BedLevelTools { public: #if ENABLED(USE_GRID_MESHVIEWER) static bool viewer_asymmetric_range; @@ -61,24 +61,24 @@ class BedLevelToolsClass { static uint8_t tilt_grid; #if ENABLED(AUTO_BED_LEVELING_UBL) - static void manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined=false); - static bool create_plane_from_mesh(); + static void manualValueUpdate(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined=false); + static bool createPlaneFromMesh(); #else - static void manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y); + static void manualValueUpdate(const uint8_t mesh_x, const uint8_t mesh_y); #endif - static void manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove=false); - static void MoveToXYZ(); - static void MoveToXY(); - static void MoveToZ(); - static void ProbeXY(); - static void mesh_reset(); - static float get_max_value(); - static float get_min_value(); - static bool meshvalidate(); + static void manualMove(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove=false); + static void moveToXYZ(); + static void moveToXY(); + static void moveToZ(); + static void probeXY(); + static void meshReset(); + static float getMaxValue(); + static float getMinValue(); + static bool meshValidate(); #if ENABLED(USE_GRID_MESHVIEWER) - static void Draw_Bed_Mesh(int16_t selected=-1, uint8_t gridline_width=1, uint16_t padding_x=8, uint16_t padding_y_top=(40 + 53 - 7)); - static void Set_Mesh_Viewer_Status(); + static void drawBedMesh(int16_t selected=-1, uint8_t gridline_width=1, uint16_t padding_x=8, uint16_t padding_y_top=(40 + 53 - 7)); + static void setMeshViewerStatus(); #endif }; -extern BedLevelToolsClass bedLevelTools; +extern BedLevelTools bedLevelTools; diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 51a53741ef3c..2e4047e05f45 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -117,7 +117,7 @@ #include "endstop_diag.h" #endif -#if SHOW_TUNING_GRAPH +#if PROUI_TUNING_GRAPH #include "plot.h" #endif @@ -175,9 +175,9 @@ #endif // Structs -HMI_value_t HMI_value; -HMI_flag_t hmiFlag{0}; -HMI_data_t HMI_data; +hmi_value_t hmiValue; +hmi_flag_t hmiFlag{0}; +hmi_data_t hmiData; enum SelectItem : uint8_t { PAGE_PRINT = 0, @@ -208,110 +208,110 @@ select_t select_page{0}, select_print{0}; bool hash_changed = true; // Flag to know if message status was changed bool blink = false; -uint8_t checkkey = 255, last_checkkey = MainMenu; +uint8_t checkkey = 255, last_checkkey = ID_MainMenu; // New menu system pointers -MenuClass *FileMenu = nullptr; -MenuClass *PrepareMenu = nullptr; +Menu *fileMenu = nullptr; +Menu *prepareMenu = nullptr; #if ENABLED(LCD_BED_TRAMMING) - MenuClass *TrammingMenu = nullptr; + Menu *trammingMenu = nullptr; #endif -MenuClass *MoveMenu = nullptr; -MenuClass *ControlMenu = nullptr; -MenuClass *AdvancedSettings = nullptr; +Menu *moveMenu = nullptr; +Menu *ControlMenu = nullptr; +Menu *AdvancedSettings = nullptr; #if HAS_HOME_OFFSET - MenuClass *HomeOffMenu = nullptr; + Menu *homeOffsetMenu = nullptr; #endif #if HAS_BED_PROBE - MenuClass *ProbeSetMenu = nullptr; -#endif -MenuClass *FilSetMenu = nullptr; -MenuClass *SelectColorMenu = nullptr; -MenuClass *GetColorMenu = nullptr; -MenuClass *TuneMenu = nullptr; -MenuClass *MotionMenu = nullptr; -MenuClass *FilamentMenu = nullptr; + Menu *ProbeSetMenu = nullptr; +#endif +Menu *filSetMenu = nullptr; +Menu *selectColorMenu = nullptr; +Menu *getColorMenu = nullptr; +Menu *tuneMenu = nullptr; +Menu *motionMenu = nullptr; +Menu *filamentMenu = nullptr; #if ENABLED(MESH_BED_LEVELING) - MenuClass *ManualMesh = nullptr; + Menu *manualMesh = nullptr; #endif #if HAS_PREHEAT - MenuClass *PreheatMenu = nullptr; - MenuClass *PreheatHotendMenu = nullptr; + Menu *preheatMenu = nullptr; + Menu *preheatHotendMenu = nullptr; #endif -MenuClass *TemperatureMenu = nullptr; -MenuClass *MaxSpeedMenu = nullptr; -MenuClass *MaxAccelMenu = nullptr; +Menu *temperatureMenu = nullptr; +Menu *maxSpeedMenu = nullptr; +Menu *maxAccelMenu = nullptr; #if HAS_CLASSIC_JERK - MenuClass *MaxJerkMenu = nullptr; + Menu *maxJerkMenu = nullptr; #endif -MenuClass *StepsMenu = nullptr; +Menu *stepsMenu = nullptr; #if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) - MenuClass *HotendMPCMenu = nullptr; + Menu *hotendMPCMenu = nullptr; #endif #if ENABLED(PIDTEMP) && ANY(PID_EDIT_MENU, PID_AUTOTUNE_MENU) - MenuClass *HotendPIDMenu = nullptr; + Menu *hotendPIDMenu = nullptr; #endif #if ENABLED(PIDTEMPBED) && ANY(PID_EDIT_MENU, PID_AUTOTUNE_MENU) - MenuClass *BedPIDMenu = nullptr; + Menu *bedPIDMenu = nullptr; #endif #if ENABLED(CASELIGHT_USES_BRIGHTNESS) - MenuClass *CaseLightMenu = nullptr; + Menu *caseLightMenu = nullptr; #endif #if ENABLED(LED_CONTROL_MENU) - MenuClass *LedControlMenu = nullptr; + Menu *ledControlMenu = nullptr; #endif #if HAS_BED_PROBE - MenuClass *ZOffsetWizMenu = nullptr; + Menu *zOffsetWizMenu = nullptr; #endif #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) - MenuClass *HomingMenu = nullptr; + Menu *homingMenu = nullptr; #endif #if ENABLED(FWRETRACT) - MenuClass *FWRetractMenu = nullptr; + Menu *fwRetractMenu = nullptr; #endif #if HAS_MESH - MenuClass *MeshMenu = nullptr; + Menu *meshMenu = nullptr; #if ENABLED(MESH_EDIT_MENU) - MenuClass *EditMeshMenu = nullptr; + Menu *editMeshMenu = nullptr; #endif #endif #if ENABLED(SHAPING_MENU) - MenuClass *InputShapingMenu = nullptr; + Menu *inputShapingMenu = nullptr; #endif #if HAS_TRINAMIC_CONFIG - MenuClass *TrinamicConfigMenu = nullptr; + Menu *trinamicConfigMenu = nullptr; #endif // Updatable menuitems pointers -MenuItemClass *HotendTargetItem = nullptr; -MenuItemClass *BedTargetItem = nullptr; -MenuItemClass *FanSpeedItem = nullptr; -MenuItemClass *MMeshMoveZItem = nullptr; -MenuItemClass *EditZValueItem = nullptr; +MenuItem *hotendTargetItem = nullptr; +MenuItem *bedTargetItem = nullptr; +MenuItem *fanSpeedItem = nullptr; +MenuItem *mMeshMoveZItem = nullptr; +MenuItem *editZValueItem = nullptr; -bool Printing() { return printingIsActive() || printingIsPaused(); } -bool SD_Printing() { return Printing() && IS_SD_FILE_OPEN(); } -bool Host_Printing() { return Printing() && !IS_SD_FILE_OPEN(); } +bool isPrinting() { return printingIsActive() || printingIsPaused(); } +bool sdPrinting() { return isPrinting() && IS_SD_FILE_OPEN(); } +bool Host_Printing() { return isPrinting() && !IS_SD_FILE_OPEN(); } #define DWIN_LANGUAGE_EEPROM_ADDRESS 0x01 // Between 0x01 and 0x63 (EEPROM_OFFSET-1) // BL24CXX::check() uses 0x00 -inline bool HMI_IsChinese() { return hmiFlag.language == DWIN_CHINESE; } +inline bool hmiIsChinese() { return hmiFlag.language == DWIN_CHINESE; } -void HMI_SetLanguageCache() { - dwinJPGCacheTo1(HMI_IsChinese() ? Language_Chinese : Language_English); +void hmiSetLanguageCache() { + dwinJPGCacheTo1(hmiIsChinese() ? Language_Chinese : Language_English); } -void HMI_SetLanguage() { +void hmiSetLanguage() { #if ALL(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) BL24CXX::read(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&hmiFlag.language, sizeof(hmiFlag.language)); #endif - HMI_SetLanguageCache(); + hmiSetLanguageCache(); } -void HMI_ToggleLanguage() { - hmiFlag.language = HMI_IsChinese() ? DWIN_ENGLISH : DWIN_CHINESE; - HMI_SetLanguageCache(); +void hmiToggleLanguage() { + hmiFlag.language = hmiIsChinese() ? DWIN_ENGLISH : DWIN_CHINESE; + hmiSetLanguageCache(); #if ALL(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&hmiFlag.language, sizeof(hmiFlag.language)); #endif @@ -324,15 +324,15 @@ void HMI_ToggleLanguage() { typedef struct { uint16_t x, y[2], w, h; } text_info_t; void ICON_Button(const bool selected, const int iconid, const frame_rect_t &ico, const text_info_t (&txt), FSTR_P caption) { - DWINUI::Draw_IconWB(iconid + selected, ico.x, ico.y); - if (selected) DWINUI::Draw_Box(0, HMI_data.Highlight_Color, ico); - if (HMI_IsChinese()) { - DWIN_Frame_AreaCopy(1, txt.x, txt.y[selected], txt.x + txt.w - 1, txt.y[selected] + txt.h - 1, ico.x + (ico.w - txt.w) / 2, (ico.y + ico.h - 25) - txt.h/2); + DWINUI::drawIconWB(iconid + selected, ico.x, ico.y); + if (selected) DWINUI::drawBox(0, hmiData.colorHighlight, ico); + if (hmiIsChinese()) { + dwinFrameAreaCopy(1, txt.x, txt.y[selected], txt.x + txt.w - 1, txt.y[selected] + txt.h - 1, ico.x + (ico.w - txt.w) / 2, (ico.y + ico.h - 25) - txt.h/2); } else { const uint16_t x = ico.x + (ico.w - strlen_P(FTOP(caption)) * DWINUI::fontWidth()) / 2, y = (ico.y + ico.h - 20) - DWINUI::fontHeight() / 2; - DWINUI::Draw_String(x, y, caption); + DWINUI::drawString(x, y, caption); } } @@ -409,83 +409,83 @@ void ICON_Stop() { } // -//PopUps +// PopUps // -void Popup_window_PauseOrStop() { - if (HMI_IsChinese()) { - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); - if (select_print.now == PRINT_PAUSE_RESUME) DWIN_Frame_AreaCopy(1, 237, 338, 269, 356, 98, 150); - else if (select_print.now == PRINT_STOP) DWIN_Frame_AreaCopy(1, 221, 320, 253, 336, 98, 150); - DWIN_Frame_AreaCopy(1, 220, 304, 264, 319, 130, 150); - DWINUI::Draw_IconWB(ICON_Confirm_C, 26, 280); - DWINUI::Draw_IconWB(ICON_Cancel_C, 146, 280); - Draw_Select_Highlight(true); +void popupPauseOrStop() { + if (hmiIsChinese()) { + DWINUI::clearMainArea(); + drawPopupBkgd(); + if (select_print.now == PRINT_PAUSE_RESUME) dwinFrameAreaCopy(1, 237, 338, 269, 356, 98, 150); + else if (select_print.now == PRINT_STOP) dwinFrameAreaCopy(1, 221, 320, 253, 336, 98, 150); + dwinFrameAreaCopy(1, 220, 304, 264, 319, 130, 150); + DWINUI::drawIconWB(ICON_Confirm_C, 26, 280); + DWINUI::drawIconWB(ICON_Cancel_C, 146, 280); + drawSelectHighlight(true); dwinUpdateLCD(); } else - DWIN_Popup_ConfirmCancel(ICON_BLTouch, select_print.now == PRINT_PAUSE_RESUME ? GET_TEXT_F(MSG_PAUSE_PRINT) : GET_TEXT_F(MSG_STOP_PRINT)); + dwinPopupConfirmCancel(ICON_BLTouch, select_print.now == PRINT_PAUSE_RESUME ? GET_TEXT_F(MSG_PAUSE_PRINT) : GET_TEXT_F(MSG_STOP_PRINT)); } #if HAS_HOTEND - void Popup_Window_ETempTooLow() { - if (HMI_IsChinese()) { - HMI_SaveProcessID(WaitResponse); - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); - DWINUI::Draw_Icon(ICON_TempTooLow, 102, 105); - DWIN_Frame_AreaCopy(1, 103, 371, 136, 386, 69, 240); - DWIN_Frame_AreaCopy(1, 170, 371, 270, 386, 102, 240); - DWINUI::Draw_IconWB(ICON_Confirm_C, 86, 280); + void popupETempTooLow() { + if (hmiIsChinese()) { + hmiSaveProcessID(ID_WaitResponse); + DWINUI::clearMainArea(); + drawPopupBkgd(); + DWINUI::drawIcon(ICON_TempTooLow, 102, 105); + dwinFrameAreaCopy(1, 103, 371, 136, 386, 69, 240); + dwinFrameAreaCopy(1, 170, 371, 270, 386, 102, 240); + DWINUI::drawIconWB(ICON_Confirm_C, 86, 280); dwinUpdateLCD(); } else - DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_HOTEND_TOO_COLD), GET_TEXT_F(MSG_PLEASE_PREHEAT)); + dwinPopupConfirm(ICON_TempTooLow, GET_TEXT_F(MSG_HOTEND_TOO_COLD), GET_TEXT_F(MSG_PLEASE_PREHEAT)); } #endif #if HAS_HOTEND || HAS_HEATED_BED void dwinPopupTemperature(const bool toohigh) { - HMI_SaveProcessID(WaitResponse); - if (HMI_IsChinese()) { - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); + hmiSaveProcessID(ID_WaitResponse); + if (hmiIsChinese()) { + DWINUI::clearMainArea(); + drawPopupBkgd(); if (toohigh) { - DWINUI::Draw_Icon(ICON_TempTooHigh, 102, 165); - DWIN_Frame_AreaCopy(1, 103, 371, 237, 386, 52, 285); - DWIN_Frame_AreaCopy(1, 151, 389, 185, 402, 187, 285); - DWIN_Frame_AreaCopy(1, 189, 389, 271, 402, 95, 310); + DWINUI::drawIcon(ICON_TempTooHigh, 102, 165); + dwinFrameAreaCopy(1, 103, 371, 237, 386, 52, 285); + dwinFrameAreaCopy(1, 151, 389, 185, 402, 187, 285); + dwinFrameAreaCopy(1, 189, 389, 271, 402, 95, 310); } else { - DWINUI::Draw_Icon(ICON_TempTooLow, 102, 165); - DWIN_Frame_AreaCopy(1, 103, 371, 270, 386, 52, 285); - DWIN_Frame_AreaCopy(1, 189, 389, 271, 402, 95, 310); + DWINUI::drawIcon(ICON_TempTooLow, 102, 165); + dwinFrameAreaCopy(1, 103, 371, 270, 386, 52, 285); + dwinFrameAreaCopy(1, 189, 389, 271, 402, 95, 310); } } else - DWIN_Show_Popup(toohigh ? ICON_TempTooHigh : ICON_TempTooLow, F("Nozzle or Bed temperature"), toohigh ? F("is too high") : F("is too low"), BTN_Continue); + dwinShowPopup(toohigh ? ICON_TempTooHigh : ICON_TempTooLow, F("Nozzle or Bed temperature"), toohigh ? F("is too high") : F("is too low"), BTN_Continue); } #endif // // Draw status line // -void DWIN_DrawStatusLine(const char *text) { - dwinDrawRectangle(1, HMI_data.StatusBg_Color, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); - if (text) DWINUI::Draw_CenteredString(HMI_data.StatusTxt_Color, STATUS_Y + 2, text); +void dwinDrawStatusLine(const char *text) { + dwinDrawRectangle(1, hmiData.colorStatusBg, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); + if (text) DWINUI::drawCenteredString(hmiData.colorStatusTxt, STATUS_Y + 2, text); } -void DWIN_DrawStatusLine(FSTR_P fstr) { DWIN_DrawStatusLine(FTOP(fstr)); } +void dwinDrawStatusLine(FSTR_P fstr) { dwinDrawStatusLine(FTOP(fstr)); } // Clear & reset status line -void DWIN_ResetStatusLine() { +void dwinResetStatusLine() { ui.status_message.clear(); - DWIN_CheckStatusMessage(); + dwinCheckStatusMessage(); } // Djb2 hash algorithm -uint32_t GetHash(char * str) { +uint32_t getHash(char * str) { uint32_t hash = 5381; char c; while ((c = *str++)) hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ @@ -493,14 +493,14 @@ uint32_t GetHash(char * str) { } // Check for a change in the status message -void DWIN_CheckStatusMessage() { +void dwinCheckStatusMessage() { static MString<>::hash_t old_hash = 0x0000; const MString<>::hash_t hash = ui.status_message.hash(); hash_changed = hash != old_hash; old_hash = hash; } -void DWIN_DrawStatusMessage() { +void dwinDrawStatusMessage() { #if ENABLED(STATUS_MESSAGE_SCROLLING) // Get the UTF8 character count of the string @@ -509,7 +509,7 @@ void DWIN_DrawStatusMessage() { // If the string fits the status line do not scroll it if (slen <= LCD_WIDTH) { if (hash_changed) { - DWIN_DrawStatusLine(ui.status_message); + dwinDrawStatusLine(ui.status_message); hash_changed = false; } } @@ -520,18 +520,18 @@ void DWIN_DrawStatusMessage() { // and the string remaining length uint8_t rlen; const char *stat = MarlinUI::status_and_len(rlen); - dwinDrawRectangle(1, HMI_data.StatusBg_Color, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); - DWINUI::MoveTo(0, STATUS_Y + 2); - DWINUI::Draw_String(HMI_data.StatusTxt_Color, stat, LCD_WIDTH); + dwinDrawRectangle(1, hmiData.colorStatusBg, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); + DWINUI::moveTo(0, STATUS_Y + 2); + DWINUI::drawString(hmiData.colorStatusTxt, stat, LCD_WIDTH); // If the string doesn't completely fill the line... if (rlen < LCD_WIDTH) { - DWINUI::Draw_Char(HMI_data.StatusTxt_Color, '.'); // Always at 1+ spaces left, draw a dot + DWINUI::drawChar(hmiData.colorStatusTxt, '.'); // Always at 1+ spaces left, draw a dot uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters if (--chars) { // Draw a second dot if there's space - DWINUI::Draw_Char(HMI_data.StatusTxt_Color, '.'); + DWINUI::drawChar(hmiData.colorStatusTxt, '.'); if (--chars) - DWINUI::Draw_String(HMI_data.StatusTxt_Color, ui.status_message, chars); // Print a second copy of the message + DWINUI::drawString(hmiData.colorStatusTxt, ui.status_message, chars); // Print a second copy of the message } } MarlinUI::advance_status_scroll(); @@ -541,147 +541,147 @@ void DWIN_DrawStatusMessage() { if (hash_changed) { ui.status_message.trunc(LCD_WIDTH); - DWIN_DrawStatusLine(ui.status_message); + dwinDrawStatusLine(ui.status_message); hash_changed = false; } #endif } -void Draw_Print_Labels() { - if (HMI_IsChinese()) { - DWIN_Frame_AreaCopy(1, 0, 72, 63, 86, 41, 173); // Printing Time - DWIN_Frame_AreaCopy(1, 65, 72, 128, 86, 176, 173); // Remain +void drawPrintLabels() { + if (hmiIsChinese()) { + dwinFrameAreaCopy(1, 0, 72, 63, 86, 41, 173); // Printing Time + dwinFrameAreaCopy(1, 65, 72, 128, 86, 176, 173); // Remain } else { - DWINUI::Draw_String( 46, 173, GET_TEXT_F(MSG_INFO_PRINT_TIME)); - DWINUI::Draw_String(181, 173, GET_TEXT_F(MSG_REMAINING_TIME)); + DWINUI::drawString( 46, 173, GET_TEXT_F(MSG_INFO_PRINT_TIME)); + DWINUI::drawString(181, 173, GET_TEXT_F(MSG_REMAINING_TIME)); } } -void Draw_Print_ProgressBar() { +void drawPrintProgressBar() { const uint8_t _percent_done = ui.get_progress_percent(); - DWINUI::Draw_IconWB(ICON_Bar, 15, 93); - dwinDrawRectangle(1, HMI_data.Barfill_Color, 16 + _percent_done * 240 / 100, 93, 256, 113); - DWINUI::Draw_Int(HMI_data.PercentTxt_Color, HMI_data.Background_Color, 3, 117, 133, _percent_done); - DWINUI::Draw_String(HMI_data.PercentTxt_Color, 142, 133, F("%")); + DWINUI::drawIconWB(ICON_Bar, 15, 93); + dwinDrawRectangle(1, hmiData.colorBarfill, 16 + _percent_done * 240 / 100, 93, 256, 113); + DWINUI::drawInt(hmiData.colorPercentTxt, hmiData.colorBackground, 3, 117, 133, _percent_done); + DWINUI::drawString(hmiData.colorPercentTxt, 142, 133, F("%")); } -void Draw_Print_ProgressElapsed() { +void drawPrintProgressElapsed() { MString<12> buf; duration_t elapsed = print_job_timer.duration(); // Print timer buf.setf(F("%02i:%02i "), uint16_t(elapsed.value / 3600), (uint16_t(elapsed.value) % 3600) / 60); - DWINUI::Draw_String(HMI_data.Text_Color, HMI_data.Background_Color, 47, 192, buf); + DWINUI::drawString(hmiData.colorText, hmiData.colorBackground, 47, 192, buf); } #if ENABLED(SHOW_REMAINING_TIME) - void Draw_Print_ProgressRemain() { + void drawPrintProgressRemain() { MString<12> buf; buf.setf(F("%02i:%02i "), _remain_time / 3600, (_remain_time % 3600) / 60); - DWINUI::Draw_String(HMI_data.Text_Color, HMI_data.Background_Color, 181, 192, buf); + DWINUI::drawString(hmiData.colorText, hmiData.colorBackground, 181, 192, buf); } #endif void ICON_ResumeOrPause() { - if (checkkey == PrintProcess) (print_job_timer.isPaused() || hmiFlag.pause_flag) ? ICON_Resume() : ICON_Pause(); + if (checkkey == ID_PrintProcess) (print_job_timer.isPaused() || hmiFlag.pause_flag) ? ICON_Resume() : ICON_Pause(); } // Update filename on print -void DWIN_Print_Header(const char *text = nullptr) { +void dwinPrintHeader(const char *text = nullptr) { static char headertxt[31] = ""; // Print header text if (text) { const int8_t size = _MIN(30U, strlen_P(text)); for (uint8_t i = 0; i < size; ++i) headertxt[i] = text[i]; headertxt[size] = '\0'; } - if (checkkey == PrintProcess || checkkey == PrintDone) { - dwinDrawRectangle(1, HMI_data.Background_Color, 0, 60, DWIN_WIDTH, 60+16); - DWINUI::Draw_CenteredString(60, headertxt); + if (checkkey == ID_PrintProcess || checkkey == ID_PrintDone) { + dwinDrawRectangle(1, hmiData.colorBackground, 0, 60, DWIN_WIDTH, 60+16); + DWINUI::drawCenteredString(60, headertxt); } } -void Draw_PrintProcess() { - if (HMI_IsChinese()) - Title.FrameCopy(30, 1, 42, 14); // "Printing" +void drawPrintProcess() { + if (hmiIsChinese()) + title.frameCopy(30, 1, 42, 14); // "Printing" else - Title.ShowCaption(GET_TEXT_F(MSG_PRINTING)); - DWINUI::ClearMainArea(); - DWIN_Print_Header(nullptr); - Draw_Print_Labels(); - DWINUI::Draw_Icon(ICON_PrintTime, 15, 173); - DWINUI::Draw_Icon(ICON_RemainTime, 150, 171); - Draw_Print_ProgressBar(); - Draw_Print_ProgressElapsed(); - TERN_(SHOW_REMAINING_TIME, Draw_Print_ProgressRemain()); + title.showCaption(GET_TEXT_F(MSG_PRINTING)); + DWINUI::clearMainArea(); + dwinPrintHeader(nullptr); + drawPrintLabels(); + DWINUI::drawIcon(ICON_PrintTime, 15, 173); + DWINUI::drawIcon(ICON_RemainTime, 150, 171); + drawPrintProgressBar(); + drawPrintProgressElapsed(); + TERN_(SHOW_REMAINING_TIME, drawPrintProgressRemain()); ICON_Tune(); ICON_ResumeOrPause(); ICON_Stop(); } -void Goto_PrintProcess() { - if (checkkey == PrintProcess) +void gotoPrintProcess() { + if (checkkey == ID_PrintProcess) ICON_ResumeOrPause(); else { - checkkey = PrintProcess; - Draw_PrintProcess(); - TERN_(DASH_REDRAW, DWIN_RedrawDash()); + checkkey = ID_PrintProcess; + drawPrintProcess(); + TERN_(DASH_REDRAW, dwinRedrawDash()); } dwinUpdateLCD(); } -void Draw_PrintDone() { +void drawPrintDone() { TERN_(SET_PROGRESS_PERCENT, ui.set_progress_done()); TERN_(SET_REMAINING_TIME, ui.reset_remaining_time()); - Title.ShowCaption(GET_TEXT_F(MSG_PRINT_DONE)); - DWINUI::ClearMainArea(); - DWIN_Print_Header(nullptr); + title.showCaption(GET_TEXT_F(MSG_PRINT_DONE)); + DWINUI::clearMainArea(); + dwinPrintHeader(nullptr); #if HAS_GCODE_PREVIEW const bool haspreview = Preview_Valid(); if (haspreview) { Preview_Show(); - DWINUI::Draw_Button(BTN_Continue, 86, 295); + DWINUI::drawButton(BTN_Continue, 86, 295); } #else constexpr bool haspreview = false; #endif if (!haspreview) { - Draw_Print_ProgressBar(); - Draw_Print_Labels(); - DWINUI::Draw_Icon(ICON_PrintTime, 15, 173); - DWINUI::Draw_Icon(ICON_RemainTime, 150, 171); - Draw_Print_ProgressElapsed(); - TERN_(SHOW_REMAINING_TIME, Draw_Print_ProgressRemain()); - DWINUI::Draw_Button(BTN_Continue, 86, 273); + drawPrintProgressBar(); + drawPrintLabels(); + DWINUI::drawIcon(ICON_PrintTime, 15, 173); + DWINUI::drawIcon(ICON_RemainTime, 150, 171); + drawPrintProgressElapsed(); + TERN_(SHOW_REMAINING_TIME, drawPrintProgressRemain()); + DWINUI::drawButton(BTN_Continue, 86, 273); } } -void Goto_PrintDone() { +void gotoPrintDone() { wait_for_user = true; - if (checkkey != PrintDone) { - checkkey = PrintDone; - Draw_PrintDone(); + if (checkkey != ID_PrintDone) { + checkkey = ID_PrintDone; + drawPrintDone(); dwinUpdateLCD(); } } -void Draw_Main_Menu() { - DWINUI::ClearMainArea(); - if (HMI_IsChinese()) - Title.FrameCopy(2, 2, 26, 13); // "Home" etc +void drawMainMenu() { + DWINUI::clearMainArea(); + if (hmiIsChinese()) + title.frameCopy(2, 2, 26, 13); // "Home" etc else - Title.ShowCaption(MACHINE_NAME); - DWINUI::Draw_Icon(ICON_LOGO, 71, 52); // CREALITY logo + title.showCaption(MACHINE_NAME); + DWINUI::drawIcon(ICON_LOGO, 71, 52); // CREALITY logo ICON_Print(); ICON_Prepare(); ICON_Control(); ICON_AdvSettings(); } -void Goto_Main_Menu() { - if (checkkey == MainMenu) return; - checkkey = MainMenu; - Draw_Main_Menu(); +void gotoMainMenu() { + if (checkkey == ID_MainMenu) return; + checkkey = ID_MainMenu; + drawMainMenu(); dwinUpdateLCD(); } @@ -706,74 +706,74 @@ void _update_axis_value(const AxisEnum axis, const uint16_t x, const uint16_t y, if (force || changed || draw_qmark || draw_empty) { if (blink && draw_qmark) - DWINUI::Draw_String(HMI_data.Coordinate_Color, HMI_data.Background_Color, x, y, F(" - ? -")); + DWINUI::drawString(hmiData.colorCoordinate, hmiData.colorBackground, x, y, F(" - ? -")); else if (blink && draw_empty) - DWINUI::Draw_String(HMI_data.Coordinate_Color, HMI_data.Background_Color, x, y, F(" ")); + DWINUI::drawString(hmiData.colorCoordinate, hmiData.colorBackground, x, y, F(" ")); else - DWINUI::Draw_Signed_Float(HMI_data.Coordinate_Color, HMI_data.Background_Color, 3, 2, x, y, p); + DWINUI::drawSignedFloat(hmiData.colorCoordinate, hmiData.colorBackground, 3, 2, x, y, p); } } -void _draw_iconblink(bool &flag, const bool sensor, const uint8_t icon1, const uint8_t icon2, const uint16_t x, const uint16_t y) { +void _drawIconBlink(bool &flag, const bool sensor, const uint8_t icon1, const uint8_t icon2, const uint16_t x, const uint16_t y) { #if DISABLED(NO_BLINK_IND) if (flag != sensor) { flag = sensor; if (!flag) { - dwinDrawBox(1, HMI_data.Background_Color, x, y, 20, 20); - DWINUI::Draw_Icon(icon1, x, y); + dwinDrawBox(1, hmiData.colorBackground, x, y, 20, 20); + DWINUI::drawIcon(icon1, x, y); } } if (flag) { - dwinDrawBox(1, blink ? HMI_data.SplitLine_Color : HMI_data.Background_Color, x, y, 20, 20); - DWINUI::Draw_Icon(icon2, x, y); + dwinDrawBox(1, blink ? hmiData.colorSplitLine : hmiData.colorBackground, x, y, 20, 20); + DWINUI::drawIcon(icon2, x, y); } #else if (flag != sensor) { flag = sensor; - dwinDrawBox(1, HMI_data.Background_Color, x, y, 20, 20); - DWINUI::Draw_Icon(flag ? icon2 : icon1, x, y); + dwinDrawBox(1, hmiData.colorBackground, x, y, 20, 20); + DWINUI::drawIcon(flag ? icon2 : icon1, x, y); } #endif } -void _draw_ZOffsetIcon() { +void _drawZOffsetIcon() { #if HAS_LEVELING static bool _leveling_active = false; - _draw_iconblink(_leveling_active, planner.leveling_active, ICON_Zoffset, ICON_SetZOffset, 186, 416); + _drawIconBlink(_leveling_active, planner.leveling_active, ICON_Zoffset, ICON_SetZOffset, 186, 416); #else - DWINUI::Draw_Icon(ICON_Zoffset, 187, 416); + DWINUI::drawIcon(ICON_Zoffset, 187, 416); #endif } -void _draw_feedrate() { +void _drawFeedrate() { #if ENABLED(SHOW_SPEED_IND) int16_t _value; if (blink) { _value = feedrate_percentage; - DWINUI::Draw_String(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 116 + 4 * STAT_CHR_W + 2, 384, F(" %")); + DWINUI::drawString(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 116 + 4 * STAT_CHR_W + 2, 384, F(" %")); } else { _value = CEIL(feedrate_mm_s * feedrate_percentage / 100); - dwinDrawBox(1, HMI_data.Background_Color, 116 + 5 * STAT_CHR_W + 2, 384, 20, 20); + dwinDrawBox(1, hmiData.colorBackground, 116 + 5 * STAT_CHR_W + 2, 384, 20, 20); } - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 116 + 2 * STAT_CHR_W, 384, _value); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 116 + 2 * STAT_CHR_W, 384, _value); #else static int16_t _feedrate = 100; if (_feedrate != feedrate_percentage) { _feedrate = feedrate_percentage; - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 116 + 2 * STAT_CHR_W, 384, _feedrate); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 116 + 2 * STAT_CHR_W, 384, _feedrate); } #endif } -void _draw_xyz_position(const bool force) { +void _drawXYZPosition(const bool force) { _update_axis_value(X_AXIS, 27, 459, force); _update_axis_value(Y_AXIS, 112, 459, force); _update_axis_value(Z_AXIS, 197, 459, force); } -void update_variable() { - _draw_xyz_position(false); +void updateVariable() { + _drawXYZPosition(false); #if HAS_HOTEND static celsius_t _hotendtemp = 0, _hotendtarget = 0; const celsius_t hc = thermalManager.wholeDegHotend(0), @@ -798,49 +798,49 @@ void update_variable() { if (_new_fanspeed) _fanspeed = thermalManager.fan_speed[0]; #endif - if (IsMenu(TuneMenu) || IsMenu(TemperatureMenu)) { + if (isMenu(tuneMenu) || isMenu(temperatureMenu)) { // Tune page temperature update - TERN_(HAS_HOTEND, if (_new_hotend_target) HotendTargetItem->redraw()); - TERN_(HAS_HEATED_BED, if (_new_bed_target) BedTargetItem->redraw()); - TERN_(HAS_FAN, if (_new_fanspeed) FanSpeedItem->redraw()); + TERN_(HAS_HOTEND, if (_new_hotend_target) hotendTargetItem->redraw()); + TERN_(HAS_HEATED_BED, if (_new_bed_target) bedTargetItem->redraw()); + TERN_(HAS_FAN, if (_new_fanspeed) fanSpeedItem->redraw()); } // Bottom temperature update #if HAS_HOTEND if (_new_hotend_temp) - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 28, 384, _hotendtemp); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 28, 384, _hotendtemp); if (_new_hotend_target) - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 25 + 4 * STAT_CHR_W + 6, 384, _hotendtarget); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 25 + 4 * STAT_CHR_W + 6, 384, _hotendtarget); static int16_t _flow = planner.flow_percentage[0]; if (_flow != planner.flow_percentage[0]) { _flow = planner.flow_percentage[0]; - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 116 + 2 * STAT_CHR_W, 417, _flow); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 116 + 2 * STAT_CHR_W, 417, _flow); } #endif #if HAS_HEATED_BED if (_new_bed_temp) - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 28, 417, _bedtemp); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 28, 417, _bedtemp); if (_new_bed_target) - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 25 + 4 * STAT_CHR_W + 6, 417, _bedtarget); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 25 + 4 * STAT_CHR_W + 6, 417, _bedtarget); #endif - _draw_feedrate(); + _drawFeedrate(); #if HAS_FAN if (_new_fanspeed) - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 195 + 2 * STAT_CHR_W, 384, _fanspeed); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 195 + 2 * STAT_CHR_W, 384, _fanspeed); #endif static float _offset = 0; if (BABY_Z_VAR != _offset) { _offset = BABY_Z_VAR; - DWINUI::Draw_Signed_Float(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 2, 2, 204, 417, _offset); + DWINUI::drawSignedFloat(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 2, 2, 204, 417, _offset); } - _draw_ZOffsetIcon(); + _drawZOffsetIcon(); } /** @@ -850,19 +850,19 @@ void update_variable() { bool DWIN_lcd_sd_status = false; #if ENABLED(MEDIASORT_MENU_ITEM) - void SetMediaSort() { - Toggle_Chkb_Line(HMI_data.MediaSort); - card.setSortOn(HMI_data.MediaSort); + void setMediaSort() { + toggleCheckboxLine(hmiData.mediaSort); + card.setSortOn(hmiData.mediaSort); } #endif -void SetMediaAutoMount() { Toggle_Chkb_Line(HMI_data.MediaAutoMount); } +void setMediaAutoMount() { toggleCheckboxLine(hmiData.mediaAutoMount); } inline uint16_t nr_sd_menu_items() { return _MIN(card.get_num_items() + !card.flag.workDirIsRoot, MENU_MAX_ITEMS); } -void make_name_without_ext(char *dst, char *src, size_t maxlen=MENU_CHAR_LIMIT) { +void makeNameWithoutExt(char *dst, char *src, size_t maxlen=MENU_CHAR_LIMIT) { size_t pos = strlen(src); // Index of ending nul // For files, remove the extension @@ -886,52 +886,53 @@ void make_name_without_ext(char *dst, char *src, size_t maxlen=MENU_CHAR_LIMIT) while (pos--) dst[pos] = src[pos]; } -void SDCard_Up() { +void sdCardUp() { card.cdup(); DWIN_lcd_sd_status = false; // On next DWIN_Update } -void SDCard_Folder(char * const dirname) { +void sdCardFolder(char * const dirname) { card.cd(dirname); DWIN_lcd_sd_status = false; // On next DWIN_Update } void onClickSDItem() { const uint16_t hasUpDir = !card.flag.workDirIsRoot; - if (hasUpDir && CurrentMenu->selected == 1) return SDCard_Up(); + if (hasUpDir && currentMenu->selected == 1) return sdCardUp(); else { - const uint16_t filenum = CurrentMenu->selected - 1 - hasUpDir; + const uint16_t filenum = currentMenu->selected - 1 - hasUpDir; card.selectFileByIndexSorted(filenum); // Enter that folder! - if (card.flag.filenameIsDir) return SDCard_Folder(card.filename); + if (card.flag.filenameIsDir) return sdCardFolder(card.filename); if (card.fileIsBinary()) - return DWIN_Popup_Confirm(ICON_Error, F("Please check filenames"), F("Only G-code can be printed")); + return dwinPopupConfirm(ICON_Error, F("Please check filenames"), F("Only G-code can be printed")); else { - DWIN_Print_Header(card.longest_filename()); // Save filename - return Goto_ConfirmToPrint(); + dwinPrintHeader(card.longest_filename()); // Save filename + return gotoConfirmToPrint(); } } } #if ENABLED(SCROLL_LONG_FILENAMES) + char shift_name[LONG_FILENAME_LENGTH + 1] = ""; - void Draw_SDItem_Shifted(uint8_t &shift) { + void drawSDItemShifted(uint8_t &shift) { // Shorten to the available space const size_t lastchar = shift + MENU_CHAR_LIMIT; const char c = shift_name[lastchar]; shift_name[lastchar] = '\0'; - const uint8_t row = FileMenu->line(); - Erase_Menu_Text(row); - Draw_Menu_Line(row, 0, &shift_name[shift]); + const uint8_t row = fileMenu->line(); + eraseMenuText(row); + drawMenuLine(row, 0, &shift_name[shift]); shift_name[lastchar] = c; } - void FileMenuIdle(bool reset=false) { + void fileMenuIdle(bool reset=false) { static bool hasUpDir = false; static uint8_t last_itemselected = 0; static int8_t shift_amt = 0, shift_len = 0; @@ -940,78 +941,81 @@ void onClickSDItem() { hasUpDir = !card.flag.workDirIsRoot; // Is a SubDir return; } - const uint8_t selected = FileMenu->selected; + const uint8_t selected = fileMenu->selected; if (last_itemselected != selected) { - if (last_itemselected >= 1 + hasUpDir) FileMenu->Items()[last_itemselected]->redraw(true); + if (last_itemselected >= 1 + hasUpDir) fileMenu->items()[last_itemselected]->redraw(true); last_itemselected = selected; if (selected >= 1 + hasUpDir) { const int8_t filenum = selected - 1 - hasUpDir; // Skip "Back" and ".." card.selectFileByIndexSorted(filenum); - make_name_without_ext(shift_name, card.longest_filename(), LONG_FILENAME_LENGTH); + makeNameWithoutExt(shift_name, card.longest_filename(), LONG_FILENAME_LENGTH); shift_len = strlen(shift_name); shift_amt = 0; } } else if ((selected >= 1 + hasUpDir) && (shift_len > MENU_CHAR_LIMIT)) { uint8_t shift_new = _MIN(shift_amt + 1, shift_len - MENU_CHAR_LIMIT); // Try to shift by... - Draw_SDItem_Shifted(shift_new); // Draw the item + drawSDItemShifted(shift_new); // Draw the item if (shift_new == shift_amt) // Scroll reached the end shift_new = -1; // Reset shift_amt = shift_new; // Set new scroll } } -#else + +#else // !SCROLL_LONG_FILENAMES + char shift_name[FILENAME_LENGTH + 1] = ""; + #endif -void onDrawFileName(MenuItemClass* menuitem, int8_t line) { +void onDrawFileName(MenuItem* menuitem, int8_t line) { const bool is_subdir = !card.flag.workDirIsRoot; if (is_subdir && menuitem->pos == 1) { - Draw_Menu_Line(line, ICON_Folder, ".."); + drawMenuLine(line, ICON_Folder, ".."); } else { uint8_t icon; card.selectFileByIndexSorted(menuitem->pos - is_subdir - 1); - make_name_without_ext(shift_name, card.longest_filename()); + makeNameWithoutExt(shift_name, card.longest_filename()); icon = card.flag.filenameIsDir ? ICON_Folder : card.fileIsBinary() ? ICON_Binary : ICON_File; - Draw_Menu_Line(line, icon, shift_name); + drawMenuLine(line, icon, shift_name); } } -void Draw_Print_File_Menu() { - checkkey = Menu; +void drawPrintFileMenu() { + checkkey = ID_Menu; if (card.isMounted()) { - if (SET_MENU(FileMenu, MSG_MEDIA_MENU, nr_sd_menu_items() + 1)) { - BACK_ITEM(Goto_Main_Menu); + if (SET_MENU(fileMenu, MSG_MEDIA_MENU, nr_sd_menu_items() + 1)) { + BACK_ITEM(gotoMainMenu); for (uint8_t i = 0; i < nr_sd_menu_items(); ++i) { - MenuItemAdd(onDrawFileName, onClickSDItem); + menuItemAdd(onDrawFileName, onClickSDItem); } } - UpdateMenu(FileMenu); - TERN_(DASH_REDRAW, DWIN_RedrawDash()); + updateMenu(fileMenu); + TERN_(DASH_REDRAW, dwinRedrawDash()); } else { - if (SET_MENU(FileMenu, MSG_MEDIA_MENU, 1)) BACK_ITEM(Goto_Main_Menu); - UpdateMenu(FileMenu); - dwinDrawRectangle(1, HMI_data.AlertBg_Color, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); - DWINUI::Draw_CenteredString(font12x24, HMI_data.AlertTxt_Color, MBASE(3), GET_TEXT_F(MSG_MEDIA_NOT_INSERTED)); + if (SET_MENU(fileMenu, MSG_MEDIA_MENU, 1)) BACK_ITEM(gotoMainMenu); + updateMenu(fileMenu); + dwinDrawRectangle(1, hmiData.colorAlertBg, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); + DWINUI::drawCenteredString(font12x24, hmiData.colorAlertTxt, MBASE(3), GET_TEXT_F(MSG_MEDIA_NOT_INSERTED)); } - TERN_(SCROLL_LONG_FILENAMES, FileMenuIdle(true)); + TERN_(SCROLL_LONG_FILENAMES, fileMenuIdle(true)); } // // Watch for media mount / unmount // -void HMI_SDCardUpdate() { +void hmiSDCardUpdate() { if (hmiFlag.home_flag) return; if (DWIN_lcd_sd_status != card.isMounted()) { DWIN_lcd_sd_status = card.isMounted(); - ResetMenu(FileMenu); - if (IsMenu(FileMenu)) { - CurrentMenu = nullptr; - Draw_Print_File_Menu(); + resetMenu(fileMenu); + if (isMenu(fileMenu)) { + currentMenu = nullptr; + drawPrintFileMenu(); } - if (!DWIN_lcd_sd_status && SD_Printing()) ui.abort_print(); // Media removed while printing + if (!DWIN_lcd_sd_status && sdPrinting()) ui.abort_print(); // Media removed while printing } } @@ -1019,80 +1023,80 @@ void HMI_SDCardUpdate() { * Dash board and indicators */ -void DWIN_Draw_Dashboard() { +void dwinDrawDashboard() { - dwinDrawRectangle(1, HMI_data.Background_Color, 0, STATUS_Y + 21, DWIN_WIDTH, DWIN_HEIGHT - 1); - dwinDrawRectangle(1, HMI_data.SplitLine_Color, 0, 449, DWIN_WIDTH, 451); + dwinDrawRectangle(1, hmiData.colorBackground, 0, STATUS_Y + 21, DWIN_WIDTH, DWIN_HEIGHT - 1); + dwinDrawRectangle(1, hmiData.colorSplitLine, 0, 449, DWIN_WIDTH, 451); - DWINUI::Draw_Icon(ICON_MaxSpeedX, 10, 456); - DWINUI::Draw_Icon(ICON_MaxSpeedY, 95, 456); - DWINUI::Draw_Icon(ICON_MaxSpeedZ, 180, 456); - _draw_xyz_position(true); + DWINUI::drawIcon(ICON_MaxSpeedX, 10, 456); + DWINUI::drawIcon(ICON_MaxSpeedY, 95, 456); + DWINUI::drawIcon(ICON_MaxSpeedZ, 180, 456); + _drawXYZPosition(true); #if HAS_HOTEND - DWINUI::Draw_Icon(ICON_HotendTemp, 10, 383); - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 28, 384, thermalManager.wholeDegHotend(0)); - DWINUI::Draw_String(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.degTargetHotend(0)); + DWINUI::drawIcon(ICON_HotendTemp, 10, 383); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 28, 384, thermalManager.wholeDegHotend(0)); + DWINUI::drawString(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.degTargetHotend(0)); - DWINUI::Draw_Icon(ICON_StepE, 112, 417); - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); - DWINUI::Draw_String(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); + DWINUI::drawIcon(ICON_StepE, 112, 417); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); + DWINUI::drawString(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); #endif #if HAS_HEATED_BED - DWINUI::Draw_Icon(ICON_BedTemp, 10, 416); - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 28, 417, thermalManager.wholeDegBed()); - DWINUI::Draw_String(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed()); + DWINUI::drawIcon(ICON_BedTemp, 10, 416); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 28, 417, thermalManager.wholeDegBed()); + DWINUI::drawString(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed()); #endif - DWINUI::Draw_Icon(ICON_Speed, 113, 383); - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 116 + 2 * STAT_CHR_W, 384, feedrate_percentage); - IF_DISABLED(SHOW_SPEED_IND, DWINUI::Draw_String(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 116 + 5 * STAT_CHR_W + 2, 384, F("%"))); + DWINUI::drawIcon(ICON_Speed, 113, 383); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 116 + 2 * STAT_CHR_W, 384, feedrate_percentage); + IF_DISABLED(SHOW_SPEED_IND, DWINUI::drawString(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 116 + 5 * STAT_CHR_W + 2, 384, F("%"))); #if HAS_FAN - DWINUI::Draw_Icon(ICON_FanSpeed, 187, 383); - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]); + DWINUI::drawIcon(ICON_FanSpeed, 187, 383); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]); #endif #if HAS_ZOFFSET_ITEM - DWINUI::Draw_Icon(planner.leveling_active ? ICON_SetZOffset : ICON_Zoffset, 187, 416); - DWINUI::Draw_Signed_Float(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 2, 2, 204, 417, BABY_Z_VAR); + DWINUI::drawIcon(planner.leveling_active ? ICON_SetZOffset : ICON_Zoffset, 187, 416); + DWINUI::drawSignedFloat(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 2, 2, 204, 417, BABY_Z_VAR); #endif } -void Draw_Info_Menu() { - DWINUI::ClearMainArea(); - if (HMI_IsChinese()) - Title.FrameCopy(30, 17, 28, 13); // "Info" +void drawInfoMenu() { + DWINUI::clearMainArea(); + if (hmiIsChinese()) + title.frameCopy(30, 17, 28, 13); // "Info" else - Title.ShowCaption(GET_TEXT_F(MSG_INFO_SCREEN)); - Draw_Menu_Line(0, ICON_Back, GET_TEXT_F(MSG_BACK), false, true); + title.showCaption(GET_TEXT_F(MSG_INFO_SCREEN)); + drawMenuLine(0, ICON_Back, GET_TEXT_F(MSG_BACK), false, true); - if (HMI_IsChinese()) { - DWIN_Frame_AreaCopy(1, 197, 149, 252, 161, 108, 102); // "Size" - DWIN_Frame_AreaCopy(1, 1, 164, 56, 176, 108, 175); // "Firmware Version" - DWIN_Frame_AreaCopy(1, 58, 164, 113, 176, 105, 248); // "Contact Details" - DWINUI::Draw_CenteredString(268, F(CORP_WEBSITE)); + if (hmiIsChinese()) { + dwinFrameAreaCopy(1, 197, 149, 252, 161, 108, 102); // "Size" + dwinFrameAreaCopy(1, 1, 164, 56, 176, 108, 175); // "Firmware Version" + dwinFrameAreaCopy(1, 58, 164, 113, 176, 105, 248); // "Contact Details" + DWINUI::drawCenteredString(268, F(CORP_WEBSITE)); } else { - DWINUI::Draw_CenteredString(102, F("Size")); - DWINUI::Draw_CenteredString(175, F("Firmware version")); - DWINUI::Draw_CenteredString(248, F("Build Datetime")); - DWINUI::Draw_CenteredString(268, F(STRING_DISTRIBUTION_DATE)); + DWINUI::drawCenteredString(102, F("Size")); + DWINUI::drawCenteredString(175, F("Firmware version")); + DWINUI::drawCenteredString(248, F("Build Datetime")); + DWINUI::drawCenteredString(268, F(STRING_DISTRIBUTION_DATE)); } - DWINUI::Draw_CenteredString(122, F(MACHINE_SIZE)); - DWINUI::Draw_CenteredString(195, F(SHORT_BUILD_VERSION)); + DWINUI::drawCenteredString(122, F(MACHINE_SIZE)); + DWINUI::drawCenteredString(195, F(SHORT_BUILD_VERSION)); for (uint8_t i = 0; i < 3; ++i) { - DWINUI::Draw_Icon(ICON_PrintSize + i, ICOX, 99 + i * 73); - dwinDrawHLine(HMI_data.SplitLine_Color, 16, MBASE(2) + i * 73, 240); + DWINUI::drawIcon(ICON_PrintSize + i, ICOX, 99 + i * 73); + dwinDrawHLine(hmiData.colorSplitLine, 16, MBASE(2) + i * 73, 240); } } // Main Process -void HMI_MainMenu() { +void hmiMainMenu() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; @@ -1119,32 +1123,32 @@ void HMI_MainMenu() { else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_page.now) { case PAGE_PRINT: - if (HMI_data.MediaAutoMount) { + if (hmiData.mediaAutoMount) { card.mount(); safe_delay(800); }; - Draw_Print_File_Menu(); + drawPrintFileMenu(); break; - case PAGE_PREPARE: Draw_Prepare_Menu(); break; - case PAGE_CONTROL: Draw_Control_Menu(); break; - case PAGE_ADVANCE: Draw_AdvancedSettings_Menu(); break; + case PAGE_PREPARE: drawPrepareMenu(); break; + case PAGE_CONTROL: drawControlMenu(); break; + case PAGE_ADVANCE: drawAdvancedSettingsMenu(); break; } } dwinUpdateLCD(); } // Pause or Stop popup -void onClick_PauseOrStop() { +void onClickPauseOrStop() { switch (select_print.now) { case PRINT_PAUSE_RESUME: if (hmiFlag.select_flag) ui.pause_print(); break; // Confirm pause case PRINT_STOP: if (hmiFlag.select_flag) ui.abort_print(); break; // Stop confirmed then abort print default: break; } - return Goto_PrintProcess(); + return gotoPrintProcess(); } // Printing -void HMI_Printing() { +void hmiPrinting() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; // Avoid flicker by updating only the previous menu @@ -1168,16 +1172,16 @@ void HMI_Printing() { } else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_print.now) { - case PRINT_SETUP: Draw_Tune_Menu(); break; + case PRINT_SETUP: drawTuneMenu(); break; case PRINT_PAUSE_RESUME: if (printingIsPaused()) { // If printer is already in pause ui.resume_print(); break; } else - return Goto_Popup(Popup_window_PauseOrStop, onClick_PauseOrStop); + return gotoPopup(popupPauseOrStop, onClickPauseOrStop); case PRINT_STOP: - return Goto_Popup(Popup_window_PauseOrStop, onClick_PauseOrStop); + return gotoPopup(popupPauseOrStop, onClickPauseOrStop); default: break; } } @@ -1186,84 +1190,84 @@ void HMI_Printing() { #include "../../../libs/buzzer.h" -void Draw_Main_Area() { +void drawMainArea() { switch (checkkey) { - case MainMenu: Draw_Main_Menu(); break; - case PrintProcess: Draw_PrintProcess(); break; - case PrintDone: Draw_PrintDone(); break; + case ID_MainMenu: drawMainMenu(); break; + case ID_PrintProcess: drawPrintProcess(); break; + case ID_PrintDone: drawPrintDone(); break; #if HAS_ESDIAG - case ESDiagProcess: Draw_EndStopDiag(); break; + case ID_ESDiagProcess: drawEndStopDiag(); break; #endif - case Popup: popupDraw(); break; + case ID_Popup: popupDraw(); break; #if HAS_LOCKSCREEN - case Locked: lockScreen.draw(); break; - #endif - case Menu: - case SetInt: - case SetPInt: - case SetIntNoDraw: - case SetFloat: - case SetPFloat: ReDrawMenu(true); break; + case ID_Locked: lockScreen.draw(); break; + #endif + case ID_Menu: + case ID_SetInt: + case ID_SetPInt: + case ID_SetIntNoDraw: + case ID_SetFloat: + case ID_SetPFloat: ReDrawMenu(true); break; default: break; } } -void HMI_WaitForUser() { +void hmiWaitForUser() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState != ENCODER_DIFF_NO && !ui.backlight) { - if (checkkey == WaitResponse) HMI_ReturnScreen(); + if (checkkey == ID_WaitResponse) hmiReturnScreen(); return ui.refresh_brightness(); } if (!wait_for_user) { switch (checkkey) { - case PrintDone: + case ID_PrintDone: select_page.reset(); - Goto_Main_Menu(); + gotoMainMenu(); break; #if HAS_BED_PROBE - case Leveling: + case ID_Leveling: #endif default: - HMI_ReturnScreen(); + hmiReturnScreen(); break; } } } -void HMI_Init() { +void hmiInit() { #if ENABLED(SHOW_BOOTSCREEN) #ifndef BOOTSCREEN_TIMEOUT #define BOOTSCREEN_TIMEOUT 1100 #endif - DWINUI::Draw_Box(1, Color_Black, { 5, 220, DWIN_WIDTH - 5, DWINUI::fontHeight() }); - DWINUI::Draw_CenteredString(Color_White, 220, F("ProUI starting up ")); + DWINUI::drawBox(1, COLOR_BLACK, { 5, 220, DWIN_WIDTH - 5, DWINUI::fontHeight() }); + DWINUI::drawCenteredString(COLOR_WHITE, 220, F("ProUI starting up ")); for (uint16_t t = 15; t < 257; t += 11) { - DWINUI::Draw_Icon(ICON_Bar, 15, 260); - dwinDrawRectangle(1, HMI_data.Background_Color, t, 260, 257, 280); + DWINUI::drawIcon(ICON_Bar, 15, 260); + dwinDrawRectangle(1, hmiData.colorBackground, t, 260, 257, 280); dwinUpdateLCD(); safe_delay((BOOTSCREEN_TIMEOUT) / 22); } #endif - HMI_SetLanguage(); + hmiSetLanguage(); } -void EachMomentUpdate() { +void eachMomentUpdate() { static millis_t next_var_update_ms = 0, next_rts_update_ms = 0, next_status_update_ms = 0; const millis_t ms = millis(); if (ELAPSED(ms, next_var_update_ms)) { next_var_update_ms = ms + DWIN_VAR_UPDATE_INTERVAL; blink = !blink; - update_variable(); + updateVariable(); #if HAS_ESDIAG - if (checkkey == ESDiagProcess) ESDiag.Update(); + if (checkkey == ID_ESDiagProcess) esDiag.update(); #endif - #if SHOW_TUNING_GRAPH - if (checkkey == PidProcess) { - TERN_(PIDTEMP, if (HMI_value.tempcontrol == PIDTEMP_START) plot.Update(thermalManager.wholeDegHotend(0))); - TERN_(PIDTEMPBED, if (HMI_value.tempcontrol == PIDTEMPBED_START) plot.Update(thermalManager.wholeDegBed())); + #if PROUI_TUNING_GRAPH + if (checkkey == ID_PIDProcess) { + TERN_(PIDTEMP, if (hmiValue.tempControl == PIDTEMP_START) plot.update(thermalManager.wholeDegHotend(0))); + TERN_(PIDTEMPBED, if (hmiValue.tempControl == PIDTEMPBED_START) plot.update(thermalManager.wholeDegBed())); } - TERN_(MPCTEMP, if (checkkey == MPCProcess) plot.Update(thermalManager.wholeDegHotend(0))); + TERN_(MPCTEMP, if (checkkey == ID_MPCProcess) plot.update(thermalManager.wholeDegHotend(0))); #endif } @@ -1275,42 +1279,42 @@ void EachMomentUpdate() { if (ELAPSED(ms, next_status_update_ms)) { next_status_update_ms = ms + 500; - DWIN_DrawStatusMessage(); + dwinDrawStatusMessage(); #if ENABLED(SCROLL_LONG_FILENAMES) - if (IsMenu(FileMenu)) FileMenuIdle(); + if (isMenu(fileMenu)) fileMenuIdle(); #endif } if (!PENDING(ms, next_rts_update_ms)) { next_rts_update_ms = ms + DWIN_UPDATE_INTERVAL; - if ((Printing() != hmiFlag.printing_flag) && !hmiFlag.home_flag) { - hmiFlag.printing_flag = Printing(); + if ((isPrinting() != hmiFlag.printing_flag) && !hmiFlag.home_flag) { + hmiFlag.printing_flag = isPrinting(); if (hmiFlag.printing_flag) - DWIN_Print_Started(); + dwinPrintStarted(); else if (hmiFlag.abort_flag) - DWIN_Print_Aborted(); + dwinPrintAborted(); else - DWIN_Print_Finished(); + dwinPrintFinished(); } if ((printingIsPaused() != hmiFlag.pause_flag) && !hmiFlag.home_flag) { hmiFlag.pause_flag = printingIsPaused(); if (hmiFlag.pause_flag) - DWIN_Print_Pause(); + dwinPrintPause(); else if (hmiFlag.abort_flag) - DWIN_Print_Aborted(); + dwinPrintAborted(); else - DWIN_Print_Resume(); + dwinPrintResume(); } - if (checkkey == PrintProcess) { // Print process + if (checkkey == ID_PrintProcess) { // Print process // Progress percent static uint8_t _percent_done = 255; if (_percent_done != ui.get_progress_percent()) { _percent_done = ui.get_progress_percent(); - Draw_Print_ProgressBar(); + drawPrintProgressBar(); } // Remaining time @@ -1318,7 +1322,7 @@ void EachMomentUpdate() { static uint32_t _remain_time = 0; if (_remain_time != ui.get_remaining_time()) { _remain_time = ui.get_remaining_time(); - Draw_Print_ProgressRemain(); + drawPrintProgressRemain(); } #endif @@ -1327,12 +1331,12 @@ void EachMomentUpdate() { const uint16_t min = (print_job_timer.duration() % 3600) / 60; if (_printtime != min) { // 1 minute update _printtime = min; - Draw_Print_ProgressElapsed(); + drawPrintProgressElapsed(); } } #if ENABLED(POWER_LOSS_RECOVERY) else if (DWIN_lcd_sd_status && recovery.dwin_flag) { // Resume print before power off - return Goto_PowerLossRecovery(); + return gotoPowerLossRecovery(); } #endif @@ -1341,136 +1345,136 @@ void EachMomentUpdate() { } #if ENABLED(POWER_LOSS_RECOVERY) - void Popup_PowerLossRecovery() { - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); - if (HMI_IsChinese()) { - DWIN_Frame_AreaCopy(1, 160, 338, 235, 354, 98, 115); - DWIN_Frame_AreaCopy(1, 103, 321, 271, 335, 52, 167); - DWINUI::Draw_IconWB(ICON_Cancel_C, 26, 280); - DWINUI::Draw_IconWB(ICON_Continue_C, 146, 280); + void popupPowerLossRecovery() { + DWINUI::clearMainArea(); + drawPopupBkgd(); + if (hmiIsChinese()) { + dwinFrameAreaCopy(1, 160, 338, 235, 354, 98, 115); + dwinFrameAreaCopy(1, 103, 321, 271, 335, 52, 167); + DWINUI::drawIconWB(ICON_Cancel_C, 26, 280); + DWINUI::drawIconWB(ICON_Continue_C, 146, 280); } else { - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 70, GET_TEXT_F(MSG_OUTAGE_RECOVERY)); - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 147, F("It looks like the last")); - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 167, F("file was interrupted.")); - DWINUI::Draw_Button(BTN_Cancel, 26, 280); - DWINUI::Draw_Button(BTN_Continue, 146, 280); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 70, GET_TEXT_F(MSG_OUTAGE_RECOVERY)); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 147, F("It looks like the last")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 167, F("file was interrupted.")); + DWINUI::drawButton(BTN_Cancel, 26, 280); + DWINUI::drawButton(BTN_Continue, 146, 280); } MediaFile *dir = nullptr; const char * const filename = card.diveToFile(true, dir, recovery.info.sd_filename); card.selectFileByName(filename); - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 207, card.longest_filename()); - DWIN_Print_Header(card.longest_filename()); // Save filename - Draw_Select_Highlight(hmiFlag.select_flag); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 207, card.longest_filename()); + dwinPrintHeader(card.longest_filename()); // Save filename + drawSelectHighlight(hmiFlag.select_flag); dwinUpdateLCD(); } - void onClick_PowerLossRecovery() { + void onClickPowerLossRecovery() { if (hmiFlag.select_flag) { queue.inject(F("M1000C")); select_page.reset(); - return Goto_Main_Menu(); + return gotoMainMenu(); } else { - HMI_SaveProcessID(NothingToDo); + hmiSaveProcessID(ID_NothingToDo); select_print.set(PRINT_SETUP); queue.inject(F("M1000")); } } - void Goto_PowerLossRecovery() { + void gotoPowerLossRecovery() { recovery.dwin_flag = false; LCD_MESSAGE(MSG_CONTINUE_PRINT_JOB); - Goto_Popup(Popup_PowerLossRecovery, onClick_PowerLossRecovery); + gotoPopup(popupPowerLossRecovery, onClickPowerLossRecovery); } #endif // POWER_LOSS_RECOVERY -void DWIN_HandleScreen() { +void dwinHandleScreen() { switch (checkkey) { - case MainMenu: HMI_MainMenu(); break; - case Menu: HMI_Menu(); break; - case SetInt: HMI_SetDraw(); break; - case SetFloat: HMI_SetDraw(); break; - case SetPInt: HMI_SetPInt(); break; - case SetPFloat: HMI_SetPFloat(); break; - case SetIntNoDraw: HMI_SetNoDraw(); break; - case PrintProcess: HMI_Printing(); break; - case Popup: HMI_Popup(); break; - case Leveling: break; + case ID_MainMenu: hmiMainMenu(); break; + case ID_Menu: hmiMenu(); break; + case ID_SetInt: hmiSetDraw(); break; + case ID_SetFloat: hmiSetDraw(); break; + case ID_SetPInt: hmiSetPInt(); break; + case ID_SetPFloat: hmiSetPFloat(); break; + case ID_SetIntNoDraw: hmiSetNoDraw(); break; + case ID_PrintProcess: hmiPrinting(); break; + case ID_Popup: hmiPopup(); break; + case ID_Leveling: break; #if HAS_LOCKSCREEN - case Locked: HMI_LockScreen(); break; - #endif - case PrintDone: - TERN_(HAS_ESDIAG, case ESDiagProcess:) - case WaitResponse: HMI_WaitForUser(); break; - case Homing: - case PidProcess: - case NothingToDo: break; + case ID_Locked: hmiLockScreen(); break; + #endif + case ID_PrintDone: + TERN_(HAS_ESDIAG, case ID_ESDiagProcess:) + case ID_WaitResponse: hmiWaitForUser(); break; + case ID_Homing: + case ID_PIDProcess: + case ID_NothingToDo: break; default: break; } } -bool IDisPopUp() { // If ID is popup... +bool idIsPopUp() { // If ID is popup... switch (checkkey) { - case NothingToDo: - case WaitResponse: - case Popup: - case Homing: - case Leveling: - case PidProcess: - TERN_(HAS_ESDIAG, case ESDiagProcess:) + case ID_NothingToDo: + case ID_WaitResponse: + case ID_Popup: + case ID_Homing: + case ID_Leveling: + case ID_PIDProcess: + TERN_(HAS_ESDIAG, case ID_ESDiagProcess:) return true; default: break; } return false; } -void HMI_SaveProcessID(const uint8_t id) { +void hmiSaveProcessID(const uint8_t id) { if (checkkey == id) return; - if (!IDisPopUp()) last_checkkey = checkkey; // If previous is not a popup + if (!idIsPopUp()) last_checkkey = checkkey; // If previous is not a popup checkkey = id; switch (id) { - case Popup: - case WaitResponse: - case PrintDone: - case Leveling: - TERN_(HAS_ESDIAG, case ESDiagProcess:) + case ID_Popup: + case ID_WaitResponse: + case ID_PrintDone: + case ID_Leveling: + TERN_(HAS_ESDIAG, case ID_ESDiagProcess:) wait_for_user = true; default: break; } } -void HMI_ReturnScreen() { +void hmiReturnScreen() { checkkey = last_checkkey; wait_for_user = false; - Draw_Main_Area(); + drawMainArea(); } void dwinHomingStart() { hmiFlag.home_flag = true; - HMI_SaveProcessID(Homing); - Title.ShowCaption(GET_TEXT_F(MSG_HOMING)); - DWIN_Show_Popup(ICON_BLTouch, GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT)); + hmiSaveProcessID(ID_Homing); + title.showCaption(GET_TEXT_F(MSG_HOMING)); + dwinShowPopup(ICON_BLTouch, GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT)); } void dwinHomingDone() { hmiFlag.home_flag = false; - if (last_checkkey == PrintDone) - Goto_PrintDone(); + if (last_checkkey == ID_PrintDone) + gotoPrintDone(); else - HMI_ReturnScreen(); + hmiReturnScreen(); } -void DWIN_LevelingStart() { +void dwinLevelingStart() { #if HAS_BED_PROBE - HMI_SaveProcessID(Leveling); - Title.ShowCaption(GET_TEXT_F(MSG_BED_LEVELING)); - DWIN_Show_Popup(ICON_AutoLeveling, GET_TEXT_F(MSG_BED_LEVELING), GET_TEXT_F(MSG_PLEASE_WAIT)); + hmiSaveProcessID(ID_Leveling); + title.showCaption(GET_TEXT_F(MSG_BED_LEVELING)); + dwinShowPopup(ICON_AutoLeveling, GET_TEXT_F(MSG_BED_LEVELING), GET_TEXT_F(MSG_PLEASE_WAIT)); #if ALL(AUTO_BED_LEVELING_UBL, PREHEAT_BEFORE_LEVELING) #if HAS_BED_PROBE - if (!DEBUGGING(DRYRUN)) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, HMI_data.BedLevT); + if (!DEBUGGING(DRYRUN)) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, hmiData.bedLevT); #else #if HAS_HOTEND if (!DEBUGGING(DRYRUN) && thermalManager.degTargetHotend(0) < LEVELING_NOZZLE_TEMP) { @@ -1479,24 +1483,24 @@ void DWIN_LevelingStart() { } #endif #if HAS_HEATED_BED - if (!DEBUGGING(DRYRUN) && thermalManager.degTargetBed() < HMI_data.BedLevT) { - thermalManager.setTargetBed(HMI_data.BedLevT); + if (!DEBUGGING(DRYRUN) && thermalManager.degTargetBed() < hmiData.bedLevT) { + thermalManager.setTargetBed(hmiData.bedLevT); thermalManager.wait_for_bed_heating(); } #endif #endif #endif #elif ENABLED(MESH_BED_LEVELING) - Draw_ManualMesh_Menu(); + drawManualMeshMenu(); #endif } -void DWIN_LevelingDone() { - TERN_(HAS_MESH, Goto_MeshViewer(true)); +void dwinLevelingDone() { + TERN_(HAS_MESH, gotoMeshViewer(true)); } #if HAS_MESH - void DWIN_MeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval) { + void dwinMeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval) { ui.set_status( &MString<32>(GET_TEXT_F(MSG_PROBING_POINT), ' ', cpos, '/', tpos, F(" Z="), p_float_t(zval, 2)) ); @@ -1505,49 +1509,49 @@ void DWIN_LevelingDone() { // PID/MPC process -#if SHOW_TUNING_GRAPH +#if PROUI_TUNING_GRAPH #include "plot.h" celsius_t _maxtemp, _target; - void DWIN_Draw_PID_MPC_Popup() { + void dwinDrawPIDMPCPopup() { constexpr frame_rect_t gfrm = { 40, 180, DWIN_WIDTH - 80, 120 }; - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); + DWINUI::clearMainArea(); + drawPopupBkgd(); - switch (HMI_value.tempcontrol) { + switch (hmiValue.tempControl) { default: return; #if ENABLED(MPC_AUTOTUNE) case MPCTEMP_START: - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_MPC_AUTOTUNE)); - DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("MPC target: Celsius")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 100, GET_TEXT_F(MSG_MPC_AUTOTUNE)); + DWINUI::drawString(hmiData.colorPopupTxt, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("MPC target: Celsius")); break; #endif #if ANY(PIDTEMP, PIDTEMPBED) TERN_(PIDTEMP, case PIDTEMP_START:) TERN_(PIDTEMPBED, case PIDTEMPBED_START:) - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_PID_AUTOTUNE)); - DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 100, GET_TEXT_F(MSG_PID_AUTOTUNE)); + DWINUI::drawString(hmiData.colorPopupTxt, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); break; #endif } - switch (HMI_value.tempcontrol) { + switch (hmiValue.tempControl) { default: break; #if ANY(PIDTEMP, MPC_AUTOTUNE) TERN_(PIDTEMP, case PIDTEMP_START:) TERN_(MPC_AUTOTUNE, case MPCTEMP_START:) - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for Nozzle is running.")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 120, F("for Nozzle is running.")); break; #endif #if ENABLED(PIDTEMPBED) case PIDTEMPBED_START: - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for BED is running.")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 120, F("for BED is running.")); break; #endif } - switch (HMI_value.tempcontrol) { + switch (hmiValue.tempControl) { default: break; #if ENABLED(MPC_AUTOTUNE) case MPCTEMP_START: @@ -1558,74 +1562,74 @@ void DWIN_LevelingDone() { #if ENABLED(PIDTEMP) case PIDTEMP_START: _maxtemp = thermalManager.hotend_maxtemp[0]; - _target = HMI_data.HotendPidT; + _target = hmiData.hotendPidT; break; #endif #if ENABLED(PIDTEMPBED) case PIDTEMPBED_START: _maxtemp = BED_MAXTEMP; - _target = HMI_data.BedPidT; + _target = hmiData.bedPidT; break; #endif } - plot.Draw(gfrm, _maxtemp, _target); - DWINUI::Draw_Int(HMI_data.PopupTxt_Color, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, _target); + plot.draw(gfrm, _maxtemp, _target); + DWINUI::drawInt(hmiData.colorPopupTxt, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, _target); } -#endif // SHOW_TUNING_GRAPH +#endif // PROUI_TUNING_GRAPH -#if DWIN_PID_TUNE +#if PROUI_PID_TUNE - void DWIN_StartM303(const bool seenC, const int c, const bool seenS, const heater_id_t hid, const celsius_t temp) { - if (seenC) HMI_data.PidCycles = c; + void dwinStartM303(const bool seenC, const int c, const bool seenS, const heater_id_t hid, const celsius_t temp) { + if (seenC) hmiData.pidCycles = c; if (seenS) { switch (hid) { - OPTCODE(PIDTEMP, case 0 ... HOTENDS - 1: HMI_data.HotendPidT = temp; break) - OPTCODE(PIDTEMPBED, case H_BED: HMI_data.BedPidT = temp; break) + OPTCODE(PIDTEMP, case 0 ... HOTENDS - 1: hmiData.hotendPidT = temp; break) + OPTCODE(PIDTEMPBED, case H_BED: hmiData.bedPidT = temp; break) default: break; } } } - void DWIN_PidTuning(tempcontrol_t result) { - HMI_value.tempcontrol = result; + void dwinPidTuning(tempcontrol_t result) { + hmiValue.tempControl = result; switch (result) { #if ENABLED(PIDTEMP) case PIDTEMP_START: - HMI_SaveProcessID(PidProcess); - #if SHOW_TUNING_GRAPH - DWIN_Draw_PID_MPC_Popup(); + hmiSaveProcessID(ID_PIDProcess); + #if PROUI_TUNING_GRAPH + dwinDrawPIDMPCPopup(); #else - DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for Nozzle is running.")); + dwinDrawPopup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for Nozzle is running.")); #endif break; case PID_TEMP_TOO_HIGH: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_TEMP_TOO_HIGH)); + dwinPopupConfirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_TEMP_TOO_HIGH)); break; #endif #if ENABLED(PIDTEMPBED) case PIDTEMPBED_START: - HMI_SaveProcessID(PidProcess); - #if SHOW_TUNING_GRAPH - DWIN_Draw_PID_MPC_Popup(); + hmiSaveProcessID(ID_PIDProcess); + #if PROUI_TUNING_GRAPH + dwinDrawPIDMPCPopup(); #else - DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for BED is running.")); + dwinDrawPopup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for BED is running.")); #endif break; #endif case PID_BAD_HEATER_ID: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_PID_BAD_HEATER_ID)); + dwinPopupConfirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_PID_BAD_HEATER_ID)); break; case PID_TUNING_TIMEOUT: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), GET_TEXT_F(MSG_PID_TIMEOUT)); + dwinPopupConfirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), GET_TEXT_F(MSG_PID_TIMEOUT)); break; case AUTOTUNE_DONE: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_BUTTON_DONE)); + dwinPopupConfirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_BUTTON_DONE)); break; default: checkkey = last_checkkey; @@ -1633,34 +1637,34 @@ void DWIN_LevelingDone() { } } -#endif // DWIN_PID_TUNE +#endif // PROUI_PID_TUNE #if ENABLED(MPC_AUTOTUNE) - void DWIN_MPCTuning(tempcontrol_t result) { - HMI_value.tempcontrol = result; + void dwinMPCTuning(tempcontrol_t result) { + hmiValue.tempControl = result; switch (result) { case MPCTEMP_START: - HMI_SaveProcessID(MPCProcess); - #if SHOW_TUNING_GRAPH - DWIN_Draw_PID_MPC_Popup(); + hmiSaveProcessID(ID_MPCProcess); + #if PROUI_TUNING_GRAPH + dwinDrawPIDMPCPopup(); #else - DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_MPC_AUTOTUNE), F("for Nozzle is running.")); + dwinDrawPopup(ICON_TempTooHigh, GET_TEXT_F(MSG_MPC_AUTOTUNE), F("for Nozzle is running.")); #endif break; case MPC_TEMP_ERROR: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), F(STR_MPC_TEMPERATURE_ERROR)); + dwinPopupConfirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), F(STR_MPC_TEMPERATURE_ERROR)); ui.reset_alert_level(); break; case MPC_INTERRUPTED: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), F(STR_MPC_AUTOTUNE_INTERRUPTED)); + dwinPopupConfirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), F(STR_MPC_AUTOTUNE_INTERRUPTED)); ui.reset_alert_level(); break; case AUTOTUNE_DONE: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_MPC_AUTOTUNE), GET_TEXT_F(MSG_BUTTON_DONE)); + dwinPopupConfirm(ICON_TempTooLow, GET_TEXT_F(MSG_MPC_AUTOTUNE), GET_TEXT_F(MSG_BUTTON_DONE)); ui.reset_alert_level(); break; default: @@ -1673,117 +1677,117 @@ void DWIN_LevelingDone() { #endif // MPC_AUTOTUNE // Started a Print Job -void DWIN_Print_Started() { +void dwinPrintStarted() { TERN_(HAS_GCODE_PREVIEW, if (Host_Printing()) Preview_Invalidate()); TERN_(SET_PROGRESS_PERCENT, ui.progress_reset()); TERN_(SET_REMAINING_TIME, ui.reset_remaining_time()); hmiFlag.pause_flag = false; hmiFlag.abort_flag = false; select_print.reset(); - Goto_PrintProcess(); + gotoPrintProcess(); } // Pause a print job -void DWIN_Print_Pause() { +void dwinPrintPause() { ICON_ResumeOrPause(); } // Resume print job -void DWIN_Print_Resume() { +void dwinPrintResume() { ICON_ResumeOrPause(); LCD_MESSAGE(MSG_RESUME_PRINT); } // Ended print job -void DWIN_Print_Finished() { +void dwinPrintFinished() { TERN_(POWER_LOSS_RECOVERY, if (card.isPrinting()) recovery.cancel()); hmiFlag.abort_flag = false; hmiFlag.pause_flag = false; wait_for_heatup = false; planner.finish_and_disable(); thermalManager.cooldown(); - Goto_PrintDone(); + gotoPrintDone(); } // Print was aborted -void DWIN_Print_Aborted() { - DWIN_Print_Finished(); +void dwinPrintAborted() { + dwinPrintFinished(); } #if HAS_FILAMENT_SENSOR // Filament Runout process - void DWIN_FilamentRunout(const uint8_t extruder) { LCD_MESSAGE(MSG_RUNOUT_SENSOR); } -#endif - -void DWIN_SetColorDefaults() { - HMI_data.Background_Color = Def_Background_Color; - HMI_data.Cursor_Color = Def_Cursor_Color; - HMI_data.TitleBg_Color = Def_TitleBg_Color; - HMI_data.TitleTxt_Color = Def_TitleTxt_Color; - HMI_data.Text_Color = Def_Text_Color; - HMI_data.Selected_Color = Def_Selected_Color; - HMI_data.SplitLine_Color = Def_SplitLine_Color; - HMI_data.Highlight_Color = Def_Highlight_Color; - HMI_data.StatusBg_Color = Def_StatusBg_Color; - HMI_data.StatusTxt_Color = Def_StatusTxt_Color; - HMI_data.PopupBg_Color = Def_PopupBg_Color; - HMI_data.PopupTxt_Color = Def_PopupTxt_Color; - HMI_data.AlertBg_Color = Def_AlertBg_Color; - HMI_data.AlertTxt_Color = Def_AlertTxt_Color; - HMI_data.PercentTxt_Color = Def_PercentTxt_Color; - HMI_data.Barfill_Color = Def_Barfill_Color; - HMI_data.Indicator_Color = Def_Indicator_Color; - HMI_data.Coordinate_Color = Def_Coordinate_Color; -} - -void DWIN_SetDataDefaults() { - DWIN_SetColorDefaults(); - DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); - TERN_(PIDTEMP, HMI_data.HotendPidT = DEF_HOTENDPIDT); - TERN_(PIDTEMPBED, HMI_data.BedPidT = DEF_BEDPIDT); - TERN_(DWIN_PID_TUNE, HMI_data.PidCycles = DEF_PIDCYCLES); + void dwinFilamentRunout(const uint8_t extruder) { LCD_MESSAGE(MSG_RUNOUT_SENSOR); } +#endif + +void dwinSetColorDefaults() { + hmiData.colorBackground = defColorBackground; + hmiData.colorCursor = defColorCursor; + hmiData.colorTitleBg = defColorTitleBg; + hmiData.colorTitleTxt = defColorTitleTxt; + hmiData.colorText = defColorText; + hmiData.colorSelected = defColorSelected; + hmiData.colorSplitLine = defColorSplitLine; + hmiData.colorHighlight = defColorHighlight; + hmiData.colorStatusBg = defColorStatusBg; + hmiData.colorStatusTxt = defColorStatusTxt; + hmiData.colorPopupBg = defColorPopupBg; + hmiData.colorPopupTxt = defColorPopupTxt; + hmiData.colorAlertBg = defColorAlertBg; + hmiData.colorAlertTxt = defColorAlertTxt; + hmiData.colorPercentTxt = defColorPercentTxt; + hmiData.colorBarfill = defColorBarfill; + hmiData.colorIndicator = defColorIndicator; + hmiData.colorCoordinate = defColorCoordinate; +} + +void dwinSetDataDefaults() { + dwinSetColorDefaults(); + DWINUI::setColors(hmiData.colorText, hmiData.colorBackground, hmiData.colorStatusBg); + TERN_(PIDTEMP, hmiData.hotendPidT = DEF_HOTENDPIDT); + TERN_(PIDTEMPBED, hmiData.bedPidT = DEF_BEDPIDT); + TERN_(PROUI_PID_TUNE, hmiData.pidCycles = DEF_PIDCYCLES); #if ENABLED(PREVENT_COLD_EXTRUSION) - HMI_data.ExtMinT = EXTRUDE_MINTEMP; - ApplyExtMinT(); + hmiData.extMinT = EXTRUDE_MINTEMP; + applyExtMinT(); #endif - TERN_(PREHEAT_BEFORE_LEVELING, HMI_data.BedLevT = LEVELING_BED_TEMP); - TERN_(BAUD_RATE_GCODE, SetBaud250K()); + TERN_(PREHEAT_BEFORE_LEVELING, hmiData.bedLevT = LEVELING_BED_TEMP); + TERN_(BAUD_RATE_GCODE, setBaud250K()); #if ALL(LCD_BED_TRAMMING, HAS_BED_PROBE) - HMI_data.FullManualTramming = DISABLED(BED_TRAMMING_USE_PROBE); + hmiData.fullManualTramming = DISABLED(BED_TRAMMING_USE_PROBE); #endif #if ENABLED(MEDIASORT_MENU_ITEM) - HMI_data.MediaSort = true; + hmiData.mediaSort = true; card.setSortOn(true); #endif - HMI_data.MediaAutoMount = ENABLED(HAS_SD_EXTENDER); + hmiData.mediaAutoMount = ENABLED(HAS_SD_EXTENDER); #if ALL(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - HMI_data.z_after_homing = DEF_Z_AFTER_HOMING; + hmiData.zAfterHoming = DEF_Z_AFTER_HOMING; #endif #if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) TERN_(LED_COLOR_PRESETS, leds.set_default()); - ApplyLEDColor(); + applyLEDColor(); #endif - TERN_(ADAPTIVE_STEP_SMOOTHING, HMI_data.AdaptiveStepSmoothing = true); - TERN_(HAS_GCODE_PREVIEW, HMI_data.EnablePreview = true); + TERN_(ADAPTIVE_STEP_SMOOTHING, hmiData.adaptiveStepSmoothing = true); + TERN_(HAS_GCODE_PREVIEW, hmiData.enablePreview = true); } -void DWIN_CopySettingsTo(char * const buff) { - memcpy(buff, &HMI_data, eeprom_data_size); +void dwinCopySettingsTo(char * const buff) { + memcpy(buff, &hmiData, eeprom_data_size); } -void DWIN_CopySettingsFrom(const char * const buff) { - memcpy(&HMI_data, buff, sizeof(HMI_data_t)); - if (HMI_data.Text_Color == HMI_data.Background_Color) DWIN_SetColorDefaults(); - DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); - TERN_(PREVENT_COLD_EXTRUSION, ApplyExtMinT()); +void dwinCopySettingsFrom(const char * const buff) { + memcpy(&hmiData, buff, sizeof(hmi_data_t)); + if (hmiData.colorText == hmiData.colorBackground) dwinSetColorDefaults(); + DWINUI::setColors(hmiData.colorText, hmiData.colorBackground, hmiData.colorStatusBg); + TERN_(PREVENT_COLD_EXTRUSION, applyExtMinT()); feedrate_percentage = 100; - TERN_(BAUD_RATE_GCODE, HMI_SetBaudRate()); + TERN_(BAUD_RATE_GCODE, hmiSetBaudRate()); #if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) leds.set_color( - HMI_data.Led_Color.r, - HMI_data.Led_Color.g, - HMI_data.Led_Color.b - OPTARG(HAS_WHITE_LED, HMI_data.Led_Color.w) + hmiData.ledColor.r, + hmiData.ledColor.g, + hmiData.ledColor.b + OPTARG(HAS_WHITE_LED, hmiData.ledColor.w) ); leds.update(); #endif @@ -1799,23 +1803,23 @@ void MarlinUI::init_lcd() { } void dwinInitScreen() { - DWIN_SetColorDefaults(); - HMI_Init(); // Draws boot screen + dwinSetColorDefaults(); + hmiInit(); // Draws boot screen DWINUI::init(); - DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); - DWINUI::onTitleDraw = Draw_Title; - InitMenu(); + DWINUI::setColors(hmiData.colorText, hmiData.colorBackground, hmiData.colorStatusBg); + DWINUI::onTitleDraw = drawTitle; + initMenu(); checkkey = 255; hash_changed = true; - DWIN_DrawStatusLine(); - DWIN_Draw_Dashboard(); - Goto_Main_Menu(); + dwinDrawStatusLine(); + dwinDrawDashboard(); + gotoMainMenu(); } void MarlinUI::update() { - HMI_SDCardUpdate(); // SD card update - EachMomentUpdate(); // Status update - DWIN_HandleScreen(); // Rotary encoder update + hmiSDCardUpdate(); // SD card update + eachMomentUpdate(); // Status update + dwinHandleScreen(); // Rotary encoder update } void MarlinUI::refresh() { /* Nothing to see here */ } @@ -1825,149 +1829,149 @@ void MarlinUI::refresh() { /* Nothing to see here */ } #endif void MarlinUI::kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component) { - DWIN_Draw_Popup(ICON_BLTouch, GET_TEXT_F(MSG_PRINTER_KILLED), lcd_error); - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 270, GET_TEXT_F(MSG_TURN_OFF)); + dwinDrawPopup(ICON_BLTouch, GET_TEXT_F(MSG_PRINTER_KILLED), lcd_error); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 270, GET_TEXT_F(MSG_TURN_OFF)); dwinUpdateLCD(); } -void DWIN_RebootScreen() { - dwinFrameClear(Color_Bg_Black); +void dwinRebootScreen() { + dwinFrameClear(COLOR_BG_BLACK); dwinJPGShowAndCache(0); - DWINUI::Draw_CenteredString(Color_White, 220, GET_TEXT_F(MSG_PLEASE_WAIT_REBOOT)); + DWINUI::drawCenteredString(COLOR_WHITE, 220, GET_TEXT_F(MSG_PLEASE_WAIT_REBOOT)); dwinUpdateLCD(); safe_delay(500); } -void DWIN_RedrawDash() { +void dwinRedrawDash() { hash_changed = true; - DWIN_DrawStatusMessage(); - DWIN_Draw_Dashboard(); + dwinDrawStatusMessage(); + dwinDrawDashboard(); } -void DWIN_RedrawScreen() { - Draw_Main_Area(); - DWIN_RedrawDash(); +void dwinRedrawScreen() { + drawMainArea(); + dwinRedrawDash(); } #if ENABLED(ADVANCED_PAUSE_FEATURE) - void DWIN_Popup_Pause(FSTR_P const fmsg, uint8_t button/*=0*/) { - HMI_SaveProcessID(button ? WaitResponse : NothingToDo); - DWIN_Show_Popup(ICON_BLTouch, GET_TEXT_F(MSG_ADVANCED_PAUSE), fmsg, button); + void dwinPopupPause(FSTR_P const fmsg, uint8_t button/*=0*/) { + hmiSaveProcessID(button ? ID_WaitResponse : ID_NothingToDo); + dwinShowPopup(ICON_BLTouch, GET_TEXT_F(MSG_ADVANCED_PAUSE), fmsg, button); } void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) { //if (mode == PAUSE_MODE_SAME) return; pause_mode = mode; switch (message) { - case PAUSE_MESSAGE_PARKING: DWIN_Popup_Pause(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; // M125 - case PAUSE_MESSAGE_CHANGING: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; // pause_print (M125, M600) - case PAUSE_MESSAGE_WAITING: DWIN_Popup_Pause(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING), BTN_Continue); break; - case PAUSE_MESSAGE_INSERT: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT), BTN_Continue); break; - case PAUSE_MESSAGE_LOAD: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; - case PAUSE_MESSAGE_UNLOAD: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; // Unload of pause and Unload of M702 + case PAUSE_MESSAGE_PARKING: dwinPopupPause(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; // M125 + case PAUSE_MESSAGE_CHANGING: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; // pause_print (M125, M600) + case PAUSE_MESSAGE_WAITING: dwinPopupPause(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING), BTN_Continue); break; + case PAUSE_MESSAGE_INSERT: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT), BTN_Continue); break; + case PAUSE_MESSAGE_LOAD: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; + case PAUSE_MESSAGE_UNLOAD: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; // Unload of pause and Unload of M702 case PAUSE_MESSAGE_PURGE: #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) - DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_CONT_PURGE)); + dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_CONT_PURGE)); #else - DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)); + dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)); #endif break; - case PAUSE_MESSAGE_OPTION: Goto_FilamentPurge(); break; - case PAUSE_MESSAGE_RESUME: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; - case PAUSE_MESSAGE_HEAT: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT), BTN_Continue); break; - case PAUSE_MESSAGE_HEATING: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break; - case PAUSE_MESSAGE_STATUS: HMI_ReturnScreen(); break; // Exit from Pause, Load and Unload + case PAUSE_MESSAGE_OPTION: gotoFilamentPurge(); break; + case PAUSE_MESSAGE_RESUME: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; + case PAUSE_MESSAGE_HEAT: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT), BTN_Continue); break; + case PAUSE_MESSAGE_HEATING: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break; + case PAUSE_MESSAGE_STATUS: hmiReturnScreen(); break; // Exit from Pause, Load and Unload default: break; } } - void Draw_Popup_FilamentPurge() { - DWIN_Draw_Popup(ICON_BLTouch, GET_TEXT_F(MSG_ADVANCED_PAUSE), GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE_CONTINUE)); - DWINUI::Draw_Button(BTN_Purge, 26, 280); - DWINUI::Draw_Button(BTN_Continue, 146, 280); - Draw_Select_Highlight(true); + void drawPopupFilamentPurge() { + dwinDrawPopup(ICON_BLTouch, GET_TEXT_F(MSG_ADVANCED_PAUSE), GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE_CONTINUE)); + DWINUI::drawButton(BTN_Purge, 26, 280); + DWINUI::drawButton(BTN_Continue, 146, 280); + drawSelectHighlight(true); } - void onClick_FilamentPurge() { + void onClickFilamentPurge() { if (hmiFlag.select_flag) pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; // "Purge More" button else { - HMI_SaveProcessID(NothingToDo); + hmiSaveProcessID(ID_NothingToDo); pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; // "Continue" button } } - void Goto_FilamentPurge() { + void gotoFilamentPurge() { pause_menu_response = PAUSE_RESPONSE_WAIT_FOR; - Goto_Popup(Draw_Popup_FilamentPurge, onClick_FilamentPurge); + gotoPopup(drawPopupFilamentPurge, onClickFilamentPurge); } #endif // ADVANCED_PAUSE_FEATURE #if HAS_MESH - void DWIN_MeshViewer() { + void dwinMeshViewer() { if (!leveling_is_valid()) - DWIN_Popup_Continue(ICON_BLTouch, GET_TEXT_F(MSG_MESH_VIEWER), GET_TEXT_F(MSG_NO_VALID_MESH)); + dwinPopupContinue(ICON_BLTouch, GET_TEXT_F(MSG_MESH_VIEWER), GET_TEXT_F(MSG_NO_VALID_MESH)); else { - HMI_SaveProcessID(WaitResponse); - MeshViewer.Draw(); + hmiSaveProcessID(ID_WaitResponse); + meshViewer.draw(); } } #endif #if HAS_LOCKSCREEN - void DWIN_LockScreen() { - if (checkkey != Locked) { + void dwinLockScreen() { + if (checkkey != ID_Locked) { lockScreen.rprocess = checkkey; - checkkey = Locked; + checkkey = ID_Locked; lockScreen.init(); } } - void DWIN_UnLockScreen() { - if (checkkey == Locked) { + void dwinUnLockScreen() { + if (checkkey == ID_Locked) { checkkey = lockScreen.rprocess; - Draw_Main_Area(); + drawMainArea(); } } - void HMI_LockScreen() { + void hmiLockScreen() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; lockScreen.onEncoder(encoder_diffState); - if (lockScreen.isUnlocked()) DWIN_UnLockScreen(); + if (lockScreen.isUnlocked()) dwinUnLockScreen(); } #endif // HAS_LOCKSCREEN #if HAS_GCODE_PREVIEW - void SetPreview() { Toggle_Chkb_Line(HMI_data.EnablePreview); } + void setPreview() { toggleCheckboxLine(hmiData.enablePreview); } - void onClick_ConfirmToPrint() { - DWIN_ResetStatusLine(); + void onClickConfirmToPrint() { + dwinResetStatusLine(); if (hmiFlag.select_flag) { // Confirm - Goto_Main_Menu(); + gotoMainMenu(); return card.openAndPrintFile(card.filename); } else - HMI_ReturnScreen(); + hmiReturnScreen(); } #endif // HAS_GCODE_PREVIEW -void Goto_ConfirmToPrint() { +void gotoConfirmToPrint() { #if HAS_GCODE_PREVIEW - if (HMI_data.EnablePreview) return Goto_Popup(Preview_DrawFromSD, onClick_ConfirmToPrint); + if (hmiData.enablePreview) return gotoPopup(Preview_DrawFromSD, onClickConfirmToPrint); #endif card.openAndPrintFile(card.filename); // Direct print SD file } #if HAS_ESDIAG - void Draw_EndStopDiag() { - HMI_SaveProcessID(ESDiagProcess); - ESDiag.Draw(); + void drawEndStopDiag() { + hmiSaveProcessID(ID_ESDiagProcess); + esDiag.draw(); } #endif @@ -1979,80 +1983,80 @@ void Goto_ConfirmToPrint() { #if ENABLED(EEPROM_SETTINGS) - void WriteEeprom() { - DWIN_DrawStatusLine(GET_TEXT_F(MSG_STORE_EEPROM)); + void writeEEPROM() { + dwinDrawStatusLine(GET_TEXT_F(MSG_STORE_EEPROM)); dwinUpdateLCD(); DONE_BUZZ(settings.save()); } - void ReadEeprom() { + void readEEPROM() { const bool success = settings.load(); - DWIN_RedrawScreen(); + dwinRedrawScreen(); DONE_BUZZ(success); } - void ResetEeprom() { + void resetEEPROM() { settings.reset(); - DWIN_RedrawScreen(); + dwinRedrawScreen(); DONE_BUZZ(true); } #if HAS_MESH - void SaveMesh() { TERN(AUTO_BED_LEVELING_UBL, UBLMeshSave(), WriteEeprom()); } + void saveMesh() { TERN(AUTO_BED_LEVELING_UBL, ublMeshSave(), writeEEPROM()); } #endif #endif // EEPROM_SETTINGS // Reset Printer -void RebootPrinter() { +void rebootPrinter() { wait_for_heatup = wait_for_user = false; // Stop waiting for heating/user thermalManager.disable_all_heaters(); planner.finish_and_disable(); - DWIN_RebootScreen(); + dwinRebootScreen(); hal.reboot(); } -void Goto_Info_Menu() { - Draw_Info_Menu(); +void gotoInfoMenu() { + drawInfoMenu(); dwinUpdateLCD(); - HMI_SaveProcessID(WaitResponse); + hmiSaveProcessID(ID_WaitResponse); } -void DisableMotors() { queue.inject(F("M84")); } +void disableMotors() { queue.inject(F("M84")); } -void AutoLev() { // Always reacquire the Z "home" position +void autoLevel() { // Always reacquire the Z "home" position queue.inject(F(TERN(AUTO_BED_LEVELING_UBL, "G29P1", "G29"))); } -void AutoHome() { queue.inject_P(G28_STR); } +void autoHome() { queue.inject_P(G28_STR); } #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) - void HomeX() { queue.inject(F("G28X")); } - void HomeY() { queue.inject(F("G28Y")); } - void HomeZ() { queue.inject(F("G28Z")); } + void homeX() { queue.inject(F("G28X")); } + void homeY() { queue.inject(F("G28Y")); } + void homeZ() { queue.inject(F("G28Z")); } #if ALL(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - void ApplyZAfterHoming() { HMI_data.z_after_homing = MenuData.Value; }; - void SetZAfterHoming() { SetIntOnClick(0, 20, HMI_data.z_after_homing, ApplyZAfterHoming); } + void applyZAfterHoming() { hmiData.zAfterHoming = menuData.value; }; + void setZAfterHoming() { setIntOnClick(0, 20, hmiData.zAfterHoming, applyZAfterHoming); } #endif #endif #if HAS_ZOFFSET_ITEM - void ApplyZOffset() { TERN_(EEPROM_SETTINGS, settings.save()); } - void LiveZOffset() { + void applyZOffset() { TERN_(EEPROM_SETTINGS, settings.save()); } + void liveZOffset() { #if ANY(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) - const_float_t step_zoffset = round((MenuData.Value / 100.0f) * planner.settings.axis_steps_per_mm[Z_AXIS]) - babystep.accum; + const_float_t step_zoffset = round((menuData.value / 100.0f) * planner.settings.axis_steps_per_mm[Z_AXIS]) - babystep.accum; if (BABYSTEP_ALLOWED()) babystep.add_steps(Z_AXIS, step_zoffset); #endif } - void SetZOffset() { + void setZOffset() { #if ANY(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) babystep.accum = round(planner.settings.axis_steps_per_mm[Z_AXIS] * BABY_Z_VAR); #endif - SetPFloatOnClick(Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, 2, ApplyZOffset, LiveZOffset); + setPFloatOnClick(Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, 2, applyZOffset, liveZOffset); } - void SetMoveZto0() { + void setMoveZto0() { #if ENABLED(Z_SAFE_HOMING) gcode.process_subcommands_now(MString<54>(F("G28XYO\nG28Z\nG0F5000X"), Z_SAFE_HOMING_X_POINT, F("Y"), Z_SAFE_HOMING_Y_POINT, F("\nG0Z0F300\nM400"))); #else @@ -2064,213 +2068,213 @@ void AutoHome() { queue.inject_P(G28_STR); } } #if !HAS_BED_PROBE - void HomeZandDisable() { - SetMoveZto0(); - DisableMotors(); + void homeZAndDisable() { + setMoveZto0(); + disableMotors(); } #endif #endif // HAS_ZOFFSET_ITEM #if HAS_PREHEAT - #define _DoPreheat(N) void DoPreheat##N() { ui.preheat_all(N-1); }\ + #define _doPreheat(N) void DoPreheat##N() { ui.preheat_all(N-1); }\ void DoPreheatHotend##N() { ui.preheat_hotend(N-1); } - REPEAT_1(PREHEAT_COUNT, _DoPreheat) + REPEAT_1(PREHEAT_COUNT, _doPreheat) #endif -void DoCoolDown() { thermalManager.cooldown(); } +void doCoolDown() { thermalManager.cooldown(); } -void SetLanguage() { - HMI_ToggleLanguage(); - CurrentMenu = nullptr; // Invalidate menu to full redraw - Draw_Prepare_Menu(); +void setLanguage() { + hmiToggleLanguage(); + currentMenu = nullptr; // Invalidate menu to full redraw + drawPrepareMenu(); } -bool EnableLiveMove = false; -void SetLiveMove() { Toggle_Chkb_Line(EnableLiveMove); } -void AxisMove(AxisEnum axis) { +bool enableLiveMove = false; +void setLiveMove() { toggleCheckboxLine(enableLiveMove); } +void axisMove(AxisEnum axis) { #if HAS_HOTEND if (axis == E_AXIS && thermalManager.tooColdToExtrude(0)) { gcode.process_subcommands_now(F("G92E0")); // Reset extruder position - return DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_HOTEND_TOO_COLD), GET_TEXT_F(MSG_PLEASE_PREHEAT)); + return dwinPopupConfirm(ICON_TempTooLow, GET_TEXT_F(MSG_HOTEND_TOO_COLD), GET_TEXT_F(MSG_PLEASE_PREHEAT)); } #endif planner.synchronize(); if (!planner.is_full()) planner.buffer_line(current_position, manual_feedrate_mm_s[axis]); } -void LiveMove() { - if (!EnableLiveMove) return; - *MenuData.P_Float = MenuData.Value / MINUNITMULT; - AxisMove(HMI_value.axis); +void liveMove() { + if (!enableLiveMove) return; + *menuData.floatPtr = menuData.value / MINUNITMULT; + axisMove(hmiValue.axis); } -void ApplyMove() { - if (EnableLiveMove) return; - AxisMove(HMI_value.axis); +void applyMove() { + if (enableLiveMove) return; + axisMove(hmiValue.axis); } -void SetMoveX() { HMI_value.axis = X_AXIS; SetPFloatOnClick(X_MIN_POS, X_MAX_POS, UNITFDIGITS, ApplyMove, LiveMove); } -void SetMoveY() { HMI_value.axis = Y_AXIS; SetPFloatOnClick(Y_MIN_POS, Y_MAX_POS, UNITFDIGITS, ApplyMove, LiveMove); } -void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS, UNITFDIGITS, ApplyMove, LiveMove); } +void setMoveX() { hmiValue.axis = X_AXIS; setPFloatOnClick(X_MIN_POS, X_MAX_POS, UNITFDIGITS, applyMove, liveMove); } +void setMoveY() { hmiValue.axis = Y_AXIS; setPFloatOnClick(Y_MIN_POS, Y_MAX_POS, UNITFDIGITS, applyMove, liveMove); } +void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS, UNITFDIGITS, applyMove, liveMove); } #if HAS_HOTEND - void SetMoveE() { + void setMoveE() { const float e_min = current_position.e - (EXTRUDE_MAXLENGTH), e_max = current_position.e + (EXTRUDE_MAXLENGTH); - HMI_value.axis = E_AXIS; SetPFloatOnClick(e_min, e_max, UNITFDIGITS, ApplyMove, LiveMove); + hmiValue.axis = E_AXIS; setPFloatOnClick(e_min, e_max, UNITFDIGITS, applyMove, liveMove); } #endif #if ENABLED(POWER_LOSS_RECOVERY) - void SetPwrLossr() { - Toggle_Chkb_Line(recovery.enabled); + void setPwrLossr() { + toggleCheckboxLine(recovery.enabled); recovery.changed(); } #endif #if ENABLED(BAUD_RATE_GCODE) - void HMI_SetBaudRate() { HMI_data.Baud115K ? SetBaud115K() : SetBaud250K(); } - void SetBaudRate() { - HMI_data.Baud115K ^= true; - HMI_SetBaudRate(); - Draw_Chkb_Line(CurrentMenu->line(), HMI_data.Baud115K); + void hmiSetBaudRate() { hmiData.baud115K ? setBaud115K() : setBaud250K(); } + void setBaudRate() { + hmiData.baud115K ^= true; + hmiSetBaudRate(); + drawCheckboxLine(currentMenu->line(), hmiData.baud115K); dwinUpdateLCD(); } - void SetBaud115K() { queue.inject(F("M575 P0 B115200")); HMI_data.Baud115K = true; } - void SetBaud250K() { queue.inject(F("M575 P0 B250000")); HMI_data.Baud115K = false; } + void setBaud115K() { queue.inject(F("M575 P0 B115200")); hmiData.baud115K = true; } + void setBaud250K() { queue.inject(F("M575 P0 B250000")); hmiData.baud115K = false; } #endif #if HAS_LCD_BRIGHTNESS - void ApplyBrightness() { ui.set_brightness(MenuData.Value); } - void LiveBrightness() { dwinLCDBrightness(MenuData.Value); } - void SetBrightness() { SetIntOnClick(LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, ui.brightness, ApplyBrightness, LiveBrightness); } - void TurnOffBacklight() { HMI_SaveProcessID(WaitResponse); ui.set_brightness(0); DWIN_RedrawScreen(); } + void applyBrightness() { ui.set_brightness(menuData.value); } + void liveBrightness() { dwinLCDBrightness(menuData.value); } + void setBrightness() { setIntOnClick(LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, ui.brightness, applyBrightness, liveBrightness); } + void turnOffBacklight() { hmiSaveProcessID(ID_WaitResponse); ui.set_brightness(0); dwinRedrawScreen(); } #endif #if ENABLED(CASE_LIGHT_MENU) - void SetCaseLight() { - Toggle_Chkb_Line(caselight.on); + void setCaseLight() { + toggleCheckboxLine(caselight.on); caselight.update_enabled(); } #if ENABLED(CASELIGHT_USES_BRIGHTNESS) - void LiveCaseLightBrightness() { caselight.brightness = MenuData.Value; caselight.update_brightness(); } - void SetCaseLightBrightness() { SetIntOnClick(0, 255, caselight.brightness, nullptr, LiveCaseLightBrightness); } + void liveCaseLightBrightness() { caselight.brightness = menuData.value; caselight.update_brightness(); } + void setCaseLightBrightness() { setIntOnClick(0, 255, caselight.brightness, nullptr, liveCaseLightBrightness); } #endif #endif #if ENABLED(LED_CONTROL_MENU) #if !ALL(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) - void SetLedStatus() { + void setLedStatus() { leds.toggle(); - Show_Chkb_Line(leds.lights_on); + showCheckboxLine(leds.lights_on); } #endif #if HAS_COLOR_LEDS - void ApplyLEDColor() { - HMI_data.Led_Color = LEDColor( {leds.color.r, leds.color.g, leds.color.b OPTARG(HAS_WHITE_LED, HMI_data.Led_Color.w) } ); - } - void LiveLEDColor(uint8_t *color) { *color = MenuData.Value; leds.update(); } - void LiveLEDColorR() { LiveLEDColor(&leds.color.r); } - void LiveLEDColorG() { LiveLEDColor(&leds.color.g); } - void LiveLEDColorB() { LiveLEDColor(&leds.color.b); } - void SetLEDColorR() { SetIntOnClick(0, 255, leds.color.r, ApplyLEDColor, LiveLEDColorR); } - void SetLEDColorG() { SetIntOnClick(0, 255, leds.color.g, ApplyLEDColor, LiveLEDColorG); } - void SetLEDColorB() { SetIntOnClick(0, 255, leds.color.b, ApplyLEDColor, LiveLEDColorB); } + void applyLEDColor() { + hmiData.ledColor = LEDColor( {leds.color.r, leds.color.g, leds.color.b OPTARG(HAS_WHITE_LED, hmiData.ledColor.w) } ); + } + void liveLEDColor(uint8_t *color) { *color = menuData.value; leds.update(); } + void liveLEDColorR() { liveLEDColor(&leds.color.r); } + void liveLEDColorG() { liveLEDColor(&leds.color.g); } + void liveLEDColorB() { liveLEDColor(&leds.color.b); } + void setLEDColorR() { setIntOnClick(0, 255, leds.color.r, applyLEDColor, liveLEDColorR); } + void setLEDColorG() { setIntOnClick(0, 255, leds.color.g, applyLEDColor, liveLEDColorG); } + void setLEDColorB() { setIntOnClick(0, 255, leds.color.b, applyLEDColor, liveLEDColorB); } #if HAS_WHITE_LED - void LiveLEDColorW() { LiveLEDColor(&leds.color.w); } - void SetLEDColorW() { SetIntOnClick(0, 255, leds.color.w, ApplyLEDColor, LiveLEDColorW); } + void liveLEDColorW() { liveLEDColor(&leds.color.w); } + void setLEDColorW() { setIntOnClick(0, 255, leds.color.w, applyLEDColor, liveLEDColorW); } #endif #endif #endif #if ENABLED(SOUND_MENU_ITEM) - void SetEnableSound() { - Toggle_Chkb_Line(ui.sound_on); + void setEnableSound() { + toggleCheckboxLine(ui.sound_on); } #endif #if HAS_HOME_OFFSET - void ApplyHomeOffset() { set_home_offset(HMI_value.axis, MenuData.Value / MINUNITMULT); } - void SetHomeOffsetX() { HMI_value.axis = X_AXIS; SetPFloatOnClick(-50, 50, UNITFDIGITS, ApplyHomeOffset); } - void SetHomeOffsetY() { HMI_value.axis = Y_AXIS; SetPFloatOnClick(-50, 50, UNITFDIGITS, ApplyHomeOffset); } - void SetHomeOffsetZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick( -2, 2, UNITFDIGITS, ApplyHomeOffset); } + void applyHomeOffset() { set_home_offset(hmiValue.axis, menuData.value / MINUNITMULT); } + void setHomeOffsetX() { hmiValue.axis = X_AXIS; setPFloatOnClick(-50, 50, UNITFDIGITS, applyHomeOffset); } + void setHomeOffsetY() { hmiValue.axis = Y_AXIS; setPFloatOnClick(-50, 50, UNITFDIGITS, applyHomeOffset); } + void setHomeOffsetZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick( -2, 2, UNITFDIGITS, applyHomeOffset); } #endif #if HAS_BED_PROBE - void SetProbeOffsetX() { SetPFloatOnClick(-60, 60, UNITFDIGITS); } - void SetProbeOffsetY() { SetPFloatOnClick(-60, 60, UNITFDIGITS); } - void SetProbeOffsetZ() { SetPFloatOnClick(-10, 10, 2); } - void ProbeTest() { + void setProbeOffsetX() { setPFloatOnClick(-60, 60, UNITFDIGITS); } + void setProbeOffsetY() { setPFloatOnClick(-60, 60, UNITFDIGITS); } + void setProbeOffsetZ() { setPFloatOnClick(-10, 10, 2); } + void probeTest() { LCD_MESSAGE(MSG_M48_TEST); queue.inject(F("G28O\nM48 P10")); } - void ProbeStow() { probe.stow(); } - void ProbeDeploy() { probe.deploy(); } + void probeStow() { probe.stow(); } + void probeDeploy() { probe.deploy(); } #if HAS_BLTOUCH_HS_MODE - void SetHSMode() { Toggle_Chkb_Line(bltouch.high_speed_mode); } + void setHSMode() { toggleCheckboxLine(bltouch.high_speed_mode); } #endif #endif #if HAS_FILAMENT_SENSOR - void SetRunoutEnable() { + void setRunoutEnable() { runout.reset(); - Toggle_Chkb_Line(runout.enabled); + toggleCheckboxLine(runout.enabled); } #if HAS_FILAMENT_RUNOUT_DISTANCE - void ApplyRunoutDistance() { runout.set_runout_distance(MenuData.Value / MINUNITMULT); } - void SetRunoutDistance() { SetFloatOnClick(0, 999, UNITFDIGITS, runout.runout_distance(), ApplyRunoutDistance); } + void applyRunoutDistance() { runout.set_runout_distance(menuData.value / MINUNITMULT); } + void setRunoutDistance() { setFloatOnClick(0, 999, UNITFDIGITS, runout.runout_distance(), applyRunoutDistance); } #endif #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) - void SetFilLoad() { SetPFloatOnClick(0, MAX_LOAD_UNLOAD, UNITFDIGITS); } - void SetFilUnload() { SetPFloatOnClick(0, MAX_LOAD_UNLOAD, UNITFDIGITS); } + void setFilLoad() { setPFloatOnClick(0, MAX_LOAD_UNLOAD, UNITFDIGITS); } + void setFilUnload() { setPFloatOnClick(0, MAX_LOAD_UNLOAD, UNITFDIGITS); } #endif #if ENABLED(PREVENT_COLD_EXTRUSION) - void ApplyExtMinT() { thermalManager.extrude_min_temp = HMI_data.ExtMinT; thermalManager.allow_cold_extrude = (HMI_data.ExtMinT == 0); } - void SetExtMinT() { SetPIntOnClick(MIN_ETEMP, MAX_ETEMP, ApplyExtMinT); } + void applyExtMinT() { thermalManager.extrude_min_temp = hmiData.extMinT; thermalManager.allow_cold_extrude = (hmiData.extMinT == 0); } + void setExtMinT() { setPIntOnClick(MIN_ETEMP, MAX_ETEMP, applyExtMinT); } #endif -void SetSpeed() { SetPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); } +void setSpeed() { setPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); } #if HAS_HOTEND - void ApplyHotendTemp() { thermalManager.setTargetHotend(MenuData.Value, 0); } - void SetHotendTemp() { SetIntOnClick(MIN_ETEMP, MAX_ETEMP, thermalManager.degTargetHotend(0), ApplyHotendTemp); } + void applyHotendTemp() { thermalManager.setTargetHotend(menuData.value, 0); } + void setHotendTemp() { setIntOnClick(MIN_ETEMP, MAX_ETEMP, thermalManager.degTargetHotend(0), applyHotendTemp); } #endif #if HAS_HEATED_BED - void ApplyBedTemp() { thermalManager.setTargetBed(MenuData.Value); } - void SetBedTemp() { SetIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP, thermalManager.degTargetBed(), ApplyBedTemp); } + void applyBedTemp() { thermalManager.setTargetBed(menuData.value); } + void setBedTemp() { setIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP, thermalManager.degTargetBed(), applyBedTemp); } #endif #if HAS_FAN - void ApplyFanSpeed() { thermalManager.set_fan_speed(0, MenuData.Value); } - void SetFanSpeed() { SetIntOnClick(0, 255, thermalManager.fan_speed[0], ApplyFanSpeed); } + void applyFanSpeed() { thermalManager.set_fan_speed(0, menuData.value); } + void setFanSpeed() { setIntOnClick(0, 255, thermalManager.fan_speed[0], applyFanSpeed); } #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) - void ChangeFilament() { - HMI_SaveProcessID(NothingToDo); + void changeFilament() { + hmiSaveProcessID(ID_NothingToDo); queue.inject(F("M600 B2")); } #if ENABLED(NOZZLE_PARK_FEATURE) - void ParkHead() { + void parkHead() { LCD_MESSAGE(MSG_FILAMENT_PARK_ENABLED); queue.inject(F("G28O\nG27")); } #endif #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - void UnloadFilament() { + void unloadFilament() { LCD_MESSAGE(MSG_FILAMENTUNLOAD); queue.inject(F("M702 Z20")); } - void LoadFilament() { + void loadFilament() { LCD_MESSAGE(MSG_FILAMENTLOAD); queue.inject(F("M701 Z20")); } @@ -2278,13 +2282,13 @@ void SetSpeed() { SetPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); } #endif // ADVANCED_PAUSE_FEATURE -void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refresh_e_factor(0); }); } +void setFlow() { setPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refresh_e_factor(0); }); } // Bed Tramming #if ENABLED(LCD_BED_TRAMMING) - void TramXY(const uint8_t point, float &x, float &y) { + void tramXY(const uint8_t point, float &x, float &y) { switch (point) { case 0: LCD_MESSAGE(MSG_TRAM_FL); @@ -2317,14 +2321,14 @@ void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refr #if HAS_BED_PROBE - float Tram(const uint8_t point) { + float tram(const uint8_t point) { static bool inLev = false; if (inLev) return NAN; float xpos = 0, ypos = 0, zval = 0; - TramXY(point, xpos, ypos); + tramXY(point, xpos, ypos); - if (HMI_data.FullManualTramming) { + if (hmiData.fullManualTramming) { queue.inject(MString<100>( F("M420S0\nG28O\nG90\nG0F300Z5\nG0F5000X"), p_float_t(xpos, 1), 'Y', p_float_t(ypos, 1), F("\nG0F300Z0") )); @@ -2361,9 +2365,9 @@ void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refr #else - void Tram(const uint8_t point) { + void tram(const uint8_t point) { float xpos = 0, ypos = 0; - TramXY(point, xpos, ypos); + tramXY(point, xpos, ypos); queue.inject(MString<100>( F("M420S0\nG28O\nG90\nG0F300Z5\nG0F5000X"), p_float_t(xpos, 1), 'Y', p_float_t(ypos, 1), F("\nG0F300Z0") )); @@ -2371,49 +2375,49 @@ void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refr #endif - inline void TramFL() { Tram(0); } - inline void TramFR() { Tram(1); } - inline void TramBR() { Tram(2); } - inline void TramBL() { Tram(3); } + inline void tramFL() { tram(0); } + inline void tramFR() { tram(1); } + inline void tramBR() { tram(2); } + inline void tramBL() { tram(3); } #if ENABLED(BED_TRAMMING_INCLUDE_CENTER) - inline void TramC() { Tram(4); } + inline void tramC() { tram(4); } #endif #if HAS_BED_PROBE && HAS_MESH - void Trammingwizard() { - if (HMI_data.FullManualTramming) { + void trammingwizard() { + if (hmiData.fullManualTramming) { LCD_MESSAGE_F("Disable manual tramming"); return; } bed_mesh_t zval = {0}; - zval[0][0] = TramFL(); - checkkey = NothingToDo; - MeshViewer.DrawMesh(zval, 2, 2); - zval[1][0] = TramFR(); - MeshViewer.DrawMesh(zval, 2, 2); - zval[1][1] = TramBR(); - MeshViewer.DrawMesh(zval, 2, 2); - zval[0][1] = TramBL(); - MeshViewer.DrawMesh(zval, 2, 2); - - DWINUI::Draw_CenteredString(140, F("Calculating average")); - DWINUI::Draw_CenteredString(160, F("and relative heights")); + zval[0][0] = tramFL(); + checkkey = ID_NothingToDo; + meshViewer.drawMesh(zval, 2, 2); + zval[1][0] = tramFR(); + meshViewer.drawMesh(zval, 2, 2); + zval[1][1] = tramBR(); + meshViewer.drawMesh(zval, 2, 2); + zval[0][1] = tramBL(); + meshViewer.drawMesh(zval, 2, 2); + + DWINUI::drawCenteredString(140, F("Calculating average")); + DWINUI::drawCenteredString(160, F("and relative heights")); safe_delay(1000); float avg = 0.0f; for (uint8_t x = 0; x < 2; ++x) for (uint8_t y = 0; y < 2; ++y) avg += zval[x][y]; avg /= 4.0f; for (uint8_t x = 0; x < 2; ++x) for (uint8_t y = 0; y < 2; ++y) zval[x][y] -= avg; - MeshViewer.DrawMesh(zval, 2, 2); + meshViewer.drawMesh(zval, 2, 2); ui.reset_status(); #ifndef BED_TRAMMING_PROBE_TOLERANCE #define BED_TRAMMING_PROBE_TOLERANCE 0.05 #endif - if (ABS(MeshViewer.max - MeshViewer.min) < BED_TRAMMING_PROBE_TOLERANCE) { - DWINUI::Draw_CenteredString(140, F("Corners leveled")); - DWINUI::Draw_CenteredString(160, F("Tolerance achieved!")); + if (ABS(meshViewer.max - meshViewer.min) < BED_TRAMMING_PROBE_TOLERANCE) { + DWINUI::drawCenteredString(140, F("Corners leveled")); + DWINUI::drawCenteredString(160, F("Tolerance achieved!")); } else { uint8_t p = 0; @@ -2435,18 +2439,18 @@ void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refr case 0b11 : plabel = GET_TEXT_F(MSG_TRAM_BR); break; default : plabel = F(""); break; } - DWINUI::Draw_CenteredString(120, F("Corners not leveled")); - DWINUI::Draw_CenteredString(140, F("Knob adjustment required")); - DWINUI::Draw_CenteredString(Color_Green, 160, s ? F("Lower") : F("Raise")); - DWINUI::Draw_CenteredString(Color_Green, 180, plabel); + DWINUI::drawCenteredString(120, F("Corners not leveled")); + DWINUI::drawCenteredString(140, F("Knob adjustment required")); + DWINUI::drawCenteredString(COLOR_GREEN, 160, s ? F("Lower") : F("Raise")); + DWINUI::drawCenteredString(COLOR_GREEN, 180, plabel); } - DWINUI::Draw_Button(BTN_Continue, 86, 305); - checkkey = Menu; - HMI_SaveProcessID(WaitResponse); + DWINUI::drawButton(BTN_Continue, 86, 305); + checkkey = ID_Menu; + hmiSaveProcessID(ID_WaitResponse); } - void SetManualTramming() { - Toggle_Chkb_Line(HMI_data.FullManualTramming); + void setManualTramming() { + toggleCheckboxLine(hmiData.fullManualTramming); } #endif // HAS_BED_PROBE && HAS_MESH @@ -2455,30 +2459,30 @@ void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refr #if ENABLED(MESH_BED_LEVELING) - void ManualMeshStart() { + void manualMeshStart() { LCD_MESSAGE(MSG_UBL_BUILD_MESH_MENU); gcode.process_subcommands_now(F("G28XYO\nG28Z\nM211S0\nG29S1")); #ifdef MANUAL_PROBE_START_Z - const uint8_t line = CurrentMenu->line(MMeshMoveZItem->pos); - DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Background_Color, 3, 2, VALX - 2 * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(line), MANUAL_PROBE_START_Z); + const uint8_t line = currentMenu->line(mMeshMoveZItem->pos); + DWINUI::drawSignedFloat(hmiData.colorText, hmiData.colorBackground, 3, 2, VALX - 2 * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(line), MANUAL_PROBE_START_Z); #endif } - void LiveMeshMoveZ() { - *MenuData.P_Float = MenuData.Value / POW(10, 2); + void liveMeshMoveZ() { + *menuData.floatPtr = menuData.value / POW(10, 2); if (!planner.is_full()) { planner.synchronize(); planner.buffer_line(current_position, manual_feedrate_mm_s[Z_AXIS]); } } - void SetMMeshMoveZ() { SetPFloatOnClick(-1, 1, 2, planner.synchronize, LiveMeshMoveZ); } + void setMMeshMoveZ() { setPFloatOnClick(-1, 1, 2, planner.synchronize, liveMeshMoveZ); } - void ManualMeshContinue() { + void manualMeshContinue() { gcode.process_subcommands_now(F("G29S2")); - MMeshMoveZItem->redraw(); + mMeshMoveZItem->redraw(); } - void ManualMeshSave() { + void manualMeshSave() { LCD_MESSAGE(MSG_UBL_STORAGE_MESH_MENU); queue.inject(F("M211S1\nM500")); } @@ -2487,207 +2491,207 @@ void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refr #if HAS_PREHEAT #if HAS_HOTEND - void SetPreheatEndTemp() { SetPIntOnClick(MIN_ETEMP, MAX_ETEMP); } + void setPreheatEndTemp() { setPIntOnClick(MIN_ETEMP, MAX_ETEMP); } #endif #if HAS_HEATED_BED - void SetPreheatBedTemp() { SetPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } + void setPreheatBedTemp() { setPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } #endif #if HAS_FAN - void SetPreheatFanSpeed() { SetPIntOnClick(0, 255); } + void setPreheatFanSpeed() { setPIntOnClick(0, 255); } #endif #endif -void ApplyMaxSpeed() { planner.set_max_feedrate(HMI_value.axis, MenuData.Value / MINUNITMULT); } +void applyMaxSpeed() { planner.set_max_feedrate(hmiValue.axis, menuData.value / MINUNITMULT); } #if HAS_X_AXIS - void SetMaxSpeedX() { HMI_value.axis = X_AXIS, SetFloatOnClick(min_feedrate_edit_values.x, max_feedrate_edit_values.x, UNITFDIGITS, planner.settings.max_feedrate_mm_s[X_AXIS], ApplyMaxSpeed); } + void setMaxSpeedX() { hmiValue.axis = X_AXIS, setFloatOnClick(min_feedrate_edit_values.x, max_feedrate_edit_values.x, UNITFDIGITS, planner.settings.max_feedrate_mm_s[X_AXIS], applyMaxSpeed); } #endif #if HAS_Y_AXIS - void SetMaxSpeedY() { HMI_value.axis = Y_AXIS, SetFloatOnClick(min_feedrate_edit_values.y, max_feedrate_edit_values.y, UNITFDIGITS, planner.settings.max_feedrate_mm_s[Y_AXIS], ApplyMaxSpeed); } + void setMaxSpeedY() { hmiValue.axis = Y_AXIS, setFloatOnClick(min_feedrate_edit_values.y, max_feedrate_edit_values.y, UNITFDIGITS, planner.settings.max_feedrate_mm_s[Y_AXIS], applyMaxSpeed); } #endif #if HAS_Z_AXIS - void SetMaxSpeedZ() { HMI_value.axis = Z_AXIS, SetFloatOnClick(min_feedrate_edit_values.z, max_feedrate_edit_values.z, UNITFDIGITS, planner.settings.max_feedrate_mm_s[Z_AXIS], ApplyMaxSpeed); } + void setMaxSpeedZ() { hmiValue.axis = Z_AXIS, setFloatOnClick(min_feedrate_edit_values.z, max_feedrate_edit_values.z, UNITFDIGITS, planner.settings.max_feedrate_mm_s[Z_AXIS], applyMaxSpeed); } #endif #if HAS_HOTEND - void SetMaxSpeedE() { HMI_value.axis = E_AXIS; SetFloatOnClick(min_feedrate_edit_values.e, max_feedrate_edit_values.e, UNITFDIGITS, planner.settings.max_feedrate_mm_s[E_AXIS], ApplyMaxSpeed); } + void setMaxSpeedE() { hmiValue.axis = E_AXIS; setFloatOnClick(min_feedrate_edit_values.e, max_feedrate_edit_values.e, UNITFDIGITS, planner.settings.max_feedrate_mm_s[E_AXIS], applyMaxSpeed); } #endif -void ApplyMaxAccel() { planner.set_max_acceleration(HMI_value.axis, MenuData.Value); } +void applyMaxAccel() { planner.set_max_acceleration(hmiValue.axis, menuData.value); } #if HAS_X_AXIS - void SetMaxAccelX() { HMI_value.axis = X_AXIS, SetIntOnClick(min_acceleration_edit_values.x, max_acceleration_edit_values.x, planner.settings.max_acceleration_mm_per_s2[X_AXIS], ApplyMaxAccel); } + void setMaxAccelX() { hmiValue.axis = X_AXIS, setIntOnClick(min_acceleration_edit_values.x, max_acceleration_edit_values.x, planner.settings.max_acceleration_mm_per_s2[X_AXIS], applyMaxAccel); } #endif #if HAS_Y_AXIS - void SetMaxAccelY() { HMI_value.axis = Y_AXIS, SetIntOnClick(min_acceleration_edit_values.y, max_acceleration_edit_values.y, planner.settings.max_acceleration_mm_per_s2[Y_AXIS], ApplyMaxAccel); } + void setMaxAccelY() { hmiValue.axis = Y_AXIS, setIntOnClick(min_acceleration_edit_values.y, max_acceleration_edit_values.y, planner.settings.max_acceleration_mm_per_s2[Y_AXIS], applyMaxAccel); } #endif #if HAS_Z_AXIS - void SetMaxAccelZ() { HMI_value.axis = Z_AXIS, SetIntOnClick(min_acceleration_edit_values.z, max_acceleration_edit_values.z, planner.settings.max_acceleration_mm_per_s2[Z_AXIS], ApplyMaxAccel); } + void setMaxAccelZ() { hmiValue.axis = Z_AXIS, setIntOnClick(min_acceleration_edit_values.z, max_acceleration_edit_values.z, planner.settings.max_acceleration_mm_per_s2[Z_AXIS], applyMaxAccel); } #endif #if HAS_HOTEND - void SetMaxAccelE() { HMI_value.axis = E_AXIS; SetIntOnClick(min_acceleration_edit_values.e, max_acceleration_edit_values.e, planner.settings.max_acceleration_mm_per_s2[E_AXIS], ApplyMaxAccel); } + void setMaxAccelE() { hmiValue.axis = E_AXIS; setIntOnClick(min_acceleration_edit_values.e, max_acceleration_edit_values.e, planner.settings.max_acceleration_mm_per_s2[E_AXIS], applyMaxAccel); } #endif #if HAS_CLASSIC_JERK - void ApplyMaxJerk() { planner.set_max_jerk(HMI_value.axis, MenuData.Value / MINUNITMULT); } + void applyMaxJerk() { planner.set_max_jerk(hmiValue.axis, menuData.value / MINUNITMULT); } #if HAS_X_AXIS - void SetMaxJerkX() { HMI_value.axis = X_AXIS, SetFloatOnClick(min_jerk_edit_values.x, max_jerk_edit_values.x, UNITFDIGITS, planner.max_jerk.x, ApplyMaxJerk); } + void setMaxJerkX() { hmiValue.axis = X_AXIS, setFloatOnClick(min_jerk_edit_values.x, max_jerk_edit_values.x, UNITFDIGITS, planner.max_jerk.x, applyMaxJerk); } #endif #if HAS_Y_AXIS - void SetMaxJerkY() { HMI_value.axis = Y_AXIS, SetFloatOnClick(min_jerk_edit_values.y, max_jerk_edit_values.y, UNITFDIGITS, planner.max_jerk.y, ApplyMaxJerk); } + void setMaxJerkY() { hmiValue.axis = Y_AXIS, setFloatOnClick(min_jerk_edit_values.y, max_jerk_edit_values.y, UNITFDIGITS, planner.max_jerk.y, applyMaxJerk); } #endif #if HAS_Z_AXIS - void SetMaxJerkZ() { HMI_value.axis = Z_AXIS, SetFloatOnClick(min_jerk_edit_values.z, max_jerk_edit_values.z, UNITFDIGITS, planner.max_jerk.z, ApplyMaxJerk); } + void setMaxJerkZ() { hmiValue.axis = Z_AXIS, setFloatOnClick(min_jerk_edit_values.z, max_jerk_edit_values.z, UNITFDIGITS, planner.max_jerk.z, applyMaxJerk); } #endif #if HAS_HOTEND - void SetMaxJerkE() { HMI_value.axis = E_AXIS; SetFloatOnClick(min_jerk_edit_values.e, max_jerk_edit_values.e, UNITFDIGITS, planner.max_jerk.e, ApplyMaxJerk); } + void setMaxJerkE() { hmiValue.axis = E_AXIS; setFloatOnClick(min_jerk_edit_values.e, max_jerk_edit_values.e, UNITFDIGITS, planner.max_jerk.e, applyMaxJerk); } #endif #elif HAS_JUNCTION_DEVIATION - void ApplyJDmm() { TERN_(LIN_ADVANCE, planner.recalculate_max_e_jerk()); } - void SetJDmm() { SetPFloatOnClick(MIN_JD_MM, MAX_JD_MM, 3, ApplyJDmm); } + void applyJDmm() { TERN_(LIN_ADVANCE, planner.recalculate_max_e_jerk()); } + void setJDmm() { setPFloatOnClick(MIN_JD_MM, MAX_JD_MM, 3, applyJDmm); } #endif #if ENABLED(LIN_ADVANCE) - void SetLA_K() { SetPFloatOnClick(0, 10, 3); } + void setLA_K() { setPFloatOnClick(0, 10, 3); } #endif #if HAS_X_AXIS - void SetStepsX() { HMI_value.axis = X_AXIS, SetPFloatOnClick( min_steps_edit_values.x, max_steps_edit_values.x, UNITFDIGITS); } + void setStepsX() { hmiValue.axis = X_AXIS, setPFloatOnClick( min_steps_edit_values.x, max_steps_edit_values.x, UNITFDIGITS); } #endif #if HAS_Y_AXIS - void SetStepsY() { HMI_value.axis = Y_AXIS, SetPFloatOnClick( min_steps_edit_values.y, max_steps_edit_values.y, UNITFDIGITS); } + void setStepsY() { hmiValue.axis = Y_AXIS, setPFloatOnClick( min_steps_edit_values.y, max_steps_edit_values.y, UNITFDIGITS); } #endif #if HAS_Z_AXIS - void SetStepsZ() { HMI_value.axis = Z_AXIS, SetPFloatOnClick( min_steps_edit_values.z, max_steps_edit_values.z, UNITFDIGITS); } + void setStepsZ() { hmiValue.axis = Z_AXIS, setPFloatOnClick( min_steps_edit_values.z, max_steps_edit_values.z, UNITFDIGITS); } #endif #if HAS_HOTEND - void SetStepsE() { HMI_value.axis = E_AXIS; SetPFloatOnClick( min_steps_edit_values.e, max_steps_edit_values.e, UNITFDIGITS); } + void setStepsE() { hmiValue.axis = E_AXIS; setPFloatOnClick( min_steps_edit_values.e, max_steps_edit_values.e, UNITFDIGITS); } #endif #if ENABLED(FWRETRACT) - void Return_FWRetract_Menu() { (PreviousMenu == FilSetMenu) ? Draw_FilSet_Menu() : Draw_Tune_Menu(); } - void SetRetractLength() { SetPFloatOnClick( 0, 10, UNITFDIGITS); } - void SetRetractSpeed() { SetPFloatOnClick( 1, 90, UNITFDIGITS); } - void SetZRaise() { SetPFloatOnClick( 0, 2, 2); } - void SetRecoverSpeed() { SetPFloatOnClick( 1, 90, UNITFDIGITS); } - void SetAddRecover() { SetPFloatOnClick(-5, 5, UNITFDIGITS); } + void returnFWRetractMenu() { (previousMenu == filSetMenu) ? drawFilSetMenu() : drawTuneMenu(); } + void setRetractLength() { setPFloatOnClick( 0, 10, UNITFDIGITS); } + void setRetractSpeed() { setPFloatOnClick( 1, 90, UNITFDIGITS); } + void setZRaise() { setPFloatOnClick( 0, 2, 2); } + void setRecoverSpeed() { setPFloatOnClick( 1, 90, UNITFDIGITS); } + void setAddRecover() { setPFloatOnClick(-5, 5, UNITFDIGITS); } #endif // Special Menuitem Drawing functions ================================================= -void onDrawBack(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 129, 72, 156, 84); +void onDrawBack(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 129, 72, 156, 84); onDrawMenuItem(menuitem, line); } -void onDrawTempSubMenu(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 57, 104, 84, 116); +void onDrawTempSubMenu(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 57, 104, 84, 116); onDrawSubMenu(menuitem, line); } -void onDrawMotionSubMenu(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 87, 104, 114, 116); +void onDrawMotionSubMenu(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 87, 104, 114, 116); onDrawSubMenu(menuitem, line); } #if ENABLED(EEPROM_SETTINGS) - void onDrawWriteEeprom(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 117, 104, 172, 116); + void onDrawWriteEeprom(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 117, 104, 172, 116); onDrawMenuItem(menuitem, line); } - void onDrawReadEeprom(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 174, 103, 229, 116); + void onDrawReadEeprom(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 174, 103, 229, 116); onDrawMenuItem(menuitem, line); } - void onDrawResetEeprom(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 1, 118, 56, 131); + void onDrawResetEeprom(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 1, 118, 56, 131); onDrawMenuItem(menuitem, line); } #endif -void onDrawInfoSubMenu(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 231, 104, 258, 116); +void onDrawInfoSubMenu(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 231, 104, 258, 116); onDrawSubMenu(menuitem, line); } -void onDrawMoveX(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 58, 118, 106, 132); +void onDrawMoveX(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 58, 118, 106, 132); onDrawPFloatMenu(menuitem, line); } -void onDrawMoveY(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 109, 118, 157, 132); +void onDrawMoveY(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 109, 118, 157, 132); onDrawPFloatMenu(menuitem, line); } -void onDrawMoveZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 160, 118, 209, 132); +void onDrawMoveZ(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 160, 118, 209, 132); onDrawPFloatMenu(menuitem, line); } #if HAS_HOTEND - void onDrawMoveE(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 212, 118, 253, 131); + void onDrawMoveE(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 212, 118, 253, 131); onDrawPFloatMenu(menuitem, line); } #endif -void onDrawMoveSubMenu(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 159, 70, 200, 84); +void onDrawMoveSubMenu(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 159, 70, 200, 84); onDrawSubMenu(menuitem, line); } -void onDrawDisableMotors(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 204, 70, 259, 82); +void onDrawDisableMotors(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 204, 70, 259, 82); onDrawMenuItem(menuitem, line); } -void onDrawAutoHome(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 0, 89, 41, 101); +void onDrawAutoHome(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 0, 89, 41, 101); onDrawMenuItem(menuitem, line); } #if HAS_ZOFFSET_ITEM #if ANY(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) - void onDrawZOffset(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 174, 164, 223, 177); + void onDrawZOffset(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 174, 164, 223, 177); onDrawPFloat2Menu(menuitem, line); } #endif #endif #if HAS_HOTEND - void onDrawPreheat1(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 100, 89, 151, 101); + void onDrawPreheat1(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 100, 89, 151, 101); onDrawMenuItem(menuitem, line); } #if PREHEAT_COUNT > 1 - void onDrawPreheat2(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 180, 89, 233, 100); + void onDrawPreheat2(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 180, 89, 233, 100); onDrawMenuItem(menuitem, line); } #endif #endif #if HAS_PREHEAT - void onDrawCooldown(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 1, 104, 56, 117); + void onDrawCooldown(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 1, 104, 56, 117); onDrawMenuItem(menuitem, line); } #endif -void onDrawLanguage(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 239, 134, 266, 146); +void onDrawLanguage(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 239, 134, 266, 146); onDrawMenuItem(menuitem, line); - DWINUI::Draw_String(VALX, MBASE(line), HMI_IsChinese() ? F("CN") : F("EN")); + DWINUI::drawString(VALX, MBASE(line), hmiIsChinese() ? F("CN") : F("EN")); } -void onDrawSelColorItem(MenuItemClass* menuitem, int8_t line) { - const uint16_t color = *(uint16_t*)static_cast(menuitem)->value; - dwinDrawRectangle(0, HMI_data.Highlight_Color, ICOX + 1, MBASE(line) - 1 + 1, ICOX + 18, MBASE(line) - 1 + 18); +void onDrawSelColorItem(MenuItem* menuitem, int8_t line) { + const uint16_t color = *(uint16_t*)static_cast(menuitem)->value; + dwinDrawRectangle(0, hmiData.colorHighlight, ICOX + 1, MBASE(line) - 1 + 1, ICOX + 18, MBASE(line) - 1 + 18); dwinDrawRectangle(1, color, ICOX + 2, MBASE(line) - 1 + 2, ICOX + 17, MBASE(line) - 1 + 17); onDrawMenuItem(menuitem, line); } -void onDrawGetColorItem(MenuItemClass* menuitem, int8_t line) { +void onDrawGetColorItem(MenuItem* menuitem, int8_t line) { const uint8_t i = menuitem->icon; uint16_t color; switch (i) { @@ -2696,165 +2700,165 @@ void onDrawGetColorItem(MenuItemClass* menuitem, int8_t line) { case 2: color = RGB(0, 0, 31); break; // Blue default: color = 0; break; } - dwinDrawRectangle(0, HMI_data.Highlight_Color, ICOX + 1, MBASE(line) - 1 + 1, ICOX + 18, MBASE(line) - 1 + 18); + dwinDrawRectangle(0, hmiData.colorHighlight, ICOX + 1, MBASE(line) - 1 + 1, ICOX + 18, MBASE(line) - 1 + 18); dwinDrawRectangle(1, color, ICOX + 2, MBASE(line) - 1 + 2, ICOX + 17, MBASE(line) - 1 + 17); - DWINUI::Draw_String(LBLX, MBASE(line) - 1, menuitem->caption); - Draw_Menu_IntValue(HMI_data.Background_Color, line, 4, HMI_value.Color[i]); - dwinDrawHLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240); + DWINUI::drawString(LBLX, MBASE(line) - 1, menuitem->caption); + drawMenuIntValue(hmiData.colorBackground, line, 4, hmiValue.Color[i]); + dwinDrawHLine(hmiData.colorSplitLine, 16, MYPOS(line + 1), 240); } -void onDrawSpeedItem(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 116, 164, 171, 176); +void onDrawSpeedItem(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 116, 164, 171, 176); onDrawPIntMenu(menuitem, line); } #if HAS_HOTEND - void onDrawHotendTemp(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 1, 134, 56, 146); + void onDrawHotendTemp(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 1, 134, 56, 146); onDrawPIntMenu(menuitem, line); } #endif #if HAS_HEATED_BED - void onDrawBedTemp(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 58, 134, 113, 146); + void onDrawBedTemp(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 58, 134, 113, 146); onDrawPIntMenu(menuitem, line); } #endif #if HAS_FAN - void onDrawFanSpeed(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 115, 134, 170, 146); + void onDrawFanSpeed(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 115, 134, 170, 146); onDrawPInt8Menu(menuitem, line); } #endif -void onDrawSteps(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 153, 148, 194, 161); +void onDrawSteps(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 153, 148, 194, 161); onDrawSubMenu(menuitem, line); } #if ENABLED(MESH_BED_LEVELING) - void onDrawMMeshMoveZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 160, 118, 209, 132); + void onDrawMMeshMoveZ(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 160, 118, 209, 132); onDrawPFloat2Menu(menuitem, line); } #endif #if HAS_PREHEAT #if HAS_HOTEND - void onDrawSetPreheatHotend(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 1, 134, 56, 146); + void onDrawSetPreheatHotend(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 1, 134, 56, 146); onDrawPIntMenu(menuitem, line); } #endif #if HAS_HEATED_BED - void onDrawSetPreheatBed(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 58, 134, 113, 146); + void onDrawSetPreheatBed(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 58, 134, 113, 146); onDrawPIntMenu(menuitem, line); } #endif #if HAS_FAN - void onDrawSetPreheatFan(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 115, 134, 170, 146); + void onDrawSetPreheatFan(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 115, 134, 170, 146); onDrawPIntMenu(menuitem, line); } #endif #endif // HAS_PREHEAT -void onDrawSpeed(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) - menuitem->SetFrame(1, 173, 133, 228, 147); +void onDrawSpeed(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) + menuitem->setFrame(1, 173, 133, 228, 147); onDrawSubMenu(menuitem, line); } #if HAS_X_AXIS - void onDrawMaxSpeedX(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 228, 147); - DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 58, MBASE(line)); // X + void onDrawMaxSpeedX(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 228, 147); + dwinFrameAreaCopy(1, 229, 133, 236, 147, LBLX + 58, MBASE(line)); // X } onDrawPFloatMenu(menuitem, line); } #endif #if HAS_Y_AXIS - void onDrawMaxSpeedY(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 228, 147); - DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 58, MBASE(line)); // Y + void onDrawMaxSpeedY(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 228, 147); + dwinFrameAreaCopy(1, 1, 150, 7, 160, LBLX + 58, MBASE(line)); // Y } onDrawPFloatMenu(menuitem, line); } #endif #if HAS_Z_AXIS - void onDrawMaxSpeedZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 228, 147); - DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 58, MBASE(line) + 3); // Z + void onDrawMaxSpeedZ(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 228, 147); + dwinFrameAreaCopy(1, 9, 150, 16, 160, LBLX + 58, MBASE(line) + 3); // Z } onDrawPFloatMenu(menuitem, line); } #endif #if HAS_HOTEND - void onDrawMaxSpeedE(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 228, 147); - DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 58, MBASE(line)); // E + void onDrawMaxSpeedE(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 228, 147); + dwinFrameAreaCopy(1, 18, 150, 25, 160, LBLX + 58, MBASE(line)); // E } onDrawPFloatMenu(menuitem, line); } #endif -void onDrawAcc(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line) + 1); // ...Acceleration +void onDrawAcc(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line) + 1); // ...Acceleration } onDrawSubMenu(menuitem, line); } #if HAS_X_AXIS - void onDrawMaxAccelX(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 71, MBASE(line)); // X + void onDrawMaxAccelX(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 229, 133, 236, 147, LBLX + 71, MBASE(line)); // X } onDrawPInt32Menu(menuitem, line); } #endif #if HAS_Y_AXIS - void onDrawMaxAccelY(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 71, MBASE(line)); // Y + void onDrawMaxAccelY(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 1, 150, 7, 160, LBLX + 71, MBASE(line)); // Y } onDrawPInt32Menu(menuitem, line); } #endif #if HAS_Z_AXIS - void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 71, MBASE(line)); // Z + void onDrawMaxAccelZ(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 9, 150, 16, 160, LBLX + 71, MBASE(line)); // Z } onDrawPInt32Menu(menuitem, line); } #endif #if HAS_HOTEND - void onDrawMaxAccelE(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 71, MBASE(line)); // E + void onDrawMaxAccelE(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 18, 150, 25, 160, LBLX + 71, MBASE(line)); // E } onDrawPInt32Menu(menuitem, line); } @@ -2862,46 +2866,46 @@ void onDrawAcc(MenuItemClass* menuitem, int8_t line) { #if HAS_CLASSIC_JERK - void onDrawJerk(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line) + 1); // ... - DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 54, MBASE(line)); // ...Jerk + void onDrawJerk(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line) + 1); // ... + dwinFrameAreaCopy(1, 202, 133, 228, 147, LBLX + 54, MBASE(line)); // ...Jerk } onDrawSubMenu(menuitem, line); } #if HAS_X_AXIS - void onDrawMaxJerkX(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); - DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 83, MBASE(line)); + void onDrawMaxJerkX(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); + dwinFrameAreaCopy(1, 229, 133, 236, 147, LBLX + 83, MBASE(line)); } onDrawPFloatMenu(menuitem, line); } #endif #if HAS_Y_AXIS - void onDrawMaxJerkY(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); - DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 83, MBASE(line)); + void onDrawMaxJerkY(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); + dwinFrameAreaCopy(1, 1, 150, 7, 160, LBLX + 83, MBASE(line)); } onDrawPFloatMenu(menuitem, line); } #endif #if HAS_Z_AXIS - void onDrawMaxJerkZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); - DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 83, MBASE(line)); + void onDrawMaxJerkZ(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); + dwinFrameAreaCopy(1, 9, 150, 16, 160, LBLX + 83, MBASE(line)); } onDrawPFloatMenu(menuitem, line); } @@ -2909,12 +2913,12 @@ void onDrawAcc(MenuItemClass* menuitem, int8_t line) { #if HAS_HOTEND - void onDrawMaxJerkE(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); - DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 83, MBASE(line)); + void onDrawMaxJerkE(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); + dwinFrameAreaCopy(1, 18, 150, 25, 160, LBLX + 83, MBASE(line)); } onDrawPFloatMenu(menuitem, line); } @@ -2924,30 +2928,30 @@ void onDrawAcc(MenuItemClass* menuitem, int8_t line) { #endif // HAS_CLASSIC_JERK #if HAS_X_AXIS - void onDrawStepsX(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 153, 148, 194, 161); - DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 44, MBASE(line)); // X + void onDrawStepsX(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 153, 148, 194, 161); + dwinFrameAreaCopy(1, 229, 133, 236, 147, LBLX + 44, MBASE(line)); // X } onDrawPFloatMenu(menuitem, line); } #endif #if HAS_Y_AXIS - void onDrawStepsY(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 153, 148, 194, 161); - DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 44, MBASE(line)); // Y + void onDrawStepsY(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 153, 148, 194, 161); + dwinFrameAreaCopy(1, 1, 150, 7, 160, LBLX + 44, MBASE(line)); // Y } onDrawPFloatMenu(menuitem, line); } #endif #if HAS_Z_AXIS - void onDrawStepsZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 153, 148, 194, 161); - DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 44, MBASE(line)); // Z + void onDrawStepsZ(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 153, 148, 194, 161); + dwinFrameAreaCopy(1, 9, 150, 16, 160, LBLX + 44, MBASE(line)); // Z } onDrawPFloatMenu(menuitem, line); } @@ -2955,10 +2959,10 @@ void onDrawAcc(MenuItemClass* menuitem, int8_t line) { #if HAS_HOTEND - void onDrawStepsE(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 153, 148, 194, 161); - DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 44, MBASE(line)); // E + void onDrawStepsE(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 153, 148, 194, 161); + dwinFrameAreaCopy(1, 18, 150, 25, 160, LBLX + 44, MBASE(line)); // E } onDrawPFloatMenu(menuitem, line); } @@ -2966,292 +2970,292 @@ void onDrawAcc(MenuItemClass* menuitem, int8_t line) { #endif #if HAS_ONESTEP_LEVELING - void onDrawManualTramming(MenuItemClass* menuitem, int8_t line) { onDrawChkbMenu(menuitem, line, HMI_data.FullManualTramming); } + void onDrawManualTramming(MenuItem* menuitem, int8_t line) { onDrawChkbMenu(menuitem, line, hmiData.fullManualTramming); } #endif // Menu Creation and Drawing functions ====================================================== frame_rect_t selrect(frame_rect_t) { - return HMI_IsChinese() ? frame_rect_t({ 133, 1, 28, 13 }) : frame_rect_t({ 0 }); + return hmiIsChinese() ? frame_rect_t({ 133, 1, 28, 13 }) : frame_rect_t({ 0 }); } -void Draw_Prepare_Menu() { - checkkey = Menu; - if (SET_MENU_R(PrepareMenu, selrect({133, 1, 28, 13}), MSG_PREPARE, 10 + PREHEAT_COUNT)) { - BACK_ITEM(Goto_Main_Menu); +void drawPrepareMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(prepareMenu, selrect({133, 1, 28, 13}), MSG_PREPARE, 10 + PREHEAT_COUNT)) { + BACK_ITEM(gotoMainMenu); #if ENABLED(ADVANCED_PAUSE_FEATURE) - MENU_ITEM(ICON_FilMan, MSG_FILAMENT_MAN, onDrawSubMenu, Draw_FilamentMan_Menu); + MENU_ITEM(ICON_FilMan, MSG_FILAMENT_MAN, onDrawSubMenu, drawFilamentManMenu); #endif - MENU_ITEM(ICON_Axis, MSG_MOVE_AXIS, onDrawMoveSubMenu, Draw_Move_Menu); + MENU_ITEM(ICON_Axis, MSG_MOVE_AXIS, onDrawMoveSubMenu, drawMoveMenu); #if ENABLED(LCD_BED_TRAMMING) - MENU_ITEM(ICON_Tram, MSG_BED_TRAMMING, onDrawSubMenu, Draw_Tramming_Menu); + MENU_ITEM(ICON_Tram, MSG_BED_TRAMMING, onDrawSubMenu, drawTrammingMenu); #endif - MENU_ITEM(ICON_CloseMotor, MSG_DISABLE_STEPPERS, onDrawDisableMotors, DisableMotors); + MENU_ITEM(ICON_CloseMotor, MSG_DISABLE_STEPPERS, onDrawDisableMotors, disableMotors); #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) - MENU_ITEM(ICON_Homing, MSG_HOMING, onDrawSubMenu, Draw_Homing_Menu); + MENU_ITEM(ICON_Homing, MSG_HOMING, onDrawSubMenu, drawHomingMenu); #else - MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawAutoHome, AutoHome); + MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawAutoHome, autoHome); #endif #if ENABLED(MESH_BED_LEVELING) - MENU_ITEM(ICON_ManualMesh, MSG_MANUAL_MESH, onDrawSubMenu, Draw_ManualMesh_Menu); + MENU_ITEM(ICON_ManualMesh, MSG_MANUAL_MESH, onDrawSubMenu, drawManualMeshMenu); #elif HAS_BED_PROBE - MENU_ITEM(ICON_Level, MSG_AUTO_MESH, onDrawMenuItem, AutoLev); + MENU_ITEM(ICON_Level, MSG_AUTO_MESH, onDrawMenuItem, autoLevel); #endif #if HAS_ZOFFSET_ITEM #if HAS_BED_PROBE - MENU_ITEM(ICON_SetZOffset, MSG_PROBE_WIZARD, onDrawSubMenu, Draw_ZOffsetWiz_Menu); + MENU_ITEM(ICON_SetZOffset, MSG_PROBE_WIZARD, onDrawSubMenu, drawZOffsetWizMenu); #elif ENABLED(BABYSTEPPING) - EDIT_ITEM(ICON_Zoffset, MSG_HOME_OFFSET_Z, onDrawPFloat2Menu, SetZOffset, &BABY_Z_VAR); + EDIT_ITEM(ICON_Zoffset, MSG_HOME_OFFSET_Z, onDrawPFloat2Menu, setZOffset, &BABY_Z_VAR); #endif #endif #if HAS_PREHEAT #define _ITEM_PREHEAT(N) MENU_ITEM(ICON_Preheat##N, MSG_PREHEAT_##N, onDrawMenuItem, DoPreheat##N); REPEAT_1(PREHEAT_COUNT, _ITEM_PREHEAT) #endif - MENU_ITEM(ICON_Cool, MSG_COOLDOWN, onDrawCooldown, DoCoolDown); - MENU_ITEM(ICON_Language, MSG_UI_LANGUAGE, onDrawLanguage, SetLanguage); + MENU_ITEM(ICON_Cool, MSG_COOLDOWN, onDrawCooldown, doCoolDown); + MENU_ITEM(ICON_Language, MSG_UI_LANGUAGE, onDrawLanguage, setLanguage); } ui.reset_status(true); - UpdateMenu(PrepareMenu); + updateMenu(prepareMenu); } #if ENABLED(LCD_BED_TRAMMING) - void Draw_Tramming_Menu() { - checkkey = Menu; - if (SET_MENU(TrammingMenu, MSG_BED_TRAMMING, 8)) { - BACK_ITEM(Draw_Prepare_Menu); + void drawTrammingMenu() { + checkkey = ID_Menu; + if (SET_MENU(trammingMenu, MSG_BED_TRAMMING, 8)) { + BACK_ITEM(drawPrepareMenu); #if HAS_BED_PROBE && HAS_MESH - MENU_ITEM(ICON_ProbeSet, MSG_TRAMMING_WIZARD, onDrawMenuItem, Trammingwizard); - EDIT_ITEM(ICON_ProbeSet, MSG_BED_TRAMMING_MANUAL, onDrawChkbMenu, SetManualTramming, &HMI_data.FullManualTramming); + MENU_ITEM(ICON_ProbeSet, MSG_TRAMMING_WIZARD, onDrawMenuItem, trammingwizard); + EDIT_ITEM(ICON_ProbeSet, MSG_BED_TRAMMING_MANUAL, onDrawChkbMenu, setManualTramming, &hmiData.fullManualTramming); #elif !HAS_BED_PROBE && HAS_ZOFFSET_ITEM - MENU_ITEM_F(ICON_MoveZ0, "Home Z and disable", onDrawMenuItem, HomeZandDisable); + MENU_ITEM_F(ICON_MoveZ0, "Home Z and disable", onDrawMenuItem, homeZAndDisable); #endif - MENU_ITEM(ICON_Axis, MSG_TRAM_FL, onDrawMenuItem, TramFL); - MENU_ITEM(ICON_Axis, MSG_TRAM_FR, onDrawMenuItem, TramFR); - MENU_ITEM(ICON_Axis, MSG_TRAM_BR, onDrawMenuItem, TramBR); - MENU_ITEM(ICON_Axis, MSG_TRAM_BL, onDrawMenuItem, TramBL); + MENU_ITEM(ICON_Axis, MSG_TRAM_FL, onDrawMenuItem, tramFL); + MENU_ITEM(ICON_Axis, MSG_TRAM_FR, onDrawMenuItem, tramFR); + MENU_ITEM(ICON_Axis, MSG_TRAM_BR, onDrawMenuItem, tramBR); + MENU_ITEM(ICON_Axis, MSG_TRAM_BL, onDrawMenuItem, tramBL); #if ENABLED(BED_TRAMMING_INCLUDE_CENTER) - MENU_ITEM(ICON_Axis, MSG_TRAM_C, onDrawMenuItem, TramC); + MENU_ITEM(ICON_Axis, MSG_TRAM_C, onDrawMenuItem, tramC); #endif } - UpdateMenu(TrammingMenu); + updateMenu(trammingMenu); } #endif // LCD_BED_TRAMMING -void Draw_Control_Menu() { - checkkey = Menu; +void drawControlMenu() { + checkkey = ID_Menu; if (SET_MENU_R(ControlMenu, selrect({103, 1, 28, 14}), MSG_CONTROL, 10)) { - BACK_ITEM(Goto_Main_Menu); - MENU_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawTempSubMenu, Draw_Temperature_Menu); - MENU_ITEM(ICON_Motion, MSG_MOTION, onDrawMotionSubMenu, Draw_Motion_Menu); + BACK_ITEM(gotoMainMenu); + MENU_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawTempSubMenu, drawTemperatureMenu); + MENU_ITEM(ICON_Motion, MSG_MOTION, onDrawMotionSubMenu, drawMotionMenu); #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawWriteEeprom, WriteEeprom); - MENU_ITEM(ICON_ReadEEPROM, MSG_LOAD_EEPROM, onDrawReadEeprom, ReadEeprom); - MENU_ITEM(ICON_ResumeEEPROM, MSG_RESTORE_DEFAULTS, onDrawResetEeprom, ResetEeprom); + MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawWriteEeprom, writeEEPROM); + MENU_ITEM(ICON_ReadEEPROM, MSG_LOAD_EEPROM, onDrawReadEeprom, readEEPROM); + MENU_ITEM(ICON_ResumeEEPROM, MSG_RESTORE_DEFAULTS, onDrawResetEeprom, resetEEPROM); #endif - MENU_ITEM(ICON_Reboot, MSG_RESET_PRINTER, onDrawMenuItem, RebootPrinter); + MENU_ITEM(ICON_Reboot, MSG_RESET_PRINTER, onDrawMenuItem, rebootPrinter); #if ENABLED(CASE_LIGHT_MENU) #if ENABLED(CASELIGHT_USES_BRIGHTNESS) - MENU_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawSubMenu, Draw_CaseLight_Menu); + MENU_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawSubMenu, drawCaseLightMenu); #else - MENU_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, SetCaseLight, &caselight.on); + MENU_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, setCaseLight, &caselight.on); #endif #endif #if ENABLED(LED_CONTROL_MENU) - MENU_ITEM(ICON_LedControl, MSG_LED_CONTROL, onDrawSubMenu, Draw_LedControl_Menu); + MENU_ITEM(ICON_LedControl, MSG_LED_CONTROL, onDrawSubMenu, drawLedControlMenu); #endif - MENU_ITEM(ICON_Info, MSG_INFO_SCREEN, onDrawInfoSubMenu, Goto_Info_Menu); + MENU_ITEM(ICON_Info, MSG_INFO_SCREEN, onDrawInfoSubMenu, gotoInfoMenu); } ui.reset_status(true); - UpdateMenu(ControlMenu); + updateMenu(ControlMenu); } -void Draw_AdvancedSettings_Menu() { - checkkey = Menu; +void drawAdvancedSettingsMenu() { + checkkey = ID_Menu; if (SET_MENU(AdvancedSettings, MSG_ADVANCED_SETTINGS, 22)) { - BACK_ITEM(Goto_Main_Menu); + BACK_ITEM(gotoMainMenu); #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, WriteEeprom); + MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, writeEEPROM); #endif #if HAS_MESH - MENU_ITEM(ICON_ProbeSet, MSG_MESH_LEVELING, onDrawSubMenu, Draw_MeshSet_Menu); + MENU_ITEM(ICON_ProbeSet, MSG_MESH_LEVELING, onDrawSubMenu, drawMeshSetMenu); #endif #if HAS_BED_PROBE - MENU_ITEM(ICON_ProbeSet, MSG_ZPROBE_SETTINGS, onDrawSubMenu, Draw_ProbeSet_Menu); + MENU_ITEM(ICON_ProbeSet, MSG_ZPROBE_SETTINGS, onDrawSubMenu, drawProbeSetMenu); #endif - MENU_ITEM(ICON_FilSet, MSG_FILAMENT_SET, onDrawSubMenu, Draw_FilSet_Menu); + MENU_ITEM(ICON_FilSet, MSG_FILAMENT_SET, onDrawSubMenu, drawFilSetMenu); #if ENABLED(PIDTEMP) && ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) - MENU_ITEM_F(ICON_PIDNozzle, STR_HOTEND_PID " Settings", onDrawSubMenu, Draw_HotendPID_Menu); + MENU_ITEM_F(ICON_PIDNozzle, STR_HOTEND_PID " Settings", onDrawSubMenu, drawHotendPIDMenu); #endif #if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) - MENU_ITEM_F(ICON_MPCNozzle, "MPC Settings", onDrawSubMenu, Draw_HotendMPC_Menu); + MENU_ITEM_F(ICON_MPCNozzle, "MPC Settings", onDrawSubMenu, drawHotendMPCMenu); #endif #if ENABLED(PIDTEMPBED) && ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) - MENU_ITEM_F(ICON_PIDBed, STR_BED_PID " Settings", onDrawSubMenu, Draw_BedPID_Menu); + MENU_ITEM_F(ICON_PIDBed, STR_BED_PID " Settings", onDrawSubMenu, drawBedPIDMenu); #endif #if HAS_TRINAMIC_CONFIG - MENU_ITEM(ICON_TMCSet, MSG_TMC_DRIVERS, onDrawSubMenu, Draw_TrinamicConfig_menu); + MENU_ITEM(ICON_TMCSet, MSG_TMC_DRIVERS, onDrawSubMenu, drawTrinamicConfigMenu); #endif #if HAS_ESDIAG - MENU_ITEM_F(ICON_ESDiag, "End-stops diag.", onDrawSubMenu, Draw_EndStopDiag); + MENU_ITEM_F(ICON_esDiag, "End-stops diag.", onDrawSubMenu, drawEndStopDiag); #endif #if ENABLED(PRINTCOUNTER) - MENU_ITEM(ICON_PrintStats, MSG_INFO_STATS_MENU, onDrawSubMenu, Goto_PrintStats); - MENU_ITEM(ICON_PrintStatsReset, MSG_INFO_PRINT_COUNT_RESET, onDrawSubMenu, PrintStatsReset); + MENU_ITEM(ICON_PrintStats, MSG_INFO_STATS_MENU, onDrawSubMenu, gotoPrintStats); + MENU_ITEM(ICON_PrintStatsReset, MSG_INFO_PRINT_COUNT_RESET, onDrawSubMenu, printStatsReset); #endif #if HAS_LOCKSCREEN - MENU_ITEM(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, DWIN_LockScreen); + MENU_ITEM(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, dwinLockScreen); #endif #if ENABLED(SOUND_MENU_ITEM) - EDIT_ITEM(ICON_Sound, MSG_SOUND_ENABLE, onDrawChkbMenu, SetEnableSound, &ui.sound_on); + EDIT_ITEM(ICON_Sound, MSG_SOUND_ENABLE, onDrawChkbMenu, setEnableSound, &ui.sound_on); #endif #if ENABLED(POWER_LOSS_RECOVERY) - EDIT_ITEM(ICON_Pwrlossr, MSG_OUTAGE_RECOVERY, onDrawChkbMenu, SetPwrLossr, &recovery.enabled); + EDIT_ITEM(ICON_Pwrlossr, MSG_OUTAGE_RECOVERY, onDrawChkbMenu, setPwrLossr, &recovery.enabled); #endif #if HAS_GCODE_PREVIEW - EDIT_ITEM(ICON_File, MSG_HAS_PREVIEW, onDrawChkbMenu, SetPreview, &HMI_data.EnablePreview); + EDIT_ITEM(ICON_File, MSG_HAS_PREVIEW, onDrawChkbMenu, setPreview, &hmiData.enablePreview); #endif #if ENABLED(MEDIASORT_MENU_ITEM) - EDIT_ITEM(ICON_File, MSG_MEDIA_SORT, onDrawChkbMenu, SetMediaSort, &HMI_data.MediaSort); + EDIT_ITEM(ICON_File, MSG_MEDIA_SORT, onDrawChkbMenu, setMediaSort, &hmiData.mediaSort); #endif - EDIT_ITEM(ICON_File, MSG_MEDIA_UPDATE, onDrawChkbMenu, SetMediaAutoMount, &HMI_data.MediaAutoMount); + EDIT_ITEM(ICON_File, MSG_MEDIA_UPDATE, onDrawChkbMenu, setMediaAutoMount, &hmiData.mediaAutoMount); #if ENABLED(BAUD_RATE_GCODE) - EDIT_ITEM_F(ICON_SetBaudRate, "115K baud", onDrawChkbMenu, SetBaudRate, &HMI_data.Baud115K); + EDIT_ITEM_F(ICON_SetBaudRate, "115K baud", onDrawChkbMenu, setBaudRate, &hmiData.baud115K); #endif #if HAS_LCD_BRIGHTNESS - EDIT_ITEM(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, SetBrightness, &ui.brightness); - MENU_ITEM(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, TurnOffBacklight); + EDIT_ITEM(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, setBrightness, &ui.brightness); + MENU_ITEM(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, turnOffBacklight); #endif #if HAS_CUSTOM_COLORS - MENU_ITEM(ICON_Scolor, MSG_COLORS_SELECT, onDrawSubMenu, Draw_SelectColors_Menu); + MENU_ITEM(ICON_Scolor, MSG_COLORS_SELECT, onDrawSubMenu, drawSelectColorsMenu); #endif } ui.reset_status(true); - UpdateMenu(AdvancedSettings); + updateMenu(AdvancedSettings); } -void Draw_Move_Menu() { - checkkey = Menu; - if (SET_MENU_R(MoveMenu, selrect({192, 1, 42, 14}), MSG_MOVE_AXIS, 6)) { - BACK_ITEM(Draw_Prepare_Menu); - EDIT_ITEM(ICON_Axis, MSG_LIVE_MOVE, onDrawChkbMenu, SetLiveMove, &EnableLiveMove); +void drawMoveMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(moveMenu, selrect({192, 1, 42, 14}), MSG_MOVE_AXIS, 6)) { + BACK_ITEM(drawPrepareMenu); + EDIT_ITEM(ICON_Axis, MSG_LIVE_MOVE, onDrawChkbMenu, setLiveMove, &enableLiveMove); #if HAS_X_AXIS - EDIT_ITEM(ICON_MoveX, MSG_MOVE_X, onDrawMoveX, SetMoveX, ¤t_position.x); + EDIT_ITEM(ICON_MoveX, MSG_MOVE_X, onDrawMoveX, setMoveX, ¤t_position.x); #endif #if HAS_Y_AXIS - EDIT_ITEM(ICON_MoveY, MSG_MOVE_Y, onDrawMoveY, SetMoveY, ¤t_position.y); + EDIT_ITEM(ICON_MoveY, MSG_MOVE_Y, onDrawMoveY, setMoveY, ¤t_position.y); #endif #if HAS_Z_AXIS - EDIT_ITEM(ICON_MoveZ, MSG_MOVE_Z, onDrawMoveZ, SetMoveZ, ¤t_position.z); + EDIT_ITEM(ICON_MoveZ, MSG_MOVE_Z, onDrawMoveZ, setMoveZ, ¤t_position.z); #endif #if HAS_HOTEND gcode.process_subcommands_now(F("G92E0")); // Reset extruder position - EDIT_ITEM(ICON_Extruder, MSG_MOVE_E, onDrawMoveE, SetMoveE, ¤t_position.e); + EDIT_ITEM(ICON_Extruder, MSG_MOVE_E, onDrawMoveE, setMoveE, ¤t_position.e); #endif } - UpdateMenu(MoveMenu); + updateMenu(moveMenu); if (!all_axes_trusted()) LCD_MESSAGE_F("WARNING: Current position unknown. Home axes."); } #if HAS_HOME_OFFSET - void Draw_HomeOffset_Menu() { - checkkey = Menu; - if (SET_MENU(HomeOffMenu, MSG_SET_HOME_OFFSETS, 4)) { - BACK_ITEM(Draw_PhySet_Menu); + void drawHomeOffsetMenu() { + checkkey = ID_Menu; + if (SET_MENU(homeOffsetMenu, MSG_SET_HOME_OFFSETS, 4)) { + BACK_ITEM(drawPhySetMenu); #if HAS_X_AXIS - EDIT_ITEM(ICON_HomeOffsetX, MSG_HOME_OFFSET_X, onDrawPFloatMenu, SetHomeOffsetX, &home_offset.x); + EDIT_ITEM(ICON_HomeOffsetX, MSG_HOME_OFFSET_X, onDrawPFloatMenu, setHomeOffsetX, &home_offset.x); #endif #if HAS_Y_AXIS - EDIT_ITEM(ICON_HomeOffsetY, MSG_HOME_OFFSET_Y, onDrawPFloatMenu, SetHomeOffsetY, &home_offset.y); + EDIT_ITEM(ICON_HomeOffsetY, MSG_HOME_OFFSET_Y, onDrawPFloatMenu, setHomeOffsetY, &home_offset.y); #endif #if HAS_Z_AXIS - EDIT_ITEM(ICON_HomeOffsetZ, MSG_HOME_OFFSET_Z, onDrawPFloatMenu, SetHomeOffsetZ, &home_offset.z); + EDIT_ITEM(ICON_HomeOffsetZ, MSG_HOME_OFFSET_Z, onDrawPFloatMenu, setHomeOffsetZ, &home_offset.z); #endif } - UpdateMenu(HomeOffMenu); + updateMenu(homeOffsetMenu); } #endif // HAS_HOME_OFFSET #if HAS_BED_PROBE - void Draw_ProbeSet_Menu() { - checkkey = Menu; + void drawProbeSetMenu() { + checkkey = ID_Menu; if (SET_MENU(ProbeSetMenu, MSG_ZPROBE_SETTINGS, 9)) { - BACK_ITEM(Draw_AdvancedSettings_Menu); + BACK_ITEM(drawAdvancedSettingsMenu); #if HAS_X_AXIS - EDIT_ITEM(ICON_ProbeOffsetX, MSG_ZPROBE_XOFFSET, onDrawPFloatMenu, SetProbeOffsetX, &probe.offset.x); + EDIT_ITEM(ICON_ProbeOffsetX, MSG_ZPROBE_XOFFSET, onDrawPFloatMenu, setProbeOffsetX, &probe.offset.x); #endif #if HAS_Y_AXIS - EDIT_ITEM(ICON_ProbeOffsetY, MSG_ZPROBE_YOFFSET, onDrawPFloatMenu, SetProbeOffsetY, &probe.offset.y); + EDIT_ITEM(ICON_ProbeOffsetY, MSG_ZPROBE_YOFFSET, onDrawPFloatMenu, setProbeOffsetY, &probe.offset.y); #endif #if HAS_Z_AXIS - EDIT_ITEM(ICON_ProbeOffsetZ, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, SetProbeOffsetZ, &probe.offset.z); + EDIT_ITEM(ICON_ProbeOffsetZ, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, setProbeOffsetZ, &probe.offset.z); #endif #if ENABLED(BLTOUCH) - MENU_ITEM(ICON_ProbeStow, MSG_MANUAL_STOW, onDrawMenuItem, ProbeStow); - MENU_ITEM(ICON_ProbeDeploy, MSG_MANUAL_DEPLOY, onDrawMenuItem, ProbeDeploy); + MENU_ITEM(ICON_ProbeStow, MSG_MANUAL_STOW, onDrawMenuItem, probeStow); + MENU_ITEM(ICON_ProbeDeploy, MSG_MANUAL_DEPLOY, onDrawMenuItem, probeDeploy); MENU_ITEM(ICON_BltouchReset, MSG_BLTOUCH_RESET, onDrawMenuItem, bltouch._reset); #if HAS_BLTOUCH_HS_MODE - EDIT_ITEM(ICON_HSMode, MSG_ENABLE_HS_MODE, onDrawChkbMenu, SetHSMode, &bltouch.high_speed_mode); + EDIT_ITEM(ICON_HSMode, MSG_ENABLE_HS_MODE, onDrawChkbMenu, setHSMode, &bltouch.high_speed_mode); #endif #endif - MENU_ITEM(ICON_ProbeTest, MSG_M48_TEST, onDrawMenuItem, ProbeTest); + MENU_ITEM(ICON_ProbeTest, MSG_M48_TEST, onDrawMenuItem, probeTest); } - UpdateMenu(ProbeSetMenu); + updateMenu(ProbeSetMenu); } #endif // HAS_BED_PROBE -void Draw_FilSet_Menu() { - checkkey = Menu; - if (SET_MENU(FilSetMenu, MSG_FILAMENT_SET, 9)) { - BACK_ITEM(Draw_AdvancedSettings_Menu); +void drawFilSetMenu() { + checkkey = ID_Menu; + if (SET_MENU(filSetMenu, MSG_FILAMENT_SET, 9)) { + BACK_ITEM(drawAdvancedSettingsMenu); #if HAS_FILAMENT_SENSOR - EDIT_ITEM(ICON_Runout, MSG_RUNOUT_ENABLE, onDrawChkbMenu, SetRunoutEnable, &runout.enabled); + EDIT_ITEM(ICON_Runout, MSG_RUNOUT_ENABLE, onDrawChkbMenu, setRunoutEnable, &runout.enabled); #endif #if HAS_FILAMENT_RUNOUT_DISTANCE - EDIT_ITEM(ICON_Runout, MSG_RUNOUT_DISTANCE_MM, onDrawPFloatMenu, SetRunoutDistance, &runout.runout_distance()); + EDIT_ITEM(ICON_Runout, MSG_RUNOUT_DISTANCE_MM, onDrawPFloatMenu, setRunoutDistance, &runout.runout_distance()); #endif #if ENABLED(PREVENT_COLD_EXTRUSION) - EDIT_ITEM(ICON_ExtrudeMinT, MSG_EXTRUDER_MIN_TEMP, onDrawPIntMenu, SetExtMinT, &HMI_data.ExtMinT); + EDIT_ITEM(ICON_ExtrudeMinT, MSG_EXTRUDER_MIN_TEMP, onDrawPIntMenu, setExtMinT, &hmiData.extMinT); #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) - EDIT_ITEM(ICON_FilLoad, MSG_FILAMENT_LOAD, onDrawPFloatMenu, SetFilLoad, &fc_settings[0].load_length); - EDIT_ITEM(ICON_FilUnload, MSG_FILAMENT_UNLOAD, onDrawPFloatMenu, SetFilUnload, &fc_settings[0].unload_length); + EDIT_ITEM(ICON_FilLoad, MSG_FILAMENT_LOAD, onDrawPFloatMenu, setFilLoad, &fc_settings[0].load_length); + EDIT_ITEM(ICON_FilUnload, MSG_FILAMENT_UNLOAD, onDrawPFloatMenu, setFilUnload, &fc_settings[0].unload_length); #endif #if ENABLED(FWRETRACT) - MENU_ITEM(ICON_FWRetract, MSG_FWRETRACT, onDrawSubMenu, Draw_FWRetract_Menu); + MENU_ITEM(ICON_FWRetract, MSG_FWRETRACT, onDrawSubMenu, drawFWRetractMenu); #endif } - UpdateMenu(FilSetMenu); + updateMenu(filSetMenu); } #if ALL(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) - void Draw_CaseLight_Menu() { - checkkey = Menu; - if (SET_MENU(CaseLightMenu, MSG_CASE_LIGHT, 3)) { - BACK_ITEM(Draw_Control_Menu); - EDIT_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, SetCaseLight, &caselight.on); - EDIT_ITEM(ICON_Brightness, MSG_CASE_LIGHT_BRIGHTNESS, onDrawPInt8Menu, SetCaseLightBrightness, &caselight.brightness); + void drawCaseLightMenu() { + checkkey = ID_Menu; + if (SET_MENU(caseLightMenu, MSG_CASE_LIGHT, 3)) { + BACK_ITEM(drawControlMenu); + EDIT_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, setCaseLight, &caselight.on); + EDIT_ITEM(ICON_Brightness, MSG_CASE_LIGHT_BRIGHTNESS, onDrawPInt8Menu, setCaseLightBrightness, &caselight.brightness); } - UpdateMenu(CaseLightMenu); + updateMenu(caseLightMenu); } #endif #if ENABLED(LED_CONTROL_MENU) - void Draw_LedControl_Menu() { - checkkey = Menu; - if (SET_MENU(LedControlMenu, MSG_LED_CONTROL, 10)) { - BACK_ITEM(Draw_Control_Menu); + void drawLedControlMenu() { + checkkey = ID_Menu; + if (SET_MENU(ledControlMenu, MSG_LED_CONTROL, 10)) { + BACK_ITEM(drawControlMenu); #if !ALL(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) - EDIT_ITEM(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, SetLedStatus, &leds.lights_on); + EDIT_ITEM(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, setLedStatus, &leds.lights_on); #endif #if HAS_COLOR_LEDS #if ENABLED(LED_COLOR_PRESETS) @@ -3264,363 +3268,363 @@ void Draw_FilSet_Menu() { MENU_ITEM(ICON_LedControl, MSG_SET_LEDS_INDIGO, onDrawMenuItem, leds.set_indigo); MENU_ITEM(ICON_LedControl, MSG_SET_LEDS_VIOLET, onDrawMenuItem, leds.set_violet); #else - EDIT_ITEM(ICON_LedControl, MSG_COLORS_RED, onDrawPInt8Menu, SetLEDColorR, &leds.color.r); - EDIT_ITEM(ICON_LedControl, MSG_COLORS_GREEN, onDrawPInt8Menu, SetLEDColorG, &leds.color.g); - EDIT_ITEM(ICON_LedControl, MSG_COLORS_BLUE, onDrawPInt8Menu, SetLEDColorB, &leds.color.b); + EDIT_ITEM(ICON_LedControl, MSG_COLORS_RED, onDrawPInt8Menu, setLEDColorR, &leds.color.r); + EDIT_ITEM(ICON_LedControl, MSG_COLORS_GREEN, onDrawPInt8Menu, setLEDColorG, &leds.color.g); + EDIT_ITEM(ICON_LedControl, MSG_COLORS_BLUE, onDrawPInt8Menu, setLEDColorB, &leds.color.b); #if ENABLED(HAS_WHITE_LED) - EDIT_ITEM(ICON_LedControl, MSG_COLORS_WHITE, onDrawPInt8Menu, SetLEDColorW, &leds.color.w); + EDIT_ITEM(ICON_LedControl, MSG_COLORS_WHITE, onDrawPInt8Menu, setLEDColorW, &leds.color.w); #endif #endif #endif } - UpdateMenu(LedControlMenu); + updateMenu(ledControlMenu); } #endif // LED_CONTROL_MENU -void Draw_Tune_Menu() { - checkkey = Menu; - if (SET_MENU_R(TuneMenu, selrect({73, 2, 28, 12}), MSG_TUNE, 17)) { - BACK_ITEM(Goto_PrintProcess); - EDIT_ITEM(ICON_Speed, MSG_SPEED, onDrawSpeedItem, SetSpeed, &feedrate_percentage); +void drawTuneMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(tuneMenu, selrect({73, 2, 28, 12}), MSG_TUNE, 17)) { + BACK_ITEM(gotoPrintProcess); + EDIT_ITEM(ICON_Speed, MSG_SPEED, onDrawSpeedItem, setSpeed, &feedrate_percentage); #if HAS_HOTEND - HotendTargetItem = EDIT_ITEM(ICON_HotendTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawHotendTemp, SetHotendTemp, &thermalManager.temp_hotend[0].target); + hotendTargetItem = EDIT_ITEM(ICON_HotendTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawHotendTemp, setHotendTemp, &thermalManager.temp_hotend[0].target); #endif #if HAS_HEATED_BED - BedTargetItem = EDIT_ITEM(ICON_BedTemp, MSG_UBL_SET_TEMP_BED, onDrawBedTemp, SetBedTemp, &thermalManager.temp_bed.target); + bedTargetItem = EDIT_ITEM(ICON_BedTemp, MSG_UBL_SET_TEMP_BED, onDrawBedTemp, setBedTemp, &thermalManager.temp_bed.target); #endif #if HAS_FAN - FanSpeedItem = EDIT_ITEM(ICON_FanSpeed, MSG_FAN_SPEED, onDrawFanSpeed, SetFanSpeed, &thermalManager.fan_speed[0]); + fanSpeedItem = EDIT_ITEM(ICON_FanSpeed, MSG_FAN_SPEED, onDrawFanSpeed, setFanSpeed, &thermalManager.fan_speed[0]); #endif #if ALL(HAS_ZOFFSET_ITEM, HAS_BED_PROBE, BABYSTEP_ZPROBE_OFFSET, BABYSTEPPING) - EDIT_ITEM(ICON_Zoffset, MSG_ZPROBE_ZOFFSET, onDrawZOffset, SetZOffset, &BABY_Z_VAR); + EDIT_ITEM(ICON_Zoffset, MSG_ZPROBE_ZOFFSET, onDrawZOffset, setZOffset, &BABY_Z_VAR); #elif ALL(HAS_ZOFFSET_ITEM, MESH_BED_LEVELING, BABYSTEPPING) - EDIT_ITEM(ICON_Zoffset, MSG_HOME_OFFSET_Z, onDrawPFloat2Menu, SetZOffset, &BABY_Z_VAR); + EDIT_ITEM(ICON_Zoffset, MSG_HOME_OFFSET_Z, onDrawPFloat2Menu, setZOffset, &BABY_Z_VAR); #endif - EDIT_ITEM(ICON_Flow, MSG_FLOW, onDrawPIntMenu, SetFlow, &planner.flow_percentage[0]); + EDIT_ITEM(ICON_Flow, MSG_FLOW, onDrawPIntMenu, setFlow, &planner.flow_percentage[0]); #if ENABLED(ADVANCED_PAUSE_FEATURE) - MENU_ITEM(ICON_FilMan, MSG_FILAMENTCHANGE, onDrawMenuItem, ChangeFilament); + MENU_ITEM(ICON_FilMan, MSG_FILAMENTCHANGE, onDrawMenuItem, changeFilament); #endif #if HAS_FILAMENT_SENSOR - EDIT_ITEM(ICON_Runout, MSG_RUNOUT_ENABLE, onDrawChkbMenu, SetRunoutEnable, &runout.enabled); + EDIT_ITEM(ICON_Runout, MSG_RUNOUT_ENABLE, onDrawChkbMenu, setRunoutEnable, &runout.enabled); #endif #if ENABLED(PLR_TUNE_ITEM) - EDIT_ITEM(ICON_Pwrlossr, MSG_OUTAGE_RECOVERY, onDrawChkbMenu, SetPwrLossr, &recovery.enabled); + EDIT_ITEM(ICON_Pwrlossr, MSG_OUTAGE_RECOVERY, onDrawChkbMenu, setPwrLossr, &recovery.enabled); #endif #if ENABLED(FWRETRACT) - MENU_ITEM(ICON_FWRetract, MSG_FWRETRACT, onDrawSubMenu, Draw_FWRetract_Menu); + MENU_ITEM(ICON_FWRetract, MSG_FWRETRACT, onDrawSubMenu, drawFWRetractMenu); #endif #if ENABLED(JD_TUNE_ITEM) - EDIT_ITEM(ICON_JDmm, MSG_JUNCTION_DEVIATION, onDrawPFloat3Menu, SetJDmm, &planner.junction_deviation_mm); + EDIT_ITEM(ICON_JDmm, MSG_JUNCTION_DEVIATION, onDrawPFloat3Menu, setJDmm, &planner.junction_deviation_mm); #endif #if ENABLED(ADVK_TUNE_ITEM) - EDIT_ITEM(ICON_MaxAccelerated, MSG_ADVANCE_K, onDrawPFloat3Menu, SetLA_K, &planner.extruder_advance_K[0]); + EDIT_ITEM(ICON_MaxAccelerated, MSG_ADVANCE_K, onDrawPFloat3Menu, setLA_K, &planner.extruder_advance_K[0]); #endif #if HAS_LOCKSCREEN - MENU_ITEM(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, DWIN_LockScreen); + MENU_ITEM(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, dwinLockScreen); #endif #if HAS_LCD_BRIGHTNESS - EDIT_ITEM(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, SetBrightness, &ui.brightness); - MENU_ITEM(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, TurnOffBacklight); + EDIT_ITEM(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, setBrightness, &ui.brightness); + MENU_ITEM(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, turnOffBacklight); #endif #if ENABLED(CASE_LIGHT_MENU) - EDIT_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, SetCaseLight, &caselight.on); + EDIT_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, setCaseLight, &caselight.on); #elif ENABLED(LED_CONTROL_MENU) && DISABLED(CASE_LIGHT_USE_NEOPIXEL) - EDIT_ITEM(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, SetLedStatus, &leds.lights_on); + EDIT_ITEM(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, setLedStatus, &leds.lights_on); #endif } - UpdateMenu(TuneMenu); + updateMenu(tuneMenu); } #if ENABLED(ADAPTIVE_STEP_SMOOTHING) - void SetAdaptiveStepSmoothing() { - Toggle_Chkb_Line(HMI_data.AdaptiveStepSmoothing); + void setAdaptiveStepSmoothing() { + toggleCheckboxLine(hmiData.adaptiveStepSmoothing); } #endif #if ENABLED(SHAPING_MENU) - void ApplyShapingFreq() { stepper.set_shaping_frequency(HMI_value.axis, MenuData.Value / 100); } - void ApplyShapingZeta() { stepper.set_shaping_damping_ratio(HMI_value.axis, MenuData.Value / 100); } + void applyShapingFreq() { stepper.set_shaping_frequency(hmiValue.axis, menuData.value / 100); } + void applyShapingZeta() { stepper.set_shaping_damping_ratio(hmiValue.axis, menuData.value / 100); } #if ENABLED(INPUT_SHAPING_X) - void onDrawShapingXFreq(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_frequency(X_AXIS)); } - void onDrawShapingXZeta(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_damping_ratio(X_AXIS)); } - void SetShapingXFreq() { HMI_value.axis = X_AXIS; SetFloatOnClick(0, 200, 2, stepper.get_shaping_frequency(X_AXIS), ApplyShapingFreq); } - void SetShapingXZeta() { HMI_value.axis = X_AXIS; SetFloatOnClick(0, 1, 2, stepper.get_shaping_damping_ratio(X_AXIS), ApplyShapingZeta); } + void onDrawShapingXFreq(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_frequency(X_AXIS)); } + void onDrawShapingXZeta(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_damping_ratio(X_AXIS)); } + void setShapingXFreq() { hmiValue.axis = X_AXIS; setFloatOnClick(0, 200, 2, stepper.get_shaping_frequency(X_AXIS), applyShapingFreq); } + void setShapingXZeta() { hmiValue.axis = X_AXIS; setFloatOnClick(0, 1, 2, stepper.get_shaping_damping_ratio(X_AXIS), applyShapingZeta); } #endif #if ENABLED(INPUT_SHAPING_Y) - void onDrawShapingYFreq(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_frequency(Y_AXIS)); } - void onDrawShapingYZeta(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_damping_ratio(Y_AXIS)); } - void SetShapingYFreq() { HMI_value.axis = Y_AXIS; SetFloatOnClick(0, 200, 2, stepper.get_shaping_frequency(Y_AXIS), ApplyShapingFreq); } - void SetShapingYZeta() { HMI_value.axis = Y_AXIS; SetFloatOnClick(0, 1, 2, stepper.get_shaping_damping_ratio(Y_AXIS), ApplyShapingZeta); } + void onDrawShapingYFreq(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_frequency(Y_AXIS)); } + void onDrawShapingYZeta(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_damping_ratio(Y_AXIS)); } + void setShapingYFreq() { hmiValue.axis = Y_AXIS; setFloatOnClick(0, 200, 2, stepper.get_shaping_frequency(Y_AXIS), applyShapingFreq); } + void setShapingYZeta() { hmiValue.axis = Y_AXIS; setFloatOnClick(0, 1, 2, stepper.get_shaping_damping_ratio(Y_AXIS), applyShapingZeta); } #endif - void Draw_InputShaping_menu() { - checkkey = Menu; - if (SET_MENU(InputShapingMenu, MSG_INPUT_SHAPING, 5)) { - BACK_ITEM(Draw_Motion_Menu); + void drawInputShaping_menu() { + checkkey = ID_Menu; + if (SET_MENU(inputShapingMenu, MSG_INPUT_SHAPING, 5)) { + BACK_ITEM(drawMotionMenu); #if ENABLED(INPUT_SHAPING_X) - MENU_ITEM(ICON_ShapingX, MSG_SHAPING_A_FREQ, onDrawShapingXFreq, SetShapingXFreq); - MENU_ITEM(ICON_ShapingX, MSG_SHAPING_A_ZETA, onDrawShapingXZeta, SetShapingXZeta); + MENU_ITEM(ICON_ShapingX, MSG_SHAPING_A_FREQ, onDrawShapingXFreq, setShapingXFreq); + MENU_ITEM(ICON_ShapingX, MSG_SHAPING_A_ZETA, onDrawShapingXZeta, setShapingXZeta); #endif #if ENABLED(INPUT_SHAPING_Y) - MENU_ITEM(ICON_ShapingY, MSG_SHAPING_B_FREQ, onDrawShapingYFreq, SetShapingYFreq); - MENU_ITEM(ICON_ShapingY, MSG_SHAPING_B_ZETA, onDrawShapingYZeta, SetShapingYZeta); + MENU_ITEM(ICON_ShapingY, MSG_SHAPING_B_FREQ, onDrawShapingYFreq, setShapingYFreq); + MENU_ITEM(ICON_ShapingY, MSG_SHAPING_B_ZETA, onDrawShapingYZeta, setShapingYZeta); #endif } - UpdateMenu(InputShapingMenu); + updateMenu(inputShapingMenu); } #endif #if HAS_TRINAMIC_CONFIG #if AXIS_IS_TMC(X) - void SetXTMCCurrent() { SetPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperX.refresh_stepper_current(); }); } + void setXTMCCurrent() { setPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperX.refresh_stepper_current(); }); } #endif #if AXIS_IS_TMC(Y) - void SetYTMCCurrent() { SetPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperY.refresh_stepper_current(); }); } + void setYTMCCurrent() { setPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperY.refresh_stepper_current(); }); } #endif #if AXIS_IS_TMC(Z) - void SetZTMCCurrent() { SetPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperZ.refresh_stepper_current(); }); } + void setZTMCCurrent() { setPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperZ.refresh_stepper_current(); }); } #endif #if AXIS_IS_TMC(E0) - void SetETMCCurrent() { SetPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperE0.refresh_stepper_current(); }); } + void setETMCCurrent() { setPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperE0.refresh_stepper_current(); }); } #endif - void Draw_TrinamicConfig_menu() { - checkkey = Menu; - if (SET_MENU(TrinamicConfigMenu, MSG_TMC_DRIVERS, 5)) { - BACK_ITEM(Draw_AdvancedSettings_Menu); + void drawTrinamicConfigMenu() { + checkkey = ID_Menu; + if (SET_MENU(trinamicConfigMenu, MSG_TMC_DRIVERS, 5)) { + BACK_ITEM(drawAdvancedSettingsMenu); #if AXIS_IS_TMC(X) - EDIT_ITEM(ICON_TMCXSet, MSG_TMC_ACURRENT, onDrawPIntMenu, SetXTMCCurrent, &stepperX.val_mA); + EDIT_ITEM(ICON_TMCXSet, MSG_TMC_ACURRENT, onDrawPIntMenu, setXTMCCurrent, &stepperX.val_mA); #endif #if AXIS_IS_TMC(Y) - EDIT_ITEM(ICON_TMCYSet, MSG_TMC_BCURRENT, onDrawPIntMenu, SetYTMCCurrent, &stepperY.val_mA); + EDIT_ITEM(ICON_TMCYSet, MSG_TMC_BCURRENT, onDrawPIntMenu, setYTMCCurrent, &stepperY.val_mA); #endif #if AXIS_IS_TMC(Z) - EDIT_ITEM(ICON_TMCZSet, MSG_TMC_CCURRENT, onDrawPIntMenu, SetZTMCCurrent, &stepperZ.val_mA); + EDIT_ITEM(ICON_TMCZSet, MSG_TMC_CCURRENT, onDrawPIntMenu, setZTMCCurrent, &stepperZ.val_mA); #endif #if AXIS_IS_TMC(E0) - EDIT_ITEM(ICON_TMCESet, MSG_TMC_ECURRENT, onDrawPIntMenu, SetETMCCurrent, &stepperE0.val_mA); + EDIT_ITEM(ICON_TMCESet, MSG_TMC_ECURRENT, onDrawPIntMenu, setETMCCurrent, &stepperE0.val_mA); #endif } - UpdateMenu(TrinamicConfigMenu); + updateMenu(trinamicConfigMenu); } #endif -void Draw_Motion_Menu() { - checkkey = Menu; - if (SET_MENU_R(MotionMenu, selrect({1, 16, 28, 13}), MSG_MOTION, 10)) { - BACK_ITEM(Draw_Control_Menu); - MENU_ITEM(ICON_MaxSpeed, MSG_SPEED, onDrawSpeed, Draw_MaxSpeed_Menu); - MENU_ITEM(ICON_MaxAccelerated, MSG_ACCELERATION, onDrawAcc, Draw_MaxAccel_Menu); +void drawMotionMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(motionMenu, selrect({1, 16, 28, 13}), MSG_MOTION, 10)) { + BACK_ITEM(drawControlMenu); + MENU_ITEM(ICON_MaxSpeed, MSG_SPEED, onDrawSpeed, drawMaxSpeedMenu); + MENU_ITEM(ICON_MaxAccelerated, MSG_ACCELERATION, onDrawAcc, drawMaxAccelMenu); #if HAS_CLASSIC_JERK - MENU_ITEM(ICON_MaxJerk, MSG_JERK, onDrawJerk, Draw_MaxJerk_Menu); + MENU_ITEM(ICON_MaxJerk, MSG_JERK, onDrawJerk, drawMaxJerkMenu); #elif HAS_JUNCTION_DEVIATION - EDIT_ITEM(ICON_JDmm, MSG_JUNCTION_DEVIATION, onDrawPFloat3Menu, SetJDmm, &planner.junction_deviation_mm); + EDIT_ITEM(ICON_JDmm, MSG_JUNCTION_DEVIATION, onDrawPFloat3Menu, setJDmm, &planner.junction_deviation_mm); #endif #if ENABLED(LIN_ADVANCE) - EDIT_ITEM(ICON_MaxAccelerated, MSG_ADVANCE_K, onDrawPFloat3Menu, SetLA_K, &planner.extruder_advance_K[0]); + EDIT_ITEM(ICON_MaxAccelerated, MSG_ADVANCE_K, onDrawPFloat3Menu, setLA_K, &planner.extruder_advance_K[0]); #endif #if ENABLED(SHAPING_MENU) - MENU_ITEM(ICON_InputShaping, MSG_INPUT_SHAPING, onDrawSubMenu, Draw_InputShaping_menu); + MENU_ITEM(ICON_InputShaping, MSG_INPUT_SHAPING, onDrawSubMenu, drawInputShaping_menu); #endif #if ENABLED(ADAPTIVE_STEP_SMOOTHING) - EDIT_ITEM(ICON_UBLActive, MSG_STEP_SMOOTHING, onDrawChkbMenu, SetAdaptiveStepSmoothing, &HMI_data.AdaptiveStepSmoothing); + EDIT_ITEM(ICON_UBLActive, MSG_STEP_SMOOTHING, onDrawChkbMenu, setAdaptiveStepSmoothing, &hmiData.adaptiveStepSmoothing); #endif - MENU_ITEM(ICON_Step, MSG_STEPS_PER_MM, onDrawSteps, Draw_Steps_Menu); - EDIT_ITEM(ICON_Flow, MSG_FLOW, onDrawPIntMenu, SetFlow, &planner.flow_percentage[0]); - EDIT_ITEM(ICON_Speed, MSG_SPEED, onDrawPIntMenu, SetSpeed, &feedrate_percentage); + MENU_ITEM(ICON_Step, MSG_STEPS_PER_MM, onDrawSteps, drawStepsMenu); + EDIT_ITEM(ICON_Flow, MSG_FLOW, onDrawPIntMenu, setFlow, &planner.flow_percentage[0]); + EDIT_ITEM(ICON_Speed, MSG_SPEED, onDrawPIntMenu, setSpeed, &feedrate_percentage); } - UpdateMenu(MotionMenu); + updateMenu(motionMenu); } #if HAS_PREHEAT - void Draw_PreheatHotend_Menu() { - checkkey = Menu; - if (SET_MENU(PreheatHotendMenu, MSG_PREHEAT_HOTEND, 1 + PREHEAT_COUNT)) { - BACK_ITEM(Draw_FilamentMan_Menu); + void drawPreheatHotendMenu() { + checkkey = ID_Menu; + if (SET_MENU(preheatHotendMenu, MSG_PREHEAT_HOTEND, 1 + PREHEAT_COUNT)) { + BACK_ITEM(drawFilamentManMenu); #define _ITEM_PREHEAT_HE(N) MENU_ITEM(ICON_Preheat##N, MSG_PREHEAT_##N, onDrawMenuItem, DoPreheatHotend##N); REPEAT_1(PREHEAT_COUNT, _ITEM_PREHEAT_HE) } - UpdateMenu(PreheatHotendMenu); + updateMenu(preheatHotendMenu); } #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) - void Draw_FilamentMan_Menu() { - checkkey = Menu; - if (SET_MENU(FilamentMenu, MSG_FILAMENT_MAN, 6)) { - BACK_ITEM(Draw_Prepare_Menu); + void drawFilamentManMenu() { + checkkey = ID_Menu; + if (SET_MENU(filamentMenu, MSG_FILAMENT_MAN, 6)) { + BACK_ITEM(drawPrepareMenu); #if ENABLED(NOZZLE_PARK_FEATURE) - MENU_ITEM(ICON_Park, MSG_FILAMENT_PARK_ENABLED, onDrawMenuItem, ParkHead); + MENU_ITEM(ICON_Park, MSG_FILAMENT_PARK_ENABLED, onDrawMenuItem, parkHead); #endif #if HAS_PREHEAT - MENU_ITEM(ICON_SetEndTemp, MSG_PREHEAT_HOTEND, onDrawSubMenu, Draw_PreheatHotend_Menu); + MENU_ITEM(ICON_SetEndTemp, MSG_PREHEAT_HOTEND, onDrawSubMenu, drawPreheatHotendMenu); #endif - MENU_ITEM(ICON_FilMan, MSG_FILAMENTCHANGE, onDrawMenuItem, ChangeFilament); + MENU_ITEM(ICON_FilMan, MSG_FILAMENTCHANGE, onDrawMenuItem, changeFilament); #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - MENU_ITEM(ICON_FilUnload, MSG_FILAMENTUNLOAD, onDrawMenuItem, UnloadFilament); - MENU_ITEM(ICON_FilLoad, MSG_FILAMENTLOAD, onDrawMenuItem, LoadFilament); + MENU_ITEM(ICON_FilUnload, MSG_FILAMENTUNLOAD, onDrawMenuItem, unloadFilament); + MENU_ITEM(ICON_FilLoad, MSG_FILAMENTLOAD, onDrawMenuItem, loadFilament); #endif } - UpdateMenu(FilamentMenu); + updateMenu(filamentMenu); } #endif #if ENABLED(MESH_BED_LEVELING) - void Draw_ManualMesh_Menu() { - checkkey = Menu; - if (SET_MENU(ManualMesh, MSG_UBL_MANUAL_MESH, 6)) { - BACK_ITEM(Draw_Prepare_Menu); - MENU_ITEM(ICON_ManualMesh, MSG_LEVEL_BED, onDrawMenuItem, ManualMeshStart); - MMeshMoveZItem = EDIT_ITEM(ICON_Zoffset, MSG_MOVE_Z, onDrawMMeshMoveZ, SetMMeshMoveZ, ¤t_position.z); - MENU_ITEM(ICON_Axis, MSG_UBL_CONTINUE_MESH, onDrawMenuItem, ManualMeshContinue); - MENU_ITEM(ICON_MeshViewer, MSG_MESH_VIEW, onDrawSubMenu, DWIN_MeshViewer); - MENU_ITEM(ICON_MeshSave, MSG_UBL_SAVE_MESH, onDrawMenuItem, ManualMeshSave); + void drawManualMeshMenu() { + checkkey = ID_Menu; + if (SET_MENU(manualMesh, MSG_UBL_MANUAL_MESH, 6)) { + BACK_ITEM(drawPrepareMenu); + MENU_ITEM(ICON_ManualMesh, MSG_LEVEL_BED, onDrawMenuItem, manualMeshStart); + mMeshMoveZItem = EDIT_ITEM(ICON_Zoffset, MSG_MOVE_Z, onDrawMMeshMoveZ, setMMeshMoveZ, ¤t_position.z); + MENU_ITEM(ICON_Axis, MSG_UBL_CONTINUE_MESH, onDrawMenuItem, manualMeshContinue); + MENU_ITEM(ICON_MeshViewer, MSG_MESH_VIEW, onDrawSubMenu, dwinMeshViewer); + MENU_ITEM(ICON_MeshSave, MSG_UBL_SAVE_MESH, onDrawMenuItem, manualMeshSave); } - UpdateMenu(ManualMesh); + updateMenu(manualMesh); } #endif // MESH_BED_LEVELING #if HAS_PREHEAT - void Draw_Preheat_Menu(bool NotCurrent) { - checkkey = Menu; - if (NotCurrent) { - BACK_ITEM(Draw_Temperature_Menu); + void drawPreheatMenu(const bool notCurrent) { + checkkey = ID_Menu; + if (notCurrent) { + BACK_ITEM(drawTemperatureMenu); #if HAS_HOTEND - EDIT_ITEM(ICON_SetEndTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawSetPreheatHotend, SetPreheatEndTemp, &ui.material_preset[HMI_value.Select].hotend_temp); + EDIT_ITEM(ICON_SetEndTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawSetPreheatHotend, setPreheatEndTemp, &ui.material_preset[hmiValue.select].hotend_temp); #endif #if HAS_HEATED_BED - EDIT_ITEM(ICON_SetBedTemp, MSG_UBL_SET_TEMP_BED, onDrawSetPreheatBed, SetPreheatBedTemp, &ui.material_preset[HMI_value.Select].bed_temp); + EDIT_ITEM(ICON_SetBedTemp, MSG_UBL_SET_TEMP_BED, onDrawSetPreheatBed, setPreheatBedTemp, &ui.material_preset[hmiValue.select].bed_temp); #endif #if HAS_FAN - EDIT_ITEM(ICON_FanSpeed, MSG_FAN_SPEED, onDrawSetPreheatFan, SetPreheatFanSpeed, &ui.material_preset[HMI_value.Select].fan_speed); + EDIT_ITEM(ICON_FanSpeed, MSG_FAN_SPEED, onDrawSetPreheatFan, setPreheatFanSpeed, &ui.material_preset[hmiValue.select].fan_speed); #endif #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawWriteEeprom, WriteEeprom); + MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawWriteEeprom, writeEEPROM); #endif } - UpdateMenu(PreheatMenu); + updateMenu(preheatMenu); } - #define _Preheat_Menu(N) \ - void Draw_Preheat## N ##_Menu() { \ - HMI_value.Select = (N) - 1; \ - Draw_Preheat_Menu(SET_MENU(PreheatMenu, MSG_PREHEAT_## N ##_SETTINGS, 5)); \ + #define _preheatMenu(N) \ + void drawPreheat## N ##Menu() { \ + hmiValue.select = (N) - 1; \ + drawPreheatMenu(SET_MENU(preheatMenu, MSG_PREHEAT_## N ##_SETTINGS, 5)); \ } - REPEAT_1(PREHEAT_COUNT, _Preheat_Menu) + REPEAT_1(PREHEAT_COUNT, _preheatMenu) #endif // HAS_PREHEAT -void Draw_Temperature_Menu() { - checkkey = Menu; - if (SET_MENU_R(TemperatureMenu, selrect({236, 2, 28, 12}), MSG_TEMPERATURE, 4 + PREHEAT_COUNT)) { - BACK_ITEM(Draw_Control_Menu); +void drawTemperatureMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(temperatureMenu, selrect({236, 2, 28, 12}), MSG_TEMPERATURE, 4 + PREHEAT_COUNT)) { + BACK_ITEM(drawControlMenu); #if HAS_HOTEND - HotendTargetItem = EDIT_ITEM(ICON_SetEndTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawHotendTemp, SetHotendTemp, &thermalManager.temp_hotend[0].target); + hotendTargetItem = EDIT_ITEM(ICON_SetEndTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawHotendTemp, setHotendTemp, &thermalManager.temp_hotend[0].target); #endif #if HAS_HEATED_BED - BedTargetItem = EDIT_ITEM(ICON_SetBedTemp, MSG_UBL_SET_TEMP_BED, onDrawBedTemp, SetBedTemp, &thermalManager.temp_bed.target); + bedTargetItem = EDIT_ITEM(ICON_SetBedTemp, MSG_UBL_SET_TEMP_BED, onDrawBedTemp, setBedTemp, &thermalManager.temp_bed.target); #endif #if HAS_FAN - FanSpeedItem = EDIT_ITEM(ICON_FanSpeed, MSG_FAN_SPEED, onDrawFanSpeed, SetFanSpeed, &thermalManager.fan_speed[0]); + fanSpeedItem = EDIT_ITEM(ICON_FanSpeed, MSG_FAN_SPEED, onDrawFanSpeed, setFanSpeed, &thermalManager.fan_speed[0]); #endif #if HAS_PREHEAT - #define _ITEM_SETPREHEAT(N) MENU_ITEM(ICON_SetPreheat##N, MSG_PREHEAT_## N ##_SETTINGS, onDrawSubMenu, Draw_Preheat## N ##_Menu); + #define _ITEM_SETPREHEAT(N) MENU_ITEM(ICON_SetPreheat##N, MSG_PREHEAT_## N ##_SETTINGS, onDrawSubMenu, drawPreheat## N ##Menu); REPEAT_1(PREHEAT_COUNT, _ITEM_SETPREHEAT) #endif } - UpdateMenu(TemperatureMenu); + updateMenu(temperatureMenu); } -void Draw_MaxSpeed_Menu() { - checkkey = Menu; - if (SET_MENU_R(MaxSpeedMenu, selrect({1, 16, 28, 13}), MSG_MAX_SPEED, 5)) { - BACK_ITEM(Draw_Motion_Menu); +void drawMaxSpeedMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(maxSpeedMenu, selrect({1, 16, 28, 13}), MSG_MAX_SPEED, 5)) { + BACK_ITEM(drawMotionMenu); #if HAS_X_AXIS - EDIT_ITEM(ICON_MaxSpeedX, MSG_VMAX_A, onDrawMaxSpeedX, SetMaxSpeedX, &planner.settings.max_feedrate_mm_s[X_AXIS]); + EDIT_ITEM(ICON_MaxSpeedX, MSG_VMAX_A, onDrawMaxSpeedX, setMaxSpeedX, &planner.settings.max_feedrate_mm_s[X_AXIS]); #endif #if HAS_Y_AXIS - EDIT_ITEM(ICON_MaxSpeedY, MSG_VMAX_B, onDrawMaxSpeedY, SetMaxSpeedY, &planner.settings.max_feedrate_mm_s[Y_AXIS]); + EDIT_ITEM(ICON_MaxSpeedY, MSG_VMAX_B, onDrawMaxSpeedY, setMaxSpeedY, &planner.settings.max_feedrate_mm_s[Y_AXIS]); #endif #if HAS_Z_AXIS - EDIT_ITEM(ICON_MaxSpeedZ, MSG_VMAX_C, onDrawMaxSpeedZ, SetMaxSpeedZ, &planner.settings.max_feedrate_mm_s[Z_AXIS]); + EDIT_ITEM(ICON_MaxSpeedZ, MSG_VMAX_C, onDrawMaxSpeedZ, setMaxSpeedZ, &planner.settings.max_feedrate_mm_s[Z_AXIS]); #endif #if HAS_HOTEND - EDIT_ITEM(ICON_MaxSpeedE, MSG_VMAX_E, onDrawMaxSpeedE, SetMaxSpeedE, &planner.settings.max_feedrate_mm_s[E_AXIS]); + EDIT_ITEM(ICON_MaxSpeedE, MSG_VMAX_E, onDrawMaxSpeedE, setMaxSpeedE, &planner.settings.max_feedrate_mm_s[E_AXIS]); #endif } - UpdateMenu(MaxSpeedMenu); + updateMenu(maxSpeedMenu); } -void Draw_MaxAccel_Menu() { - checkkey = Menu; - if (SET_MENU_R(MaxAccelMenu, selrect({1, 16, 28, 13}), MSG_AMAX_EN, 5)) { - BACK_ITEM(Draw_Motion_Menu); +void drawMaxAccelMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(maxAccelMenu, selrect({1, 16, 28, 13}), MSG_AMAX_EN, 5)) { + BACK_ITEM(drawMotionMenu); #if HAS_X_AXIS - EDIT_ITEM(ICON_MaxAccX, MSG_AMAX_A, onDrawMaxAccelX, SetMaxAccelX, &planner.settings.max_acceleration_mm_per_s2[X_AXIS]); + EDIT_ITEM(ICON_MaxAccX, MSG_AMAX_A, onDrawMaxAccelX, setMaxAccelX, &planner.settings.max_acceleration_mm_per_s2[X_AXIS]); #endif #if HAS_Y_AXIS - EDIT_ITEM(ICON_MaxAccY, MSG_AMAX_B, onDrawMaxAccelY, SetMaxAccelY, &planner.settings.max_acceleration_mm_per_s2[Y_AXIS]); + EDIT_ITEM(ICON_MaxAccY, MSG_AMAX_B, onDrawMaxAccelY, setMaxAccelY, &planner.settings.max_acceleration_mm_per_s2[Y_AXIS]); #endif #if HAS_Z_AXIS - EDIT_ITEM(ICON_MaxAccZ, MSG_AMAX_C, onDrawMaxAccelZ, SetMaxAccelZ, &planner.settings.max_acceleration_mm_per_s2[Z_AXIS]); + EDIT_ITEM(ICON_MaxAccZ, MSG_AMAX_C, onDrawMaxAccelZ, setMaxAccelZ, &planner.settings.max_acceleration_mm_per_s2[Z_AXIS]); #endif #if HAS_HOTEND - EDIT_ITEM(ICON_MaxAccE, MSG_AMAX_E, onDrawMaxAccelE, SetMaxAccelE, &planner.settings.max_acceleration_mm_per_s2[E_AXIS]); + EDIT_ITEM(ICON_MaxAccE, MSG_AMAX_E, onDrawMaxAccelE, setMaxAccelE, &planner.settings.max_acceleration_mm_per_s2[E_AXIS]); #endif } - UpdateMenu(MaxAccelMenu); + updateMenu(maxAccelMenu); } #if HAS_CLASSIC_JERK - void Draw_MaxJerk_Menu() { - checkkey = Menu; - if (SET_MENU_R(MaxJerkMenu, selrect({1, 16, 28, 13}), MSG_JERK, 5)) { - BACK_ITEM(Draw_Motion_Menu); + void drawMaxJerkMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(maxJerkMenu, selrect({1, 16, 28, 13}), MSG_JERK, 5)) { + BACK_ITEM(drawMotionMenu); #if HAS_X_AXIS - EDIT_ITEM(ICON_MaxSpeedJerkX, MSG_VA_JERK, onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk.x); + EDIT_ITEM(ICON_MaxSpeedJerkX, MSG_VA_JERK, onDrawMaxJerkX, setMaxJerkX, &planner.max_jerk.x); #endif #if HAS_Y_AXIS - EDIT_ITEM(ICON_MaxSpeedJerkY, MSG_VB_JERK, onDrawMaxJerkY, SetMaxJerkY, &planner.max_jerk.y); + EDIT_ITEM(ICON_MaxSpeedJerkY, MSG_VB_JERK, onDrawMaxJerkY, setMaxJerkY, &planner.max_jerk.y); #endif #if HAS_Z_AXIS - EDIT_ITEM(ICON_MaxSpeedJerkZ, MSG_VC_JERK, onDrawMaxJerkZ, SetMaxJerkZ, &planner.max_jerk.z); + EDIT_ITEM(ICON_MaxSpeedJerkZ, MSG_VC_JERK, onDrawMaxJerkZ, setMaxJerkZ, &planner.max_jerk.z); #endif #if HAS_HOTEND - EDIT_ITEM(ICON_MaxSpeedJerkE, MSG_VE_JERK, onDrawMaxJerkE, SetMaxJerkE, &planner.max_jerk.e); + EDIT_ITEM(ICON_MaxSpeedJerkE, MSG_VE_JERK, onDrawMaxJerkE, setMaxJerkE, &planner.max_jerk.e); #endif } - UpdateMenu(MaxJerkMenu); + updateMenu(maxJerkMenu); } #endif // HAS_CLASSIC_JERK -void Draw_Steps_Menu() { - checkkey = Menu; - if (SET_MENU_R(StepsMenu, selrect({1, 16, 28, 13}), MSG_STEPS_PER_MM, 5)) { - BACK_ITEM(Draw_Motion_Menu); +void drawStepsMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(stepsMenu, selrect({1, 16, 28, 13}), MSG_STEPS_PER_MM, 5)) { + BACK_ITEM(drawMotionMenu); #if HAS_X_AXIS - EDIT_ITEM(ICON_StepX, MSG_A_STEPS, onDrawStepsX, SetStepsX, &planner.settings.axis_steps_per_mm[X_AXIS]); + EDIT_ITEM(ICON_StepX, MSG_A_STEPS, onDrawStepsX, setStepsX, &planner.settings.axis_steps_per_mm[X_AXIS]); #endif #if HAS_Y_AXIS - EDIT_ITEM(ICON_StepY, MSG_B_STEPS, onDrawStepsY, SetStepsY, &planner.settings.axis_steps_per_mm[Y_AXIS]); + EDIT_ITEM(ICON_StepY, MSG_B_STEPS, onDrawStepsY, setStepsY, &planner.settings.axis_steps_per_mm[Y_AXIS]); #endif #if HAS_Z_AXIS - EDIT_ITEM(ICON_StepZ, MSG_C_STEPS, onDrawStepsZ, SetStepsZ, &planner.settings.axis_steps_per_mm[Z_AXIS]); + EDIT_ITEM(ICON_StepZ, MSG_C_STEPS, onDrawStepsZ, setStepsZ, &planner.settings.axis_steps_per_mm[Z_AXIS]); #endif #if HAS_HOTEND - EDIT_ITEM(ICON_StepE, MSG_E_STEPS, onDrawStepsE, SetStepsE, &planner.settings.axis_steps_per_mm[E_AXIS]); + EDIT_ITEM(ICON_StepE, MSG_E_STEPS, onDrawStepsE, setStepsE, &planner.settings.axis_steps_per_mm[E_AXIS]); #endif } - UpdateMenu(StepsMenu); + updateMenu(stepsMenu); } //============================================================================= @@ -3629,77 +3633,77 @@ void Draw_Steps_Menu() { #if HAS_CUSTOM_COLORS - void RestoreDefaultColors() { - DWIN_SetColorDefaults(); - DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); - DWIN_RedrawScreen(); + void restoreDefaultColors() { + dwinSetColorDefaults(); + DWINUI::setColors(hmiData.colorText, hmiData.colorBackground, hmiData.colorStatusBg); + dwinRedrawScreen(); } - void SelColor() { - MenuData.P_Int = (int16_t*)static_cast(CurrentMenu->SelectedItem())->value; - HMI_value.Color[0] = GetRColor(*MenuData.P_Int); // Red - HMI_value.Color[1] = GetGColor(*MenuData.P_Int); // Green - HMI_value.Color[2] = GetBColor(*MenuData.P_Int); // Blue - Draw_GetColor_Menu(); + void selColor() { + menuData.intPtr = (int16_t*)static_cast(currentMenu->selectedItem())->value; + hmiValue.Color[0] = GetRColor(*menuData.intPtr); // Red + hmiValue.Color[1] = GetGColor(*menuData.intPtr); // Green + hmiValue.Color[2] = GetBColor(*menuData.intPtr); // Blue + drawGetColorMenu(); } - void LiveRGBColor() { - HMI_value.Color[CurrentMenu->line() - 2] = MenuData.Value; - uint16_t color = RGB(HMI_value.Color[0], HMI_value.Color[1], HMI_value.Color[2]); + void liveRGBColor() { + hmiValue.Color[currentMenu->line() - 2] = menuData.value; + uint16_t color = RGB(hmiValue.Color[0], hmiValue.Color[1], hmiValue.Color[2]); dwinDrawRectangle(1, color, 20, 315, DWIN_WIDTH - 20, 335); } - void SetRGBColor() { - const uint8_t color = static_cast(CurrentMenu->SelectedItem())->icon; - SetIntOnClick(0, (color == 1) ? 63 : 31, HMI_value.Color[color], nullptr, LiveRGBColor); + void setRGBColor() { + const uint8_t color = static_cast(currentMenu->selectedItem())->icon; + setIntOnClick(0, (color == 1) ? 63 : 31, hmiValue.Color[color], nullptr, liveRGBColor); } - void DWIN_ApplyColor() { - *MenuData.P_Int = RGB(HMI_value.Color[0], HMI_value.Color[1], HMI_value.Color[2]); - DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); - Draw_SelectColors_Menu(); + void dwinApplyColor() { + *menuData.intPtr = RGB(hmiValue.Color[0], hmiValue.Color[1], hmiValue.Color[2]); + DWINUI::setColors(hmiData.colorText, hmiData.colorBackground, hmiData.colorStatusBg); + drawSelectColorsMenu(); hash_changed = true; LCD_MESSAGE(MSG_COLORS_APPLIED); - DWIN_Draw_Dashboard(); - } - - void Draw_SelectColors_Menu() { - checkkey = Menu; - if (SET_MENU(SelectColorMenu, MSG_COLORS_SELECT, 20)) { - BACK_ITEM(Draw_AdvancedSettings_Menu); - MENU_ITEM(ICON_StockConfiguration, MSG_RESTORE_DEFAULTS, onDrawMenuItem, RestoreDefaultColors); - EDIT_ITEM_F(0, "Screen Background", onDrawSelColorItem, SelColor, &HMI_data.Background_Color); - EDIT_ITEM_F(0, "Cursor", onDrawSelColorItem, SelColor, &HMI_data.Cursor_Color); - EDIT_ITEM_F(0, "Title Background", onDrawSelColorItem, SelColor, &HMI_data.TitleBg_Color); - EDIT_ITEM_F(0, "Title Text", onDrawSelColorItem, SelColor, &HMI_data.TitleTxt_Color); - EDIT_ITEM_F(0, "Text", onDrawSelColorItem, SelColor, &HMI_data.Text_Color); - EDIT_ITEM_F(0, "Selected", onDrawSelColorItem, SelColor, &HMI_data.Selected_Color); - EDIT_ITEM_F(0, "Split Line", onDrawSelColorItem, SelColor, &HMI_data.SplitLine_Color); - EDIT_ITEM_F(0, "Highlight", onDrawSelColorItem, SelColor, &HMI_data.Highlight_Color); - EDIT_ITEM_F(0, "Status Background", onDrawSelColorItem, SelColor, &HMI_data.StatusBg_Color); - EDIT_ITEM_F(0, "Status Text", onDrawSelColorItem, SelColor, &HMI_data.StatusTxt_Color); - EDIT_ITEM_F(0, "Popup Background", onDrawSelColorItem, SelColor, &HMI_data.PopupBg_Color); - EDIT_ITEM_F(0, "Popup Text", onDrawSelColorItem, SelColor, &HMI_data.PopupTxt_Color); - EDIT_ITEM_F(0, "Alert Background", onDrawSelColorItem, SelColor, &HMI_data.AlertBg_Color); - EDIT_ITEM_F(0, "Alert Text", onDrawSelColorItem, SelColor, &HMI_data.AlertTxt_Color); - EDIT_ITEM_F(0, "Percent Text", onDrawSelColorItem, SelColor, &HMI_data.PercentTxt_Color); - EDIT_ITEM_F(0, "Bar Fill", onDrawSelColorItem, SelColor, &HMI_data.Barfill_Color); - EDIT_ITEM_F(0, "Indicator value", onDrawSelColorItem, SelColor, &HMI_data.Indicator_Color); - EDIT_ITEM_F(0, "Coordinate value", onDrawSelColorItem, SelColor, &HMI_data.Coordinate_Color); - } - UpdateMenu(SelectColorMenu); - } - - void Draw_GetColor_Menu() { - checkkey = Menu; - if (SET_MENU(GetColorMenu, MSG_COLORS_GET, 5)) { - BACK_ITEM(DWIN_ApplyColor); - MENU_ITEM(ICON_Cancel, MSG_BUTTON_CANCEL, onDrawMenuItem, Draw_SelectColors_Menu); - MENU_ITEM(0, MSG_COLORS_RED, onDrawGetColorItem, SetRGBColor); - MENU_ITEM(1, MSG_COLORS_GREEN, onDrawGetColorItem, SetRGBColor); - MENU_ITEM(2, MSG_COLORS_BLUE, onDrawGetColorItem, SetRGBColor); - } - UpdateMenu(GetColorMenu); - dwinDrawRectangle(1, *MenuData.P_Int, 20, 315, DWIN_WIDTH - 20, 335); + dwinDrawDashboard(); + } + + void drawSelectColorsMenu() { + checkkey = ID_Menu; + if (SET_MENU(selectColorMenu, MSG_COLORS_SELECT, 20)) { + BACK_ITEM(drawAdvancedSettingsMenu); + MENU_ITEM(ICON_StockConfiguration, MSG_RESTORE_DEFAULTS, onDrawMenuItem, restoreDefaultColors); + EDIT_ITEM_F(0, "Screen Background", onDrawSelColorItem, selColor, &hmiData.colorBackground); + EDIT_ITEM_F(0, "Cursor", onDrawSelColorItem, selColor, &hmiData.colorCursor); + EDIT_ITEM_F(0, "Title Background", onDrawSelColorItem, selColor, &hmiData.colorTitleBg); + EDIT_ITEM_F(0, "Title Text", onDrawSelColorItem, selColor, &hmiData.colorTitleTxt); + EDIT_ITEM_F(0, "Text", onDrawSelColorItem, selColor, &hmiData.colorText); + EDIT_ITEM_F(0, "Selected", onDrawSelColorItem, selColor, &hmiData.colorSelected); + EDIT_ITEM_F(0, "Split Line", onDrawSelColorItem, selColor, &hmiData.colorSplitLine); + EDIT_ITEM_F(0, "Highlight", onDrawSelColorItem, selColor, &hmiData.colorHighlight); + EDIT_ITEM_F(0, "Status Background", onDrawSelColorItem, selColor, &hmiData.colorStatusBg); + EDIT_ITEM_F(0, "Status Text", onDrawSelColorItem, selColor, &hmiData.colorStatusTxt); + EDIT_ITEM_F(0, "Popup Background", onDrawSelColorItem, selColor, &hmiData.colorPopupBg); + EDIT_ITEM_F(0, "Popup Text", onDrawSelColorItem, selColor, &hmiData.colorPopupTxt); + EDIT_ITEM_F(0, "Alert Background", onDrawSelColorItem, selColor, &hmiData.colorAlertBg); + EDIT_ITEM_F(0, "Alert Text", onDrawSelColorItem, selColor, &hmiData.colorAlertTxt); + EDIT_ITEM_F(0, "Percent Text", onDrawSelColorItem, selColor, &hmiData.colorPercentTxt); + EDIT_ITEM_F(0, "Bar Fill", onDrawSelColorItem, selColor, &hmiData.colorBarfill); + EDIT_ITEM_F(0, "Indicator value", onDrawSelColorItem, selColor, &hmiData.colorIndicator); + EDIT_ITEM_F(0, "Coordinate value", onDrawSelColorItem, selColor, &hmiData.colorCoordinate); + } + updateMenu(selectColorMenu); + } + + void drawGetColorMenu() { + checkkey = ID_Menu; + if (SET_MENU(getColorMenu, MSG_COLORS_GET, 5)) { + BACK_ITEM(dwinApplyColor); + MENU_ITEM(ICON_Cancel, MSG_BUTTON_CANCEL, onDrawMenuItem, drawSelectColorsMenu); + MENU_ITEM(0, MSG_COLORS_RED, onDrawGetColorItem, setRGBColor); + MENU_ITEM(1, MSG_COLORS_GREEN, onDrawGetColorItem, setRGBColor); + MENU_ITEM(2, MSG_COLORS_BLUE, onDrawGetColorItem, setRGBColor); + } + updateMenu(getColorMenu); + dwinDrawRectangle(1, *menuData.intPtr, 20, 315, DWIN_WIDTH - 20, 335); } #endif // HAS_CUSTOM_COLORS @@ -3711,91 +3715,91 @@ void Draw_Steps_Menu() { #if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) #if ENABLED(MPC_EDIT_MENU) - void SetHeaterPower() { SetPFloatOnClick(1, 200, 1); } - void SetBlkHeatCapacity() { SetPFloatOnClick(0, 40, 2); } - void SetSensorResponse() { SetPFloatOnClick(0, 1, 4); } - void SetAmbientXfer() { SetPFloatOnClick(0, 1, 4); } + void setHeaterPower() { setPFloatOnClick(1, 200, 1); } + void setBlkHeatCapacity() { setPFloatOnClick(0, 40, 2); } + void setSensorResponse() { setPFloatOnClick(0, 1, 4); } + void setAmbientXfer() { setPFloatOnClick(0, 1, 4); } #if ENABLED(MPC_INCLUDE_FAN) - void onDrawFanAdj(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 4, thermalManager.temp_hotend[0].fanCoefficient()); } - void ApplyFanAdj() { thermalManager.temp_hotend[0].applyFanAdjustment(MenuData.Value / POW(10, 4)); } - void SetFanAdj() { SetFloatOnClick(0, 1, 4, thermalManager.temp_hotend[0].fanCoefficient(), ApplyFanAdj); } + void onDrawFanAdj(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 4, thermalManager.temp_hotend[0].fanCoefficient()); } + void applyFanAdj() { thermalManager.temp_hotend[0].applyFanAdjustment(menuData.value / POW(10, 4)); } + void setFanAdj() { setFloatOnClick(0, 1, 4, thermalManager.temp_hotend[0].fanCoefficient(), applyFanAdj); } #endif #endif - void Draw_HotendMPC_Menu() { - checkkey = Menu; - if (SET_MENU_F(HotendMPCMenu, "MPC Settings", 7)) { + void drawHotendMPCMenu() { + checkkey = ID_Menu; + if (SET_MENU_F(hotendMPCMenu, "MPC Settings", 7)) { MPC_t &mpc = thermalManager.temp_hotend[0].mpc; - BACK_ITEM(Draw_AdvancedSettings_Menu); + BACK_ITEM(drawAdvancedSettingsMenu); #if ENABLED(MPC_AUTOTUNE_MENU) MENU_ITEM(ICON_MPCNozzle, MSG_MPC_AUTOTUNE, onDrawMenuItem, []{ thermalManager.MPC_autotune(active_extruder, Temperature::MPCTuningType::AUTO); }); #endif #if ENABLED(MPC_EDIT_MENU) - EDIT_ITEM(ICON_MPCHeater, MSG_MPC_POWER, onDrawPFloatMenu, SetHeaterPower, &mpc.heater_power); - EDIT_ITEM(ICON_MPCHeatCap, MSG_MPC_BLOCK_HEAT_CAPACITY, onDrawPFloat2Menu, SetBlkHeatCapacity, &mpc.block_heat_capacity); - EDIT_ITEM(ICON_MPCValue, MSG_SENSOR_RESPONSIVENESS, onDrawPFloat4Menu, SetSensorResponse, &mpc.sensor_responsiveness); - EDIT_ITEM(ICON_MPCValue, MSG_MPC_AMBIENT_XFER_COEFF, onDrawPFloat4Menu, SetAmbientXfer, &mpc.ambient_xfer_coeff_fan0); + EDIT_ITEM(ICON_MPCHeater, MSG_MPC_POWER, onDrawPFloatMenu, setHeaterPower, &mpc.heater_power); + EDIT_ITEM(ICON_MPCHeatCap, MSG_MPC_BLOCK_HEAT_CAPACITY, onDrawPFloat2Menu, setBlkHeatCapacity, &mpc.block_heat_capacity); + EDIT_ITEM(ICON_MPCValue, MSG_SENSOR_RESPONSIVENESS, onDrawPFloat4Menu, setSensorResponse, &mpc.sensor_responsiveness); + EDIT_ITEM(ICON_MPCValue, MSG_MPC_AMBIENT_XFER_COEFF, onDrawPFloat4Menu, setAmbientXfer, &mpc.ambient_xfer_coeff_fan0); #if ENABLED(MPC_INCLUDE_FAN) - EDIT_ITEM(ICON_MPCFan, MSG_MPC_AMBIENT_XFER_COEFF_FAN, onDrawFanAdj, SetFanAdj, &mpc.fan255_adjustment); + EDIT_ITEM(ICON_MPCFan, MSG_MPC_AMBIENT_XFER_COEFF_FAN, onDrawFanAdj, setFanAdj, &mpc.fan255_adjustment); #endif #endif } - UpdateMenu(HotendMPCMenu); + updateMenu(hotendMPCMenu); } #endif // MPC_EDIT_MENU || MPC_AUTOTUNE_MENU -#if DWIN_PID_TUNE - void SetPID(celsius_t t, heater_id_t h) { +#if PROUI_PID_TUNE + void setPID(celsius_t t, heater_id_t h) { gcode.process_subcommands_now( MString<60>(F("G28OXY\nG0Z5F300\nG0X"), X_CENTER, F("Y"), Y_CENTER, F("F5000\nM84\nM400")) ); - thermalManager.PID_autotune(t, h, HMI_data.PidCycles, true); + thermalManager.PID_autotune(t, h, hmiData.pidCycles, true); } - void SetPidCycles() { SetPIntOnClick(3, 50); } + void setPidCycles() { setPIntOnClick(3, 50); } #endif #if ALL(HAS_PID_HEATING, PID_EDIT_MENU) - void SetKp() { SetPFloatOnClick(0, 1000, 2); } - void ApplyPIDi() { - *MenuData.P_Float = scalePID_i(MenuData.Value / POW(10, 2)); + void setKp() { setPFloatOnClick(0, 1000, 2); } + void applyPIDi() { + *menuData.floatPtr = scalePID_i(menuData.value / POW(10, 2)); TERN_(PIDTEMP, thermalManager.updatePID()); } - void ApplyPIDd() { - *MenuData.P_Float = scalePID_d(MenuData.Value / POW(10, 2)); + void applyPIDd() { + *menuData.floatPtr = scalePID_d(menuData.value / POW(10, 2)); TERN_(PIDTEMP, thermalManager.updatePID()); } - void SetKi() { - MenuData.P_Float = (float*)static_cast(CurrentMenu->SelectedItem())->value; - const float value = unscalePID_i(*MenuData.P_Float); - SetFloatOnClick(0, 1000, 2, value, ApplyPIDi); + void setKi() { + menuData.floatPtr = (float*)static_cast(currentMenu->selectedItem())->value; + const float value = unscalePID_i(*menuData.floatPtr); + setFloatOnClick(0, 1000, 2, value, applyPIDi); } - void SetKd() { - MenuData.P_Float = (float*)static_cast(CurrentMenu->SelectedItem())->value; - const float value = unscalePID_d(*MenuData.P_Float); - SetFloatOnClick(0, 1000, 2, value, ApplyPIDd); + void setKd() { + menuData.floatPtr = (float*)static_cast(currentMenu->selectedItem())->value; + const float value = unscalePID_d(*menuData.floatPtr); + setFloatOnClick(0, 1000, 2, value, applyPIDd); } - void onDrawPIDi(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_i(*(float*)static_cast(menuitem)->value)); } - void onDrawPIDd(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_d(*(float*)static_cast(menuitem)->value)); } + void onDrawPIDi(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_i(*(float*)static_cast(menuitem)->value)); } + void onDrawPIDd(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_d(*(float*)static_cast(menuitem)->value)); } #endif // HAS_PID_HEATING && PID_EDIT_MENU #if ENABLED(PIDTEMP) && ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) #if ENABLED(PID_AUTOTUNE_MENU) - void HotendPID() { SetPID(HMI_data.HotendPidT, H_E0); } - void SetHotendPidT() { SetPIntOnClick(MIN_ETEMP, MAX_ETEMP); } + void hotendPID() { setPID(hmiData.hotendPidT, H_E0); } + void setHotendPidT() { setPIntOnClick(MIN_ETEMP, MAX_ETEMP); } #endif - void Draw_HotendPID_Menu() { - checkkey = Menu; - if (SET_MENU_F(HotendPIDMenu, STR_HOTEND_PID " Settings", 8)) { - BACK_ITEM(Draw_AdvancedSettings_Menu); + void drawHotendPIDMenu() { + checkkey = ID_Menu; + if (SET_MENU_F(hotendPIDMenu, STR_HOTEND_PID " Settings", 8)) { + BACK_ITEM(drawAdvancedSettingsMenu); #if ENABLED(PID_AUTOTUNE_MENU) - MENU_ITEM_F(ICON_PIDNozzle, STR_HOTEND_PID, onDrawMenuItem, HotendPID); - EDIT_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawPIntMenu, SetHotendPidT, &HMI_data.HotendPidT); - EDIT_ITEM(ICON_PIDCycles, MSG_PID_CYCLE, onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles); + MENU_ITEM_F(ICON_PIDNozzle, STR_HOTEND_PID, onDrawMenuItem, hotendPID); + EDIT_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawPIntMenu, setHotendPidT, &hmiData.hotendPidT); + EDIT_ITEM(ICON_PIDCycles, MSG_PID_CYCLE, onDrawPIntMenu, setPidCycles, &hmiData.pidCycles); #endif #if ENABLED(PID_EDIT_MENU) EDIT_ITEM_F(ICON_PIDValue, "Set" STR_KP, onDrawPFloat2Menu, SetKp, &thermalManager.temp_hotend[0].pid.Kp); @@ -3803,10 +3807,10 @@ void Draw_Steps_Menu() { EDIT_ITEM_F(ICON_PIDValue, "Set" STR_KD, onDrawPIDd, SetKd, &thermalManager.temp_hotend[0].pid.Kd); #endif #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, WriteEeprom); + MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, writeEEPROM); #endif } - UpdateMenu(HotendPIDMenu); + updateMenu(hotendPIDMenu); } #endif // PIDTEMP && (PID_AUTOTUNE_MENU || PID_EDIT_MENU) @@ -3814,18 +3818,18 @@ void Draw_Steps_Menu() { #if ENABLED(PIDTEMPBED) && ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) #if ENABLED(PID_AUTOTUNE_MENU) - void BedPID() { SetPID(HMI_data.BedPidT, H_BED); } - void SetBedPidT() { SetPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } + void bedPID() { setPID(hmiData.bedPidT, H_BED); } + void setBedPidT() { setPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } #endif - void Draw_BedPID_Menu() { - checkkey = Menu; - if (SET_MENU_F(BedPIDMenu, STR_BED_PID " Settings", 8)) { - BACK_ITEM(Draw_AdvancedSettings_Menu); + void drawBedPIDMenu() { + checkkey = ID_Menu; + if (SET_MENU_F(bedPIDMenu, STR_BED_PID " Settings", 8)) { + BACK_ITEM(drawAdvancedSettingsMenu); #if ENABLED(PID_AUTOTUNE_MENU) - MENU_ITEM_F(ICON_PIDBed, STR_BED_PID, onDrawMenuItem,BedPID); - EDIT_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawPIntMenu, SetBedPidT, &HMI_data.BedPidT); - EDIT_ITEM(ICON_PIDCycles, MSG_PID_CYCLE, onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles); + MENU_ITEM_F(ICON_PIDBed, STR_BED_PID, onDrawMenuItem,bedPID); + EDIT_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawPIntMenu, setBedPidT, &hmiData.bedPidT); + EDIT_ITEM(ICON_PIDCycles, MSG_PID_CYCLE, onDrawPIntMenu, setPidCycles, &hmiData.pidCycles); #endif #if ENABLED(PID_EDIT_MENU) EDIT_ITEM_F(ICON_PIDValue, "Set" STR_KP, onDrawPFloat2Menu, SetKp, &thermalManager.temp_bed.pid.Kp); @@ -3833,10 +3837,10 @@ void Draw_Steps_Menu() { EDIT_ITEM_F(ICON_PIDValue, "Set" STR_KD, onDrawPIDd, SetKd, &thermalManager.temp_bed.pid.Kd); #endif #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, WriteEeprom); + MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, writeEEPROM); #endif } - UpdateMenu(BedPIDMenu); + updateMenu(bedPIDMenu); } #endif // PIDTEMPBED && (PID_AUTOTUNE_MENU || PID_EDIT_MENU) @@ -3845,15 +3849,15 @@ void Draw_Steps_Menu() { #if HAS_BED_PROBE - void Draw_ZOffsetWiz_Menu() { - checkkey = Menu; - if (SET_MENU(ZOffsetWizMenu, MSG_PROBE_WIZARD, 4)) { - BACK_ITEM(Draw_Prepare_Menu); - MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawMenuItem, AutoHome); - MENU_ITEM_F(ICON_MoveZ0, "Move Z to Home", onDrawMenuItem, SetMoveZto0); - EDIT_ITEM(ICON_Zoffset, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, SetZOffset, &BABY_Z_VAR); + void drawZOffsetWizMenu() { + checkkey = ID_Menu; + if (SET_MENU(zOffsetWizMenu, MSG_PROBE_WIZARD, 4)) { + BACK_ITEM(drawPrepareMenu); + MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawMenuItem, autoHome); + MENU_ITEM_F(ICON_MoveZ0, "Move Z to Home", onDrawMenuItem, setMoveZto0); + EDIT_ITEM(ICON_Zoffset, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, setZOffset, &BABY_Z_VAR); } - UpdateMenu(ZOffsetWizMenu); + updateMenu(zOffsetWizMenu); if (!axis_is_trusted(Z_AXIS)) LCD_MESSAGE_F("WARNING: Z position unknown, move Z to home"); } @@ -3861,42 +3865,42 @@ void Draw_Steps_Menu() { #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) - void Draw_Homing_Menu() { - checkkey = Menu; - if (SET_MENU(HomingMenu, MSG_HOMING, 6)) { - BACK_ITEM(Draw_Prepare_Menu); - MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawMenuItem, AutoHome); + void drawHomingMenu() { + checkkey = ID_Menu; + if (SET_MENU(homingMenu, MSG_HOMING, 6)) { + BACK_ITEM(drawPrepareMenu); + MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawMenuItem, autoHome); #if HAS_X_AXIS - MENU_ITEM(ICON_HomeX, MSG_AUTO_HOME_X, onDrawMenuItem, HomeX); + MENU_ITEM(ICON_HomeX, MSG_AUTO_HOME_X, onDrawMenuItem, homeX); #endif #if HAS_Y_AXIS - MENU_ITEM(ICON_HomeY, MSG_AUTO_HOME_Y, onDrawMenuItem, HomeY); + MENU_ITEM(ICON_HomeY, MSG_AUTO_HOME_Y, onDrawMenuItem, homeY); #endif #if HAS_Z_AXIS - MENU_ITEM(ICON_HomeZ, MSG_AUTO_HOME_Z, onDrawMenuItem, HomeZ); + MENU_ITEM(ICON_HomeZ, MSG_AUTO_HOME_Z, onDrawMenuItem, homeZ); #endif #if ENABLED(MESH_BED_LEVELING) - EDIT_ITEM(ICON_ZAfterHome, MSG_Z_AFTER_HOME, onDrawPInt8Menu, SetZAfterHoming, &HMI_data.z_after_homing); + EDIT_ITEM(ICON_ZAfterHome, MSG_Z_AFTER_HOME, onDrawPInt8Menu, setZAfterHoming, &hmiData.zAfterHoming); #endif } - UpdateMenu(HomingMenu); + updateMenu(homingMenu); } #endif // INDIVIDUAL_AXIS_HOMING_SUBMENU #if ENABLED(FWRETRACT) - void Draw_FWRetract_Menu() { - checkkey = Menu; - if (SET_MENU(FWRetractMenu, MSG_FWRETRACT, 6)) { - BACK_ITEM(Return_FWRetract_Menu); - EDIT_ITEM(ICON_FWRetLength, MSG_CONTROL_RETRACT, onDrawPFloatMenu, SetRetractLength, &fwretract.settings.retract_length); - EDIT_ITEM(ICON_FWRetSpeed, MSG_SINGLENOZZLE_RETRACT_SPEED, onDrawPFloatMenu, SetRetractSpeed, &fwretract.settings.retract_feedrate_mm_s); - EDIT_ITEM(ICON_FWRetZRaise, MSG_CONTROL_RETRACT_ZHOP, onDrawPFloat2Menu, SetZRaise, &fwretract.settings.retract_zraise); - EDIT_ITEM(ICON_FWRecSpeed, MSG_SINGLENOZZLE_UNRETRACT_SPEED, onDrawPFloatMenu, SetRecoverSpeed, &fwretract.settings.retract_recover_feedrate_mm_s); - EDIT_ITEM(ICON_FWRecExtra, MSG_CONTROL_RETRACT_RECOVER, onDrawPFloatMenu, SetAddRecover, &fwretract.settings.retract_recover_extra); + void drawFWRetractMenu() { + checkkey = ID_Menu; + if (SET_MENU(fwRetractMenu, MSG_FWRETRACT, 6)) { + BACK_ITEM(returnFWRetractMenu); + EDIT_ITEM(ICON_FWRetLength, MSG_CONTROL_RETRACT, onDrawPFloatMenu, setRetractLength, &fwretract.settings.retract_length); + EDIT_ITEM(ICON_FWRetSpeed, MSG_SINGLENOZZLE_RETRACT_SPEED, onDrawPFloatMenu, setRetractSpeed, &fwretract.settings.retract_feedrate_mm_s); + EDIT_ITEM(ICON_FWRetZRaise, MSG_CONTROL_RETRACT_ZHOP, onDrawPFloat2Menu, setZRaise, &fwretract.settings.retract_zraise); + EDIT_ITEM(ICON_FWRecSpeed, MSG_SINGLENOZZLE_UNRETRACT_SPEED, onDrawPFloatMenu, setRecoverSpeed, &fwretract.settings.retract_recover_feedrate_mm_s); + EDIT_ITEM(ICON_FWRecExtra, MSG_CONTROL_RETRACT_RECOVER, onDrawPFloatMenu, setAddRecover, &fwretract.settings.retract_recover_extra); } - UpdateMenu(FWRetractMenu); + updateMenu(fwRetractMenu); } #endif @@ -3907,47 +3911,47 @@ void Draw_Steps_Menu() { #if HAS_MESH - void ApplyMeshFadeHeight() { set_z_fade_height(planner.z_fade_height); } - void SetMeshFadeHeight() { SetPFloatOnClick(0, 100, 1, ApplyMeshFadeHeight); } + void applyMeshFadeHeight() { set_z_fade_height(planner.z_fade_height); } + void setMeshFadeHeight() { setPFloatOnClick(0, 100, 1, applyMeshFadeHeight); } - void SetMeshActive() { + void setMeshActive() { set_bed_leveling_enabled(!planner.leveling_active); - Draw_Chkb_Line(CurrentMenu->line(), planner.leveling_active); + drawCheckboxLine(currentMenu->line(), planner.leveling_active); dwinUpdateLCD(); } #if ENABLED(PREHEAT_BEFORE_LEVELING) - void SetBedLevT() { SetPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } + void setBedLevT() { setPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } #endif #if ENABLED(MESH_EDIT_MENU) #define Z_OFFSET_MIN -3 #define Z_OFFSET_MAX 3 - void LiveEditMesh() { ((MenuItemPtrClass*)EditZValueItem)->value = &bedlevel.z_values[HMI_value.Select ? bedLevelTools.mesh_x : MenuData.Value][HMI_value.Select ? MenuData.Value : bedLevelTools.mesh_y]; EditZValueItem->redraw(); } - void ApplyEditMeshX() { bedLevelTools.mesh_x = MenuData.Value; } - void ApplyEditMeshY() { bedLevelTools.mesh_y = MenuData.Value; } - void ResetMesh() { bedLevelTools.mesh_reset(); LCD_MESSAGE(MSG_MESH_RESET); } - void SetEditMeshX() { HMI_value.Select = 0; SetIntOnClick(0, GRID_MAX_POINTS_X - 1, bedLevelTools.mesh_x, ApplyEditMeshX, LiveEditMesh); } - void SetEditMeshY() { HMI_value.Select = 1; SetIntOnClick(0, GRID_MAX_POINTS_Y - 1, bedLevelTools.mesh_y, ApplyEditMeshY, LiveEditMesh); } - void SetEditZValue() { SetPFloatOnClick(Z_OFFSET_MIN, Z_OFFSET_MAX, 3); } + void LiveEditMesh() { ((MenuItemPtr*)editZValueItem)->value = &bedlevel.z_values[hmiValue.select ? bedLevelTools.mesh_x : menuData.value][hmiValue.select ? menuData.value : bedLevelTools.mesh_y]; editZValueItem->redraw(); } + void applyEditMeshX() { bedLevelTools.mesh_x = menuData.value; } + void applyEditMeshY() { bedLevelTools.mesh_y = menuData.value; } + void ResetMesh() { bedLevelTools.meshReset(); LCD_MESSAGE(MSG_MESH_RESET); } + void setEditMeshX() { hmiValue.select = 0; setIntOnClick(0, GRID_MAX_POINTS_X - 1, bedLevelTools.mesh_x, applyEditMeshX, LiveEditMesh); } + void setEditMeshY() { hmiValue.select = 1; setIntOnClick(0, GRID_MAX_POINTS_Y - 1, bedLevelTools.mesh_y, applyEditMeshY, LiveEditMesh); } + void setEditZValue() { setPFloatOnClick(Z_OFFSET_MIN, Z_OFFSET_MAX, 3); } #endif #endif // HAS_MESH #if ENABLED(AUTO_BED_LEVELING_UBL) - void ApplyUBLSlot() { bedlevel.storage_slot = MenuData.Value; } - void SetUBLSlot() { SetIntOnClick(0, settings.calc_num_meshes() - 1, bedlevel.storage_slot, ApplyUBLSlot); } - void onDrawUBLSlot(MenuItemClass* menuitem, int8_t line) { + void applyUBLSlot() { bedlevel.storage_slot = menuData.value; } + void setUBLSlot() { setIntOnClick(0, settings.calc_num_meshes() - 1, bedlevel.storage_slot, applyUBLSlot); } + void onDrawUBLSlot(MenuItem* menuitem, int8_t line) { NOLESS(bedlevel.storage_slot, 0); onDrawIntMenu(menuitem, line, bedlevel.storage_slot); } - void ApplyUBLTiltGrid() { bedLevelTools.tilt_grid = MenuData.Value; } - void SetUBLTiltGrid() { SetIntOnClick(1, 3, bedLevelTools.tilt_grid, ApplyUBLTiltGrid); } + void applyUBLTiltGrid() { bedLevelTools.tilt_grid = menuData.value; } + void setUBLTiltGrid() { setIntOnClick(1, 3, bedLevelTools.tilt_grid, applyUBLTiltGrid); } - void UBLMeshTilt() { + void ublMeshTilt() { NOLESS(bedlevel.storage_slot, 0); if (bedLevelTools.tilt_grid > 1) gcode.process_subcommands_now(TS(F("G29J"), bedLevelTools.tilt_grid)); @@ -3956,19 +3960,19 @@ void Draw_Steps_Menu() { LCD_MESSAGE(MSG_UBL_MESH_TILTED); } - void UBLSmartFillMesh() { + void ublSmartFillMesh() { for (uint8_t x = 0; x < GRID_MAX_POINTS_Y; ++x) bedlevel.smart_fill_mesh(); LCD_MESSAGE(MSG_UBL_MESH_FILLED); } - void UBLMeshSave() { + void ublMeshSave() { NOLESS(bedlevel.storage_slot, 0); settings.store_mesh(bedlevel.storage_slot); ui.status_printf(0, GET_TEXT_F(MSG_MESH_SAVED), bedlevel.storage_slot); DONE_BUZZ(true); } - void UBLMeshLoad() { + void ublMeshLoad() { NOLESS(bedlevel.storage_slot, 0); settings.load_mesh(bedlevel.storage_slot); } @@ -3977,48 +3981,48 @@ void Draw_Steps_Menu() { #if HAS_MESH - void Draw_MeshSet_Menu() { - checkkey = Menu; - if (SET_MENU(MeshMenu, MSG_MESH_LEVELING, 14)) { - BACK_ITEM(Draw_AdvancedSettings_Menu); + void drawMeshSetMenu() { + checkkey = ID_Menu; + if (SET_MENU(meshMenu, MSG_MESH_LEVELING, 14)) { + BACK_ITEM(drawAdvancedSettingsMenu); #if ENABLED(PREHEAT_BEFORE_LEVELING) - EDIT_ITEM(ICON_Temperature, MSG_UBL_SET_TEMP_BED, onDrawPIntMenu, SetBedLevT, &HMI_data.BedLevT); + EDIT_ITEM(ICON_Temperature, MSG_UBL_SET_TEMP_BED, onDrawPIntMenu, setBedLevT, &hmiData.bedLevT); #endif - EDIT_ITEM(ICON_SetZOffset, MSG_Z_FADE_HEIGHT, onDrawPFloatMenu, SetMeshFadeHeight, &planner.z_fade_height); - EDIT_ITEM(ICON_UBLActive, MSG_ACTIVATE_MESH, onDrawChkbMenu, SetMeshActive, &planner.leveling_active); + EDIT_ITEM(ICON_SetZOffset, MSG_Z_FADE_HEIGHT, onDrawPFloatMenu, setMeshFadeHeight, &planner.z_fade_height); + EDIT_ITEM(ICON_UBLActive, MSG_ACTIVATE_MESH, onDrawChkbMenu, setMeshActive, &planner.leveling_active); #if HAS_BED_PROBE - MENU_ITEM(ICON_Level, MSG_AUTO_MESH, onDrawMenuItem, AutoLev); + MENU_ITEM(ICON_Level, MSG_AUTO_MESH, onDrawMenuItem, autoLevel); #endif #if ENABLED(AUTO_BED_LEVELING_UBL) - EDIT_ITEM(ICON_UBLSlot, MSG_UBL_STORAGE_SLOT, onDrawUBLSlot, SetUBLSlot, &bedlevel.storage_slot); - MENU_ITEM(ICON_UBLMeshSave, MSG_UBL_SAVE_MESH, onDrawMenuItem, UBLMeshSave); - MENU_ITEM(ICON_UBLMeshLoad, MSG_UBL_LOAD_MESH, onDrawMenuItem, UBLMeshLoad); - EDIT_ITEM(ICON_UBLTiltGrid, MSG_UBL_TILTING_GRID, onDrawPInt8Menu, SetUBLTiltGrid, &bedLevelTools.tilt_grid); - MENU_ITEM(ICON_UBLTiltGrid, MSG_UBL_TILT_MESH, onDrawMenuItem, UBLMeshTilt); - MENU_ITEM(ICON_UBLSmartFill, MSG_UBL_SMART_FILLIN, onDrawMenuItem, UBLSmartFillMesh); + EDIT_ITEM(ICON_UBLSlot, MSG_UBL_STORAGE_SLOT, onDrawUBLSlot, setUBLSlot, &bedlevel.storage_slot); + MENU_ITEM(ICON_UBLMeshSave, MSG_UBL_SAVE_MESH, onDrawMenuItem, ublMeshSave); + MENU_ITEM(ICON_UBLMeshLoad, MSG_UBL_LOAD_MESH, onDrawMenuItem, ublMeshLoad); + EDIT_ITEM(ICON_UBLTiltGrid, MSG_UBL_TILTING_GRID, onDrawPInt8Menu, setUBLTiltGrid, &bedLevelTools.tilt_grid); + MENU_ITEM(ICON_UBLTiltGrid, MSG_UBL_TILT_MESH, onDrawMenuItem, ublMeshTilt); + MENU_ITEM(ICON_UBLSmartFill, MSG_UBL_SMART_FILLIN, onDrawMenuItem, ublSmartFillMesh); #endif #if ENABLED(MESH_EDIT_MENU) MENU_ITEM(ICON_MeshReset, MSG_MESH_RESET, onDrawMenuItem, ResetMesh); - MENU_ITEM(ICON_MeshEdit, MSG_EDIT_MESH, onDrawSubMenu, Draw_EditMesh_Menu); + MENU_ITEM(ICON_MeshEdit, MSG_EDIT_MESH, onDrawSubMenu, drawEditMeshMenu); #endif - MENU_ITEM(ICON_MeshViewer, MSG_MESH_VIEW, onDrawSubMenu, DWIN_MeshViewer); + MENU_ITEM(ICON_MeshViewer, MSG_MESH_VIEW, onDrawSubMenu, dwinMeshViewer); } - UpdateMenu(MeshMenu); + updateMenu(meshMenu); } #if ENABLED(MESH_EDIT_MENU) - void Draw_EditMesh_Menu() { + void drawEditMeshMenu() { if (!leveling_is_valid()) { LCD_MESSAGE(MSG_UBL_MESH_INVALID); return; } set_bed_leveling_enabled(false); - checkkey = Menu; - if (SET_MENU(EditMeshMenu, MSG_EDIT_MESH, 4)) { + checkkey = ID_Menu; + if (SET_MENU(editMeshMenu, MSG_EDIT_MESH, 4)) { bedLevelTools.mesh_x = bedLevelTools.mesh_y = 0; - BACK_ITEM(Draw_MeshSet_Menu); - EDIT_ITEM(ICON_MeshEditX, MSG_MESH_X, onDrawPInt8Menu, SetEditMeshX, &bedLevelTools.mesh_x); - EDIT_ITEM(ICON_MeshEditY, MSG_MESH_Y, onDrawPInt8Menu, SetEditMeshY, &bedLevelTools.mesh_y); - EditZValueItem = EDIT_ITEM(ICON_MeshEditZ, MSG_MESH_EDIT_Z, onDrawPFloat2Menu, SetEditZValue, &bedlevel.z_values[bedLevelTools.mesh_x][bedLevelTools.mesh_y]); + BACK_ITEM(drawMeshSetMenu); + EDIT_ITEM(ICON_MeshEditX, MSG_MESH_X, onDrawPInt8Menu, setEditMeshX, &bedLevelTools.mesh_x); + EDIT_ITEM(ICON_MeshEditY, MSG_MESH_Y, onDrawPInt8Menu, setEditMeshY, &bedLevelTools.mesh_y); + editZValueItem = EDIT_ITEM(ICON_MeshEditZ, MSG_MESH_EDIT_Z, onDrawPFloat2Menu, setEditZValue, &bedlevel.z_values[bedLevelTools.mesh_x][bedLevelTools.mesh_y]); } - UpdateMenu(EditMeshMenu); + updateMenu(editMeshMenu); } #endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index bd1e80245837..62bf2ad99ee3 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -54,31 +54,31 @@ namespace GET_LANG(LCD_LANGUAGE) { enum processID : uint8_t { // Process ID - MainMenu, - Menu, - SetInt, - SetPInt, - SetIntNoDraw, - SetFloat, - SetPFloat, - PrintProcess, - Popup, - Leveling, - Locked, - Reboot, - PrintDone, - ESDiagProcess, - WaitResponse, - Homing, - PidProcess, - MPCProcess, - NothingToDo + ID_MainMenu, + ID_Menu, + ID_SetInt, + ID_SetPInt, + ID_SetIntNoDraw, + ID_SetFloat, + ID_SetPFloat, + ID_PrintProcess, + ID_Popup, + ID_Leveling, + ID_Locked, + ID_Reboot, + ID_PrintDone, + ID_ESDiagProcess, + ID_WaitResponse, + ID_Homing, + ID_PIDProcess, + ID_MPCProcess, + ID_NothingToDo }; -#if ANY(DWIN_PID_TUNE, MPC_AUTOTUNE) +#if ANY(PROUI_PID_TUNE, MPC_AUTOTUNE) enum tempcontrol_t : uint8_t { - #if DWIN_PID_TUNE + #if PROUI_PID_TUNE PIDTEMP_START, PIDTEMPBED_START, PID_BAD_HEATER_ID, @@ -100,69 +100,69 @@ enum processID : uint8_t { typedef struct { // Color settings - uint16_t Background_Color; - uint16_t Cursor_Color; - uint16_t TitleBg_Color; - uint16_t TitleTxt_Color; - uint16_t Text_Color; - uint16_t Selected_Color; - uint16_t SplitLine_Color; - uint16_t Highlight_Color; - uint16_t StatusBg_Color; - uint16_t StatusTxt_Color; - uint16_t PopupBg_Color; - uint16_t PopupTxt_Color; - uint16_t AlertBg_Color; - uint16_t AlertTxt_Color; - uint16_t PercentTxt_Color; - uint16_t Barfill_Color; - uint16_t Indicator_Color; - uint16_t Coordinate_Color; + uint16_t colorBackground; + uint16_t colorCursor; + uint16_t colorTitleBg; + uint16_t colorTitleTxt; + uint16_t colorText; + uint16_t colorSelected; + uint16_t colorSplitLine; + uint16_t colorHighlight; + uint16_t colorStatusBg; + uint16_t colorStatusTxt; + uint16_t colorPopupBg; + uint16_t colorPopupTxt; + uint16_t colorAlertBg; + uint16_t colorAlertTxt; + uint16_t colorPercentTxt; + uint16_t colorBarfill; + uint16_t colorIndicator; + uint16_t colorCoordinate; // Temperatures - #if DWIN_PID_TUNE - int16_t PidCycles = DEF_PIDCYCLES; + #if PROUI_PID_TUNE + int16_t pidCycles = DEF_PIDCYCLES; #if ENABLED(PIDTEMP) - int16_t HotendPidT = DEF_HOTENDPIDT; + int16_t hotendPidT = DEF_HOTENDPIDT; #endif #if ENABLED(PIDTEMPBED) - int16_t BedPidT = DEF_BEDPIDT; + int16_t bedPidT = DEF_BEDPIDT; #endif #endif #if ENABLED(PREVENT_COLD_EXTRUSION) - int16_t ExtMinT = EXTRUDE_MINTEMP; + int16_t extMinT = EXTRUDE_MINTEMP; #endif #if ENABLED(PREHEAT_BEFORE_LEVELING) - int16_t BedLevT = LEVELING_BED_TEMP; + int16_t bedLevT = LEVELING_BED_TEMP; #endif #if ENABLED(BAUD_RATE_GCODE) - bool Baud115K = false; + bool baud115K = false; #endif - bool FullManualTramming = false; - bool MediaSort = true; - bool MediaAutoMount = ENABLED(HAS_SD_EXTENDER); + bool fullManualTramming = false; + bool mediaSort = true; + bool mediaAutoMount = ENABLED(HAS_SD_EXTENDER); #if ALL(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - uint8_t z_after_homing = DEF_Z_AFTER_HOMING; + uint8_t zAfterHoming = DEF_Z_AFTER_HOMING; #endif #if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) - LEDColor Led_Color = Def_Leds_Color; + LEDColor ledColor = defColorLeds; #endif - bool AdaptiveStepSmoothing = true; - bool EnablePreview = true; -} HMI_data_t; + bool adaptiveStepSmoothing = true; + bool enablePreview = true; +} hmi_data_t; -extern HMI_data_t HMI_data; -static constexpr size_t eeprom_data_size = sizeof(HMI_data_t); +extern hmi_data_t hmiData; +static constexpr size_t eeprom_data_size = sizeof(hmi_data_t); typedef struct { int8_t Color[3]; // Color components - #if ANY(DWIN_PID_TUNE, MPCTEMP) - tempcontrol_t tempcontrol = AUTOTUNE_DONE; + #if ANY(PROUI_PID_TUNE, MPCTEMP) + tempcontrol_t tempControl = AUTOTUNE_DONE; #endif - uint8_t Select = 0; // Auxiliary selector variable + uint8_t select = 0; // Auxiliary selector variable AxisEnum axis = X_AXIS; // Axis Select -} HMI_value_t; +} hmi_value_t; typedef struct { uint8_t language; @@ -171,10 +171,10 @@ typedef struct { bool pause_flag:1; // printing is paused bool select_flag:1; // Popup button selected bool home_flag:1; // homing in course -} HMI_flag_t; +} hmi_flag_t; -extern HMI_value_t HMI_value; -extern HMI_flag_t hmiFlag; +extern hmi_value_t hmiValue; +extern hmi_flag_t hmiFlag; extern uint8_t checkkey; // Popups @@ -182,217 +182,214 @@ extern uint8_t checkkey; void dwinPopupTemperature(const bool toohigh); #endif #if ENABLED(POWER_LOSS_RECOVERY) - void Popup_PowerLossRecovery(); + void popupPowerLossRecovery(); #endif // Tool Functions -uint32_t GetHash(char * str); +uint32_t getHash(char * str); #if ENABLED(EEPROM_SETTINGS) - void WriteEeprom(); - void ReadEeprom(); - void ResetEeprom(); + void writeEEPROM(); + void readEEPROM(); + void resetEEPROM(); #if HAS_MESH - void SaveMesh(); + void saveMesh(); #endif #endif -void RebootPrinter(); -void DisableMotors(); -void AutoLev(); -void AutoHome(); +void rebootPrinter(); +void disableMotors(); +void autoLevel(); +void autoHome(); #if HAS_PREHEAT #define _DOPREHEAT(N) void DoPreheat##N(); REPEAT_1(PREHEAT_COUNT, _DOPREHEAT) #endif -void DoCoolDown(); +void doCoolDown(); #if ENABLED(BAUD_RATE_GCODE) - void HMI_SetBaudRate(); - void SetBaud115K(); - void SetBaud250K(); + void hmiSetBaudRate(); + void setBaud115K(); + void setBaud250K(); #endif #if HAS_LCD_BRIGHTNESS - void TurnOffBacklight(); + void turnOffBacklight(); #endif -void ApplyExtMinT(); -void ParkHead(); +void applyExtMinT(); +void parkHead(); #if HAS_ONESTEP_LEVELING - void Trammingwizard(); + void trammingwizard(); #endif #if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) - void ApplyLEDColor(); + void applyLEDColor(); #endif #if ENABLED(AUTO_BED_LEVELING_UBL) - void UBLMeshTilt(); - void UBLMeshSave(); - void UBLMeshLoad(); + void ublMeshTilt(); + void ublMeshSave(); + void ublMeshLoad(); #endif #if ENABLED(HOST_SHUTDOWN_MENU_ITEM) && defined(SHUTDOWN_ACTION) - void HostShutDown(); + void hostShutDown(); #endif #if DISABLED(HAS_BED_PROBE) - void HomeZandDisable(); + void homeZAndDisable(); #endif // Other -void Goto_PrintProcess(); -void Goto_Main_Menu(); -void Goto_Info_Menu(); -void Goto_PowerLossRecovery(); -void Goto_ConfirmToPrint(); -void DWIN_Draw_Dashboard(const bool with_update); // Status Area -void Draw_Main_Area(); // Redraw main area -void DWIN_DrawStatusLine(const char *text = ""); // Draw simple status text -void DWIN_RedrawDash(); // Redraw Dash and Status line -void DWIN_RedrawScreen(); // Redraw all screen elements -void HMI_MainMenu(); // Main process screen -void HMI_Printing(); // Print page -void HMI_ReturnScreen(); // Return to previous screen before popups -void HMI_WaitForUser(); -void HMI_SaveProcessID(const uint8_t id); -void HMI_SDCardUpdate(); -void EachMomentUpdate(); -void update_variable(); +void gotoPrintProcess(); +void gotoMainMenu(); +void gotoInfoMenu(); +void gotoPowerLossRecovery(); +void gotoConfirmToPrint(); +void dwinDrawDashboard(const bool with_update); // Status Area +void drawMainArea(); // Redraw main area +void dwinDrawStatusLine(const char *text = ""); // Draw simple status text +void dwinRedrawDash(); // Redraw Dash and Status line +void dwinRedrawScreen(); // Redraw all screen elements +void hmiMainMenu(); // Main process screen +void hmiPrinting(); // Print page +void hmiReturnScreen(); // Return to previous screen before popups +void hmiWaitForUser(); +void hmiSaveProcessID(const uint8_t id); +void hmiSDCardUpdate(); +void eachMomentUpdate(); +void updateVariable(); void dwinInitScreen(); -void DWIN_HandleScreen(); -void DWIN_CheckStatusMessage(); +void dwinHandleScreen(); +void dwinCheckStatusMessage(); void dwinHomingStart(); void dwinHomingDone(); #if HAS_MESH - void DWIN_MeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval); -#endif -void DWIN_LevelingStart(); -void DWIN_LevelingDone(); -void DWIN_Print_Started(); -void DWIN_Print_Pause(); -void DWIN_Print_Resume(); -void DWIN_Print_Finished(); -void DWIN_Print_Aborted(); + void dwinMeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval); +#endif +void dwinLevelingStart(); +void dwinLevelingDone(); +void dwinPrintStarted(); +void dwinPrintPause(); +void dwinPrintResume(); +void dwinPrintFinished(); +void dwinPrintAborted(); #if HAS_FILAMENT_SENSOR - void DWIN_FilamentRunout(const uint8_t extruder); -#endif -void DWIN_Print_Header(const char *text); -void DWIN_SetColorDefaults(); -void DWIN_CopySettingsTo(char * const buff); -void DWIN_CopySettingsFrom(const char * const buff); -void DWIN_SetDataDefaults(); -void DWIN_RebootScreen(); + void dwinFilamentRunout(const uint8_t extruder); +#endif +void dwinPrintHeader(const char *text); +void dwinSetColorDefaults(); +void dwinCopySettingsTo(char * const buff); +void dwinCopySettingsFrom(const char * const buff); +void dwinSetDataDefaults(); +void dwinRebootScreen(); #if ENABLED(ADVANCED_PAUSE_FEATURE) - void DWIN_Popup_Pause(FSTR_P const fmsg, uint8_t button=0); - void Draw_Popup_FilamentPurge(); - void Goto_FilamentPurge(); + void dwinPopupPause(FSTR_P const fmsg, uint8_t button=0); + void drawPopupFilamentPurge(); + void gotoFilamentPurge(); #endif // Utility and extensions #if HAS_LOCKSCREEN - void DWIN_LockScreen(); - void DWIN_UnLockScreen(); - void HMI_LockScreen(); + void dwinLockScreen(); + void dwinUnLockScreen(); + void hmiLockScreen(); #endif #if HAS_MESH - void DWIN_MeshViewer(); + void dwinMeshViewer(); #endif #if HAS_GCODE_PREVIEW - void HMI_ConfirmToPrint(); + void hmiConfirmToPrint(); #endif #if HAS_ESDIAG - void Draw_EndStopDiag(); + void drawEndStopDiag(); #endif #if ENABLED(PRINTCOUNTER) - void Draw_PrintStats(); + void drawPrintStats(); #endif // Menu drawing functions -void Draw_Print_File_Menu(); -void Draw_Control_Menu(); -void Draw_AdvancedSettings_Menu(); -void Draw_Prepare_Menu(); -void Draw_Move_Menu(); -void Draw_Tramming_Menu(); +void drawPrintFileMenu(); +void drawControlMenu(); +void drawAdvancedSettingsMenu(); +void drawPrepareMenu(); +void drawMoveMenu(); +void drawTrammingMenu(); #if HAS_HOME_OFFSET - void Draw_HomeOffset_Menu(); + void drawHomeOffsetMenu(); #endif #if HAS_BED_PROBE - void Draw_ProbeSet_Menu(); + void drawProbeSetMenu(); #endif -void Draw_FilSet_Menu(); +void drawFilSetMenu(); #if ENABLED(NOZZLE_PARK_FEATURE) - void Draw_ParkPos_Menu(); + void drawParkPosMenu(); #endif -void Draw_PhySet_Menu(); +void drawPhySetMenu(); #if ALL(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) - void Draw_CaseLight_Menu(); + void drawCaseLightMenu(); #endif #if ENABLED(LED_CONTROL_MENU) - void Draw_LedControl_Menu(); + void drawLedControlMenu(); #endif -void Draw_Tune_Menu(); -void Draw_Motion_Menu(); +void drawTuneMenu(); +void drawMotionMenu(); #if ENABLED(ADVANCED_PAUSE_FEATURE) - void Draw_FilamentMan_Menu(); + void drawFilamentManMenu(); #endif #if ENABLED(MESH_BED_LEVELING) - void Draw_ManualMesh_Menu(); + void drawManualMeshMenu(); #endif -void Draw_Temperature_Menu(); -void Draw_MaxSpeed_Menu(); -void Draw_MaxAccel_Menu(); +void drawTemperatureMenu(); +void drawMaxSpeedMenu(); +void drawMaxAccelMenu(); #if HAS_CLASSIC_JERK - void Draw_MaxJerk_Menu(); + void drawMaxJerkMenu(); #endif -void Draw_Steps_Menu(); +void drawStepsMenu(); #if ANY(HAS_BED_PROBE, BABYSTEPPING) - void Draw_ZOffsetWiz_Menu(); + void drawZOffsetWizMenu(); #endif #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) - void Draw_Homing_Menu(); + void drawHomingMenu(); #endif #if ENABLED(FWRETRACT) - void Draw_FWRetract_Menu(); + void drawFWRetractMenu(); #endif #if HAS_MESH - void Draw_MeshSet_Menu(); + void drawMeshSetMenu(); #if ENABLED(MESH_EDIT_MENU) - void Draw_EditMesh_Menu(); + void drawEditMeshMenu(); #endif #endif -#if HAS_TRINAMIC_CONFIG - void Draw_TrinamicConfig_menu(); -#endif // Custom colors editing #if HAS_CUSTOM_COLORS - void DWIN_ApplyColor(); - void Draw_SelectColors_Menu(); - void Draw_GetColor_Menu(); + void dwinApplyColor(); + void drawSelectColorsMenu(); + void drawGetColorMenu(); #endif // PID -#if DWIN_PID_TUNE +#if PROUI_PID_TUNE #include "../../../module/temperature.h" - void DWIN_StartM303(const bool seenC, const int c, const bool seenS, const heater_id_t hid, const celsius_t temp); - void DWIN_PidTuning(tempcontrol_t result); + void dwinStartM303(const bool seenC, const int c, const bool seenS, const heater_id_t hid, const celsius_t temp); + void dwinPidTuning(tempcontrol_t result); #endif #if ENABLED(PIDTEMP) #if ENABLED(PID_AUTOTUNE_MENU) - void HotendPID(); + void hotendPID(); #endif #if ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) - void Draw_HotendPID_Menu(); + void drawHotendPIDMenu(); #endif #endif #if ENABLED(PIDTEMPBED) #if ENABLED(PID_AUTOTUNE_MENU) - void BedPID(); + void bedPID(); #endif #if ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) - void Draw_BedPID_Menu(); + void drawBedPIDMenu(); #endif #endif // MPC #if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) - void Draw_HotendMPC_Menu(); + void drawHotendMPCMenu(); #endif #if ENABLED(MPC_AUTOTUNE) - void DWIN_MPCTuning(tempcontrol_t result); + void dwinMPCTuning(tempcontrol_t result); #endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h index 6f4520e23bc0..c52d57031c83 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h @@ -46,30 +46,30 @@ #define HAS_ZOFFSET_ITEM 1 #endif -#define Def_Background_Color RGB( 1, 12, 8) -#define Def_Cursor_Color RGB(20, 49, 31) -#define Def_TitleBg_Color RGB( 0, 23, 16) -#define Def_TitleTxt_Color Color_White -#define Def_Text_Color Color_White -#define Def_Selected_Color Select_Color -#define Def_SplitLine_Color RGB( 0, 23, 16) -#define Def_Highlight_Color Color_White -#define Def_StatusBg_Color RGB( 0, 23, 16) -#define Def_StatusTxt_Color Color_Yellow -#define Def_PopupBg_Color Color_Bg_Window -#define Def_PopupTxt_Color Popup_Text_Color -#define Def_AlertBg_Color Color_Bg_Red -#define Def_AlertTxt_Color Color_Yellow -#define Def_PercentTxt_Color Percent_Color -#define Def_Barfill_Color BarFill_Color -#define Def_Indicator_Color Color_White -#define Def_Coordinate_Color Color_White -#define Def_Button_Color RGB( 0, 23, 16) +#define defColorBackground RGB( 1, 12, 8) +#define defColorCursor RGB(20, 49, 31) +#define defColorTitleBg RGB( 0, 23, 16) +#define defColorTitleTxt COLOR_WHITE +#define defColorText COLOR_WHITE +#define defColorSelected COLOR_SELECT +#define defColorSplitLine RGB( 0, 23, 16) +#define defColorHighlight COLOR_WHITE +#define defColorStatusBg RGB( 0, 23, 16) +#define defColorStatusTxt COLOR_YELLOW +#define defColorPopupBg COLOR_BG_WINDOW +#define defColorPopupTxt COLOR_POPUP_TEXT +#define defColorAlertBg COLOR_BG_RED +#define defColorAlertTxt COLOR_YELLOW +#define defColorPercentTxt COLOR_PERCENT +#define defColorBarfill COLOR_BARFILL +#define defColorIndicator COLOR_WHITE +#define defColorCoordinate COLOR_WHITE +#define defColorButton RGB( 0, 23, 16) #if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) - #define Def_Leds_Color LEDColorWhite() + #define defColorLeds LEDColorWhite() #endif #if ENABLED(CASELIGHT_USES_BRIGHTNESS) - #define Def_CaseLight_Brightness 255 + #define defCaseLightBrightness 255 #endif #ifdef Z_AFTER_HOMING #define DEF_Z_AFTER_HOMING Z_AFTER_HOMING diff --git a/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp index 180b35e2ecb1..853da8532e12 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp @@ -42,7 +42,7 @@ // QR_Pixel: The pixel size occupied by each point of the QR code: 0x01-0x0F (1-16) // (Nx, Ny): The coordinates of the upper left corner displayed by the QR code // str: multi-bit data -void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string) { +void dwinDrawQR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string) { size_t i = 0; dwinByte(i, 0x21); dwinWord(i, x); @@ -64,7 +64,7 @@ void dwinIconShow(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) { // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area // x/y: Screen paste point -void DWIN_Frame_AreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { +void dwinFrameAreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { size_t i = 0; dwinByte(i, 0x26); dwinWord(i, xStart); @@ -84,7 +84,7 @@ void DWIN_Frame_AreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16 // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area // x/y: Screen paste point -void DWIN_Frame_AreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { +void dwinFrameAreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { size_t i = 0; dwinByte(i, 0x27); dwinByte(i, (IBD & 1) << 7 | (BIR & 1) << 6 | (BFI & 1) << 5 | cacheID); @@ -102,8 +102,8 @@ void DWIN_Frame_AreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area // x/y: Screen paste point -void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { - DWIN_Frame_AreaCopy(false, false, true, cacheID, xStart, yStart, xEnd, yEnd, x, y); +void dwinFrameAreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { + dwinFrameAreaCopy(false, false, true, cacheID, xStart, yStart, xEnd, yEnd, x, y); } // Write buffer data to the SRAM or Flash @@ -111,7 +111,7 @@ void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint // addr: start address // length: Bytes to write // data: address of the buffer with data -void DWIN_WriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data) { +void dwinWriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data) { const uint8_t max_size = 128; uint16_t pending = length; uint16_t to_send; @@ -156,7 +156,7 @@ void dwinIconShow(uint16_t x, uint16_t y, uint16_t addr) { // Write the contents of the 32KB SRAM data memory into the designated image memory space. // picID: Picture memory space location, 0x00-0x0F, each space is 32Kbytes -void DWIN_SRAMToPic(uint8_t picID) { +void dwinSRAMToPic(uint8_t picID) { size_t i = 0; dwinByte(i, 0x33); dwinByte(i, 0x5A); @@ -167,7 +167,7 @@ void DWIN_SRAMToPic(uint8_t picID) { //--------------------------Test area ------------------------- -//void DWIN_ReadSRAM(uint16_t addr, const uint8_t length, const char * const data) { +//void dwinReadSRAM(uint16_t addr, const uint8_t length, const char * const data) { // size_t i = 0; // dwinByte(i, 0x32); // dwinByte(i, 0x5A); // 0x5A Read from SRAM - 0xA5 Read from Flash diff --git a/Marlin/src/lcd/e3v2/proui/dwin_lcd.h b/Marlin/src/lcd/e3v2/proui/dwin_lcd.h index 8c9c063367dc..51f459012905 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_lcd.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_lcd.h @@ -35,10 +35,10 @@ // QR_Pixel: The pixel size occupied by each point of the QR code: 0x01-0x0F (1-16) // (Nx, Ny): The coordinates of the upper left corner displayed by the QR code // str: multi-bit data -void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string); +void dwinDrawQR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string); -inline void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, FSTR_P title) { - DWIN_Draw_QR(QR_Pixel, x, y, (char *)title); +inline void dwinDrawQR(uint8_t QR_Pixel, uint16_t x, uint16_t y, FSTR_P fTitle) { + dwinDrawQR(QR_Pixel, x, y, (char *)fTitle); } // Copy area from virtual display area to current screen @@ -46,13 +46,13 @@ inline void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, FSTR_P title) // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area // x/y: Screen paste point -void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); +void dwinFrameAreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); // Copy area from current virtual display area to current screen // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area // x/y: Screen paste point -void DWIN_Frame_AreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); +void dwinFrameAreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); // Copy area from virtual display area to current screen // IBD: background display: 0=Background filtering is not displayed, 1=Background display \\When setting the background filtering not to display, the background must be pure black @@ -62,14 +62,14 @@ void DWIN_Frame_AreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16 // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area // x/y: Screen paste point -void DWIN_Frame_AreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); +void dwinFrameAreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); // Write buffer data to the SRAM or Flash // mem: 0x5A=32KB SRAM, 0xA5=16KB Flash // addr: start address // length: Bytes to write // data: address of the buffer with data -void DWIN_WriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data); +void dwinWriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data); // Draw an Icon from SRAM // x/y: Upper-left point @@ -78,4 +78,4 @@ void dwinIconShow(uint16_t x, uint16_t y, uint16_t addr); // Write the contents of the 32KB SRAM data memory into the designated image memory space. // picID: Picture memory space location, 0x00-0x0F, each space is 32Kbytes -void DWIN_SRAMToPic(uint8_t picID); +void dwinSRAMToPic(uint8_t picID); diff --git a/Marlin/src/lcd/e3v2/proui/dwin_popup.cpp b/Marlin/src/lcd/e3v2/proui/dwin_popup.cpp index 7b22069c69e1..91c3ee98e390 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_popup.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin_popup.cpp @@ -43,41 +43,41 @@ popupChangeFunc_t popupChange = nullptr; uint16_t HighlightYPos = 280; -void Draw_Select_Highlight(const bool sel, const uint16_t ypos) { +void drawSelectHighlight(const bool sel, const uint16_t ypos) { HighlightYPos = ypos; hmiFlag.select_flag = sel; - const uint16_t c1 = sel ? HMI_data.Highlight_Color : HMI_data.PopupBg_Color, - c2 = sel ? HMI_data.PopupBg_Color : HMI_data.Highlight_Color; + const uint16_t c1 = sel ? hmiData.colorHighlight : hmiData.colorPopupBg, + c2 = sel ? hmiData.colorPopupBg : hmiData.colorHighlight; dwinDrawRectangle(0, c1, 25, ypos - 1, 126, ypos + 38); dwinDrawRectangle(0, c1, 24, ypos - 2, 127, ypos + 39); dwinDrawRectangle(0, c2, 145, ypos - 1, 246, ypos + 38); dwinDrawRectangle(0, c2, 144, ypos - 2, 247, ypos + 39); } -void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2) { - HMI_SaveProcessID(WaitResponse); - DWIN_Draw_Popup(icon, fmsg1, fmsg2, BTN_Continue); // Button Continue +void dwinPopupContinue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2) { + hmiSaveProcessID(ID_WaitResponse); + dwinDrawPopup(icon, fmsg1, fmsg2, BTN_Continue); // Button Continue dwinUpdateLCD(); } -void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2) { - DWIN_Draw_Popup(ICON_BLTouch, F("Please confirm"), fmsg2); - DWINUI::Draw_Button(BTN_Confirm, 26, 280); - DWINUI::Draw_Button(BTN_Cancel, 146, 280); - Draw_Select_Highlight(hmiFlag.select_flag); +void dwinPopupConfirmCancel(const uint8_t icon, FSTR_P const fmsg2) { + dwinDrawPopup(ICON_BLTouch, F("Please confirm"), fmsg2); + DWINUI::drawButton(BTN_Confirm, 26, 280); + DWINUI::drawButton(BTN_Cancel, 146, 280); + drawSelectHighlight(hmiFlag.select_flag); dwinUpdateLCD(); } -void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick/*=nullptr*/, const popupChangeFunc_t fnChange/*=nullptr*/) { +void gotoPopup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick/*=nullptr*/, const popupChangeFunc_t fnChange/*=nullptr*/) { popupDraw = fnDraw; popupClick = fnClick; popupChange = fnChange; - HMI_SaveProcessID(Popup); + hmiSaveProcessID(ID_Popup); hmiFlag.select_flag = false; popupDraw(); } -void HMI_Popup() { +void hmiPopup() { if (!wait_for_user) { if (popupClick) popupClick(); return; @@ -86,7 +86,7 @@ void HMI_Popup() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_CW || encoder_diffState == ENCODER_DIFF_CCW) { const bool change = encoder_diffState != ENCODER_DIFF_CW; - if (popupChange) popupChange(change); else Draw_Select_Highlight(change, HighlightYPos); + if (popupChange) popupChange(change); else drawSelectHighlight(change, HighlightYPos); dwinUpdateLCD(); } } diff --git a/Marlin/src/lcd/e3v2/proui/dwin_popup.h b/Marlin/src/lcd/e3v2/proui/dwin_popup.h index 5009f36b3b15..ee8664e874dd 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_popup.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_popup.h @@ -36,38 +36,38 @@ typedef void (*popupClickFunc_t)(); typedef void (*popupChangeFunc_t)(const bool state); extern popupDrawFunc_t popupDraw; -void Draw_Select_Highlight(const bool sel, const uint16_t ypos); -inline void Draw_Select_Highlight(const bool sel) { Draw_Select_Highlight(sel, 280); }; -void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2); -void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2); -void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick=nullptr, const popupChangeFunc_t fnChange=nullptr); -void HMI_Popup(); +void drawSelectHighlight(const bool sel, const uint16_t ypos); +inline void drawSelectHighlight(const bool sel) { drawSelectHighlight(sel, 280); }; +void dwinPopupContinue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2); +void dwinPopupConfirmCancel(const uint8_t icon, FSTR_P const fmsg2); +void gotoPopup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick=nullptr, const popupChangeFunc_t fnChange=nullptr); +void hmiPopup(); -inline void Draw_Popup_Bkgd() { - dwinDrawRectangle(1, HMI_data.PopupBg_Color, 14, 60, 258, 330); - dwinDrawRectangle(0, HMI_data.Highlight_Color, 14, 60, 258, 330); +inline void drawPopupBkgd() { + dwinDrawRectangle(1, hmiData.colorPopupBg, 14, 60, 258, 330); + dwinDrawRectangle(0, hmiData.colorHighlight, 14, 60, 258, 330); } template -void DWIN_Draw_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) { - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); - if (icon) DWINUI::Draw_Icon(icon, 101, 105); - if (amsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, amsg1); - if (amsg2) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 240, amsg2); - if (button) DWINUI::Draw_Button(button, 86, 280); +void dwinDrawPopup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) { + DWINUI::clearMainArea(); + drawPopupBkgd(); + if (icon) DWINUI::drawIcon(icon, 101, 105); + if (amsg1) DWINUI::drawCenteredString(hmiData.colorPopupTxt, 210, amsg1); + if (amsg2) DWINUI::drawCenteredString(hmiData.colorPopupTxt, 240, amsg2); + if (button) DWINUI::drawButton(button, 86, 280); } template -void DWIN_Show_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) { - DWIN_Draw_Popup(icon, amsg1, amsg2, button); +void dwinShowPopup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) { + dwinDrawPopup(icon, amsg1, amsg2, button); dwinUpdateLCD(); } template -void DWIN_Popup_Confirm(const uint8_t icon, T amsg1, U amsg2) { - HMI_SaveProcessID(WaitResponse); - DWIN_Draw_Popup(icon, amsg1, amsg2, BTN_Confirm); // Button Confirm +void dwinPopupConfirm(const uint8_t icon, T amsg1, U amsg2) { + hmiSaveProcessID(ID_WaitResponse); + dwinDrawPopup(icon, amsg1, amsg2, BTN_Confirm); // Button Confirm dwinUpdateLCD(); } diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.cpp b/Marlin/src/lcd/e3v2/proui/dwinui.cpp index 235b30f9faa2..72b66fb5b3e4 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwinui.cpp @@ -35,26 +35,26 @@ #include "dwinui.h" xy_int_t DWINUI::cursor = { 0 }; -uint16_t DWINUI::pencolor = Color_White; -uint16_t DWINUI::textcolor = Def_Text_Color; -uint16_t DWINUI::backcolor = Def_Background_Color; -uint16_t DWINUI::buttoncolor = Def_Button_Color; -uint8_t DWINUI::fontid = font8x16; -FSTR_P const DWINUI::Author = F(STRING_CONFIG_H_AUTHOR); +uint16_t DWINUI::penColor = COLOR_WHITE; +uint16_t DWINUI::textColor = defColorText; +uint16_t DWINUI::backColor = defColorBackground; +uint16_t DWINUI::buttonColor = defColorButton; +uint8_t DWINUI::fontID = font8x16; +FSTR_P const DWINUI::author = F(STRING_CONFIG_H_AUTHOR); -void (*DWINUI::onTitleDraw)(TitleClass* title) = nullptr; +void (*DWINUI::onTitleDraw)(Title* t) = nullptr; void DWINUI::init() { cursor.reset(); - pencolor = Color_White; - textcolor = Def_Text_Color; - backcolor = Def_Background_Color; - buttoncolor = Def_Button_Color; - fontid = font8x16; + penColor = COLOR_WHITE; + textColor = defColorText; + backColor = defColorBackground; + buttonColor = defColorButton; + fontID = font8x16; } // Set text/number font -void DWINUI::setFont(fontid_t fid) { fontid = fid; } +void DWINUI::setFont(fontid_t fid) { fontID = fid; } // Get font character width uint8_t DWINUI::fontWidth(fontid_t fid) { @@ -95,33 +95,33 @@ uint8_t DWINUI::fontHeight(fontid_t fid) { } // Get screen x coordinates from text column -uint16_t DWINUI::ColToX(uint8_t col) { return col * fontWidth(fontid); } +uint16_t DWINUI::colToX(uint8_t col) { return col * fontWidth(fontID); } // Get screen y coordinates from text row -uint16_t DWINUI::RowToY(uint8_t row) { return row * fontHeight(fontid); } +uint16_t DWINUI::rowToY(uint8_t row) { return row * fontHeight(fontID); } // Set text/number color -void DWINUI::SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor) { - textcolor = fgcolor; - backcolor = bgcolor; - buttoncolor = alcolor; +void DWINUI::setColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor) { + textColor = fgcolor; + backColor = bgcolor; + buttonColor = alcolor; } -void DWINUI::SetTextColor(uint16_t fgcolor) { - textcolor = fgcolor; +void DWINUI::setTextColor(uint16_t fgcolor) { + textColor = fgcolor; } -void DWINUI::SetBackgroundColor(uint16_t bgcolor) { - backcolor = bgcolor; +void DWINUI::setBackgroundColor(uint16_t bgcolor) { + backColor = bgcolor; } // Moves cursor to point // x: abscissa of the display // y: ordinate of the display // point: xy coordinate -void DWINUI::MoveTo(int16_t x, int16_t y) { +void DWINUI::moveTo(int16_t x, int16_t y) { cursor.x = x; cursor.y = y; } -void DWINUI::MoveTo(xy_int_t point) { +void DWINUI::moveTo(xy_int_t point) { cursor = point; } @@ -129,16 +129,16 @@ void DWINUI::MoveTo(xy_int_t point) { // x: abscissa of the display // y: ordinate of the display // point: xy coordinate -void DWINUI::MoveBy(int16_t x, int16_t y) { +void DWINUI::moveBy(int16_t x, int16_t y) { cursor.x += x; cursor.y += y; } -void DWINUI::MoveBy(xy_int_t point) { +void DWINUI::moveBy(xy_int_t point) { cursor += point; } // Draw a Centered string using arbitrary x1 and x2 margins -void DWINUI::Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string) { +void DWINUI::drawCenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string) { const uint16_t x = _MAX(0U, x2 + x1 - strlen_P(string) * fontWidth(fid)) / 2 - 1; dwinDrawString(bShow, fid, color, bColor, x, y, string); } @@ -148,28 +148,28 @@ void DWINUI::Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint1 // x: abscissa of the display // y: ordinate of the display // c: ASCII code of char -void DWINUI::Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c) { +void DWINUI::drawChar(uint16_t color, uint16_t x, uint16_t y, const char c) { const char string[2] = { c, 0}; - dwinDrawString(false, fontid, color, backcolor, x, y, string, 1); + dwinDrawString(false, fontID, color, backColor, x, y, string, 1); } // Draw a char at cursor position and increment cursor -void DWINUI::Draw_Char(uint16_t color, const char c) { - Draw_Char(color, cursor.x, cursor.y, c); - MoveBy(fontWidth(fontid), 0); +void DWINUI::drawChar(uint16_t color, const char c) { + drawChar(color, cursor.x, cursor.y, c); + moveBy(fontWidth(fontID), 0); } // Draw a string at cursor position // color: Character color // *string: The string // rlimit: For draw less chars than string length use rlimit -void DWINUI::Draw_String(const char * const string, uint16_t rlimit) { - dwinDrawString(false, fontid, textcolor, backcolor, cursor.x, cursor.y, string, rlimit); - MoveBy(strlen(string) * fontWidth(fontid), 0); +void DWINUI::drawString(const char * const string, uint16_t rlimit) { + dwinDrawString(false, fontID, textColor, backColor, cursor.x, cursor.y, string, rlimit); + moveBy(strlen(string) * fontWidth(fontID), 0); } -void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rlimit) { - dwinDrawString(false, fontid, color, backcolor, cursor.x, cursor.y, string, rlimit); - MoveBy(strlen(string) * fontWidth(fontid), 0); +void DWINUI::drawString(uint16_t color, const char * const string, uint16_t rlimit) { + dwinDrawString(false, fontID, color, backColor, cursor.x, cursor.y, string, rlimit); + moveBy(strlen(string) * fontWidth(fontID), 0); } // Draw a numeric integer value @@ -181,7 +181,7 @@ void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rli // iNum: Number of digits // x/y: Upper-left coordinate // value: Integer value -void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value) { +void DWINUI::drawInt(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value) { char nstr[10]; sprintf_P(nstr, PSTR("%*li"), (signedMode ? iNum + 1 : iNum), value); dwinDrawString(bShow, fid, color, bColor, x, y, nstr); @@ -197,7 +197,7 @@ void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t col // fNum: Number of decimal digits // x/y: Upper-left coordinate // value: float value -void DWINUI::Draw_Float(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { +void DWINUI::drawFloat(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { char nstr[10]; dwinDrawString(bShow, fid, color, bColor, x, y, dtostrf(value, iNum + (signedMode ? 2:1) + fNum, fNum, nstr)); } @@ -217,19 +217,19 @@ void DWINUI::ICON_Show(bool BG, uint8_t icon, uint16_t x, uint16_t y) { // ------------------------- Buttons ------------------------------// -void DWINUI::Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption) { +void DWINUI::drawButton(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption) { dwinDrawRectangle(1, bcolor, x1, y1, x2, y2); - Draw_CenteredString(0, fontid, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption); + drawCenteredString(0, fontID, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption); } -void DWINUI::Draw_Button(uint8_t id, uint16_t x, uint16_t y) { +void DWINUI::drawButton(uint8_t id, uint16_t x, uint16_t y) { switch (id) { - case BTN_Cancel : Draw_Button(GET_TEXT_F(MSG_BUTTON_CANCEL), x, y); break; - case BTN_Confirm : Draw_Button(GET_TEXT_F(MSG_BUTTON_CONFIRM), x, y); break; - case BTN_Continue: Draw_Button(GET_TEXT_F(MSG_BUTTON_CONTINUE), x, y); break; - case BTN_Print : Draw_Button(GET_TEXT_F(MSG_BUTTON_PRINT), x, y); break; - case BTN_Save : Draw_Button(GET_TEXT_F(MSG_BUTTON_SAVE), x, y); break; - case BTN_Purge : Draw_Button(GET_TEXT_F(MSG_BUTTON_PURGE), x, y); break; + case BTN_Cancel : drawButton(GET_TEXT_F(MSG_BUTTON_CANCEL), x, y); break; + case BTN_Confirm : drawButton(GET_TEXT_F(MSG_BUTTON_CONFIRM), x, y); break; + case BTN_Continue: drawButton(GET_TEXT_F(MSG_BUTTON_CONTINUE), x, y); break; + case BTN_Print : drawButton(GET_TEXT_F(MSG_BUTTON_PRINT), x, y); break; + case BTN_Save : drawButton(GET_TEXT_F(MSG_BUTTON_SAVE), x, y); break; + case BTN_Purge : drawButton(GET_TEXT_F(MSG_BUTTON_PURGE), x, y); break; default: break; } } @@ -241,7 +241,7 @@ void DWINUI::Draw_Button(uint8_t id, uint16_t x, uint16_t y) { // x: the abscissa of the center of the circle // y: ordinate of the center of the circle // r: circle radius -void DWINUI::Draw_Circle(uint16_t color, uint16_t x, uint16_t y, uint8_t r) { +void DWINUI::drawCircle(uint16_t color, uint16_t x, uint16_t y, uint8_t r) { int a = 0, b = 0; while (a <= b) { b = SQRT(sq(r) - sq(a)); @@ -263,7 +263,7 @@ void DWINUI::Draw_Circle(uint16_t color, uint16_t x, uint16_t y, uint8_t r) { // x: the abscissa of the center of the circle // y: ordinate of the center of the circle // r: circle radius -void DWINUI::Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r) { +void DWINUI::drawFillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r) { dwinDrawLine(bcolor, x - r, y, x + r, y); uint16_t b = 1; while (b <= r) { @@ -322,54 +322,54 @@ uint16_t DWINUI::RainbowInt(int16_t val, int16_t minv, int16_t maxv) { // bColor: Background color // x/y: Upper-left point // mode : 0 : unchecked, 1 : checked -void DWINUI::Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked=false) { +void DWINUI::drawCheckbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked=false) { dwinDrawRectangle(0, color, x + 2, y + 2, x + 17, y + 17); dwinDrawRectangle(1, checked ? color : bcolor, x + 6, y + 6, x + 13, y + 13); } // Clear Menu by filling the menu area with background color -void DWINUI::ClearMainArea() { - dwinDrawRectangle(1, backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1); +void DWINUI::clearMainArea() { + dwinDrawRectangle(1, backColor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1); } /* Title Class ==============================================================*/ -TitleClass Title; +Title title; -void TitleClass::draw() { +void Title::draw() { if (DWINUI::onTitleDraw != nullptr) (*DWINUI::onTitleDraw)(this); } -void TitleClass::SetCaption(const char * const title) { +void Title::setCaption(const char * const titleStr) { frameid = 0; - if ( caption == title ) return; - const uint8_t len = _MIN(sizeof(caption) - 1, strlen(title)); - memcpy(&caption[0], title, len); + if ( caption == titleStr ) return; + const uint8_t len = _MIN(sizeof(caption) - 1, strlen(titleStr)); + memcpy(&caption[0], titleStr, len); caption[len] = '\0'; } -void TitleClass::ShowCaption(const char * const title) { - SetCaption(title); +void Title::showCaption(const char * const titleStr) { + setCaption(titleStr); draw(); } -void TitleClass::SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { +void Title::setFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { caption[0] = '\0'; frameid = id; frame = { x1, y1, x2, y2 }; } -void TitleClass::SetFrame(uint16_t x, uint16_t y, uint16_t w, uint16_t h) { - SetFrame(1, x, y, x + w - 1, y + h - 1); +void Title::setFrame(uint16_t x, uint16_t y, uint16_t w, uint16_t h) { + setFrame(1, x, y, x + w - 1, y + h - 1); } -void TitleClass::FrameCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { - SetFrame(id, x1, y1, x2, y2); +void Title::frameCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { + setFrame(id, x1, y1, x2, y2); draw(); } -void TitleClass::FrameCopy(uint16_t x, uint16_t y, uint16_t w, uint16_t h) { - FrameCopy(1, x, y, x + w - 1, y + h - 1); +void Title::frameCopy(uint16_t x, uint16_t y, uint16_t w, uint16_t h) { + frameCopy(1, x, y, x + w - 1, y + h - 1); } #endif // DWIN_LCD_PROUI diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.h b/Marlin/src/lcd/e3v2/proui/dwinui.h index 06daece9d099..9f8ab70e71b3 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.h +++ b/Marlin/src/lcd/e3v2/proui/dwinui.h @@ -46,7 +46,7 @@ #define ICON_Cancel ICON_StockConfiguration #define ICON_CustomPreheat ICON_SetEndTemp #define ICON_Error ICON_TempTooHigh -#define ICON_ESDiag ICON_Info +#define ICON_esDiag ICON_Info #define ICON_ExtrudeMinT ICON_HotendTemp #define ICON_FilLoad ICON_WriteEEPROM #define ICON_FilMan ICON_ResumeEEPROM @@ -170,24 +170,24 @@ #define BTN_Purge 92 // Extended and default UI Colors -#define Color_Black 0 -#define Color_Green RGB(0,63,0) -#define Color_Aqua RGB(0,63,31) -#define Color_Blue RGB(0,0,31) -#define Color_Light_White 0xBDD7 -#define Color_Light_Green 0x3460 -#define Color_Cyan 0x07FF -#define Color_Light_Cyan 0x04F3 -#define Color_Light_Blue 0x3A6A -#define Color_Magenta 0xF81F -#define Color_Light_Magenta 0x9813 -#define Color_Light_Red 0x8800 -#define Color_Orange 0xFA20 -#define Color_Light_Orange 0xFBC0 -#define Color_Light_Yellow 0x8BE0 -#define Color_Brown 0xCC27 -#define Color_Light_Brown 0x6204 -#define Color_Grey 0x18E3 +#define COLOR_BLACK 0 +#define COLOR_GREEN RGB(0,63,0) +#define COLOR_AQUA RGB(0,63,31) +#define COLOR_BLUE RGB(0,0,31) +#define COLOR_LIGHT_WHITE 0xBDD7 +#define COLOR_LIGHT_GREEN 0x3460 +#define COLOR_CYAN 0x07FF +#define COLOR_LIGHT_CYAN 0x04F3 +#define COLOR_LIGHT_BLUE 0x3A6A +#define COLOR_MAGENTA 0xF81F +#define COLOR_LIGHT_MAGENTA 0x9813 +#define COLOR_LIGHT_RED 0x8800 +#define COLOR_ORANGE 0xFA20 +#define COLOR_LIGHT_ORANGE 0xFBC0 +#define COLOR_LIGHT_YELLOW 0x8BE0 +#define COLOR_BROWN 0xCC27 +#define COLOR_LIGHT_BROWN 0x6204 +#define COLOR_GREY 0x18E3 // UI element defines and constants #define DWIN_FONT_MENU font8x16 @@ -195,7 +195,7 @@ #define DWIN_FONT_HEAD font10x20 #define DWIN_FONT_ALERT font10x20 #define STATUS_Y 354 -#define LCD_WIDTH (DWIN_WIDTH / 8) // only if the default fontid is font8x16 +#define LCD_WIDTH (DWIN_WIDTH / 8) // only if the default fontID is font8x16 // Minimum unit (0.1) : multiple (10) #define UNITFDIGITS 1 @@ -223,33 +223,33 @@ constexpr uint8_t TITLE_HEIGHT = 30, // Title bar heig typedef struct { uint16_t left, top, right, bottom; } rect_t; typedef struct { uint16_t x, y, w, h; } frame_rect_t; -class TitleClass { +class Title { public: char caption[32] = ""; uint8_t frameid = 0; rect_t frame = {0}; void draw(); - void SetCaption(const char * const title); - inline void SetCaption(FSTR_P title) { SetCaption((char *)title); } - void ShowCaption(const char * const title); - inline void ShowCaption(FSTR_P title) { ShowCaption((char *)title); } - void SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); - void SetFrame(uint16_t x, uint16_t y, uint16_t w, uint16_t h); - void FrameCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); - void FrameCopy(uint16_t x, uint16_t y, uint16_t h, uint16_t v); + void setCaption(const char * const titleStr); + inline void setCaption(FSTR_P fTitle) { setCaption((char *)fTitle); } + void showCaption(const char * const titleStr); + inline void showCaption(FSTR_P fTitle) { showCaption((char *)fTitle); } + void setFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); + void setFrame(uint16_t x, uint16_t y, uint16_t w, uint16_t h); + void frameCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); + void frameCopy(uint16_t x, uint16_t y, uint16_t h, uint16_t v); }; -extern TitleClass Title; +extern Title title; namespace DWINUI { extern xy_int_t cursor; - extern uint16_t pencolor; - extern uint16_t textcolor; - extern uint16_t backcolor; - extern uint16_t buttoncolor; - extern fontid_t fontid; - extern FSTR_P const Author; + extern uint16_t penColor; + extern uint16_t textColor; + extern uint16_t backColor; + extern uint16_t buttonColor; + extern fontid_t fontID; + extern FSTR_P const author; - extern void (*onTitleDraw)(TitleClass* title); + extern void (*onTitleDraw)(Title* t); // DWIN LCD Initialization void init(); @@ -259,50 +259,50 @@ namespace DWINUI { // Get font character width uint8_t fontWidth(fontid_t cfont); - inline uint8_t fontWidth() { return fontWidth(fontid); }; + inline uint8_t fontWidth() { return fontWidth(fontID); }; // Get font character height uint8_t fontHeight(fontid_t cfont); - inline uint8_t fontHeight() { return fontHeight(fontid); }; + inline uint8_t fontHeight() { return fontHeight(fontID); }; // Get screen x coordinates from text column - uint16_t ColToX(uint8_t col); + uint16_t colToX(uint8_t col); // Get screen y coordinates from text row - uint16_t RowToY(uint8_t row); + uint16_t rowToY(uint8_t row); // Set text/number color - void SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor); - void SetTextColor(uint16_t fgcolor); - void SetBackgroundColor(uint16_t bgcolor); + void setColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor); + void setTextColor(uint16_t fgcolor); + void setBackgroundColor(uint16_t bgcolor); // Moves cursor to point // x: abscissa of the display // y: ordinate of the display // point: xy coordinate - void MoveTo(int16_t x, int16_t y); - void MoveTo(xy_int_t point); + void moveTo(int16_t x, int16_t y); + void moveTo(xy_int_t point); // Moves cursor relative to the actual position // x: abscissa of the display // y: ordinate of the display // point: xy coordinate - void MoveBy(int16_t x, int16_t y); - void MoveBy(xy_int_t point); + void moveBy(int16_t x, int16_t y); + void moveBy(xy_int_t point); // Draw a line from the cursor to xy position // color: Line segment color // x/y: End point - inline void LineTo(uint16_t color, uint16_t x, uint16_t y) { + inline void lineTo(uint16_t color, uint16_t x, uint16_t y) { dwinDrawLine(color, cursor.x, cursor.y, x, y); } - inline void LineTo(uint16_t x, uint16_t y) { - dwinDrawLine(pencolor, cursor.x, cursor.y, x, y); + inline void lineTo(uint16_t x, uint16_t y) { + dwinDrawLine(penColor, cursor.x, cursor.y, x, y); } // Extend a frame box // v: value to extend - inline frame_rect_t ExtendFrame(frame_rect_t frame, uint8_t v) { + inline frame_rect_t extendFrame(frame_rect_t frame, uint8_t v) { frame_rect_t t; t.x = frame.x - v; t.y = frame.y - v; @@ -321,14 +321,14 @@ namespace DWINUI { // Draw an Icon with transparent background from the library ICON // icon: Icon ID // x/y: Upper-left point - inline void Draw_Icon(uint8_t icon, uint16_t x, uint16_t y) { + inline void drawIcon(uint8_t icon, uint16_t x, uint16_t y) { ICON_Show(false, icon, x, y); } // Draw an Icon from the library ICON with its background // icon: Icon ID // x/y: Upper-left point - inline void Draw_IconWB(uint8_t icon, uint16_t x, uint16_t y) { + inline void drawIconWB(uint8_t icon, uint16_t x, uint16_t y) { ICON_Show(true, icon, x, y); } @@ -341,48 +341,48 @@ namespace DWINUI { // iNum: Number of digits // x/y: Upper-left coordinate // value: Integer value - void Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value); + void drawInt(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value); // Draw a positive integer - inline void Draw_Int(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(bShow, 0, fid, color, bColor, iNum, x, y, value); + inline void drawInt(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(bShow, 0, fid, color, bColor, iNum, x, y, value); } - inline void Draw_Int(uint8_t iNum, long value) { - Draw_Int(false, 0, fontid, textcolor, backcolor, iNum, cursor.x, cursor.y, value); - MoveBy(iNum * fontWidth(fontid), 0); + inline void drawInt(uint8_t iNum, long value) { + drawInt(false, 0, fontID, textColor, backColor, iNum, cursor.x, cursor.y, value); + moveBy(iNum * fontWidth(fontID), 0); } - inline void Draw_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 0, fontid, textcolor, backcolor, iNum, x, y, value); + inline void drawInt(uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(false, 0, fontID, textColor, backColor, iNum, x, y, value); } - inline void Draw_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 0, fontid, color, backcolor, iNum, x, y, value); + inline void drawInt(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(false, 0, fontID, color, backColor, iNum, x, y, value); } - inline void Draw_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 0, fontid, color, bColor, iNum, x, y, value); + inline void drawInt(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(true, 0, fontID, color, bColor, iNum, x, y, value); } - inline void Draw_Int(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 0, fid, color, bColor, iNum, x, y, value); + inline void drawInt(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(true, 0, fid, color, bColor, iNum, x, y, value); } // Draw a signed integer - inline void Draw_Signed_Int(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(bShow, 1, fid, color, bColor, iNum, x, y, value); + inline void drawSignedInt(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(bShow, 1, fid, color, bColor, iNum, x, y, value); } - inline void Draw_Signed_Int(uint8_t iNum, long value) { - Draw_Int(false, 1, fontid, textcolor, backcolor, iNum, cursor.x, cursor.y, value); - MoveBy(iNum * fontWidth(fontid), 0); + inline void drawSignedInt(uint8_t iNum, long value) { + drawInt(false, 1, fontID, textColor, backColor, iNum, cursor.x, cursor.y, value); + moveBy(iNum * fontWidth(fontID), 0); } - inline void Draw_Signed_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 1, fontid, textcolor, backcolor, iNum, x, y, value); + inline void drawSignedInt(uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(false, 1, fontID, textColor, backColor, iNum, x, y, value); } - inline void Draw_Signed_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 1, fontid, color, backcolor, iNum, x, y, value); + inline void drawSignedInt(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(false, 1, fontID, color, backColor, iNum, x, y, value); } - inline void Draw_Signed_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 1, fontid, color, bColor, iNum, x, y, value); + inline void drawSignedInt(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(true, 1, fontID, color, bColor, iNum, x, y, value); } - inline void Draw_Signed_Int(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 1, fid, color, bColor, iNum, x, y, value); + inline void drawSignedInt(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(true, 1, fid, color, bColor, iNum, x, y, value); } // Draw a numeric float value @@ -395,48 +395,48 @@ namespace DWINUI { // fNum: Number of decimal digits // x/y: Upper-left coordinate // value: float value - void Draw_Float(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value); + void drawFloat(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value); // Draw a positive floating point number - inline void Draw_Float(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(bShow, 0, fid, color, bColor, iNum, fNum, x, y, value); + inline void drawFloat(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(bShow, 0, fid, color, bColor, iNum, fNum, x, y, value); } - inline void Draw_Float(uint8_t iNum, uint8_t fNum, float value) { - Draw_Float(false, 0, fontid, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); - MoveBy((iNum + fNum + 1) * fontWidth(fontid), 0); + inline void drawFloat(uint8_t iNum, uint8_t fNum, float value) { + drawFloat(false, 0, fontID, textColor, backColor, iNum, fNum, cursor.x, cursor.y, value); + moveBy((iNum + fNum + 1) * fontWidth(fontID), 0); } - inline void Draw_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 0, fontid, textcolor, backcolor, iNum, fNum, x, y, value); + inline void drawFloat(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(false, 0, fontID, textColor, backColor, iNum, fNum, x, y, value); } - inline void Draw_Float(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 0, fid, textcolor, backcolor, iNum, fNum, x, y, value); + inline void drawFloat(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(false, 0, fid, textColor, backColor, iNum, fNum, x, y, value); } - inline void Draw_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 0, fontid, color, bColor, iNum, fNum, x, y, value); + inline void drawFloat(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(true, 0, fontID, color, bColor, iNum, fNum, x, y, value); } - inline void Draw_Float(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 0, fid, color, bColor, iNum, fNum, x, y, value); + inline void drawFloat(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(true, 0, fid, color, bColor, iNum, fNum, x, y, value); } // Draw a signed floating point number - inline void Draw_Signed_Float(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(bShow, 1, fid, color, bColor, iNum, fNum, x, y, value); + inline void drawSignedFloat(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(bShow, 1, fid, color, bColor, iNum, fNum, x, y, value); } - inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, float value) { - Draw_Float(false, 1, fontid, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); - MoveBy((iNum + fNum + 1) * fontWidth(fontid), 0); + inline void drawSignedFloat(uint8_t iNum, uint8_t fNum, float value) { + drawFloat(false, 1, fontID, textColor, backColor, iNum, fNum, cursor.x, cursor.y, value); + moveBy((iNum + fNum + 1) * fontWidth(fontID), 0); } - inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 1, fontid, textcolor, backcolor, iNum, fNum, x, y, value); + inline void drawSignedFloat(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(false, 1, fontID, textColor, backColor, iNum, fNum, x, y, value); } - inline void Draw_Signed_Float(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 1, fid, textcolor, backcolor, iNum, fNum, x, y, value); + inline void drawSignedFloat(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(false, 1, fid, textColor, backColor, iNum, fNum, x, y, value); } - inline void Draw_Signed_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 1, fontid, color, bColor, iNum, fNum, x, y, value); + inline void drawSignedFloat(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(true, 1, fontID, color, bColor, iNum, fNum, x, y, value); } - inline void Draw_Signed_Float(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 1, fid, color, bColor, iNum, fNum, x, y, value); + inline void drawSignedFloat(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(true, 1, fid, color, bColor, iNum, fNum, x, y, value); } // Draw a char @@ -444,23 +444,23 @@ namespace DWINUI { // x: abscissa of the display // y: ordinate of the display // c: ASCII code of char - void Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c); - inline void Draw_Char(uint16_t x, uint16_t y, const char c) { Draw_Char(textcolor, x, y, c); }; + void drawChar(uint16_t color, uint16_t x, uint16_t y, const char c); + inline void drawChar(uint16_t x, uint16_t y, const char c) { drawChar(textColor, x, y, c); }; // Draw a char at cursor position and increment cursor - void Draw_Char(uint16_t color, const char c); - inline void Draw_Char(const char c) { Draw_Char(textcolor, c); } + void drawChar(uint16_t color, const char c); + inline void drawChar(const char c) { drawChar(textColor, c); } // Draw a string at cursor position // color: Character color // *string: The string // rlimit: For draw less chars than string length use rlimit - void Draw_String(const char * const string, uint16_t rlimit = 0xFFFF); - void Draw_String(uint16_t color, const char * const string, uint16_t rlimit = 0xFFFF); - inline void Draw_String(FSTR_P string, uint16_t rlimit = 0xFFFF) { - Draw_String(FTOP(string), rlimit); + void drawString(const char * const string, uint16_t rlimit = 0xFFFF); + void drawString(uint16_t color, const char * const string, uint16_t rlimit = 0xFFFF); + inline void drawString(FSTR_P string, uint16_t rlimit = 0xFFFF) { + drawString(FTOP(string), rlimit); } - inline void Draw_String(uint16_t color, FSTR_P string, uint16_t rlimit = 0xFFFF) { - Draw_String(color, FTOP(string), rlimit); + inline void drawString(uint16_t color, FSTR_P string, uint16_t rlimit = 0xFFFF) { + drawString(color, FTOP(string), rlimit); } // Draw a string @@ -469,29 +469,29 @@ namespace DWINUI { // bColor: Background color // x/y: Upper-left coordinate of the string // *string: The string - inline void Draw_String(uint16_t x, uint16_t y, const char * const string) { - dwinDrawString(false, fontid, textcolor, backcolor, x, y, string); + inline void drawString(uint16_t x, uint16_t y, const char * const string) { + dwinDrawString(false, fontID, textColor, backColor, x, y, string); } - inline void Draw_String(uint16_t x, uint16_t y, FSTR_P title) { - dwinDrawString(false, fontid, textcolor, backcolor, x, y, FTOP(title)); + inline void drawString(uint16_t x, uint16_t y, FSTR_P fTitle) { + dwinDrawString(false, fontID, textColor, backColor, x, y, FTOP(fTitle)); } - inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) { - dwinDrawString(false, fontid, color, backcolor, x, y, string); + inline void drawString(uint16_t color, uint16_t x, uint16_t y, const char * const string) { + dwinDrawString(false, fontID, color, backColor, x, y, string); } - inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, FSTR_P title) { - dwinDrawString(false, fontid, color, backcolor, x, y, title); + inline void drawString(uint16_t color, uint16_t x, uint16_t y, FSTR_P fTitle) { + dwinDrawString(false, fontID, color, backColor, x, y, fTitle); } - inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { - dwinDrawString(true, fontid, color, bgcolor, x, y, string); + inline void drawString(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { + dwinDrawString(true, fontID, color, bgcolor, x, y, string); } - inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { - dwinDrawString(true, fontid, color, bgcolor, x, y, title); + inline void drawString(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P fTitle) { + dwinDrawString(true, fontID, color, bgcolor, x, y, fTitle); } - inline void Draw_String(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { + inline void drawString(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { dwinDrawString(true, fid, color, bgcolor, x, y, string); } - inline void Draw_String(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { - dwinDrawString(true, fid, color, bgcolor, x, y, title); + inline void drawString(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P fTitle) { + dwinDrawString(true, fid, color, bgcolor, x, y, fTitle); } // Draw a centered string using DWIN_WIDTH @@ -501,40 +501,40 @@ namespace DWINUI { // bColor: Background color // y: Upper coordinate of the string // *string: The string - void Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string); - inline void Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) { - Draw_CenteredString(bShow, fid, color, bColor, 0, DWIN_WIDTH, y, string); + void drawCenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string); + inline void drawCenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) { + drawCenteredString(bShow, fid, color, bColor, 0, DWIN_WIDTH, y, string); } - inline void Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) { - Draw_CenteredString(bShow, fid, color, bColor, y, FTOP(string)); + inline void drawCenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) { + drawCenteredString(bShow, fid, color, bColor, y, FTOP(string)); } - inline void Draw_CenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) { - Draw_CenteredString(true, fontid, color, bcolor, y, string); + inline void drawCenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) { + drawCenteredString(true, fontID, color, bcolor, y, string); } - inline void Draw_CenteredString(fontid_t fid, uint16_t color, uint16_t y, const char * const string) { - Draw_CenteredString(false, fid, color, backcolor, y, string); + inline void drawCenteredString(fontid_t fid, uint16_t color, uint16_t y, const char * const string) { + drawCenteredString(false, fid, color, backColor, y, string); } - inline void Draw_CenteredString(fontid_t fid, uint16_t color, uint16_t y, FSTR_P title) { - Draw_CenteredString(false, fid, color, backcolor, y, title); + inline void drawCenteredString(fontid_t fid, uint16_t color, uint16_t y, FSTR_P fTitle) { + drawCenteredString(false, fid, color, backColor, y, fTitle); } - inline void Draw_CenteredString(uint16_t color, uint16_t y, const char * const string) { - Draw_CenteredString(false, fontid, color, backcolor, y, string); + inline void drawCenteredString(uint16_t color, uint16_t y, const char * const string) { + drawCenteredString(false, fontID, color, backColor, y, string); } - inline void Draw_CenteredString(uint16_t color, uint16_t y, FSTR_P title) { - Draw_CenteredString(false, fontid, color, backcolor, y, title); + inline void drawCenteredString(uint16_t color, uint16_t y, FSTR_P fTitle) { + drawCenteredString(false, fontID, color, backColor, y, fTitle); } - inline void Draw_CenteredString(uint16_t y, const char * const string) { - Draw_CenteredString(false, fontid, textcolor, backcolor, y, string); + inline void drawCenteredString(uint16_t y, const char * const string) { + drawCenteredString(false, fontID, textColor, backColor, y, string); } - inline void Draw_CenteredString(uint16_t y, FSTR_P title) { - Draw_CenteredString(false, fontid, textcolor, backcolor, y, title); + inline void drawCenteredString(uint16_t y, FSTR_P fTitle) { + drawCenteredString(false, fontID, textColor, backColor, y, fTitle); } // Draw a box // mode: 0=frame, 1=fill, 2=XOR fill // color: Rectangle color // frame: Box coordinates and size - inline void Draw_Box(uint8_t mode, uint16_t color, frame_rect_t frame) { + inline void drawBox(uint8_t mode, uint16_t color, frame_rect_t frame) { dwinDrawBox(mode, color, frame.x, frame.y, frame.w, frame.h); } @@ -543,9 +543,9 @@ namespace DWINUI { // x: abscissa of the center of the circle // y: ordinate of the center of the circle // r: circle radius - void Draw_Circle(uint16_t color, uint16_t x,uint16_t y,uint8_t r); - inline void Draw_Circle(uint16_t color, uint8_t r) { - Draw_Circle(color, cursor.x, cursor.y, r); + void drawCircle(uint16_t color, uint16_t x,uint16_t y,uint8_t r); + inline void drawCircle(uint16_t color, uint8_t r) { + drawCircle(color, cursor.x, cursor.y, r); } // Draw a checkbox @@ -553,9 +553,9 @@ namespace DWINUI { // bColor: Background color // x/y: Upper-left point // checked : 0 : unchecked, 1 : checked - void Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked); - inline void Draw_Checkbox(uint16_t x, uint16_t y, bool checked=false) { - Draw_Checkbox(textcolor, backcolor, x, y, checked); + void drawCheckbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked); + inline void drawCheckbox(uint16_t x, uint16_t y, bool checked=false) { + drawCheckbox(textColor, backColor, x, y, checked); } // Color Interpolator @@ -568,14 +568,14 @@ namespace DWINUI { // ------------------------- Buttons ------------------------------// - void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption); - inline void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, FSTR_P caption) { - Draw_Button(color, bcolor, x1, y1, x2, y2, FTOP(caption)); + void drawButton(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption); + inline void drawButton(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, FSTR_P caption) { + drawButton(color, bcolor, x1, y1, x2, y2, FTOP(caption)); } - inline void Draw_Button(FSTR_P caption, uint16_t x, uint16_t y) { - Draw_Button(textcolor, buttoncolor, x, y, x + 99, y + 37, caption); + inline void drawButton(FSTR_P caption, uint16_t x, uint16_t y) { + drawButton(textColor, buttonColor, x, y, x + 99, y + 37, caption); } - void Draw_Button(uint8_t id, uint16_t x, uint16_t y); + void drawButton(uint8_t id, uint16_t x, uint16_t y); // -------------------------- Extra -------------------------------// @@ -584,9 +584,9 @@ namespace DWINUI { // x: abscissa of the center of the circle // y: ordinate of the center of the circle // r: circle radius - void Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r); - inline void Draw_FillCircle(uint16_t bcolor, uint8_t r) { - Draw_FillCircle(bcolor, cursor.x, cursor.y, r); + void drawFillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r); + inline void drawFillCircle(uint16_t bcolor, uint8_t r) { + drawFillCircle(bcolor, cursor.x, cursor.y, r); } // Color Interpolator through Red->Yellow->Green->Blue @@ -600,7 +600,7 @@ namespace DWINUI { // length: Bytes to write // data: address of the buffer with data inline void WriteToSRAM(uint16_t addr, uint16_t length, uint8_t *data) { - DWIN_WriteToMem(0x5A, addr, length, data); + dwinWriteToMem(0x5A, addr, length, data); } // Write buffer data to the Flash @@ -608,11 +608,11 @@ namespace DWINUI { // length: Bytes to write // data: address of the buffer with data inline void WriteToFlash(uint16_t addr, uint16_t length, uint8_t *data) { - DWIN_WriteToMem(0xA5, addr, length, data); + dwinWriteToMem(0xA5, addr, length, data); } // Clear by filling the area with background color // Area (0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - 1) - void ClearMainArea(); + void clearMainArea(); }; diff --git a/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp index c6d014e53c80..4dd3d7a369ea 100644 --- a/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp +++ b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp @@ -46,38 +46,38 @@ #include "../../../module/probe.h" #endif -ESDiagClass ESDiag; +ESDiag esDiag; void draw_es_label(FSTR_P const flabel=nullptr) { DWINUI::cursor.x = 40; - if (flabel) DWINUI::Draw_String(F(flabel)); - DWINUI::Draw_String(F(": ")); - DWINUI::MoveBy(0, 25); + if (flabel) DWINUI::drawString(F(flabel)); + DWINUI::drawString(F(": ")); + DWINUI::moveBy(0, 25); } void draw_es_state(const bool is_hit) { const uint8_t LM = 130; DWINUI::cursor.x = LM; - dwinDrawRectangle(1, HMI_data.PopupBg_Color, LM, DWINUI::cursor.y, LM + 100, DWINUI::cursor.y + 20); - is_hit ? DWINUI::Draw_String(RGB(31,31,16), F(STR_ENDSTOP_HIT)) : DWINUI::Draw_String(RGB(16,63,16), F(STR_ENDSTOP_OPEN)); - DWINUI::MoveBy(0, 25); + dwinDrawRectangle(1, hmiData.colorPopupBg, LM, DWINUI::cursor.y, LM + 100, DWINUI::cursor.y + 20); + is_hit ? DWINUI::drawString(RGB(31,31,16), F(STR_ENDSTOP_HIT)) : DWINUI::drawString(RGB(16,63,16), F(STR_ENDSTOP_OPEN)); + DWINUI::moveBy(0, 25); } -void ESDiagClass::Draw() { - Title.ShowCaption(GET_TEXT_F(MSG_ENDSTOP_TEST)); - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); - DWINUI::Draw_Button(BTN_Continue, 86, 250); +void ESDiag::draw() { + title.showCaption(GET_TEXT_F(MSG_ENDSTOP_TEST)); + DWINUI::clearMainArea(); + drawPopupBkgd(); + DWINUI::drawButton(BTN_Continue, 86, 250); DWINUI::cursor.y = 80; #define ES_LABEL(S) draw_es_label(F(STR_##S)) TERN_(USE_X_MIN, ES_LABEL(X_MIN)); TERN_(USE_X_MAX, ES_LABEL(X_MAX)); TERN_(USE_Y_MIN, ES_LABEL(Y_MIN)); TERN_(USE_Y_MAX, ES_LABEL(Y_MAX)); TERN_(HAS_Z_MIN_PIN, ES_LABEL(Z_MIN)); TERN_(USE_Z_MAX, ES_LABEL(Z_MAX)); TERN_(HAS_FILAMENT_SENSOR, draw_es_label(F(STR_FILAMENT))); - Update(); + update(); } -void ESDiagClass::Update() { +void ESDiag::update() { DWINUI::cursor.y = 80; #define ES_REPORT(S) draw_es_state(READ(S##_PIN) == S##_ENDSTOP_HIT_STATE) TERN_(USE_X_MIN, ES_REPORT(X_MIN)); TERN_(USE_X_MAX, ES_REPORT(X_MAX)); diff --git a/Marlin/src/lcd/e3v2/proui/endstop_diag.h b/Marlin/src/lcd/e3v2/proui/endstop_diag.h index 236262282e11..d4a98d5f1a86 100644 --- a/Marlin/src/lcd/e3v2/proui/endstop_diag.h +++ b/Marlin/src/lcd/e3v2/proui/endstop_diag.h @@ -28,10 +28,10 @@ * Date: 2023/05/10 */ -class ESDiagClass { +class ESDiag { public: - static void Draw(); - static void Update(); + static void draw(); + static void update(); }; -extern ESDiagClass ESDiag; +extern ESDiag esDiag; diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp index c0b12c5946fd..8017847538e4 100644 --- a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp +++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp @@ -200,27 +200,27 @@ void Preview_DrawFromSD() { if (Has_Preview()) { MString<45> buf; char str_1[6] = "", str_2[6] = "", str_3[6] = ""; - dwinDrawRectangle(1, HMI_data.Background_Color, 0, 0, DWIN_WIDTH, STATUS_Y - 1); + dwinDrawRectangle(1, hmiData.colorBackground, 0, 0, DWIN_WIDTH, STATUS_Y - 1); if (fileprop.time) { buf.setf(F("Estimated time: %i:%02i"), (uint16_t)fileprop.time / 3600, ((uint16_t)fileprop.time % 3600) / 60); - DWINUI::Draw_String(20, 10, &buf); + DWINUI::drawString(20, 10, &buf); } if (fileprop.filament) { buf.setf(F("Filament used: %s m"), dtostrf(fileprop.filament, 1, 2, str_1)); - DWINUI::Draw_String(20, 30, &buf); + DWINUI::drawString(20, 30, &buf); } if (fileprop.layer) { buf.setf(F("Layer height: %s mm"), dtostrf(fileprop.layer, 1, 2, str_1)); - DWINUI::Draw_String(20, 50, &buf); + DWINUI::drawString(20, 50, &buf); } if (fileprop.width) { buf.setf(F("Volume: %sx%sx%s mm"), dtostrf(fileprop.width, 1, 1, str_1), dtostrf(fileprop.length, 1, 1, str_2), dtostrf(fileprop.height, 1, 1, str_3)); - DWINUI::Draw_String(20, 70, &buf); + DWINUI::drawString(20, 70, &buf); } - DWINUI::Draw_Button(BTN_Print, 26, 290); - DWINUI::Draw_Button(BTN_Cancel, 146, 290); + DWINUI::drawButton(BTN_Print, 26, 290); + DWINUI::drawButton(BTN_Cancel, 146, 290); Preview_Show(); - Draw_Select_Highlight(true, 290); + drawSelectHighlight(true, 290); dwinUpdateLCD(); } else { diff --git a/Marlin/src/lcd/e3v2/proui/lockscreen.cpp b/Marlin/src/lcd/e3v2/proui/lockscreen.cpp index 50874e0fc2bb..ebe3568c9879 100644 --- a/Marlin/src/lcd/e3v2/proui/lockscreen.cpp +++ b/Marlin/src/lcd/e3v2/proui/lockscreen.cpp @@ -36,39 +36,39 @@ #include "dwin.h" #include "lockscreen.h" -LockScreenClass lockScreen; +LockScreen lockScreen; -uint8_t LockScreenClass::lock_pos = 0; -bool LockScreenClass::unlocked = false; -uint8_t LockScreenClass::rprocess = 0; +uint8_t LockScreen::lock_pos = 0; +bool LockScreen::unlocked = false; +uint8_t LockScreen::rprocess = 0; -void LockScreenClass::init() { +void LockScreen::init() { lock_pos = 0; unlocked = false; draw(); } -void LockScreenClass::draw() { - Title.SetCaption(GET_TEXT_F(MSG_LOCKSCREEN)); - DWINUI::ClearMainArea(); - DWINUI::Draw_Icon(ICON_LOGO, 71, 120); // CREALITY logo - DWINUI::Draw_CenteredString(Color_White, 180, GET_TEXT_F(MSG_LOCKSCREEN_LOCKED)); - DWINUI::Draw_CenteredString(Color_White, 200, GET_TEXT_F(MSG_LOCKSCREEN_UNLOCK)); - DWINUI::Draw_CenteredString(Color_White, 240, F("-> | <-")); - dwinDrawBox(1, HMI_data.Barfill_Color, 0, 260, DWIN_WIDTH, 20); - dwinDrawVLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20); +void LockScreen::draw() { + title.setCaption(GET_TEXT_F(MSG_LOCKSCREEN)); + DWINUI::clearMainArea(); + DWINUI::drawIcon(ICON_LOGO, 71, 120); // CREALITY logo + DWINUI::drawCenteredString(COLOR_WHITE, 180, GET_TEXT_F(MSG_LOCKSCREEN_LOCKED)); + DWINUI::drawCenteredString(COLOR_WHITE, 200, GET_TEXT_F(MSG_LOCKSCREEN_UNLOCK)); + DWINUI::drawCenteredString(COLOR_WHITE, 240, F("-> | <-")); + dwinDrawBox(1, hmiData.colorBarfill, 0, 260, DWIN_WIDTH, 20); + dwinDrawVLine(COLOR_YELLOW, lock_pos * DWIN_WIDTH / 255, 260, 20); dwinUpdateLCD(); } -void LockScreenClass::onEncoder(EncoderState encoder_diffState) { +void LockScreen::onEncoder(EncoderState encoder_diffState) { switch (encoder_diffState) { case ENCODER_DIFF_CW: lock_pos += 8; break; case ENCODER_DIFF_CCW: lock_pos -= 8; break; case ENCODER_DIFF_ENTER: unlocked = (lock_pos == 128); break; default: break; } - dwinDrawBox(1, HMI_data.Barfill_Color, 0, 260, DWIN_WIDTH, 20); - dwinDrawVLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20); + dwinDrawBox(1, hmiData.colorBarfill, 0, 260, DWIN_WIDTH, 20); + dwinDrawVLine(COLOR_YELLOW, lock_pos * DWIN_WIDTH / 255, 260, 20); dwinUpdateLCD(); } diff --git a/Marlin/src/lcd/e3v2/proui/lockscreen.h b/Marlin/src/lcd/e3v2/proui/lockscreen.h index cb75f2c7c0db..9feb91c25b41 100644 --- a/Marlin/src/lcd/e3v2/proui/lockscreen.h +++ b/Marlin/src/lcd/e3v2/proui/lockscreen.h @@ -31,7 +31,7 @@ #include "../common/encoder.h" #include -class LockScreenClass { +class LockScreen { private: static bool unlocked; static uint8_t lock_pos; @@ -43,4 +43,4 @@ class LockScreenClass { static bool isUnlocked() { return unlocked; } }; -extern LockScreenClass lockScreen; +extern LockScreen lockScreen; diff --git a/Marlin/src/lcd/e3v2/proui/menus.cpp b/Marlin/src/lcd/e3v2/proui/menus.cpp index 54892b6acbb0..347130743c63 100644 --- a/Marlin/src/lcd/e3v2/proui/menus.cpp +++ b/Marlin/src/lcd/e3v2/proui/menus.cpp @@ -37,135 +37,135 @@ int8_t MenuItemTotal = 0; int8_t MenuItemCount = 0; -CustomMenuItemClass** MenuItems = nullptr; -MenuClass *CurrentMenu = nullptr; -MenuClass *PreviousMenu = nullptr; -MenuData_t MenuData; +CustomMenuItem** menuItems = nullptr; +Menu *currentMenu = nullptr; +Menu *previousMenu = nullptr; +MenuData_t menuData; // Menuitem Drawing functions ================================================= -void Draw_Title(TitleClass* title) { - dwinDrawRectangle(1, HMI_data.TitleBg_Color, 0, 0, DWIN_WIDTH - 1, TITLE_HEIGHT - 1); - if (title->frameid) - DWIN_Frame_AreaCopy(title->frameid, title->frame.left, title->frame.top, title->frame.right, title->frame.bottom, 14, (TITLE_HEIGHT - (title->frame.bottom - title->frame.top)) / 2 - 1); +void drawTitle(Title* aTitle) { + dwinDrawRectangle(1, hmiData.colorTitleBg, 0, 0, DWIN_WIDTH - 1, TITLE_HEIGHT - 1); + if (aTitle->frameid) + dwinFrameAreaCopy(aTitle->frameid, aTitle->frame.left, aTitle->frame.top, aTitle->frame.right, aTitle->frame.bottom, 14, (TITLE_HEIGHT - (aTitle->frame.bottom - aTitle->frame.top)) / 2 - 1); else #if ENABLED(TITLE_CENTERED) - DWINUI::Draw_CenteredString(false, DWIN_FONT_HEAD, HMI_data.TitleTxt_Color, HMI_data.TitleBg_Color, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, title->caption); + DWINUI::drawCenteredString(false, DWIN_FONT_HEAD, hmiData.colorTitleTxt, hmiData.colorTitleBg, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, aTitle->caption); #else - dwinDrawString(false, DWIN_FONT_HEAD, HMI_data.TitleTxt_Color, HMI_data.TitleBg_Color, 14, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, title->caption); + dwinDrawString(false, DWIN_FONT_HEAD, hmiData.colorTitleTxt, hmiData.colorTitleBg, 14, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, aTitle->caption); #endif } -void Draw_Menu_Cursor(const int8_t line) { +void drawMenuCursor(const int8_t line) { const uint16_t ypos = MYPOS(line); - DWINUI::Draw_Box(1, HMI_data.Cursor_Color, {0, ypos, 15, MLINE - 1}); + DWINUI::drawBox(1, hmiData.colorCursor, {0, ypos, 15, MLINE - 1}); } -void Erase_Menu_Cursor(const int8_t line) { +void eraseMenuCursor(const int8_t line) { const uint16_t ypos = MYPOS(line); - DWINUI::Draw_Box(1, HMI_data.Background_Color, {0, ypos, 15, MLINE - 1}); + DWINUI::drawBox(1, hmiData.colorBackground, {0, ypos, 15, MLINE - 1}); } -void Erase_Menu_Text(const int8_t line) { +void eraseMenuText(const int8_t line) { if (line < 0 || line >= TROWS) return; const uint16_t ypos = MYPOS(line) + 1; - DWINUI::Draw_Box(1, HMI_data.Background_Color, {LBLX, ypos, DWIN_WIDTH - LBLX, MLINE - 2}); + DWINUI::drawBox(1, hmiData.colorBackground, {LBLX, ypos, DWIN_WIDTH - LBLX, MLINE - 2}); } -void Draw_Menu_Line(const uint8_t line, const uint8_t icon/*=0*/, const char * const label/*=nullptr*/, bool more/*=false*/, bool selected/*=false*/) { - if (icon) DWINUI::Draw_Icon(icon, ICOX, MBASE(line) - 3); - if (label) DWINUI::Draw_String(LBLX, MBASE(line) - 1, (char*)label); - if (more) DWINUI::Draw_Icon(ICON_More, VALX + 16, MBASE(line) - 3); - if (selected) Draw_Menu_Cursor(line); - dwinDrawHLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240); +void drawMenuLine(const uint8_t line, const uint8_t icon/*=0*/, const char * const label/*=nullptr*/, bool more/*=false*/, bool selected/*=false*/) { + if (icon) DWINUI::drawIcon(icon, ICOX, MBASE(line) - 3); + if (label) DWINUI::drawString(LBLX, MBASE(line) - 1, (char*)label); + if (more) DWINUI::drawIcon(ICON_More, VALX + 16, MBASE(line) - 3); + if (selected) drawMenuCursor(line); + dwinDrawHLine(hmiData.colorSplitLine, 16, MYPOS(line + 1), 240); } -void Draw_Menu_Line(const uint8_t line, const uint8_t icon/*=0*/, FSTR_P label/*=nullptr*/, bool more/*=false*/, bool selected/*=false*/) { - Draw_Menu_Line(line, icon, FTOP(label), more, selected); +void drawMenuLine(const uint8_t line, const uint8_t icon/*=0*/, FSTR_P label/*=nullptr*/, bool more/*=false*/, bool selected/*=false*/) { + drawMenuLine(line, icon, FTOP(label), more, selected); } -void Draw_Chkb_Line(const uint8_t line, const bool checked) { - DWINUI::Draw_Checkbox(HMI_data.Text_Color, HMI_data.Background_Color, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked); +void drawCheckboxLine(const uint8_t line, const bool checked) { + DWINUI::drawCheckbox(hmiData.colorText, hmiData.colorBackground, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked); } -void Show_Chkb_Line(const bool checked) { - const uint8_t line = CurrentMenu->line(); - DWINUI::Draw_Checkbox(HMI_data.Text_Color, HMI_data.Background_Color, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked); +void showCheckboxLine(const bool checked) { + const uint8_t line = currentMenu->line(); + DWINUI::drawCheckbox(hmiData.colorText, hmiData.colorBackground, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked); dwinUpdateLCD(); } -void Toggle_Chkb_Line(bool &checked) { +void toggleCheckboxLine(bool &checked) { checked = !checked; - Show_Chkb_Line(checked); + showCheckboxLine(checked); } -void Draw_Menu_IntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value/*=0*/) { - DWINUI::Draw_Signed_Int(HMI_data.Text_Color, bcolor, iNum , VALX, MBASE(line) - 1, value); +void drawMenuIntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value/*=0*/) { + DWINUI::drawSignedInt(hmiData.colorText, bcolor, iNum , VALX, MBASE(line) - 1, value); } -void onDrawMenuItem(MenuItemClass* menuitem, int8_t line) { - if (menuitem->icon) DWINUI::Draw_Icon(menuitem->icon, ICOX, MBASE(line) - 3); +void onDrawMenuItem(MenuItem* menuitem, int8_t line) { + if (menuitem->icon) DWINUI::drawIcon(menuitem->icon, ICOX, MBASE(line) - 3); if (menuitem->frameid) - DWIN_Frame_AreaCopy(menuitem->frameid, menuitem->frame.left, menuitem->frame.top, menuitem->frame.right, menuitem->frame.bottom, LBLX, MBASE(line)); + dwinFrameAreaCopy(menuitem->frameid, menuitem->frame.left, menuitem->frame.top, menuitem->frame.right, menuitem->frame.bottom, LBLX, MBASE(line)); else if (menuitem->caption) - DWINUI::Draw_String(LBLX, MBASE(line) - 1, menuitem->caption); - dwinDrawHLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240); + DWINUI::drawString(LBLX, MBASE(line) - 1, menuitem->caption); + dwinDrawHLine(hmiData.colorSplitLine, 16, MYPOS(line + 1), 240); } -void onDrawSubMenu(MenuItemClass* menuitem, int8_t line) { +void onDrawSubMenu(MenuItem* menuitem, int8_t line) { onDrawMenuItem(menuitem, line); - DWINUI::Draw_Icon(ICON_More, VALX + 16, MBASE(line) - 3); + DWINUI::drawIcon(ICON_More, VALX + 16, MBASE(line) - 3); } -void onDrawIntMenu(MenuItemClass* menuitem, int8_t line, int32_t value) { +void onDrawIntMenu(MenuItem* menuitem, int8_t line, int32_t value) { onDrawMenuItem(menuitem, line); - Draw_Menu_IntValue(HMI_data.Background_Color, line, 4, value); + drawMenuIntValue(hmiData.colorBackground, line, 4, value); } -void onDrawPIntMenu(MenuItemClass* menuitem, int8_t line) { - const int16_t value = *(int16_t*)static_cast(menuitem)->value; +void onDrawPIntMenu(MenuItem* menuitem, int8_t line) { + const int16_t value = *(int16_t*)static_cast(menuitem)->value; onDrawIntMenu(menuitem, line, value); } -void onDrawPInt8Menu(MenuItemClass* menuitem, int8_t line) { - const uint8_t value = *(uint8_t*)static_cast(menuitem)->value; +void onDrawPInt8Menu(MenuItem* menuitem, int8_t line) { + const uint8_t value = *(uint8_t*)static_cast(menuitem)->value; onDrawIntMenu(menuitem, line, value); } -void onDrawPInt32Menu(MenuItemClass* menuitem, int8_t line) { - const uint32_t value = *(uint32_t*)static_cast(menuitem)->value; +void onDrawPInt32Menu(MenuItem* menuitem, int8_t line) { + const uint32_t value = *(uint32_t*)static_cast(menuitem)->value; onDrawIntMenu(menuitem, line, value); } -void onDrawFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp, const float value) { +void onDrawFloatMenu(MenuItem* menuitem, int8_t line, uint8_t dp, const float value) { onDrawMenuItem(menuitem, line); - DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Background_Color, 3, dp, VALX - dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(line), value); + DWINUI::drawSignedFloat(hmiData.colorText, hmiData.colorBackground, 3, dp, VALX - dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(line), value); } -void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp) { - const float value = *(float*)static_cast(menuitem)->value; +void onDrawPFloatMenu(MenuItem* menuitem, int8_t line, uint8_t dp) { + const float value = *(float*)static_cast(menuitem)->value; onDrawFloatMenu(menuitem, line, dp, value); } -void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line, bool checked) { +void onDrawChkbMenu(MenuItem* menuitem, int8_t line, bool checked) { onDrawMenuItem(menuitem, line); - Draw_Chkb_Line(line, checked); + drawCheckboxLine(line, checked); } -void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line) { - const bool val = *(bool*)static_cast(menuitem)->value; +void onDrawChkbMenu(MenuItem* menuitem, int8_t line) { + const bool val = *(bool*)static_cast(menuitem)->value; onDrawChkbMenu(menuitem, line, val); } void DrawItemEdit(const bool selected) { - const uint16_t bcolor = selected ? HMI_data.Selected_Color : HMI_data.Background_Color; - const uint8_t iNum = 4 - ((MenuData.dp > 0) ? (MenuData.dp - 1) : 0); + const uint16_t bcolor = selected ? hmiData.colorSelected : hmiData.colorBackground; + const uint8_t iNum = 4 - ((menuData.dp > 0) ? (menuData.dp - 1) : 0); switch (checkkey) { - case SetIntNoDraw: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break; - case SetInt: - case SetPInt: DWINUI::Draw_Signed_Int(HMI_data.Text_Color, bcolor, iNum , VALX, MBASE(CurrentMenu->line()) - 1, MenuData.Value); break; - case SetFloat: - case SetPFloat: DWINUI::Draw_Signed_Float(HMI_data.Text_Color, bcolor, iNum, MenuData.dp, VALX - 2 * DWINUI::fontWidth(), MBASE(CurrentMenu->line()), MenuData.Value / POW(10, MenuData.dp)); break; + case ID_SetIntNoDraw: if (menuData.liveUpdate) menuData.liveUpdate(); break; + case ID_SetInt: + case ID_SetPInt: DWINUI::drawSignedInt(hmiData.colorText, bcolor, iNum , VALX, MBASE(currentMenu->line()) - 1, menuData.value); break; + case ID_SetFloat: + case ID_SetPFloat: DWINUI::drawSignedFloat(hmiData.colorText, bcolor, iNum, menuData.dp, VALX - 2 * DWINUI::fontWidth(), MBASE(currentMenu->line()), menuData.value / POW(10, menuData.dp)); break; default: break; } } @@ -180,16 +180,16 @@ void DrawItemEdit(const bool selected) { // hi: high limit // dp: decimal places, 0 for integers // val: value / scaled value -// LiveUpdate: live update function when the encoder changes -// Apply: update function when the encoder is pressed -void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) { +// liveUpdate: live update function when the encoder changes +// apply: update function when the encoder is pressed +void setOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) { checkkey = process; - MenuData.MinValue = lo; - MenuData.MaxValue = hi; - MenuData.dp = dp; - MenuData.Apply = Apply; - MenuData.LiveUpdate = LiveUpdate; - MenuData.Value = constrain(val, lo, hi); + menuData.minValue = lo; + menuData.maxValue = hi; + menuData.dp = dp; + menuData.apply = apply; + menuData.liveUpdate = liveUpdate; + menuData.value = constrain(val, lo, hi); encoderRate.enabled = true; } @@ -198,10 +198,10 @@ void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, // lo: scaled low limit // hi: scaled high limit // val: value -// LiveUpdate: live update function when the encoder changes -// Apply: update function when the encoder is pressed -void SetValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) { - SetOnClick(process, lo, hi, 0, val, Apply, LiveUpdate); +// liveUpdate: live update function when the encoder changes +// apply: update function when the encoder is pressed +void setValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) { + setOnClick(process, lo, hi, 0, val, apply, liveUpdate); DrawItemEdit(true); } @@ -210,11 +210,11 @@ void SetValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const // lo: scaled low limit // hi: scaled high limit // val: value -// LiveUpdate: live update function when the encoder changes -// Apply: update function when the encoder is pressed -void SetValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) { +// liveUpdate: live update function when the encoder changes +// apply: update function when the encoder is pressed +void setValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) { const int32_t value = round(val * POW(10, dp)); - SetOnClick(process, lo * POW(10, dp), hi * POW(10, dp), dp, value, Apply, LiveUpdate); + setOnClick(process, lo * POW(10, dp), hi * POW(10, dp), dp, value, apply, liveUpdate); DrawItemEdit(true); } @@ -222,21 +222,21 @@ void SetValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp // lo: scaled low limit // hi: scaled high limit // val: value -// LiveUpdate: live update function when the encoder changes -// Apply: update function when the encoder is pressed -void SetIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) { - SetValueOnClick(SetInt, lo, hi, val, Apply, LiveUpdate); +// liveUpdate: live update function when the encoder changes +// apply: update function when the encoder is pressed +void setIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) { + setValueOnClick(ID_SetInt, lo, hi, val, apply, liveUpdate); } // Generic onclick event for set pointer to 16 bit uinteger values // lo: low limit // hi: high limit -// LiveUpdate: live update function when the encoder changes -// Apply: update function when the encoder is pressed -void SetPIntOnClick(const int32_t lo, const int32_t hi, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) { - MenuData.P_Int = (int16_t*)static_cast(CurrentMenu->SelectedItem())->value; - const int32_t value = *MenuData.P_Int; - SetValueOnClick(SetPInt, lo, hi, value, Apply, LiveUpdate); +// liveUpdate: live update function when the encoder changes +// apply: update function when the encoder is pressed +void setPIntOnClick(const int32_t lo, const int32_t hi, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) { + menuData.intPtr = (int16_t*)static_cast(currentMenu->selectedItem())->value; + const int32_t value = *menuData.intPtr; + setValueOnClick(ID_SetPInt, lo, hi, value, apply, liveUpdate); } // Generic onclick event for float values @@ -245,31 +245,31 @@ void SetPIntOnClick(const int32_t lo, const int32_t hi, void (*Apply)()/*=nullpt // hi: high limit // dp: decimal places // val: value -void SetFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) { - SetValueOnClick(SetFloat, lo, hi, dp, val, Apply, LiveUpdate); +void setFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) { + setValueOnClick(ID_SetFloat, lo, hi, dp, val, apply, liveUpdate); } // Generic onclick event for set pointer to float values // lo: low limit // hi: high limit -// LiveUpdate: live update function when the encoder changes -// Apply: update function when the encoder is pressed -void SetPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) { - MenuData.P_Float = (float*)static_cast(CurrentMenu->SelectedItem())->value; - SetValueOnClick(SetPFloat, lo, hi, dp, *MenuData.P_Float, Apply, LiveUpdate); +// liveUpdate: live update function when the encoder changes +// apply: update function when the encoder is pressed +void setPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) { + menuData.floatPtr = (float*)static_cast(currentMenu->selectedItem())->value; + setValueOnClick(ID_SetPFloat, lo, hi, dp, *menuData.floatPtr, apply, liveUpdate); } // HMI Control functions ====================================================== // Generic menu control using the encoder -void HMI_Menu() { +void hmiMenu() { EncoderState encoder_diffState = get_encoder_state(); - if (CurrentMenu) { + if (currentMenu) { if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_ENTER) - CurrentMenu->onClick(); + currentMenu->onClick(); else - CurrentMenu->onScroll(encoder_diffState == ENCODER_DIFF_CW); + currentMenu->onScroll(encoder_diffState == ENCODER_DIFF_CW); } } @@ -279,283 +279,283 @@ void HMI_Menu() { // 0 : no change // 1 : live change // 2 : apply change -int8_t HMI_Get(bool draw) { - const int32_t lo = MenuData.MinValue; - const int32_t hi = MenuData.MaxValue; - const int32_t cval = MenuData.Value; +int8_t hmiGet(bool draw) { + const int32_t lo = menuData.minValue; + const int32_t hi = menuData.maxValue; + const int32_t cval = menuData.value; EncoderState encoder_diffState = TERN(SMOOTH_ENCODER_MENUITEMS, get_encoder_state(), encoderReceiveAnalyze()); if (encoder_diffState != ENCODER_DIFF_NO) { - if (applyEncoder(encoder_diffState, MenuData.Value)) { + if (applyEncoder(encoder_diffState, menuData.value)) { encoderRate.enabled = false; if (draw) DrawItemEdit(false); - checkkey = Menu; + checkkey = ID_Menu; return 2; } - LIMIT(MenuData.Value, lo, hi); + LIMIT(menuData.value, lo, hi); } - const bool change = cval != MenuData.Value; + const bool change = cval != menuData.value; if (change) DrawItemEdit(true); return int8_t(change); } // Set and draw a value using the encoder -void HMI_SetDraw() { - int8_t val = HMI_Get(true); +void hmiSetDraw() { + int8_t val = hmiGet(true); switch (val) { case 0: return; - case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break; - case 2: if (MenuData.Apply) MenuData.Apply(); break; + case 1: if (menuData.liveUpdate) menuData.liveUpdate(); break; + case 2: if (menuData.apply) menuData.apply(); break; } } // Set an value without drawing -void HMI_SetNoDraw() { - int8_t val = HMI_Get(false); +void hmiSetNoDraw() { + int8_t val = hmiGet(false); switch (val) { case 0: return; - case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break; - case 2: if (MenuData.Apply) MenuData.Apply(); break; + case 1: if (menuData.liveUpdate) menuData.liveUpdate(); break; + case 2: if (menuData.apply) menuData.apply(); break; } } // Set an integer pointer variable using the encoder -void HMI_SetPInt() { - int8_t val = HMI_Get(true); +void hmiSetPInt() { + int8_t val = hmiGet(true); switch (val) { case 0: return; - case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break; - case 2: *MenuData.P_Int = MenuData.Value; if (MenuData.Apply) MenuData.Apply(); break; + case 1: if (menuData.liveUpdate) menuData.liveUpdate(); break; + case 2: *menuData.intPtr = menuData.value; if (menuData.apply) menuData.apply(); break; } } // Set a scaled float pointer variable using the encoder -void HMI_SetPFloat() { - const int8_t val = HMI_Get(true); +void hmiSetPFloat() { + const int8_t val = hmiGet(true); switch (val) { case 0: return; - case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break; - case 2: *MenuData.P_Float = MenuData.Value / POW(10, MenuData.dp); if (MenuData.Apply) MenuData.Apply(); break; + case 1: if (menuData.liveUpdate) menuData.liveUpdate(); break; + case 2: *menuData.floatPtr = menuData.value / POW(10, menuData.dp); if (menuData.apply) menuData.apply(); break; } } // Menu Class =============================================================== -MenuClass::MenuClass() { +Menu::Menu() { selected = 0; topline = 0; } -void MenuClass::draw() { - MenuTitle.draw(); - DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); - dwinDrawRectangle(1, DWINUI::backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1); +void Menu::draw() { + menuTitle.draw(); + DWINUI::setColors(hmiData.colorText, hmiData.colorBackground, hmiData.colorStatusBg); + dwinDrawRectangle(1, DWINUI::backColor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1); for (int8_t i = 0; i < MenuItemCount; i++) - MenuItems[i]->draw(i - topline); - Draw_Menu_Cursor(line()); + menuItems[i]->draw(i - topline); + drawMenuCursor(line()); dwinUpdateLCD(); } -void MenuClass::onScroll(bool dir) { +void Menu::onScroll(bool dir) { int8_t sel = selected; if (dir) sel++; else sel--; LIMIT(sel, 0, MenuItemCount - 1); if (sel != selected) { - Erase_Menu_Cursor(line()); + eraseMenuCursor(line()); dwinUpdateLCD(); if ((sel - topline) == TROWS) { - dwinFrameAreaMove(1, DWIN_SCROLL_UP, MLINE, DWINUI::backcolor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1); + dwinFrameAreaMove(1, DWIN_SCROLL_UP, MLINE, DWINUI::backColor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1); topline++; - MenuItems[sel]->draw(TROWS - 1); + menuItems[sel]->draw(TROWS - 1); } if ((sel < topline)) { - dwinFrameAreaMove(1, DWIN_SCROLL_DOWN, MLINE, DWINUI::backcolor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1); + dwinFrameAreaMove(1, DWIN_SCROLL_DOWN, MLINE, DWINUI::backColor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1); topline--; - MenuItems[sel]->draw(0); + menuItems[sel]->draw(0); } selected = sel; - Draw_Menu_Cursor(line()); + drawMenuCursor(line()); dwinUpdateLCD(); } } -void MenuClass::onClick() { - if (MenuItems[selected]->onClick != nullptr) (*MenuItems[selected]->onClick)(); +void Menu::onClick() { + if (menuItems[selected]->onClick != nullptr) (*menuItems[selected]->onClick)(); } -CustomMenuItemClass *MenuClass::SelectedItem() { - return MenuItems[selected]; +CustomMenuItem *Menu::selectedItem() { + return menuItems[selected]; } -CustomMenuItemClass** MenuClass::Items() { - return MenuItems; +CustomMenuItem** Menu::items() { + return menuItems; } -int8_t MenuClass::count() { +int8_t Menu::count() { return MenuItemCount; }; /* MenuItem Class ===========================================================*/ -void CustomMenuItemClass::draw(int8_t line) { +void CustomMenuItem::draw(int8_t line) { if (line < 0 || line >= TROWS) return; - if (onDraw != nullptr) (*onDraw)(static_cast(this), line); + if (onDraw != nullptr) (*onDraw)(static_cast(this), line); }; -void CustomMenuItemClass::redraw(bool erase/*=false*/) { - const int8_t line = CurrentMenu->line(this->pos); - if (erase) Erase_Menu_Text(line); +void CustomMenuItem::redraw(bool erase/*=false*/) { + const int8_t line = currentMenu->line(this->pos); + if (erase) eraseMenuText(line); draw(line); } -CustomMenuItemClass::CustomMenuItemClass(OnDrawItem ondraw, OnClickItem onclick) { +CustomMenuItem::CustomMenuItem(OnDrawItem ondraw, OnClickItem onclick) { onClick = onclick; onDraw = ondraw; } -MenuItemClass::MenuItemClass(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick) : CustomMenuItemClass(ondraw, onclick) { +MenuItem::MenuItem(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick) : CustomMenuItem(ondraw, onclick) { icon = cicon; - SetCaption(text); + setCaption(text); } -MenuItemClass::MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw, OnClickItem onclick) : CustomMenuItemClass(ondraw, onclick) { +MenuItem::MenuItem(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw, OnClickItem onclick) : CustomMenuItem(ondraw, onclick) { icon = cicon; caption[0] = '\0'; frameid = id; frame = { x1, y1, x2, y2 }; } -void MenuItemClass::SetCaption(const char * const text) { +void MenuItem::setCaption(const char * const text) { const uint8_t len = _MIN(sizeof(caption) - 1, strlen(text)); memcpy(&caption[0], text, len); caption[len] = '\0'; } -void MenuItemClass::SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { +void MenuItem::setFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { caption[0] = '\0'; frameid = id; frame = { x1, y1, x2, y2 }; } -MenuItemPtrClass::MenuItemPtrClass(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val) : MenuItemClass(cicon, text, ondraw, onclick) { +MenuItemPtr::MenuItemPtr(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val) : MenuItem(cicon, text, ondraw, onclick) { value = val; }; // Menu auxiliary functions =================================================== -void MenuItemsClear() { - if (MenuItems == nullptr) return; - for (int8_t i = 0; i < MenuItemCount; i++) delete MenuItems[i]; - delete[] MenuItems; - MenuItems = nullptr; +void menuItemsClear() { + if (menuItems == nullptr) return; + for (int8_t i = 0; i < MenuItemCount; i++) delete menuItems[i]; + delete[] menuItems; + menuItems = nullptr; MenuItemCount = 0; MenuItemTotal = 0; } -void MenuItemsPrepare(int8_t totalitems) { - MenuItemsClear(); +void menuItemsPrepare(int8_t totalitems) { + menuItemsClear(); MenuItemTotal = _MIN(totalitems, MENU_MAX_ITEMS); - MenuItems = new CustomMenuItemClass*[totalitems]; + menuItems = new CustomMenuItem*[totalitems]; } -bool IsMenu(MenuClass* _menu) { - return ((checkkey == Menu) && !!CurrentMenu && (CurrentMenu == _menu)); +bool isMenu(Menu* _menu) { + return ((checkkey == ID_Menu) && !!currentMenu && (currentMenu == _menu)); } template -T* MenuItemAdd(T* menuitem) { - MenuItems[MenuItemCount] = menuitem; +T* menuItemAdd(T* menuitem) { + menuItems[MenuItemCount] = menuitem; menuitem->pos = MenuItemCount++; return menuitem; } -CustomMenuItemClass* MenuItemAdd(OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) { +CustomMenuItem* menuItemAdd(OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) { if (MenuItemCount < MenuItemTotal) { - CustomMenuItemClass* menuitem = new CustomMenuItemClass(ondraw, onclick); - return MenuItemAdd(menuitem); + CustomMenuItem* menuitem = new CustomMenuItem(ondraw, onclick); + return menuItemAdd(menuitem); } else return nullptr; } -MenuItemClass* MenuItemAdd(uint8_t cicon, const char * const text/*=nullptr*/, OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) { +MenuItem* menuItemAdd(uint8_t cicon, const char * const text/*=nullptr*/, OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) { if (MenuItemCount < MenuItemTotal) { - MenuItemClass* menuitem = new MenuItemClass(cicon, text, ondraw, onclick); - return MenuItemAdd(menuitem); + MenuItem* menuitem = new MenuItem(cicon, text, ondraw, onclick); + return menuItemAdd(menuitem); } else return nullptr; } -MenuItemClass* MenuItemAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) { +MenuItem* menuItemAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) { if (MenuItemCount < MenuItemTotal) { - MenuItemClass* menuitem = new MenuItemClass(cicon, id, x1, y1, x2, y2, ondraw, onclick); - return MenuItemAdd(menuitem); + MenuItem* menuitem = new MenuItem(cicon, id, x1, y1, x2, y2, ondraw, onclick); + return menuItemAdd(menuitem); } else return nullptr; } -MenuItemClass* EditItemAdd(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val) { +MenuItem* editItemAdd(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val) { if (MenuItemCount < MenuItemTotal) { - MenuItemClass* menuitem = new MenuItemPtrClass(cicon, text, ondraw, onclick, val); - return MenuItemAdd(menuitem); + MenuItem* menuitem = new MenuItemPtr(cicon, text, ondraw, onclick, val); + return menuItemAdd(menuitem); } else return nullptr; } -void InitMenu() { - CurrentMenu = nullptr; - PreviousMenu = nullptr; +void initMenu() { + currentMenu = nullptr; + previousMenu = nullptr; } -bool SetMenu(MenuClass* &menu, FSTR_P title, int8_t totalitems) { - if (!menu) menu = new MenuClass(); - const bool NotCurrent = (CurrentMenu != menu); +bool setMenu(Menu* &menu, FSTR_P fTitle, int8_t totalitems) { + if (!menu) menu = new Menu(); + const bool NotCurrent = (currentMenu != menu); if (NotCurrent) { - menu->MenuTitle.SetCaption(title); - MenuItemsPrepare(totalitems); + menu->menuTitle.setCaption(fTitle); + menuItemsPrepare(totalitems); } return NotCurrent; } -bool SetMenu(MenuClass* &menu, frame_rect_t cn, FSTR_P title, int8_t totalitems) { - if (!menu) menu = new MenuClass(); - const bool NotCurrent = (CurrentMenu != menu); +bool setMenu(Menu* &menu, frame_rect_t cn, FSTR_P fTitle, int8_t totalitems) { + if (!menu) menu = new Menu(); + const bool NotCurrent = (currentMenu != menu); if (NotCurrent) { if (cn.w != 0) - menu->MenuTitle.SetFrame(cn.x, cn.y, cn.w, cn.h); + menu->menuTitle.setFrame(cn.x, cn.y, cn.w, cn.h); else - menu->MenuTitle.SetCaption(title); - MenuItemsPrepare(totalitems); + menu->menuTitle.setCaption(fTitle); + menuItemsPrepare(totalitems); } return NotCurrent; } -void ResetMenu(MenuClass* &menu) { +void resetMenu(Menu* &menu) { if (menu) { menu->topline = 0; menu->selected = 0; } } -void InvalidateMenu() { - ResetMenu(CurrentMenu); - CurrentMenu = nullptr; +void invalidateMenu() { + resetMenu(currentMenu); + currentMenu = nullptr; } -void UpdateMenu(MenuClass* &menu) { +void updateMenu(Menu* &menu) { if (!menu) return; - if (CurrentMenu != menu) { - PreviousMenu = CurrentMenu; - CurrentMenu = menu; + if (currentMenu != menu) { + previousMenu = currentMenu; + currentMenu = menu; } menu->draw(); } void ReDrawMenu(bool force/*=false*/) { - if (CurrentMenu && (force || checkkey == Menu)) CurrentMenu->draw(); + if (currentMenu && (force || checkkey == ID_Menu)) currentMenu->draw(); if (force) DrawItemEdit(true); } void ReDrawItem() { - static_cast(CurrentMenu->SelectedItem())->redraw(false); + static_cast(currentMenu->selectedItem())->redraw(false); } #endif // DWIN_LCD_PROUI diff --git a/Marlin/src/lcd/e3v2/proui/menus.h b/Marlin/src/lcd/e3v2/proui/menus.h index f0855e707343..58dd92f0f6ac 100644 --- a/Marlin/src/lcd/e3v2/proui/menus.h +++ b/Marlin/src/lcd/e3v2/proui/menus.h @@ -37,154 +37,154 @@ #endif typedef struct { - int32_t MaxValue = 0; // Auxiliar max integer/scaled float value - int32_t MinValue = 0; // Auxiliar min integer/scaled float value + int32_t maxValue = 0; // Auxiliar max integer/scaled float value + int32_t minValue = 0; // Auxiliar min integer/scaled float value int8_t dp = 0; // Auxiliar decimal places - int32_t Value = 0; // Auxiliar integer / scaled float value - int16_t *P_Int = nullptr; // Auxiliar pointer to 16 bit integer variable - float *P_Float = nullptr; // Auxiliar pointer to float variable - void (*Apply)() = nullptr; // Auxiliar apply function - void (*LiveUpdate)() = nullptr; // Auxiliar live update function + int32_t value = 0; // Auxiliar integer / scaled float value + int16_t *intPtr = nullptr; // Auxiliar pointer to 16 bit integer variable + float *floatPtr = nullptr; // Auxiliar pointer to float variable + void (*apply)() = nullptr; // Auxiliar apply function + void (*liveUpdate)() = nullptr; // Auxiliar live update function } MenuData_t; -extern MenuData_t MenuData; +extern MenuData_t menuData; // Auxiliary Macros =========================================================== // Create and add a MenuItem object to the menu array -#define SET_MENU(I,L,V) SetMenu(I, GET_TEXT_F(L), V) -#define SET_MENU_F(I,L,V) SetMenu(I, F(L), V) -#define SET_MENU_R(I,R,L,V) SetMenu(I, R, GET_TEXT_F(L), V) +#define SET_MENU(I,L,V) setMenu(I, GET_TEXT_F(L), V) +#define SET_MENU_F(I,L,V) setMenu(I, F(L), V) +#define SET_MENU_R(I,R,L,V) setMenu(I, R, GET_TEXT_F(L), V) -#define BACK_ITEM(H) MenuItemAdd(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, H) -#define MENU_ITEM(I,L,V...) MenuItemAdd(I, GET_TEXT_F(L), V) -#define EDIT_ITEM(I,L,V...) EditItemAdd(I, GET_TEXT_F(L), V) -#define MENU_ITEM_F(I,L,V...) MenuItemAdd(I, F(L), V) -#define EDIT_ITEM_F(I,L,V...) EditItemAdd(I, F(L), V) +#define BACK_ITEM(H) menuItemAdd(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, H) +#define MENU_ITEM(I,L,V...) menuItemAdd(I, GET_TEXT_F(L), V) +#define EDIT_ITEM(I,L,V...) editItemAdd(I, GET_TEXT_F(L), V) +#define MENU_ITEM_F(I,L,V...) menuItemAdd(I, F(L), V) +#define EDIT_ITEM_F(I,L,V...) editItemAdd(I, F(L), V) // Menu Classes =============================================================== -class CustomMenuItemClass; -class MenuItemClass; +class CustomMenuItem; +class MenuItem; -typedef void (*OnDrawCustomItem)(CustomMenuItemClass* menuitem, int8_t line); -typedef void (*OnDrawItem)(MenuItemClass* menuitem, int8_t line); +typedef void (*OnDrawCustomItem)(CustomMenuItem* menuitem, int8_t line); +typedef void (*OnDrawItem)(MenuItem* menuitem, int8_t line); typedef void (*OnClickItem)(); -class CustomMenuItemClass { +class CustomMenuItem { public: int8_t pos = 0; OnDrawItem onDraw = nullptr; void (*onClick)() = nullptr; - CustomMenuItemClass() {}; - CustomMenuItemClass(OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); - virtual ~CustomMenuItemClass(){}; + CustomMenuItem() {}; + CustomMenuItem(OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); + virtual ~CustomMenuItem(){}; virtual void draw(int8_t line); void redraw(bool erase=false); }; -class MenuItemClass: public CustomMenuItemClass { +class MenuItem: public CustomMenuItem { public: uint8_t icon = 0; char caption[MENU_CHAR_LIMIT] = ""; uint8_t frameid = 0; rect_t frame = {0}; - using CustomMenuItemClass::CustomMenuItemClass; - MenuItemClass(uint8_t cicon, const char * const text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); - MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); - void SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); - void SetCaption(const char * const text = nullptr); + using CustomMenuItem::CustomMenuItem; + MenuItem(uint8_t cicon, const char * const text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); + MenuItem(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); + void setFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); + void setCaption(const char * const text = nullptr); }; -class MenuItemPtrClass: public MenuItemClass { +class MenuItemPtr: public MenuItem { public: void *value = nullptr; - using MenuItemClass::MenuItemClass; - MenuItemPtrClass(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val); - MenuItemPtrClass(uint8_t cicon, FSTR_P text, OnDrawItem ondraw, OnClickItem onclick, void* val) : MenuItemPtrClass(cicon, FTOP(text), ondraw, onclick, val){} + using MenuItem::MenuItem; + MenuItemPtr(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val); + MenuItemPtr(uint8_t cicon, FSTR_P text, OnDrawItem ondraw, OnClickItem onclick, void* val) : MenuItemPtr(cicon, FTOP(text), ondraw, onclick, val){} }; -class MenuClass { +class Menu { public: int8_t topline = 0; int8_t selected = 0; - TitleClass MenuTitle; - MenuClass(); - virtual ~MenuClass(){}; + Title menuTitle; + Menu(); + virtual ~Menu(){}; inline int8_t line() { return selected - topline; }; inline int8_t line(uint8_t pos) {return pos - topline; }; int8_t count(); virtual void draw(); virtual void onScroll(bool dir); void onClick(); - CustomMenuItemClass* SelectedItem(); - static CustomMenuItemClass** Items(); + CustomMenuItem* selectedItem(); + static CustomMenuItem** items(); }; -extern MenuClass *CurrentMenu; -extern MenuClass *PreviousMenu; +extern Menu *currentMenu; +extern Menu *previousMenu; // Menuitem Drawing functions ================================================= -void Draw_Title(TitleClass* title); -void Draw_Menu_Cursor(const int8_t line); -void Erase_Menu_Cursor(const int8_t line); -void Erase_Menu_Text(const int8_t line); -void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false, bool selected=false); -void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, FSTR_P label=nullptr, bool more=false, bool selected=false); -void Draw_Chkb_Line(const uint8_t line, const bool checked); -void Show_Chkb_Line(const bool checked); -void Toggle_Chkb_Line(bool &checked); -void Draw_Menu_IntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value=0); -void onDrawMenuItem(MenuItemClass* menuitem, int8_t line); -void onDrawSubMenu(MenuItemClass* menuitem, int8_t line); -void onDrawIntMenu(MenuItemClass* menuitem, int8_t line, int32_t value); -void onDrawPIntMenu(MenuItemClass* menuitem, int8_t line); -void onDrawPInt8Menu(MenuItemClass* menuitem, int8_t line); -void onDrawPInt32Menu(MenuItemClass* menuitem, int8_t line); -void onDrawFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp, const float value); -void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp); -inline void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, UNITFDIGITS); }; -inline void onDrawPFloat2Menu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 2); }; -inline void onDrawPFloat3Menu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 3); }; -inline void onDrawPFloat4Menu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 4); }; -void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line, bool checked); -void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line); +void drawTitle(Title* aTitle); +void drawMenuCursor(const int8_t line); +void eraseMenuCursor(const int8_t line); +void eraseMenuText(const int8_t line); +void drawMenuLine(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false, bool selected=false); +void drawMenuLine(const uint8_t line, const uint8_t icon=0, FSTR_P label=nullptr, bool more=false, bool selected=false); +void drawCheckboxLine(const uint8_t line, const bool checked); +void showCheckboxLine(const bool checked); +void toggleCheckboxLine(bool &checked); +void drawMenuIntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value=0); +void onDrawMenuItem(MenuItem* menuitem, int8_t line); +void onDrawSubMenu(MenuItem* menuitem, int8_t line); +void onDrawIntMenu(MenuItem* menuitem, int8_t line, int32_t value); +void onDrawPIntMenu(MenuItem* menuitem, int8_t line); +void onDrawPInt8Menu(MenuItem* menuitem, int8_t line); +void onDrawPInt32Menu(MenuItem* menuitem, int8_t line); +void onDrawFloatMenu(MenuItem* menuitem, int8_t line, uint8_t dp, const float value); +void onDrawPFloatMenu(MenuItem* menuitem, int8_t line, uint8_t dp); +inline void onDrawPFloatMenu(MenuItem* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, UNITFDIGITS); }; +inline void onDrawPFloat2Menu(MenuItem* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 2); }; +inline void onDrawPFloat3Menu(MenuItem* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 3); }; +inline void onDrawPFloat4Menu(MenuItem* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 4); }; +void onDrawChkbMenu(MenuItem* menuitem, int8_t line, bool checked); +void onDrawChkbMenu(MenuItem* menuitem, int8_t line); // On click functions ========================================================= -void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr); -void SetValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr); -void SetValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr); -void SetIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr); -void SetPIntOnClick(const int32_t lo, const int32_t hi, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr); -void SetFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr); -void SetPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr); +void setOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr); +void setValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr); +void setValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr); +void setIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr); +void setPIntOnClick(const int32_t lo, const int32_t hi, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr); +void setFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr); +void setPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr); // HMI user control functions ================================================= -void HMI_Menu(); -void HMI_SetDraw(); -void HMI_SetNoDraw(); -void HMI_SetPInt(); -void HMI_SetPFloat(); +void hmiMenu(); +void hmiSetDraw(); +void hmiSetNoDraw(); +void hmiSetPInt(); +void hmiSetPFloat(); // Menu auxiliary functions =================================================== // Initialize menu -void InitMenu(); +void initMenu(); // Create a new menu -bool SetMenu(MenuClass* &menu, FSTR_P title, int8_t totalitems); -bool SetMenu(MenuClass* &menu, frame_rect_t cn, FSTR_P title, int8_t totalitems); +bool setMenu(Menu* &menu, FSTR_P fTitle, int8_t totalitems); +bool setMenu(Menu* &menu, frame_rect_t cn, FSTR_P fTitle, int8_t totalitems); // Reset top line and selected item -void ResetMenu(MenuClass* &menu); +void resetMenu(Menu* &menu); -// Invalidate CurrentMenu to prepare for full menu drawing -void InvalidateMenu(); +// Invalidate currentMenu to prepare for full menu drawing +void invalidateMenu(); //Update the Menu and Draw if it is valid -void UpdateMenu(MenuClass* &menu); +void updateMenu(Menu* &menu); //Redraw the current Menu if it is valid void ReDrawMenu(bool force=false); @@ -192,23 +192,23 @@ void ReDrawMenu(bool force=false); //Redraw selected menu item void ReDrawItem(); -// Clear MenuItems array and free MenuItems elements -void MenuItemsClear(); +// Clear menuItems array and free menuItems elements +void menuItemsClear(); -// Prepare MenuItems array -void MenuItemsPrepare(int8_t totalitems); +// Prepare menuItems array +void menuItemsPrepare(int8_t totalitems); // Is the current menu = menu? -bool IsMenu(MenuClass* menu); +bool isMenu(Menu* menu); -// Add elements to the MenuItems array -CustomMenuItemClass* MenuItemAdd(OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); -MenuItemClass* MenuItemAdd(uint8_t cicon, const char * const text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); -inline MenuItemClass* MenuItemAdd(uint8_t cicon, FSTR_P text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr) { - return MenuItemAdd(cicon, FTOP(text), ondraw, onclick); +// Add elements to the menuItems array +CustomMenuItem* menuItemAdd(OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); +MenuItem* menuItemAdd(uint8_t cicon, const char * const text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); +inline MenuItem* menuItemAdd(uint8_t cicon, FSTR_P text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr) { + return menuItemAdd(cicon, FTOP(text), ondraw, onclick); } -MenuItemClass* MenuItemAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); -MenuItemClass* EditItemAdd(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val); -inline MenuItemClass* EditItemAdd(uint8_t cicon, FSTR_P text, OnDrawItem ondraw, OnClickItem onclick, void* val) { - return EditItemAdd(cicon, FTOP(text), ondraw, onclick, val); +MenuItem* menuItemAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); +MenuItem* editItemAdd(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val); +inline MenuItem* editItemAdd(uint8_t cicon, FSTR_P text, OnDrawItem ondraw, OnClickItem onclick, void* val) { + return editItemAdd(cicon, FTOP(text), ondraw, onclick, val); } diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp index 086795d943c5..2781ccaa1df7 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp @@ -56,101 +56,101 @@ uint8_t rmax; // Maximum radius constexpr uint8_t meshfont = TERN(TJC_DISPLAY, font8x16, font6x12); -MeshViewerClass MeshViewer; +MeshViewer meshViewer; -float MeshViewerClass::max, MeshViewerClass::min; +float MeshViewer::max, MeshViewer::min; -void MeshViewerClass::DrawMeshGrid(const uint8_t csizex, const uint8_t csizey) { +void MeshViewer::drawMeshGrid(const uint8_t csizex, const uint8_t csizey) { sizex = csizex; sizey = csizey; rmax = _MIN(margin - 2, 0.5 * (width) / (sizex - 1)); min = 100; max = -100; - DWINUI::ClearMainArea(); - dwinDrawRectangle(0, HMI_data.SplitLine_Color, px(0), py(0), px(sizex - 1), py(sizey - 1)); - for (uint8_t x = 1; x < sizex - 1; ++x) dwinDrawVLine(HMI_data.SplitLine_Color, px(x), py(sizey - 1), width); - for (uint8_t y = 1; y < sizey - 1; ++y) dwinDrawHLine(HMI_data.SplitLine_Color, px(0), py(y), width); + DWINUI::clearMainArea(); + dwinDrawRectangle(0, hmiData.colorSplitLine, px(0), py(0), px(sizex - 1), py(sizey - 1)); + for (uint8_t x = 1; x < sizex - 1; ++x) dwinDrawVLine(hmiData.colorSplitLine, px(x), py(sizey - 1), width); + for (uint8_t y = 1; y < sizey - 1; ++y) dwinDrawHLine(hmiData.colorSplitLine, px(0), py(y), width); } -void MeshViewerClass::DrawMeshPoint(const uint8_t x, const uint8_t y, const float z) { +void MeshViewer::drawMeshPoint(const uint8_t x, const uint8_t y, const float z) { const uint8_t fs = DWINUI::fontWidth(meshfont); const int16_t v = isnan(z) ? 0 : round(z * 100); NOLESS(max, z); NOMORE(min, z); const uint16_t color = DWINUI::RainbowInt(v, zmin, zmax); - DWINUI::Draw_FillCircle(color, px(x), py(y), r(_MAX(_MIN(v,zmax),zmin))); + DWINUI::drawFillCircle(color, px(x), py(y), r(_MAX(_MIN(v,zmax),zmin))); TERN_(TJC_DISPLAY, delay(100)); if (sizex < (ENABLED(TJC_DISPLAY) ? 8 : 9)) { - if (v == 0) DWINUI::Draw_Float(meshfont, 1, 2, px(x) - 2*fs, py(y) - fs, 0); - else DWINUI::Draw_Signed_Float(meshfont, 1, 2, px(x) - 3*fs, py(y) - fs, z); + if (v == 0) DWINUI::drawFloat(meshfont, 1, 2, px(x) - 2*fs, py(y) - fs, 0); + else DWINUI::drawSignedFloat(meshfont, 1, 2, px(x) - 3*fs, py(y) - fs, z); } else { char str_1[9]; str_1[0] = '\0'; switch (v) { case -999 ... -100: - DWINUI::Draw_Signed_Float(meshfont, 1, 1, px(x) - 3*fs, py(y) - fs, z); + DWINUI::drawSignedFloat(meshfont, 1, 1, px(x) - 3*fs, py(y) - fs, z); break; case -99 ... -1: sprintf_P(str_1, PSTR("-.%02i"), -v); break; case 0: - dwinDrawString(false, meshfont, DWINUI::textcolor, DWINUI::backcolor, px(x) - 4, py(y) - fs, "0"); + dwinDrawString(false, meshfont, DWINUI::textColor, DWINUI::backColor, px(x) - 4, py(y) - fs, "0"); break; case 1 ... 99: sprintf_P(str_1, PSTR(".%02i"), v); break; case 100 ... 999: - DWINUI::Draw_Signed_Float(meshfont, 1, 1, px(x) - 3 * fs, py(y) - fs, z); + DWINUI::drawSignedFloat(meshfont, 1, 1, px(x) - 3 * fs, py(y) - fs, z); break; } if (str_1[0]) - dwinDrawString(false, meshfont, DWINUI::textcolor, DWINUI::backcolor, px(x) - 2 * fs, py(y) - fs, str_1); + dwinDrawString(false, meshfont, DWINUI::textColor, DWINUI::backColor, px(x) - 2 * fs, py(y) - fs, str_1); } } -void MeshViewerClass::DrawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey) { - DrawMeshGrid(csizex, csizey); +void MeshViewer::drawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey) { + drawMeshGrid(csizex, csizey); for (uint8_t y = 0; y < csizey; ++y) { hal.watchdog_refresh(); - for (uint8_t x = 0; x < csizex; ++x) DrawMeshPoint(x, y, zval[x][y]); + for (uint8_t x = 0; x < csizex; ++x) drawMeshPoint(x, y, zval[x][y]); } } -void MeshViewerClass::Draw(const bool withsave/*=false*/, const bool redraw/*=true*/) { - Title.ShowCaption(GET_TEXT_F(MSG_MESH_VIEWER)); +void MeshViewer::draw(const bool withsave/*=false*/, const bool redraw/*=true*/) { + title.showCaption(GET_TEXT_F(MSG_MESH_VIEWER)); #if ENABLED(USE_GRID_MESHVIEWER) - DWINUI::ClearMainArea(); + DWINUI::clearMainArea(); bedLevelTools.viewer_print_value = true; - bedLevelTools.Draw_Bed_Mesh(-1, 1, 8, 10 + TITLE_HEIGHT); + bedLevelTools.drawBedMesh(-1, 1, 8, 10 + TITLE_HEIGHT); #else - if (redraw) DrawMesh(bedlevel.z_values, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y); - else DWINUI::Draw_Box(1, HMI_data.Background_Color, { 89, 305, 99, 38 }); + if (redraw) drawMesh(bedlevel.z_values, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y); + else DWINUI::drawBox(1, hmiData.colorBackground, { 89, 305, 99, 38 }); #endif if (withsave) { - DWINUI::Draw_Button(BTN_Save, 26, 305); - DWINUI::Draw_Button(BTN_Continue, 146, 305); - Draw_Select_Highlight(hmiFlag.select_flag, 305); + DWINUI::drawButton(BTN_Save, 26, 305); + DWINUI::drawButton(BTN_Continue, 146, 305); + drawSelectHighlight(hmiFlag.select_flag, 305); } else - DWINUI::Draw_Button(BTN_Continue, 86, 305); + DWINUI::drawButton(BTN_Continue, 86, 305); #if ENABLED(USE_GRID_MESHVIEWER) - bedLevelTools.Set_Mesh_Viewer_Status(); + bedLevelTools.setMeshViewerStatus(); #else char str_1[6], str_2[6] = ""; ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"), dtostrf(min, 1, 2, str_1), dtostrf(max, 1, 2, str_2)); #endif } -void Draw_MeshViewer() { MeshViewer.Draw(true, meshredraw); } +void drawMeshViewer() { meshViewer.draw(true, meshredraw); } -void onClick_MeshViewer() { if (hmiFlag.select_flag) SaveMesh(); HMI_ReturnScreen(); } +void onClick_MeshViewer() { if (hmiFlag.select_flag) saveMesh(); hmiReturnScreen(); } -void Goto_MeshViewer(const bool redraw) { +void gotoMeshViewer(const bool redraw) { meshredraw = redraw; - if (leveling_is_valid()) Goto_Popup(Draw_MeshViewer, onClick_MeshViewer); - else HMI_ReturnScreen(); + if (leveling_is_valid()) gotoPopup(drawMeshViewer, onClick_MeshViewer); + else hmiReturnScreen(); } #endif // DWIN_LCD_PROUI && HAS_MESH diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.h b/Marlin/src/lcd/e3v2/proui/meshviewer.h index 1f45a834809b..f73f1da86e1c 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.h +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.h @@ -28,15 +28,15 @@ * Date: 2023/05/05 */ -class MeshViewerClass { +class MeshViewer { public: static float max, min; - static void DrawMeshGrid(const uint8_t csizex, const uint8_t csizey); - static void DrawMeshPoint(const uint8_t x, const uint8_t y, const float z); - static void Draw(const bool withsave=false, const bool redraw=true); - static void DrawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey); + static void drawMeshGrid(const uint8_t csizex, const uint8_t csizey); + static void drawMeshPoint(const uint8_t x, const uint8_t y, const float z); + static void draw(const bool withsave=false, const bool redraw=true); + static void drawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey); }; -extern MeshViewerClass MeshViewer; +extern MeshViewer meshViewer; -void Goto_MeshViewer(const bool redraw); +void gotoMeshViewer(const bool redraw); diff --git a/Marlin/src/lcd/e3v2/proui/plot.cpp b/Marlin/src/lcd/e3v2/proui/plot.cpp index 45341ae62463..95d8ec291d1b 100644 --- a/Marlin/src/lcd/e3v2/proui/plot.cpp +++ b/Marlin/src/lcd/e3v2/proui/plot.cpp @@ -29,7 +29,7 @@ #include "../../../inc/MarlinConfig.h" -#if ALL(DWIN_LCD_PROUI, SHOW_TUNING_GRAPH) +#if ALL(DWIN_LCD_PROUI, PROUI_TUNING_GRAPH) #include "dwin.h" #include "../../../core/types.h" @@ -44,32 +44,32 @@ uint16_t grphpoints, r, x2, y2 = 0; frame_rect_t grphframe = {0}; float scale = 0; -void PlotClass::Draw(const frame_rect_t &frame, const_float_t max, const_float_t ref/*=0*/) { +void PlotClass::draw(const frame_rect_t &frame, const_float_t max, const_float_t ref/*=0*/) { grphframe = frame; grphpoints = 0; scale = frame.h / max; x2 = frame.x + frame.w - 1; y2 = frame.y + frame.h - 1; r = round((y2) - ref * scale); - DWINUI::Draw_Box(1, Plot_Bg_Color, frame); - for (uint8_t i = 1; i < 4; i++) if (i * 50 < frame.w) dwinDrawVLine(Line_Color, i * 50 + frame.x, frame.y, frame.h); - DWINUI::Draw_Box(0, Color_White, DWINUI::ExtendFrame(frame, 1)); - dwinDrawHLine(Color_Red, frame.x, r, frame.w); + DWINUI::drawBox(1, Plot_Bg_Color, frame); + for (uint8_t i = 1; i < 4; i++) if (i * 50 < frame.w) dwinDrawVLine(COLOR_LINE, i * 50 + frame.x, frame.y, frame.h); + DWINUI::drawBox(0, COLOR_WHITE, DWINUI::extendFrame(frame, 1)); + dwinDrawHLine(COLOR_RED, frame.x, r, frame.w); } -void PlotClass::Update(const_float_t value) { +void PlotClass::update(const_float_t value) { if (!scale) return; const uint16_t y = round((y2) - value * scale); if (grphpoints < grphframe.w) { - dwinDrawPoint(Color_Yellow, 1, 1, grphpoints + grphframe.x, y); + dwinDrawPoint(COLOR_YELLOW, 1, 1, grphpoints + grphframe.x, y); } else { dwinFrameAreaMove(1, 0, 1, Plot_Bg_Color, grphframe.x, grphframe.y, x2, y2); - if ((grphpoints % 50) == 0) dwinDrawVLine(Line_Color, x2 - 1, grphframe.y + 1, grphframe.h - 2); - dwinDrawPoint(Color_Red, 1, 1, x2 - 1, r); - dwinDrawPoint(Color_Yellow, 1, 1, x2 - 1, y); + if ((grphpoints % 50) == 0) dwinDrawVLine(COLOR_LINE, x2 - 1, grphframe.y + 1, grphframe.h - 2); + dwinDrawPoint(COLOR_RED, 1, 1, x2 - 1, r); + dwinDrawPoint(COLOR_YELLOW, 1, 1, x2 - 1, y); } grphpoints++; } -#endif // DWIN_LCD_PROUI && SHOW_TUNING_GRAPH +#endif // DWIN_LCD_PROUI && PROUI_TUNING_GRAPH diff --git a/Marlin/src/lcd/e3v2/proui/plot.h b/Marlin/src/lcd/e3v2/proui/plot.h index 144ba0073b4d..bc0e3a774ccd 100644 --- a/Marlin/src/lcd/e3v2/proui/plot.h +++ b/Marlin/src/lcd/e3v2/proui/plot.h @@ -32,8 +32,8 @@ class PlotClass { public: - static void Draw(const frame_rect_t &frame, const_float_t max, const_float_t ref=0); - static void Update(const_float_t value); + static void draw(const frame_rect_t &frame, const_float_t max, const_float_t ref=0); + static void update(const_float_t value); }; extern PlotClass plot; diff --git a/Marlin/src/lcd/e3v2/proui/printstats.cpp b/Marlin/src/lcd/e3v2/proui/printstats.cpp index 993b5b7b70f1..732e80542d16 100644 --- a/Marlin/src/lcd/e3v2/proui/printstats.cpp +++ b/Marlin/src/lcd/e3v2/proui/printstats.cpp @@ -40,43 +40,43 @@ #include "dwin.h" #include "dwin_popup.h" -PrintStatsClass PrintStats; +PrintStats printStats; -void PrintStatsClass::Draw() { +void PrintStats::draw() { char str[30] = ""; constexpr int8_t MRG = 30; - Title.ShowCaption(GET_TEXT_F(MSG_INFO_STATS_MENU)); - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); - DWINUI::Draw_Button(BTN_Continue, 86, 250); + title.showCaption(GET_TEXT_F(MSG_INFO_STATS_MENU)); + DWINUI::clearMainArea(); + drawPopupBkgd(); + DWINUI::drawButton(BTN_Continue, 86, 250); printStatistics ps = print_job_timer.getStats(); - DWINUI::Draw_String(MRG, 80, TS(GET_TEXT_F(MSG_INFO_PRINT_COUNT), F(": "), ps.totalPrints)); - DWINUI::Draw_String(MRG, 100, TS(GET_TEXT_F(MSG_INFO_COMPLETED_PRINTS), F(": "), ps.finishedPrints)); + DWINUI::drawString(MRG, 80, TS(GET_TEXT_F(MSG_INFO_PRINT_COUNT), F(": "), ps.totalPrints)); + DWINUI::drawString(MRG, 100, TS(GET_TEXT_F(MSG_INFO_COMPLETED_PRINTS), F(": "), ps.finishedPrints)); duration_t(print_job_timer.getStats().printTime).toDigital(str, true); - DWINUI::Draw_String(MRG, 120, MString<50>(GET_TEXT_F(MSG_INFO_PRINT_TIME), F(": "), str)); + DWINUI::drawString(MRG, 120, MString<50>(GET_TEXT_F(MSG_INFO_PRINT_TIME), F(": "), str)); duration_t(print_job_timer.getStats().longestPrint).toDigital(str, true); - DWINUI::Draw_String(MRG, 140, MString<50>(GET_TEXT(MSG_INFO_PRINT_LONGEST), F(": "), str)); - DWINUI::Draw_String(MRG, 160, TS(GET_TEXT_F(MSG_INFO_PRINT_FILAMENT), F(": "), p_float_t(ps.filamentUsed / 1000, 2), F(" m"))); + DWINUI::drawString(MRG, 140, MString<50>(GET_TEXT(MSG_INFO_PRINT_LONGEST), F(": "), str)); + DWINUI::drawString(MRG, 160, TS(GET_TEXT_F(MSG_INFO_PRINT_FILAMENT), F(": "), p_float_t(ps.filamentUsed / 1000, 2), F(" m"))); } -void PrintStatsClass::Reset() { +void PrintStats::reset() { print_job_timer.initStats(); DONE_BUZZ(true); } -void Goto_PrintStats() { - PrintStats.Draw(); - HMI_SaveProcessID(WaitResponse); +void gotoPrintStats() { + printStats.draw(); + hmiSaveProcessID(ID_WaitResponse); } // Print Stats Reset popup -void Popup_ResetStats() { DWIN_Popup_ConfirmCancel(ICON_Info_0, GET_TEXT_F(MSG_RESET_STATS)); } -void OnClick_ResetStats() { - if (hmiFlag.select_flag) PrintStatsClass::Reset(); - HMI_ReturnScreen(); +void popupResetStats() { dwinPopupConfirmCancel(ICON_Info_0, GET_TEXT_F(MSG_RESET_STATS)); } +void onClickResetStats() { + if (hmiFlag.select_flag) printStats.reset(); + hmiReturnScreen(); } -void PrintStatsReset() { Goto_Popup(Popup_ResetStats, OnClick_ResetStats); } +void printStatsReset() { gotoPopup(popupResetStats, onClickResetStats); } #endif // DWIN_LCD_PROUI && PRINTCOUNTER diff --git a/Marlin/src/lcd/e3v2/proui/printstats.h b/Marlin/src/lcd/e3v2/proui/printstats.h index aadb3e8dceed..133e9eb96e17 100644 --- a/Marlin/src/lcd/e3v2/proui/printstats.h +++ b/Marlin/src/lcd/e3v2/proui/printstats.h @@ -28,13 +28,13 @@ * Date: 2022/12/03 */ -class PrintStatsClass { +class PrintStats { public: - static void Draw(); - static void Reset(); + static void draw(); + static void reset(); }; -extern PrintStatsClass PrintStats; +extern PrintStats printStats; -void Goto_PrintStats(); -void PrintStatsReset(); +void gotoPrintStats(); +void printStatsReset(); diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 8517e2ec2324..f8fde2177738 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1600,7 +1600,7 @@ void MarlinUI::host_status() { TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message)); TERN_(DWIN_CREALITY_LCD, dwinStatusChanged(status_message)); - TERN_(DWIN_LCD_PROUI, DWIN_CheckStatusMessage()); + TERN_(DWIN_LCD_PROUI, dwinCheckStatusMessage()); TERN_(DWIN_CREALITY_LCD_JYERSUI, jyersDWIN.updateStatus(status_message)); } diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index 1e6d02d2a7c8..9d5da849e5a9 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -413,7 +413,7 @@ void restore_feedrate_and_scaling(); #if HAS_Z_AXIS #if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - #define Z_POST_CLEARANCE HMI_data.z_after_homing + #define Z_POST_CLEARANCE hmiData.z_after_homing #elif defined(Z_AFTER_HOMING) #define Z_POST_CLEARANCE Z_AFTER_HOMING #else diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index e426e3bb4bdd..b3872146d136 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -377,7 +377,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(ds_str)); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(ds_str)); - TERN_(DWIN_LCD_PROUI, DWIN_Popup_Confirm(ICON_BLTouch, ds_str, FPSTR(CONTINUE_STR))); + TERN_(DWIN_LCD_PROUI, dwinPopupConfirm(ICON_BLTouch, ds_str, FPSTR(CONTINUE_STR))); TERN_(HAS_RESUME_CONTINUE, wait_for_user_response()); ui.reset_status(); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 7ef697014199..479b43c4bd7d 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -1610,7 +1610,7 @@ void MarlinSettings::postprocess() { { _FIELD_TEST(dwin_data); char dwin_data[eeprom_data_size] = { 0 }; - DWIN_CopySettingsTo(dwin_data); + dwinCopySettingsTo(dwin_data); EEPROM_WRITE(dwin_data); } #endif @@ -2675,7 +2675,7 @@ void MarlinSettings::postprocess() { const char dwin_data[eeprom_data_size] = { 0 }; _FIELD_TEST(dwin_data); EEPROM_READ(dwin_data); - if (!validating) DWIN_CopySettingsFrom(dwin_data); + if (!validating) dwinCopySettingsFrom(dwin_data); } #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) { @@ -3022,7 +3022,7 @@ void MarlinSettings::postprocess() { #endif #if ENABLED(DWIN_LCD_PROUI) - status = !bedLevelTools.meshvalidate(); + status = !bedLevelTools.meshValidate(); if (status) { bedlevel.invalidate(); LCD_MESSAGE(MSG_UBL_MESH_INVALID); @@ -3559,7 +3559,7 @@ void MarlinSettings::reset() { // // Ender-3 V2 with ProUI // - TERN_(DWIN_LCD_PROUI, DWIN_SetDataDefaults()); + TERN_(DWIN_LCD_PROUI, dwinSetDataDefaults()); // // Model predictive control diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 5d48b20ee8e8..6133b6e39b08 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -2639,7 +2639,7 @@ hal_timer_t Stepper::block_phase_isr() { oversampling_factor = 0; // Assume no axis smoothing (via oversampling) // Decide if axis smoothing is possible uint32_t max_rate = current_block->nominal_rate; // Get the step event rate - if (TERN1(DWIN_LCD_PROUI, HMI_data.AdaptiveStepSmoothing)) { + if (TERN1(DWIN_LCD_PROUI, hmiData.adaptiveStepSmoothing)) { while (max_rate < MIN_STEP_ISR_FREQUENCY) { // As long as more ISRs are possible... max_rate <<= 1; // Try to double the rate if (max_rate < MIN_STEP_ISR_FREQUENCY) // Don't exceed the estimated ISR limit diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index c38d4968c9ca..e209d6f83519 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -723,12 +723,12 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(HAS_FAN_LOGIC, fan_update_ms = next_temp_ms + fan_update_interval_ms); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_STARTED)); - TERN_(DWIN_PID_TUNE, DWIN_PidTuning(isbed ? PIDTEMPBED_START : PIDTEMP_START)); + TERN_(PROUI_PID_TUNE, dwinPidTuning(isbed ? PIDTEMPBED_START : PIDTEMP_START)); if (target > GHV(CHAMBER_MAX_TARGET, BED_MAX_TARGET, temp_range[heater_id].maxtemp - (HOTEND_OVERSHOOT))) { SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); - TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); + TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); return; } @@ -820,7 +820,7 @@ volatile bool Temperature::raw_temps_ready = false; if (current_temp > target + MAX_OVERSHOOT_PID_AUTOTUNE) { SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); - TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); + TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); break; } @@ -857,7 +857,7 @@ volatile bool Temperature::raw_temps_ready = false; #endif if ((ms - _MIN(t1, t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) { TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0)); - TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_TUNING_TIMEOUT)); + TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_TUNING_TIMEOUT)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TIMEOUT))); SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TIMEOUT); @@ -910,7 +910,7 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(color)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE)); - TERN_(DWIN_PID_TUNE, DWIN_PidTuning(AUTOTUNE_DONE)); + TERN_(PROUI_PID_TUNE, dwinPidTuning(AUTOTUNE_DONE)); goto EXIT_M303; } @@ -928,7 +928,7 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(color)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE)); - TERN_(DWIN_PID_TUNE, DWIN_PidTuning(AUTOTUNE_DONE)); + TERN_(PROUI_PID_TUNE, dwinPidTuning(AUTOTUNE_DONE)); EXIT_M303: TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = true); @@ -1147,7 +1147,7 @@ volatile bool Temperature::raw_temps_ready = false; // Ensure we don't drift too far from the window between the last sampled temp and the target temperature if (!WITHIN(current_temp, get_sample_3_temp() - 15.0f, hotend.target + 15.0f)) { SERIAL_ECHOLNPGM(STR_MPC_TEMPERATURE_ERROR); - TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_TEMP_ERROR)); + TERN_(DWIN_LCD_PROUI, dwinMPCTuning(MPC_TEMP_ERROR)); wait_for_heatup = false; return FAILED; } @@ -1187,7 +1187,7 @@ volatile bool Temperature::raw_temps_ready = false; if (!wait_for_heatup) { SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_INTERRUPTED); - TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_INTERRUPTED)); + TERN_(DWIN_LCD_PROUI, dwinMPCTuning(MPC_INTERRUPTED)); return MeasurementState::CANCELLED; } @@ -1215,7 +1215,7 @@ volatile bool Temperature::raw_temps_ready = false; // Determine ambient temperature. SERIAL_ECHOLNPGM(STR_MPC_COOLING_TO_AMBIENT); #if ENABLED(DWIN_LCD_PROUI) - DWIN_MPCTuning(MPCTEMP_START); + dwinMPCTuning(MPCTEMP_START); LCD_ALERTMESSAGE(MSG_MPC_COOLING_TO_AMBIENT); #else LCD_MESSAGE(MSG_COOLING); @@ -1305,7 +1305,7 @@ volatile bool Temperature::raw_temps_ready = false; } SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_FINISHED); - TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(AUTOTUNE_DONE)); + TERN_(DWIN_LCD_PROUI, dwinMPCTuning(AUTOTUNE_DONE)); SERIAL_ECHOLNPGM("MPC_BLOCK_HEAT_CAPACITY ", mpc.block_heat_capacity); SERIAL_ECHOLNPGM("MPC_SENSOR_RESPONSIVENESS ", p_float_t(mpc.sensor_responsiveness, 4));