🚸 Enhanced UI => Professional UI - with updates (#23624)

This commit is contained in:
Scott Lahteine 2022-02-05 10:30:17 -06:00 committed by GitHub
parent 6af5cb295c
commit 0564cb188f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 319 additions and 178 deletions

View file

@ -75,7 +75,7 @@
#if ENABLED(DWIN_CREALITY_LCD)
#include "lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "lcd/e3v2/enhanced/dwin.h"
#include "lcd/e3v2/proui/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "lcd/e3v2/jyersui/dwin.h"
#endif

View file

@ -58,7 +58,7 @@
#if ENABLED(EXTENSIBLE_UI)
#include "../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../lcd/e3v2/enhanced/dwin.h"
#include "../lcd/e3v2/proui/dwin.h"
#endif
#include "../lcd/marlinui.h"

View file

@ -69,7 +69,7 @@ bool FilamentMonitorBase::enabled = true,
#if ENABLED(EXTENSIBLE_UI)
#include "../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../lcd/e3v2/enhanced/dwin.h"
#include "../lcd/e3v2/proui/dwin.h"
#endif
void event_filament_runout(const uint8_t extruder) {

View file

@ -61,7 +61,7 @@
#elif ENABLED(DWIN_CREALITY_LCD)
#include "../../../lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../../lcd/e3v2/enhanced/dwin.h"
#include "../../../lcd/e3v2/proui/dwin.h"
#endif
#if HAS_MULTI_HOTEND

View file

@ -41,7 +41,7 @@
#if ENABLED(EXTENSIBLE_UI)
#include "../../../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../../lcd/e3v2/enhanced/dwin.h"
#include "../../../lcd/e3v2/proui/dwin.h"
#endif
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)

View file

@ -34,7 +34,7 @@
#if ENABLED(EXTENSIBLE_UI)
#include "../../../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../../lcd/e3v2/enhanced/dwin.h"
#include "../../../lcd/e3v2/proui/dwin.h"
#endif
/**

View file

@ -52,7 +52,7 @@
#elif ENABLED(DWIN_CREALITY_LCD)
#include "../../lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../lcd/e3v2/enhanced/dwin.h"
#include "../../lcd/e3v2/proui/dwin.h"
#endif
#if HAS_L64XX // set L6470 absolute position registers to counts

View file

@ -25,7 +25,7 @@
#if ENABLED(PLATFORM_M997_SUPPORT)
#if ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../lcd/e3v2/enhanced/dwin.h"
#include "../../lcd/e3v2/proui/dwin.h"
#endif
/**

View file

@ -34,7 +34,7 @@
#elif ENABLED(DWIN_CREALITY_LCD)
#include "../../../lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../../lcd/e3v2/enhanced/dwin.h"
#include "../../../lcd/e3v2/proui/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "../../../lcd/e3v2/jyersui/dwin.h" // Temporary fix until it can be better implemented
#endif

View file

@ -36,8 +36,8 @@
#elif ENABLED(EXTENSIBLE_UI)
#include "../../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../lcd/e3v2/enhanced/dwin_popup.h"
#include "../../lcd/e3v2/enhanced/dwin.h"
#include "../../lcd/e3v2/proui/dwin_popup.h"
#include "../../lcd/e3v2/proui/dwin.h"
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)

View file

@ -29,7 +29,7 @@
#include "../../sd/cardreader.h"
#if ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../lcd/e3v2/enhanced/dwin.h"
#include "../../lcd/e3v2/proui/dwin.h"
#endif
/**

View file

@ -50,7 +50,7 @@
#if ENABLED(EXTENSIBLE_UI)
#include "../../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../lcd/e3v2/enhanced/dwin.h"
#include "../../lcd/e3v2/proui/dwin.h"
#endif
#if ENABLED(HOST_ACTION_COMMANDS)

View file

@ -30,7 +30,7 @@
#include "../../MarlinCore.h" // for startOrResumeJob
#if ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../lcd/e3v2/enhanced/dwin.h"
#include "../../lcd/e3v2/proui/dwin.h"
#endif
/**

View file

@ -31,7 +31,7 @@
#if ENABLED(EXTENSIBLE_UI)
#include "../../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../lcd/e3v2/enhanced/dwin.h"
#include "../../lcd/e3v2/proui/dwin.h"
#endif
/**

View file

@ -494,6 +494,9 @@
#endif
#define HAS_LCD_BRIGHTNESS 1
#define LCD_BRIGHTNESS_MAX 250
#if ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#define LCD_BRIGHTNESS_DEFAULT 127
#endif
#endif
#if IS_ULTRA_LCD

View file

@ -607,6 +607,8 @@
#error "LCD_SCREEN_ROT_180 is now LCD_SCREEN_ROTATE with a value of 180."
#elif defined(LCD_SCREEN_ROT_270)
#error "LCD_SCREEN_ROT_270 is now LCD_SCREEN_ROTATE with a value of 270."
#elif defined(DEFAULT_LCD_BRIGHTNESS)
#error "DEFAULT_LCD_BRIGHTNESS is now LCD_BRIGHTNESS_DEFAULT."
#endif
#if MB(DUE3DOM_MINI) && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)

View file

@ -25,7 +25,16 @@
#define Language_English 1
#define Language_Chinese 2
#define ICON 7 // Icon set file 7.ICO
//#define USE_STOCK_DWIN_SET // Use the Creality stock DWIN_SET instead of Marlin's unified DWIN_SET by The-EG & thinkyhead
#ifdef USE_STOCK_DWIN_SET
#define ICON 9 // 9.ICO
#else
#define ICON 7 // 7.ICO
#endif
#ifndef CORP_WEBSITE
#define CORP_WEBSITE WEBSITE_URL
#endif
#define ICON_LOGO 0
#define ICON_Print_0 1

View file

@ -91,9 +91,6 @@
#ifndef MACHINE_SIZE
#define MACHINE_SIZE STRINGIFY(X_BED_SIZE) "x" STRINGIFY(Y_BED_SIZE) "x" STRINGIFY(Z_MAX_POS)
#endif
#ifndef CORP_WEBSITE
#define CORP_WEBSITE WEBSITE_URL
#endif
#define PAUSE_HEAT

View file

@ -82,10 +82,6 @@
#define MACHINE_SIZE STRINGIFY(X_BED_SIZE) "x" STRINGIFY(Y_BED_SIZE) "x" STRINGIFY(Z_MAX_POS)
#ifndef CORP_WEBSITE
#define CORP_WEBSITE WEBSITE_URL
#endif
#define DWIN_FONT_MENU font8x16
#define DWIN_FONT_STAT font10x20
#define DWIN_FONT_HEAD font10x20

View file

@ -21,10 +21,12 @@
*/
/**
* DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo
* Version: 3.9.1
* Date: 2021/11/21
* Enhanced DWIN implementation
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 3.11.2
* date: 2022/01/19
*
* Based on the original code provided by Creality under GPL
*/
#include "../../../inc/MarlinConfigPre.h"
@ -83,6 +85,10 @@
#include "../../../feature/powerloss.h"
#endif
#if HAS_GCODE_PREVIEW
#include "gcode_preview.h"
#endif
#if HAS_ESDIAG
#include "endstop_diag.h"
#endif
@ -113,10 +119,6 @@
#include "lockscreen.h"
#ifndef CORP_WEBSITE
#define CORP_WEBSITE WEBSITE_URL
#endif
#define PAUSE_HEAT
#define MENU_CHAR_LIMIT 24
@ -169,7 +171,7 @@ enum SelectItem : uint8_t {
PAGE_PRINT = 0,
PAGE_PREPARE,
PAGE_CONTROL,
PAGE_INFO_LEVELING,
PAGE_INFO_LEV_ADV,
PAGE_COUNT,
PRINT_SETUP = 0,
@ -310,11 +312,11 @@ void ICON_Button(const bool selected, const int iconid, const frame_rect_t &ico,
DWIN_ICON_Show(true, false, false, ICON, 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 - 28) - txt.h/2);
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);
}
else {
const uint16_t x = ico.x + (ico.w - strlen_P(FTOP(caption)) * DWINUI::fontWidth()) / 2,
y = (ico.y + ico.h - 28) - DWINUI::fontHeight() / 2;
y = (ico.y + ico.h - 20) - DWINUI::fontHeight() / 2;
DWINUI::Draw_String(x, y, caption);
}
}
@ -324,7 +326,7 @@ void ICON_Button(const bool selected, const int iconid, const frame_rect_t &ico,
//
void ICON_Print() {
constexpr frame_rect_t ico = { 17, 110, 110, 100 };
constexpr text_info_t txt = { 1, { 405, 447 }, 27, 15 };
constexpr text_info_t txt = { 1, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 };
ICON_Button(select_page.now == PAGE_PRINT, ICON_Print_0, ico, txt, GET_TEXT_F(MSG_BUTTON_PRINT));
}
@ -333,7 +335,7 @@ void ICON_Print() {
//
void ICON_Prepare() {
constexpr frame_rect_t ico = { 145, 110, 110, 100 };
constexpr text_info_t txt = { 31, { 405, 447 }, 27, 15 };
constexpr text_info_t txt = { 31, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 };
ICON_Button(select_page.now == PAGE_PREPARE, ICON_Prepare_0, ico, txt, GET_TEXT_F(MSG_PREPARE));
}
@ -342,7 +344,7 @@ void ICON_Prepare() {
//
void ICON_Control() {
constexpr frame_rect_t ico = { 17, 226, 110, 100 };
constexpr text_info_t txt = { 61, { 405, 447 }, 27, 15 };
constexpr text_info_t txt = { 61, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 };
ICON_Button(select_page.now == PAGE_CONTROL, ICON_Control_0, ico, txt, GET_TEXT_F(MSG_CONTROL));
}
@ -351,8 +353,8 @@ void ICON_Control() {
//
void ICON_StartInfo() {
constexpr frame_rect_t ico = { 145, 226, 110, 100 };
constexpr text_info_t txt = { 91, { 405, 447 }, 27, 15 };
ICON_Button(select_page.now == PAGE_INFO_LEVELING, ICON_Info_0, ico, txt, GET_TEXT_F(MSG_BUTTON_INFO));
constexpr text_info_t txt = { 91, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 };
ICON_Button(select_page.now == PAGE_INFO_LEV_ADV, ICON_Info_0, ico, txt, GET_TEXT_F(MSG_BUTTON_INFO));
}
//
@ -360,8 +362,17 @@ void ICON_StartInfo() {
//
void ICON_Leveling() {
constexpr frame_rect_t ico = { 145, 226, 110, 100 };
constexpr text_info_t txt = { 211, { 405, 447 }, 27, 15 };
ICON_Button(select_page.now == PAGE_INFO_LEVELING, ICON_Leveling_0, ico, txt, GET_TEXT_F(MSG_BUTTON_LEVEL));
constexpr text_info_t txt = { 211, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 };
ICON_Button(select_page.now == PAGE_INFO_LEV_ADV, ICON_Leveling_0, ico, txt, GET_TEXT_F(MSG_BUTTON_LEVEL));
}
//
// Main Menu: "Advanced Settings"
//
void ICON_AdvSettings() {
constexpr frame_rect_t ico = { 145, 226, 110, 100 };
constexpr text_info_t txt = { 91, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 };
ICON_Button(select_page.now == PAGE_INFO_LEV_ADV, ICON_Info_0, ico, txt, GET_TEXT_F(MSG_BUTTON_ADVANCED));
}
//
@ -369,7 +380,7 @@ void ICON_Leveling() {
//
void ICON_Tune() {
constexpr frame_rect_t ico = { 8, 232, 80, 100 };
constexpr text_info_t txt = { 121, { 405, 447 }, 27, 15 };
constexpr text_info_t txt = { 121, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 };
ICON_Button(select_print.now == PRINT_SETUP, ICON_Setup_0, ico, txt, GET_TEXT_F(MSG_TUNE));
}
@ -378,7 +389,7 @@ void ICON_Tune() {
//
void ICON_Pause() {
constexpr frame_rect_t ico = { 96, 232, 80, 100 };
constexpr text_info_t txt = { 181, { 405, 447 }, 27, 15 };
constexpr text_info_t txt = { 181, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 };
ICON_Button(select_print.now == PRINT_PAUSE_RESUME, ICON_Pause_0, ico, txt, GET_TEXT_F(MSG_BUTTON_PAUSE));
}
@ -387,7 +398,7 @@ void ICON_Pause() {
//
void ICON_Resume() {
constexpr frame_rect_t ico = { 96, 232, 80, 100 };
constexpr text_info_t txt = { 1, { 405, 447 }, 27, 15 };
constexpr text_info_t txt = { 1, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 };
ICON_Button(select_print.now == PRINT_PAUSE_RESUME, ICON_Continue_0, ico, txt, GET_TEXT_F(MSG_BUTTON_RESUME));
}
@ -396,7 +407,7 @@ void ICON_Resume() {
//
void ICON_Stop() {
constexpr frame_rect_t ico = { 184, 232, 80, 100 };
constexpr text_info_t txt = { 151, { 405, 447 }, 27, 12 };
constexpr text_info_t txt = { 151, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 12 };
ICON_Button(select_print.now == PRINT_STOP, ICON_Stop_0, ico, txt, GET_TEXT_F(MSG_BUTTON_STOP));
}
@ -453,18 +464,13 @@ void Draw_Menu_IntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const
DWINUI::Draw_Int(HMI_data.Text_Color, bcolor, iNum , VALX, MBASE(line) - 1, value);
}
// The "Back" label is always on the first line
void Draw_Back_Label() {
if (HMI_IsChinese())
DWIN_Frame_AreaCopy(1, 129, 72, 156, 84, LBLX, MBASE(0));
else
DWIN_Frame_AreaCopy(1, 223, 179, 254, 189, LBLX, MBASE(0));
}
// Draw "Back" line at the top
void Draw_Back_First(const bool is_sel=true) {
Draw_Menu_Line(0, ICON_Back);
Draw_Back_Label();
if (HMI_IsChinese())
DWIN_Frame_AreaCopy(1, 129, 72, 156, 84, LBLX, MBASE(0));
else
DWINUI::Draw_String(LBLX, MBASE(0), GET_TEXT_F(MSG_BACK));
if (is_sel) Draw_Menu_Cursor(0);
}
@ -489,15 +495,15 @@ inline bool Apply_Encoder(const EncoderState &encoder_diffState, T &valref) {
//PopUps
void Popup_window_PauseOrStop() {
if (HMI_IsChinese()) {
DWINUI::ClearMenuArea();
DWINUI::ClearMenuArea();
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_Icon(ICON_Confirm_C, 26, 280);
DWINUI::Draw_Icon(ICON_Cancel_C, 146, 280);
DWINUI::Draw_IconWB(ICON_Confirm_C, 26, 280);
DWINUI::Draw_IconWB(ICON_Cancel_C, 146, 280);
Draw_Select_Highlight(true);
DWIN_UpdateLCD();
DWIN_UpdateLCD();
}
else
DWIN_Popup_ConfirmCancel(ICON_BLTouch, select_print.now == PRINT_PAUSE_RESUME ? GET_TEXT_F(MSG_PAUSE_PRINT) : GET_TEXT_F(MSG_STOP_PRINT));
@ -513,7 +519,7 @@ void Popup_window_PauseOrStop() {
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_Icon(ICON_Confirm_C, 86, 280);
DWINUI::Draw_IconWB(ICON_Confirm_C, 86, 280);
DWIN_UpdateLCD();
}
else
@ -527,8 +533,8 @@ void Popup_window_PauseOrStop() {
DWINUI::ClearMenuArea();
Draw_Popup_Bkgd();
if (HMI_IsChinese()) {
if (toohigh) {
DWINUI::Draw_Icon(ICON_TempTooHigh, 102, 165);
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);
@ -637,7 +643,7 @@ void Draw_Print_Labels() {
}
void Draw_Print_ProgressBar() {
DWINUI::Draw_Icon(ICON_Bar, 15, 93);
DWINUI::Draw_IconWB(ICON_Bar, 15, 93);
DWIN_Draw_Rectangle(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("%"));
@ -707,7 +713,7 @@ void Draw_PrintDone() {
Draw_Print_ProgressElapsed();
Draw_Print_ProgressRemain();
// show print done confirm
DWINUI::Draw_Icon(HMI_IsChinese() ? ICON_Confirm_C : ICON_Confirm_E, 86, 273);
DWINUI::Draw_IconWB(HMI_IsChinese() ? ICON_Confirm_C : ICON_Confirm_E, 86, 273);
DWIN_UpdateLCD();
}
@ -721,7 +727,7 @@ void Draw_Main_Menu() {
ICON_Print();
ICON_Prepare();
ICON_Control();
TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)();
ICON_AdvSettings();
DWIN_UpdateLCD();
}
@ -745,11 +751,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)
DWINUI::Draw_String(HMI_data.Coordinate_Color, HMI_data.Background_Color, x, y, F("--?--"));
DWINUI::Draw_String(HMI_data.Coordinate_Color, HMI_data.Background_Color, x, y, F(" - ? -"));
else if (blink && draw_empty)
DWINUI::Draw_String(HMI_data.Coordinate_Color, HMI_data.Background_Color, x, y, F(" "));
else
DWINUI::Draw_Signed_Float(HMI_data.Coordinate_Color, HMI_data.Background_Color, 3, 1, x, y, p);
DWINUI::Draw_Signed_Float(HMI_data.Coordinate_Color, HMI_data.Background_Color, 3, 2, x, y, p);
}
}
@ -911,8 +917,6 @@ void MarlinUI::refresh() { /* Nothing to see here */ }
void MarlinUI::_set_brightness() { DWIN_LCD_Brightness(backlight ? brightness : 0); }
#endif
#define ICON_Folder ICON_More
#if ENABLED(SCROLL_LONG_FILENAMES)
char shift_name[LONG_FILENAME_LENGTH + 1];
@ -1115,25 +1119,25 @@ void HMI_StartFrame(const bool with_update) {
void Draw_Info_Menu() {
DWINUI::ClearMenuArea();
Draw_Back_First();
DWINUI::Draw_CenteredString(122, F(MACHINE_SIZE));
DWINUI::Draw_CenteredString(195, F(SHORT_BUILD_VERSION));
if (HMI_IsChinese())
Title.FrameCopy(30, 17, 28, 13); // "Info"
else
Title.ShowCaption(GET_TEXT_F(MSG_INFO_SCREEN));
if (HMI_IsChinese()) {
Title.FrameCopy(30, 17, 28, 13); // "Info"
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));
}
else {
Title.ShowCaption(GET_TEXT_F(MSG_INFO_SCREEN));
DWIN_Frame_AreaCopy(1, 120, 150, 146, 161, 124, 102); // "Size"
DWIN_Frame_AreaCopy(1, 146, 151, 254, 161, 82, 175); // "Firmware Version"
DWIN_Frame_AreaCopy(1, 1, 164, 96, 175, 89, 248); // "Contact details"
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::Draw_CenteredString(268, F(CORP_WEBSITE));
DWINUI::Draw_CenteredString(122, F(MACHINE_SIZE));
DWINUI::Draw_CenteredString(195, F(SHORT_BUILD_VERSION));
LOOP_L_N(i, 3) {
DWINUI::Draw_Icon(ICON_PrintSize + i, ICOX, 99 + i * 73);
@ -1162,7 +1166,7 @@ void HMI_MainMenu() {
case PAGE_PRINT: ICON_Print(); break;
case PAGE_PREPARE: ICON_Print(); ICON_Prepare(); break;
case PAGE_CONTROL: ICON_Prepare(); ICON_Control(); break;
case PAGE_INFO_LEVELING: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break;
case PAGE_INFO_LEV_ADV: ICON_Control(); ICON_AdvSettings(); break;
}
}
}
@ -1171,8 +1175,8 @@ void HMI_MainMenu() {
switch (select_page.now) {
case PAGE_PRINT: ICON_Print(); ICON_Prepare(); break;
case PAGE_PREPARE: ICON_Prepare(); ICON_Control(); break;
case PAGE_CONTROL: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break;
case PAGE_INFO_LEVELING: TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break;
case PAGE_CONTROL: ICON_Control(); ICON_AdvSettings(); break;
case PAGE_INFO_LEV_ADV: ICON_AdvSettings(); break;
}
}
}
@ -1180,6 +1184,7 @@ void HMI_MainMenu() {
switch (select_page.now) {
case PAGE_PRINT:
checkkey = SelectFile;
card.mount();
Draw_Print_File_Menu();
break;
@ -1187,14 +1192,7 @@ void HMI_MainMenu() {
case PAGE_CONTROL: Draw_Control_Menu(); break;
case PAGE_INFO_LEVELING:
#if HAS_ONESTEP_LEVELING
queue.inject(F("G28Z\nG29")); // Force to get the current Z home position
#else
last_checkkey = MainMenu;
Goto_Info_Menu();
#endif
break;
case PAGE_INFO_LEV_ADV: Draw_AdvancedSettings_Menu(); break;
}
}
DWIN_UpdateLCD();
@ -1469,6 +1467,9 @@ void Draw_Main_Area() {
case FilamentPurge: Draw_Popup_FilamentPurge(); break;
#endif
case Locked: lockScreen.draw(); break;
#if HAS_GCODE_PREVIEW
case ConfirmToPrint: Draw_PreviewFromSD(); break;
#endif
case Menu:
case SetInt:
case SetPInt:
@ -1496,14 +1497,12 @@ void HMI_Popup() {
void HMI_Init() {
HMI_SDCardInit();
for (uint16_t t = 0; t <= 100; t += 2) {
DWINUI::Draw_Icon(ICON_Bar, 15, 260);
DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 15 + t * 242 / 100, 260, 257, 280);
DWIN_UpdateLCD();
delay(20);
}
HMI_SetLanguage();
}
@ -1623,15 +1622,15 @@ void EachMomentUpdate() {
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_Icon(ICON_Cancel_C, 26, 280);
DWINUI::Draw_Icon(ICON_Continue_C, 146, 280);
DWINUI::Draw_IconWB(ICON_Cancel_C, 26, 280);
DWINUI::Draw_IconWB(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_Icon(ICON_Cancel_E, 26, 280);
DWINUI::Draw_Icon(ICON_Continue_E, 146, 280);
DWINUI::Draw_IconWB(ICON_Cancel_E, 26, 280);
DWINUI::Draw_IconWB(ICON_Continue_E, 146, 280);
}
SdFile *dir = nullptr;
const char * const filename = card.diveToFile(true, dir, recovery.info.sd_filename);
@ -1698,6 +1697,9 @@ void DWIN_HandleScreen() {
#if ENABLED(POWER_LOSS_RECOVERY)
case PwrlossRec: HMI_PowerlossRecovery(); break;
#endif
#if HAS_GCODE_PREVIEW
case ConfirmToPrint: HMI_ConfirmToPrint(); break;
#endif
#if HAS_ESDIAG
case ESDiagProcess: HMI_Popup(); break;
#endif
@ -1747,7 +1749,7 @@ void DWIN_MeshLevelingStart() {
#if HAS_ONESTEP_LEVELING
HMI_SaveProcessID(Leveling);
Title.ShowCaption(GET_TEXT_F(MSG_BED_LEVELING));
DWIN_Draw_Popup(ICON_AutoLeveling, GET_TEXT_F(MSG_BED_LEVELING), GET_TEXT_F(MSG_PLEASE_WAIT));
DWIN_Show_Popup(ICON_AutoLeveling, GET_TEXT_F(MSG_BED_LEVELING), GET_TEXT_F(MSG_PLEASE_WAIT), ICON_Cancel_E);
#elif ENABLED(MESH_BED_LEVELING)
Draw_ManualMesh_Menu();
#endif
@ -1924,7 +1926,8 @@ void DWIN_LoadSettings(const char *buff) {
}
void MarlinUI::kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component) {
DWIN_Draw_Popup(ICON_BLTouch, lcd_error, lcd_component);
DWIN_Draw_Popup(ICON_BLTouch, F("Printer killed:"), lcd_error);
DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 270, F("Turn off the printer"));
DWIN_UpdateLCD();
}
@ -1969,8 +1972,8 @@ void DWIN_Redraw_screen() {
void Draw_Popup_FilamentPurge() {
DWIN_Draw_Popup(ICON_BLTouch, GET_TEXT_F(MSG_ADVANCED_PAUSE), F("Purge or Continue?"));
DWINUI::Draw_Icon(ICON_Confirm_E, 26, 280);
DWINUI::Draw_Icon(ICON_Continue_E, 146, 280);
DWINUI::Draw_IconWB(ICON_Confirm_E, 26, 280);
DWINUI::Draw_IconWB(ICON_Continue_E, 146, 280);
Draw_Select_Highlight(true);
DWIN_UpdateLCD();
}
@ -2037,6 +2040,41 @@ void HMI_LockScreen() {
if (lockScreen.isUnlocked()) DWIN_UnLockScreen();
}
#if HAS_GCODE_PREVIEW
void HMI_ConfirmToPrint() {
EncoderState encoder_diffState = get_encoder_state();
if (encoder_diffState == ENCODER_DIFF_NO) return;
if (encoder_diffState == ENCODER_DIFF_CW)
Draw_Select_Highlight(false);
else if (encoder_diffState == ENCODER_DIFF_CCW)
Draw_Select_Highlight(true);
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
if (HMI_flag.select_flag) { // Confirm
card.openAndPrintFile(card.filename);
DWIN_Print_Started(true);
}
else { // Cancel
DWIN_ResetStatusLine();
checkkey = SelectFile;
Draw_Print_File_Menu();
}
}
DWIN_UpdateLCD();
}
#endif
void Goto_ConfirmToPrint() {
#if HAS_GCODE_PREVIEW
HMI_SaveProcessID(ConfirmToPrint);
Draw_PreviewFromSD();
#else
card.openAndPrintFile(card.filename);
DWIN_Print_Started(true);
#endif
}
#if HAS_ESDIAG
void Draw_EndStopDiag() {
HMI_SaveProcessID(ESDiagProcess);
@ -2308,8 +2346,9 @@ void SetPID(celsius_t t, heater_id_t h) {
#endif
#if HAS_LCD_BRIGHTNESS
void LiveBrightness() { ui.set_brightness(HMI_value.Value); }
void SetBrightness() { SetIntOnClick(LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, ui.brightness, nullptr, LiveBrightness); }
void ApplyBrightness() { ui.set_brightness(HMI_value.Value); }
void LiveBrightness() { DWIN_LCD_Brightness(HMI_value.Value); }
void SetBrightness() { SetIntOnClick(LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, ui.brightness, ApplyBrightness, LiveBrightness); }
#endif
#if ENABLED(CASE_LIGHT_MENU)
@ -2382,6 +2421,12 @@ void SetPID(celsius_t t, heater_id_t h) {
#endif
#endif
#if ENABLED(NOZZLE_PARK_FEATURE)
void SetParkPosX() { SetPIntOnClick(0, X_MAX_POS); }
void SetParkPosY() { SetPIntOnClick(0, Y_MAX_POS); }
void SetParkZRaise() { SetPIntOnClick(0, 50); }
#endif
#if HAS_FILAMENT_SENSOR
void SetRunoutEnable() {
runout.reset();
@ -2490,9 +2535,11 @@ void Tram(uint8_t point) {
static bool inLev = false;
if (inLev) return;
char str_1[6] = "", str_2[6] = "", str_3[6] = "";
#define fmt "X:%s, Y:%s, Z:%s"
float xpos = 0, ypos = 0, zval = 0;
float margin = PROBING_MARGIN;
#else
#define fmt "M420S0\nG28O\nG90\nG0Z5F300\nG0X%iY%iF5000\nG0Z0F300"
int16_t xpos = 0, ypos = 0;
int16_t margin = 30;
#endif
@ -2527,7 +2574,7 @@ void Tram(uint8_t point) {
planner.synchronize();
inLev = true;
zval = probe.probe_at_point(xpos, ypos, PROBE_PT_STOW);
sprintf_P(cmd, PSTR("X:%s, Y:%s, Z:%s"),
sprintf_P(cmd, PSTR(fmt),
dtostrf(xpos, 1, 1, str_1),
dtostrf(ypos, 1, 1, str_2),
dtostrf(zval, 1, 2, str_3)
@ -2536,7 +2583,7 @@ void Tram(uint8_t point) {
inLev = false;
#else
planner.synchronize();
sprintf_P(cmd, PSTR("M420S0\nG28O\nG90\nG0Z5F300\nG0X%iY%iF5000\nG0Z0F300"), xpos, ypos);
sprintf_P(cmd, PSTR(fmt), xpos, ypos);
queue.inject(cmd);
#endif
}
@ -2957,7 +3004,7 @@ void onDrawSpeed(MenuItemClass* menuitem, int8_t line) {
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
DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 58, MBASE(line)); // X
}
onDrawPFloatMenu(menuitem, line);
}
@ -2965,7 +3012,7 @@ void onDrawMaxSpeedX(MenuItemClass* menuitem, int8_t line) {
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
DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 58, MBASE(line)); // Y
}
onDrawPFloatMenu(menuitem, line);
}
@ -2973,7 +3020,7 @@ void onDrawMaxSpeedY(MenuItemClass* menuitem, int8_t line) {
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
DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 58, MBASE(line) + 3); // Z
}
onDrawPFloatMenu(menuitem, line);
}
@ -2982,7 +3029,7 @@ void onDrawMaxSpeedZ(MenuItemClass* menuitem, int8_t line) {
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
DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 58, MBASE(line)); // E
}
onDrawPFloatMenu(menuitem, line);
}
@ -2991,7 +3038,7 @@ void onDrawMaxSpeedZ(MenuItemClass* menuitem, int8_t line) {
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
DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line) + 1); // ...Acceleration
}
onDrawSubMenu(menuitem, line);
}
@ -3000,7 +3047,7 @@ 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
DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 71, MBASE(line)); // X
}
onDrawPInt32Menu(menuitem, line);
}
@ -3008,8 +3055,8 @@ void onDrawMaxAccelX(MenuItemClass* menuitem, int8_t line) {
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
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
}
onDrawPInt32Menu(menuitem, line);
}
@ -3017,8 +3064,8 @@ void onDrawMaxAccelY(MenuItemClass* menuitem, int8_t line) {
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
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
}
onDrawPInt32Menu(menuitem, line);
}
@ -3027,8 +3074,8 @@ void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) {
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
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
}
onDrawPInt32Menu(menuitem, line);
}
@ -3039,7 +3086,7 @@ void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) {
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, 1, 180, 28, 192, LBLX + 27, MBASE(line) + 1); // ...
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 54, MBASE(line)); // ...Jerk
}
onDrawSubMenu(menuitem, line);
@ -3286,6 +3333,9 @@ void Draw_Prepare_Menu() {
#if ENABLED(MESH_BED_LEVELING)
MENU_ITEM(ICON_ManualMesh, GET_TEXT_F(MSG_MANUAL_MESH), onDrawSubMenu, Draw_ManualMesh_Menu);
#endif
#if HAS_ONESTEP_LEVELING
MENU_ITEM(ICON_Level, GET_TEXT_F(MSG_AUTO_MESH), onDrawMenuItem, AutoLev);
#endif
#if HAS_ZOFFSET_ITEM
#if HAS_BED_PROBE
MENU_ITEM(ICON_SetZOffset, GET_TEXT_F(MSG_PROBE_WIZARD), onDrawSubMenu, Draw_ZOffsetWiz_Menu);
@ -3334,12 +3384,12 @@ void Draw_Control_Menu() {
if (CurrentMenu != ControlMenu) {
CurrentMenu = ControlMenu;
SetMenuTitle({103, 1, 28, 14}, GET_TEXT_F(MSG_CONTROL));
DWINUI::MenuItemsPrepare(11);
DWINUI::MenuItemsPrepare(8);
MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu);
#if ENABLED(CASE_LIGHT_MENU)
#if ENABLED(CASELIGHT_USES_BRIGHTNESS)
MENU_ITEM(ICON_CaseLight, GET_TEXT_F(MSG_CASE_LIGHT), onDrawSubMenu, Draw_CaseLight_Menu);
#else
#else
MENU_ITEM(ICON_CaseLight, GET_TEXT_F(MSG_CASE_LIGHT), onDrawCaseLight, SetCaseLight);
#endif
#endif
@ -3354,7 +3404,6 @@ void Draw_Control_Menu() {
MENU_ITEM(ICON_ResumeEEPROM, GET_TEXT_F(MSG_RESTORE_DEFAULTS), onDrawResetEeprom, ResetEeprom);
#endif
MENU_ITEM(ICON_Reboot, GET_TEXT_F(MSG_RESET_PRINTER), onDrawMenuItem, RebootPrinter);
MENU_ITEM(ICON_AdvSet, GET_TEXT_F(MSG_ADVANCED_SETTINGS), onDrawSubMenu, Draw_AdvancedSettings_Menu);
MENU_ITEM(ICON_Info, GET_TEXT_F(MSG_INFO_SCREEN), onDrawInfoSubMenu, Goto_Info_Menu);
}
CurrentMenu->draw();
@ -3367,7 +3416,7 @@ void Draw_AdvancedSettings_Menu() {
CurrentMenu = AdvancedSettings;
SetMenuTitle({0}, GET_TEXT_F(MSG_ADVANCED_SETTINGS)); // TODO: Chinese, English "Advanced Settings" JPG
DWINUI::MenuItemsPrepare(15);
MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu);
MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu);
#if HAS_HOME_OFFSET
MENU_ITEM(ICON_HomeOffset, GET_TEXT_F(MSG_SET_HOME_OFFSETS), onDrawSubMenu, Draw_HomeOffset_Menu);
#endif
@ -3601,7 +3650,7 @@ void Draw_Tune_Menu() {
MENU_ITEM(ICON_CaseLight, GET_TEXT_F(MSG_CASE_LIGHT), onDrawCaseLight, SetCaseLight);
#elif ENABLED(LED_CONTROL_MENU) && DISABLED(CASE_LIGHT_USE_NEOPIXEL)
MENU_ITEM(ICON_LedControl, GET_TEXT_F(MSG_LEDS), onDrawLedStatus, SetLedStatus);
#endif
#endif
EDIT_ITEM(ICON_Speed, GET_TEXT_F(MSG_SPEED), onDrawSpeedItem, SetSpeed, &feedrate_percentage);
#if HAS_HOTEND
HotendTargetItem = EDIT_ITEM(ICON_HotendTemp, GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND), onDrawHotendTemp, SetHotendTemp, &thermalManager.temp_hotend[0].target);

View file

@ -22,10 +22,12 @@
#pragma once
/**
* DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo
* Version: 3.9.1
* Date: 2021/11/21
* Enhanced DWIN implementation
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 3.9.2
* date: 2021/11/21
*
* Based on the original code provided by Creality under GPL
*/
#include "../../../inc/MarlinConfigPre.h"
@ -62,6 +64,7 @@ enum processID : uint8_t {
PwrlossRec,
Reboot,
Info,
ConfirmToPrint,
// Popup Windows
Homing,
@ -90,6 +93,8 @@ enum pidresult_t : uint8_t {
typedef struct {
int8_t Color[3]; // Color components
uint16_t pidgrphpoints = 0;
pidresult_t pidresult = PID_DONE;
int8_t Preheat = 0; // Material Select 0: PLA, 1: ABS, 2: Custom
AxisEnum axis = X_AXIS; // Axis Select
int32_t MaxValue = 0; // Auxiliar max integer/scaled float value
@ -137,6 +142,7 @@ void Goto_PrintProcess();
void Goto_Main_Menu();
void Goto_Info_Menu();
void Goto_PowerLossRecovery();
void Goto_ConfirmToPrint();
void Draw_Status_Area(const bool with_update); // Status Area
void Draw_Main_Area(); // Redraw main area;
void DWIN_Redraw_screen(); // Redraw all screen elements
@ -191,6 +197,9 @@ void HMI_LockScreen();
#if HAS_MESH
void DWIN_MeshViewer();
#endif
#if HAS_GCODE_PREVIEW
void HMI_ConfirmToPrint();
#endif
#if HAS_ESDIAG
void Draw_EndStopDiag();
#endif
@ -221,6 +230,10 @@ void Draw_Tramming_Menu();
#if HAS_FILAMENT_SENSOR
void Draw_FilSet_Menu();
#endif
#if ENABLED(NOZZLE_PARK_FEATURE)
void Draw_ParkPos_Menu();
#endif
void Draw_PhySet_Menu();
void Draw_SelectColors_Menu();
void Draw_GetColor_Menu();
#if BOTH(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS)

View file

@ -23,11 +23,16 @@
/**
* DWIN general defines and data structs
* Author: Miguel A. Risco-Castillo
* Version: 3.9.1
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 3.9.2
* Date: 2021/11/21
*
* Based on the original code provided by Creality under GPL
*/
//#define NEED_HEX_PRINT 1
//#define DEBUG_DWIN 1
#include "../../../core/types.h"
#include "../common/dwin_color.h"
#if ENABLED(LED_CONTROL_MENU)
@ -53,8 +58,8 @@
#define Def_Indicator_Color Color_White
#define Def_Coordinate_Color Color_White
//#define HAS_GCODE_PREVIEW 1
#define HAS_ESDIAG 1
#define DEFAULT_LCD_BRIGHTNESS 127
#if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS)
#define Def_Leds_Color LEDColorWhite()

View file

@ -22,9 +22,11 @@
/**
* DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 3.8.1
* Date: 2021/11/09
*
* Based on the original code provided by Creality under GPL
*/
#include "../../../inc/MarlinConfigPre.h"

View file

@ -23,9 +23,11 @@
/**
* DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 3.8.1
* Date: 2021/11/09
*
* Based on the original code provided by Creality under GPL
*/
#include "../common/dwin_api.h"

View file

@ -22,9 +22,11 @@
/**
* DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo
* Version: 3.8.1
* Date: 2021/11/06
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 3.10.1
* Date: 2022/01/21
*
* Based on the original code provided by Creality under GPL
*/
#include "../../../inc/MarlinConfigPre.h"
@ -52,8 +54,8 @@ void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fm
void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2) {
DWIN_Draw_Popup(ICON_BLTouch, F("Please confirm"), fmsg2);
DWINUI::Draw_Icon(ICON_Confirm_E, 26, 280);
DWINUI::Draw_Icon(ICON_Cancel_E, 146, 280);
DWINUI::Draw_IconWB(ICON_Confirm_E, 26, 280);
DWINUI::Draw_IconWB(ICON_Cancel_E, 146, 280);
Draw_Select_Highlight(true);
DWIN_UpdateLCD();
}

View file

@ -23,9 +23,11 @@
/**
* DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo
* Version: 3.8.1
* Date: 2021/11/06
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 3.10.1
* Date: 2022/01/21
*
* Based on the original code provided by Creality under GPL
*/
#include "dwinui.h"
@ -47,7 +49,13 @@ void DWIN_Draw_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8
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_Icon(button, 86, 280);
if (button) DWINUI::Draw_IconWB(button, 86, 280);
}
template<typename T, typename U>
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);
DWIN_UpdateLCD();
}
template<typename T, typename U>

View file

@ -22,9 +22,11 @@
/**
* DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo
* Version: 3.8.1
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 3.8.2
* Date: 2021/11/09
*
* Based on the original code provided by Creality under GPL
*/
#include "../../../inc/MarlinConfigPre.h"

View file

@ -23,9 +23,11 @@
/**
* DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo
* Version: 3.9.1
* Date: 2021/11/21
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 3.11.1
* Date: 2022/01/19
*
* Based on the original code provided by Creality under GPL
*/
#include "dwin_lcd.h"
@ -34,6 +36,10 @@
#include "../common/dwin_color.h"
// Extra Icons
#define ICON_AdvSet ICON_Language
#define ICON_BedSizeX ICON_PrintSize
#define ICON_BedSizeY ICON_PrintSize
#define ICON_Binary ICON_Contact
#define ICON_Brightness ICON_Motion
#define ICON_Cancel ICON_StockConfiguration
#define ICON_CustomPreheat ICON_SetEndTemp
@ -45,6 +51,7 @@
#define ICON_FilSet ICON_ResumeEEPROM
#define ICON_FilUnload ICON_ReadEEPROM
#define ICON_Flow ICON_StepE
#define ICON_Folder ICON_More
#define ICON_FWRetLength ICON_StepE
#define ICON_FWRetSpeed ICON_Setspeed
#define ICON_FWRetZRaise ICON_MoveZ
@ -52,28 +59,49 @@
#define ICON_HomeX ICON_MoveX
#define ICON_HomeY ICON_MoveY
#define ICON_HomeZ ICON_MoveZ
#define ICON_HomeOffset ICON_AdvSet
#define ICON_HomeOffsetX ICON_StepX
#define ICON_HomeOffsetY ICON_StepY
#define ICON_HomeOffsetZ ICON_StepZ
#define ICON_HSMode ICON_StockConfiguration
#define ICON_InvertE0 ICON_StepE
#define ICON_Tram ICON_SetEndTemp
#define ICON_Level ICON_HotendTemp
#define ICON_Lock ICON_Cool
#define ICON_ManualMesh ICON_HotendTemp
#define ICON_MaxPosX ICON_MoveX
#define ICON_MaxPosY ICON_MoveY
#define ICON_MaxPosZ ICON_MoveZ
#define ICON_MeshNext ICON_Axis
#define ICON_MeshPoints ICON_SetEndTemp
#define ICON_MeshSave ICON_WriteEEPROM
#define ICON_MeshViewer ICON_HotendTemp
#define ICON_MoveZ0 ICON_HotendTemp
#define ICON_Park ICON_Motion
#define ICON_ParkPos ICON_AdvSet
#define ICON_ParkPosX ICON_StepX
#define ICON_ParkPosY ICON_StepY
#define ICON_ParkPosZ ICON_StepZ
#define ICON_PhySet ICON_PrintSize
#define ICON_PIDbed ICON_SetBedTemp
#define ICON_PIDcycles ICON_ResumeEEPROM
#define ICON_PIDValue ICON_Contact
#define ICON_PrintStats ICON_PrintTime
#define ICON_PrintStatsReset ICON_RemainTime
#define ICON_ProbeDeploy ICON_SetEndTemp
#define ICON_ProbeMargin ICON_PrintSize
#define ICON_ProbeOffsetX ICON_StepX
#define ICON_ProbeOffsetY ICON_StepY
#define ICON_ProbeOffsetZ ICON_StepZ
#define ICON_ProbeSet ICON_SetEndTemp
#define ICON_ProbeStow ICON_SetEndTemp
#define ICON_ProbeTest ICON_SetEndTemp
#define ICON_ProbeZSpeed ICON_MaxSpeedZ
#define ICON_Pwrlossr ICON_Motion
#define ICON_Reboot ICON_ResumeEEPROM
#define ICON_Runout ICON_MaxAccE
#define ICON_Scolor ICON_MaxSpeed
#define ICON_SetBaudRate ICON_Setspeed
#define ICON_SetCustomPreheat ICON_SetEndTemp
#define ICON_Sound ICON_Cool
#define ICON_CaseLight ICON_Motion
@ -247,6 +275,13 @@ namespace DWINUI {
DWIN_ICON_Show(ICON, 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) {
DWIN_ICON_Show(true, false, false, ICON, icon, x, y);
}
// Draw a positive integer
// bShow: true=display background color; false=don't display background color
// zeroFill: true=zero fill; false=no zero fill

View file

@ -22,9 +22,11 @@
/**
* DWIN End Stops diagnostic page
* Author: Miguel A. Risco-Castillo
* Version: 1.0
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 1.0.2
* Date: 2021/11/06
*
* Based on the original code provided by Creality under GPL
*/
#include "../../../inc/MarlinConfigPre.h"
@ -106,4 +108,4 @@ void ESDiagClass::Update() {
DWIN_UpdateLCD();
}
#endif // DWIN_CREALITY_LCD_ENHANCED && HAS_MESH
#endif // DWIN_CREALITY_LCD_ENHANCED && HAS_ESDIAG

View file

@ -23,9 +23,11 @@
/**
* DWIN End Stops diagnostic page
* Author: Miguel A. Risco-Castillo
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 1.0
* Date: 2021/11/06
*
* Based on the original code provided by Creality under GPL
*/
class ESDiagClass {

View file

@ -22,9 +22,11 @@
/**
* Lock screen implementation for DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 2.1
* Date: 2021/11/09
*
* Based on the original code provided by Creality under GPL
*/
#include "../../../inc/MarlinConfigPre.h"

View file

@ -23,9 +23,11 @@
/**
* Lock screen implementation for DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 2.1
* Date: 2021/11/09
*
* Based on the original code provided by Creality under GPL
*/
#include "../common/encoder.h"

View file

@ -22,9 +22,11 @@
/**
* DWIN Mesh Viewer
* Author: Miguel A. Risco-Castillo
* Version: 3.8.1
* Date: 2021/11/06
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 3.9.1
* Date: 2021/11/09
*
* Based on the original code provided by Creality under GPL
*/
#include "../../../inc/MarlinConfigPre.h"
@ -56,7 +58,7 @@ void MeshViewerClass::Draw() {
#define DrawMeshHLine(yp) DWIN_Draw_HLine(HMI_data.SplitLine_Color, px(0), py(yp), DWIN_WIDTH - 2 * mx)
#define DrawMeshVLine(xp) DWIN_Draw_VLine(HMI_data.SplitLine_Color, px(xp), py(GRID_MAX_POINTS_Y - 1), DWIN_WIDTH - 2 * my)
GRID_LOOP(x, y) {
const float v = Z_VALUES(x,y) * 100;
const float v = isnan(Z_VALUES(x,y)) ? 0 : round(Z_VALUES(x,y) * 100);
zmesh[x][y] = v;
NOLESS(maxz, v);
NOMORE(minz, v);

View file

@ -23,9 +23,11 @@
/**
* DWIN Mesh Viewer
* Author: Miguel A. Risco-Castillo
* Version: 3.8.1
* Date: 2021/11/06
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 3.9.1
* Date: 2021/11/09
*
* Based on the original code provided by Creality under GPL
*/
class MeshViewerClass {

View file

@ -22,9 +22,11 @@
/**
* DWIN Print Stats page
* Author: Miguel A. Risco-Castillo
* Version: 1.0
* Date: 2021/11/21
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 1.1
* Date: 2022/01/09
*
* Based on the original code provided by Creality under GPL
*/
#include "../../../inc/MarlinConfigPre.h"

View file

@ -23,9 +23,11 @@
/**
* DWIN Print Stats page
* Author: Miguel A. Risco-Castillo
* Version: 1.0
* Date: 2021/11/21
* Author: Miguel A. Risco-Castillo (MRISCOC)
* Version: 1.1
* Date: 2022/01/09
*
* Based on the original code provided by Creality under GPL
*/
class PrintStatsClass {

View file

@ -49,7 +49,7 @@ MarlinUI ui;
#include "e3v2/creality/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "fontutils.h"
#include "e3v2/enhanced/dwin.h"
#include "e3v2/proui/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "e3v2/jyersui/dwin.h"
#endif
@ -104,7 +104,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#endif
#if HAS_LCD_BRIGHTNESS
uint8_t MarlinUI::brightness = DEFAULT_LCD_BRIGHTNESS;
uint8_t MarlinUI::brightness = LCD_BRIGHTNESS_DEFAULT;
bool MarlinUI::backlight = true;
void MarlinUI::set_brightness(const uint8_t value) {

View file

@ -58,7 +58,7 @@
#if ENABLED(DWIN_CREALITY_LCD)
#include "e3v2/creality/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "e3v2/enhanced/dwin.h"
#include "e3v2/proui/dwin.h"
#endif
#define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80U)
@ -263,8 +263,8 @@ public:
#ifndef LCD_BRIGHTNESS_MAX
#define LCD_BRIGHTNESS_MAX 255
#endif
#ifndef DEFAULT_LCD_BRIGHTNESS
#define DEFAULT_LCD_BRIGHTNESS LCD_BRIGHTNESS_MAX
#ifndef LCD_BRIGHTNESS_DEFAULT
#define LCD_BRIGHTNESS_DEFAULT LCD_BRIGHTNESS_MAX
#endif
static uint8_t brightness;
static bool backlight;

View file

@ -80,7 +80,7 @@
#if ENABLED(EXTENSIBLE_UI)
#include "../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../lcd/e3v2/enhanced/dwin.h"
#include "../lcd/e3v2/proui/dwin.h"
#endif
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)

View file

@ -75,7 +75,7 @@
#if ENABLED(EXTENSIBLE_UI)
#include "../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../lcd/e3v2/enhanced/dwin.h"
#include "../lcd/e3v2/proui/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "../lcd/e3v2/jyersui/dwin.h"
#endif
@ -3028,7 +3028,7 @@ void MarlinSettings::reset() {
//
// LCD Brightness
//
TERN_(HAS_LCD_BRIGHTNESS, ui.brightness = DEFAULT_LCD_BRIGHTNESS);
TERN_(HAS_LCD_BRIGHTNESS, ui.brightness = LCD_BRIGHTNESS_DEFAULT);
//
// Controller Fan

View file

@ -52,7 +52,7 @@
#if ENABLED(DWIN_CREALITY_LCD)
#include "../lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../lcd/e3v2/enhanced/dwin.h"
#include "../lcd/e3v2/proui/dwin.h"
#endif
#if ENABLED(EXTENSIBLE_UI)

View file

@ -157,7 +157,7 @@
#if defined(TFT_BACKLIGHT_PWM) && !defined(MAPLE_STM32F1)
#define HAS_LCD_BRIGHTNESS 1
#define DEFAULT_LCD_BRIGHTNESS TFT_BACKLIGHT_PWM
#define LCD_BRIGHTNESS_DEFAULT TFT_BACKLIGHT_PWM
#endif
#if ENABLED(SDIO_SUPPORT)

View file

@ -34,7 +34,7 @@
#if ENABLED(DWIN_CREALITY_LCD)
#include "../lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../lcd/e3v2/enhanced/dwin.h"
#include "../lcd/e3v2/proui/dwin.h"
#endif
#include "../module/planner.h" // for synchronize

View file

@ -15,7 +15,7 @@ exec_test $1 $2 "Ender 3 v2 with CrealityUI" "$3"
use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI"
opt_disable DWIN_CREALITY_LCD
opt_enable DWIN_CREALITY_LCD_ENHANCED BLTOUCH AUTO_BED_LEVELING_UBL Z_SAFE_HOMING
opt_enable DWIN_CREALITY_LCD_ENHANCED BLTOUCH AUTO_BED_LEVELING_UBL Z_SAFE_HOMING INDIVIDUAL_AXIS_HOMING_SUBMENU LCD_SET_PROGRESS_MANUALLY STATUS_MESSAGE_SCROLLING BAUD_RATE_GCODE
exec_test $1 $2 "Ender 3 v2 with Enhanced UI" "$3"
use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI"

View file

@ -46,7 +46,7 @@ SOFT_I2C_EEPROM = SlowSoftI2CMaster, SlowSoftWire=https:/
SPI_EEPROM = src_filter=+<src/HAL/shared/eeprom_if_spi.cpp>
HAS_DWIN_E3V2|IS_DWIN_MARLINUI = src_filter=+<src/lcd/e3v2/common>
DWIN_CREALITY_LCD = src_filter=+<src/lcd/e3v2/creality>
DWIN_CREALITY_LCD_ENHANCED = src_filter=+<src/lcd/e3v2/enhanced>
DWIN_CREALITY_LCD_ENHANCED = src_filter=+<src/lcd/e3v2/proui>
DWIN_CREALITY_LCD_JYERSUI = src_filter=+<src/lcd/e3v2/jyersui>
IS_DWIN_MARLINUI = src_filter=+<src/lcd/e3v2/marlinui>
HAS_GRAPHICAL_TFT = src_filter=+<src/lcd/tft>

View file

@ -51,7 +51,7 @@ lib_deps =
default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
-<src/lcd/HD44780> -<src/lcd/TFTGLCD> -<src/lcd/dogm> -<src/lcd/tft> -<src/lcd/tft_io>
-<src/HAL/STM32/tft> -<src/HAL/STM32F1/tft>
-<src/lcd/e3v2/common> -<src/lcd/e3v2/creality> -<src/lcd/e3v2/enhanced> -<src/lcd/e3v2/jyersui> -<src/lcd/e3v2/marlinui>
-<src/lcd/e3v2/common> -<src/lcd/e3v2/creality> -<src/lcd/e3v2/proui> -<src/lcd/e3v2/jyersui> -<src/lcd/e3v2/marlinui>
-<src/lcd/menu>
-<src/lcd/menu/game/game.cpp> -<src/lcd/menu/game/brickout.cpp> -<src/lcd/menu/game/invaders.cpp>
-<src/lcd/menu/game/maze.cpp> -<src/lcd/menu/game/snake.cpp>