🚸 Fix up E3V2 Enhanced (#23100)

This commit is contained in:
Miguel Risco-Castillo 2021-11-10 11:55:20 -05:00 committed by Scott Lahteine
parent 7f4a49cc44
commit 3cccb21dc9
11 changed files with 128 additions and 104 deletions

View File

@ -254,7 +254,6 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR))); TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR)));
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR)));
wait_for_user = true; // A click or M108 breaks the purge_length loop wait_for_user = true; // A click or M108 breaks the purge_length loop
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count) for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE); unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);

View File

@ -23,8 +23,8 @@
/** /**
* DWIN UI Enhanced implementation * DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo * Author: Miguel A. Risco-Castillo
* Version: 3.6.3 * Version: 3.7.1
* Date: 2021/09/10 * Date: 2021/11/09
*/ */
#include "../../../inc/MarlinConfigPre.h" #include "../../../inc/MarlinConfigPre.h"
@ -142,7 +142,7 @@ HMI_data_t HMI_data;
millis_t dwin_heat_time = 0; millis_t dwin_heat_time = 0;
uint8_t checkkey = MainMenu, last_checkkey = MainMenu; uint8_t checkkey = 255, last_checkkey = MainMenu;
enum SelectItem : uint8_t { enum SelectItem : uint8_t {
PAGE_PRINT = 0, PAGE_PRINT = 0,
@ -386,15 +386,15 @@ void ICON_Stop() {
ICON_Button(select_print.now == PRINT_STOP, ICON_Stop_0, ico, txt); ICON_Button(select_print.now == PRINT_STOP, ICON_Stop_0, ico, txt);
} }
void Draw_Menu_Cursor(const uint8_t line) { void Draw_Menu_Cursor(const int8_t line) {
DWIN_Draw_Rectangle(1, HMI_data.Cursor_color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20); DWIN_Draw_Rectangle(1, HMI_data.Cursor_color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20);
} }
void Erase_Menu_Cursor(const uint8_t line) { void Erase_Menu_Cursor(const int8_t line) {
DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20); DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20);
} }
void Move_Highlight(const int16_t from, const uint16_t newline) { void Move_Highlight(const int8_t from, const int8_t newline) {
Erase_Menu_Cursor(newline - from); Erase_Menu_Cursor(newline - from);
Draw_Menu_Cursor(newline); Draw_Menu_Cursor(newline);
} }
@ -577,6 +577,7 @@ void Popup_window_PauseOrStop() {
DWINUI::Draw_Icon(ICON_Cancel_E, 146, 280); DWINUI::Draw_Icon(ICON_Cancel_E, 146, 280);
} }
Draw_Select_Highlight(true); Draw_Select_Highlight(true);
DWIN_UpdateLCD();
} }
#if HAS_HOTEND || HAS_HEATED_BED #if HAS_HOTEND || HAS_HEATED_BED
@ -607,7 +608,6 @@ void Popup_window_PauseOrStop() {
} }
} }
} }
#endif #endif
void Draw_Print_Labels() { void Draw_Print_Labels() {
@ -671,6 +671,7 @@ void Draw_PrintProcess() {
} }
void Goto_PrintProcess() { void Goto_PrintProcess() {
if (checkkey == PrintProcess) return;
checkkey = PrintProcess; checkkey = PrintProcess;
Draw_PrintProcess(); Draw_PrintProcess();
} }
@ -712,6 +713,7 @@ void Draw_Main_Menu() {
} }
void Goto_Main_Menu() { void Goto_Main_Menu() {
if (checkkey == MainMenu) return;
checkkey = MainMenu; checkkey = MainMenu;
DWIN_StatusChanged(); DWIN_StatusChanged();
Draw_Main_Menu(); Draw_Main_Menu();
@ -1157,10 +1159,10 @@ void HMI_MainMenu() {
case PAGE_INFO_LEVELING: case PAGE_INFO_LEVELING:
#if HAS_ONESTEP_LEVELING #if HAS_ONESTEP_LEVELING
queue.inject(F("G28XYO\nG28Z\nG29")); // TODO: 'G29' should be homing when needed. Does it make sense for every LCD to do this differently? queue.inject(F("G28Z\nG29")); // Force to get the current Z home position
#else #else
checkkey = Info; last_checkkey = MainMenu;
Draw_Info_Menu(); Goto_InfoMenu();
#endif #endif
break; break;
} }
@ -1245,7 +1247,7 @@ void HMI_SelectFile() {
} }
} }
else if (encoder_diffState == ENCODER_DIFF_ENTER) { else if (encoder_diffState == ENCODER_DIFF_ENTER) {
if (select_file.now == 0) { if (select_file.now == 0) { // Back
select_page.set(PAGE_PRINT); select_page.set(PAGE_PRINT);
Goto_Main_Menu(); Goto_Main_Menu();
} }
@ -1441,7 +1443,6 @@ void Draw_Main_Area() {
void HMI_ReturnScreen() { void HMI_ReturnScreen() {
checkkey = last_checkkey; checkkey = last_checkkey;
Draw_Main_Area(); Draw_Main_Area();
DWIN_UpdateLCD();
return; return;
} }
@ -2161,7 +2162,7 @@ void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS
void SetMoveZto0() { void SetMoveZto0() {
char cmd[48] = ""; char cmd[48] = "";
char str_1[5] = "", str_2[5] = ""; char str_1[5] = "", str_2[5] = "";
sprintf_P(cmd, PSTR("G28OXY\nG28Z\nG0X%sY%sF5000\nG0Z0F300"), sprintf_P(cmd, PSTR("G28Z\nG0X%sY%sF5000\nM420S0\nG0Z0F300"),
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
dtostrf(0, 1, 1, str_1), dtostrf(0, 1, 1, str_1),
dtostrf(0, 1, 1, str_2) dtostrf(0, 1, 1, str_2)
@ -2400,7 +2401,7 @@ void LevBedC () { LevBed(4); }
void ManualMeshStart(){ void ManualMeshStart(){
LCD_MESSAGE(MSG_UBL_BUILD_MESH_MENU); LCD_MESSAGE(MSG_UBL_BUILD_MESH_MENU);
gcode.process_subcommands_now(F("G28 XYO\nG28 Z\nM211 S0\nG29S1")); gcode.process_subcommands_now(F("G28Z\nM211S0\nG29S1"));
planner.synchronize(); planner.synchronize();
#ifdef MANUAL_PROBE_START_Z #ifdef MANUAL_PROBE_START_Z
const uint8_t line = CurrentMenu->line(MMeshMoveZItem->pos); const uint8_t line = CurrentMenu->line(MMeshMoveZItem->pos);
@ -2741,7 +2742,7 @@ void onDrawSteps(MenuItemClass* menuitem, int8_t line) {
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
void onDrawMMeshMoveZ(MenuItemClass* menuitem, int8_t line) { void onDrawMMeshMoveZ(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) menuitem->SetFrame(1, 160, 118, 209, 132); if (HMI_IsChinese()) menuitem->SetFrame(1, 160, 118, 209, 132);
onDrawPFloatMenu(menuitem, line); onDrawPFloat2Menu(menuitem, line);
} }
#endif #endif
@ -3027,11 +3028,11 @@ void HMI_SetIntNoDraw() {
// Set an integer pointer variable using the encoder // Set an integer pointer variable using the encoder
void HMI_SetPInt() { void HMI_SetPInt() {
int8_t val = HMI_GetInt(HMI_value.MinValue, HMI_value.MaxValue); int8_t val = HMI_GetInt(HMI_value.MinValue, HMI_value.MaxValue);
if (!val) return; switch (val) {
else if (val == 2) { // Apply case 0: return;
*HMI_value.P_Int = HMI_value.Value; case 1: if (HMI_value.LiveUpdate != nullptr) HMI_value.LiveUpdate(); break;
if (HMI_value.Apply != nullptr) HMI_value.Apply(); case 2: *HMI_value.P_Int = HMI_value.Value; if (HMI_value.Apply != nullptr) HMI_value.Apply(); break;
} else if (HMI_value.LiveUpdate != nullptr) HMI_value.LiveUpdate(); }
} }
// Get a scaled float value using the encoder // Get a scaled float value using the encoder
@ -3071,17 +3072,16 @@ void HMI_SetFloat() {
// Set a scaled float pointer variable using the encoder // Set a scaled float pointer variable using the encoder
void HMI_SetPFloat() { void HMI_SetPFloat() {
const int8_t val = HMI_GetFloat(HMI_value.dp, HMI_value.MinValue, HMI_value.MaxValue); const int8_t val = HMI_GetFloat(HMI_value.dp, HMI_value.MinValue, HMI_value.MaxValue);
if (!val) return; switch (val) {
if (val == 2) { // Apply case 0: return;
*HMI_value.P_Float = HMI_value.Value / POW(10, HMI_value.dp); case 1: if (HMI_value.LiveUpdate != nullptr) HMI_value.LiveUpdate(); break;
if (HMI_value.Apply != nullptr) HMI_value.Apply(); case 2: *HMI_value.P_Float = HMI_value.Value / POW(10, HMI_value.dp); if (HMI_value.Apply != nullptr) HMI_value.Apply(); break;
} }
else if (HMI_value.LiveUpdate != nullptr) HMI_value.LiveUpdate();
} }
// Menu Creation and Drawing functions ====================================================== // Menu Creation and Drawing functions ======================================================
void SetMenuTitle(frame_rect_t cn, frame_rect_t en, const __FlashStringHelper* fstr) { void SetMenuTitle(frame_rect_t cn, const __FlashStringHelper* fstr) {
if (HMI_IsChinese() && (cn.w != 0)) if (HMI_IsChinese() && (cn.w != 0))
CurrentMenu->MenuTitle.SetFrame(cn.x, cn.y, cn.w, cn.h); CurrentMenu->MenuTitle.SetFrame(cn.x, cn.y, cn.w, cn.h);
else else
@ -3093,7 +3093,7 @@ void Draw_Prepare_Menu() {
if (PrepareMenu == nullptr) PrepareMenu = new MenuClass(); if (PrepareMenu == nullptr) PrepareMenu = new MenuClass();
if (CurrentMenu != PrepareMenu) { if (CurrentMenu != PrepareMenu) {
CurrentMenu = PrepareMenu; CurrentMenu = PrepareMenu;
SetMenuTitle({133, 1, 28, 13}, {179, 0, 48, 14}, GET_TEXT_F(MSG_PREPARE)); SetMenuTitle({133, 1, 28, 13}, GET_TEXT_F(MSG_PREPARE));
DWINUI::MenuItemsPrepare(13); DWINUI::MenuItemsPrepare(13);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu);
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
@ -3134,7 +3134,7 @@ void Draw_LevBedCorners_Menu() {
if (LevBedMenu == nullptr) LevBedMenu = new MenuClass(); if (LevBedMenu == nullptr) LevBedMenu = new MenuClass();
if (CurrentMenu != LevBedMenu) { if (CurrentMenu != LevBedMenu) {
CurrentMenu = LevBedMenu; CurrentMenu = LevBedMenu;
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_BED_TRAMMING)); // TODO: Chinese, English "Bed Tramming" JPG SetMenuTitle({0}, GET_TEXT_F(MSG_BED_TRAMMING)); // TODO: Chinese, English "Bed Tramming" JPG
DWINUI::MenuItemsPrepare(6); DWINUI::MenuItemsPrepare(6);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_FL), onDrawMenuItem, LevBedFL); ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_FL), onDrawMenuItem, LevBedFL);
@ -3151,7 +3151,7 @@ void Draw_Control_Menu() {
if (ControlMenu == nullptr) ControlMenu = new MenuClass(); if (ControlMenu == nullptr) ControlMenu = new MenuClass();
if (CurrentMenu != ControlMenu) { if (CurrentMenu != ControlMenu) {
CurrentMenu = ControlMenu; CurrentMenu = ControlMenu;
SetMenuTitle({103, 1, 28, 14}, {128, 2, 49, 11}, GET_TEXT_F(MSG_CONTROL)); SetMenuTitle({103, 1, 28, 14}, GET_TEXT_F(MSG_CONTROL));
DWINUI::MenuItemsPrepare(9); DWINUI::MenuItemsPrepare(9);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu);
ADDMENUITEM(ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE), onDrawTempSubMenu, Draw_Temperature_Menu); ADDMENUITEM(ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE), onDrawTempSubMenu, Draw_Temperature_Menu);
@ -3173,8 +3173,8 @@ void Draw_AdvancedSettings_Menu() {
if (AdvancedSettings == nullptr) AdvancedSettings = new MenuClass(); if (AdvancedSettings == nullptr) AdvancedSettings = new MenuClass();
if (CurrentMenu != AdvancedSettings) { if (CurrentMenu != AdvancedSettings) {
CurrentMenu = AdvancedSettings; CurrentMenu = AdvancedSettings;
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_ADVANCED_SETTINGS)); // TODO: Chinese, English "Advanced Settings" JPG SetMenuTitle({0}, GET_TEXT_F(MSG_ADVANCED_SETTINGS)); // TODO: Chinese, English "Advanced Settings" JPG
DWINUI::MenuItemsPrepare(11); DWINUI::MenuItemsPrepare(12);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu);
#if HAS_HOME_OFFSET #if HAS_HOME_OFFSET
ADDMENUITEM(ICON_HomeOffset, GET_TEXT_F(MSG_SET_HOME_OFFSETS), onDrawSubMenu, Draw_HomeOffset_Menu); ADDMENUITEM(ICON_HomeOffset, GET_TEXT_F(MSG_SET_HOME_OFFSETS), onDrawSubMenu, Draw_HomeOffset_Menu);
@ -3214,7 +3214,7 @@ void Draw_Move_Menu() {
if (MoveMenu == nullptr) MoveMenu = new MenuClass(); if (MoveMenu == nullptr) MoveMenu = new MenuClass();
if (CurrentMenu != MoveMenu) { if (CurrentMenu != MoveMenu) {
CurrentMenu = MoveMenu; CurrentMenu = MoveMenu;
SetMenuTitle({192, 1, 42, 14}, {231, 2, 35, 11}, GET_TEXT_F(MSG_MOVE_AXIS)); SetMenuTitle({192, 1, 42, 14}, GET_TEXT_F(MSG_MOVE_AXIS));
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
ADDMENUITEM_P(ICON_MoveX, GET_TEXT_F(MSG_MOVE_X), onDrawMoveX, SetMoveX, &current_position.x); ADDMENUITEM_P(ICON_MoveX, GET_TEXT_F(MSG_MOVE_X), onDrawMoveX, SetMoveX, &current_position.x);
@ -3234,7 +3234,7 @@ void Draw_Move_Menu() {
if (HomeOffMenu == nullptr) HomeOffMenu = new MenuClass(); if (HomeOffMenu == nullptr) HomeOffMenu = new MenuClass();
if (CurrentMenu != HomeOffMenu) { if (CurrentMenu != HomeOffMenu) {
CurrentMenu = HomeOffMenu; CurrentMenu = HomeOffMenu;
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_SET_HOME_OFFSETS)); // TODO: Chinese, English "Set Home Offsets" JPG SetMenuTitle({0}, GET_TEXT_F(MSG_SET_HOME_OFFSETS)); // TODO: Chinese, English "Set Home Offsets" JPG
DWINUI::MenuItemsPrepare(4); DWINUI::MenuItemsPrepare(4);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu);
ADDMENUITEM_P(ICON_HomeOffsetX, GET_TEXT_F(MSG_HOME_OFFSET_X), onDrawPFloatMenu, SetHomeOffsetX, &home_offset[X_AXIS]); ADDMENUITEM_P(ICON_HomeOffsetX, GET_TEXT_F(MSG_HOME_OFFSET_X), onDrawPFloatMenu, SetHomeOffsetX, &home_offset[X_AXIS]);
@ -3251,7 +3251,7 @@ void Draw_Move_Menu() {
if (ProbeSetMenu == nullptr) ProbeSetMenu = new MenuClass(); if (ProbeSetMenu == nullptr) ProbeSetMenu = new MenuClass();
if (CurrentMenu != ProbeSetMenu) { if (CurrentMenu != ProbeSetMenu) {
CurrentMenu = ProbeSetMenu; CurrentMenu = ProbeSetMenu;
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_ZPROBE_SETTINGS)); // TODO: Chinese, English "Probe Settings" JPG SetMenuTitle({0}, GET_TEXT_F(MSG_ZPROBE_SETTINGS)); // TODO: Chinese, English "Probe Settings" JPG
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu);
ADDMENUITEM_P(ICON_ProbeOffsetX, GET_TEXT_F(MSG_ZPROBE_XOFFSET), onDrawPFloatMenu, SetProbeOffsetX, &probe.offset.x); ADDMENUITEM_P(ICON_ProbeOffsetX, GET_TEXT_F(MSG_ZPROBE_XOFFSET), onDrawPFloatMenu, SetProbeOffsetX, &probe.offset.x);
@ -3295,7 +3295,7 @@ void Draw_SelectColors_Menu() {
if (SelectColorMenu == nullptr) SelectColorMenu = new MenuClass(); if (SelectColorMenu == nullptr) SelectColorMenu = new MenuClass();
if (CurrentMenu != SelectColorMenu) { if (CurrentMenu != SelectColorMenu) {
CurrentMenu = SelectColorMenu; CurrentMenu = SelectColorMenu;
SetMenuTitle({0}, {0}, F("Select Colors")); // TODO: Chinese, English "Select Color" JPG SetMenuTitle({0}, F("Select Colors")); // TODO: Chinese, English "Select Color" JPG
DWINUI::MenuItemsPrepare(20); DWINUI::MenuItemsPrepare(20);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu);
ADDMENUITEM(ICON_StockConfiguration, GET_TEXT_F(MSG_RESTORE_DEFAULTS), onDrawMenuItem, RestoreDefaultsColors); ADDMENUITEM(ICON_StockConfiguration, GET_TEXT_F(MSG_RESTORE_DEFAULTS), onDrawMenuItem, RestoreDefaultsColors);
@ -3326,7 +3326,7 @@ void Draw_GetColor_Menu() {
if (GetColorMenu == nullptr) GetColorMenu = new MenuClass(); if (GetColorMenu == nullptr) GetColorMenu = new MenuClass();
if (CurrentMenu != GetColorMenu) { if (CurrentMenu != GetColorMenu) {
CurrentMenu = GetColorMenu; CurrentMenu = GetColorMenu;
SetMenuTitle({0}, {0}, F("Get Color")); // TODO: Chinese, English "Get Color" JPG SetMenuTitle({0}, F("Get Color")); // TODO: Chinese, English "Get Color" JPG
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, DWIN_ApplyColor); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, DWIN_ApplyColor);
ADDMENUITEM(ICON_Cancel, GET_TEXT_F(MSG_BUTTON_CANCEL), onDrawMenuItem, Draw_SelectColors_Menu); ADDMENUITEM(ICON_Cancel, GET_TEXT_F(MSG_BUTTON_CANCEL), onDrawMenuItem, Draw_SelectColors_Menu);
@ -3343,7 +3343,7 @@ void Draw_Tune_Menu() {
if (TuneMenu == nullptr) TuneMenu = new MenuClass(); if (TuneMenu == nullptr) TuneMenu = new MenuClass();
if (CurrentMenu != TuneMenu) { if (CurrentMenu != TuneMenu) {
CurrentMenu = TuneMenu; CurrentMenu = TuneMenu;
SetMenuTitle({73, 2, 28, 12}, {94, 2, 33, 11}, GET_TEXT_F(MSG_TUNE)); // TODO: Chinese, English "Tune" JPG SetMenuTitle({73, 2, 28, 12}, GET_TEXT_F(MSG_TUNE)); // TODO: Chinese, English "Tune" JPG
DWINUI::MenuItemsPrepare(10); DWINUI::MenuItemsPrepare(10);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_PrintProcess); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_PrintProcess);
ADDMENUITEM_P(ICON_Speed, GET_TEXT_F(MSG_SPEED), onDrawSpeedItem, SetSpeed, &feedrate_percentage); ADDMENUITEM_P(ICON_Speed, GET_TEXT_F(MSG_SPEED), onDrawSpeedItem, SetSpeed, &feedrate_percentage);
@ -3376,7 +3376,7 @@ void Draw_Motion_Menu() {
if (MotionMenu == nullptr) MotionMenu = new MenuClass(); if (MotionMenu == nullptr) MotionMenu = new MenuClass();
if (CurrentMenu != MotionMenu) { if (CurrentMenu != MotionMenu) {
CurrentMenu = MotionMenu; CurrentMenu = MotionMenu;
SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_MOTION)); // TODO: Chinese, English "Motion" JPG SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_MOTION)); // TODO: Chinese, English "Motion" JPG
DWINUI::MenuItemsPrepare(6); DWINUI::MenuItemsPrepare(6);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu);
ADDMENUITEM(ICON_MaxSpeed, GET_TEXT_F(MSG_SPEED), onDrawSpeed, Draw_MaxSpeed_Menu); ADDMENUITEM(ICON_MaxSpeed, GET_TEXT_F(MSG_SPEED), onDrawSpeed, Draw_MaxSpeed_Menu);
@ -3396,7 +3396,7 @@ void Draw_Motion_Menu() {
if (FilamentMenu == nullptr) FilamentMenu = new MenuClass(); if (FilamentMenu == nullptr) FilamentMenu = new MenuClass();
if (CurrentMenu != FilamentMenu) { if (CurrentMenu != FilamentMenu) {
CurrentMenu = FilamentMenu; CurrentMenu = FilamentMenu;
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_FILAMENT_MAN)); // TODO: Chinese, English "Filament Management" JPG SetMenuTitle({0}, GET_TEXT_F(MSG_FILAMENT_MAN)); // TODO: Chinese, English "Filament Management" JPG
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
ADDMENUITEM(ICON_Park, GET_TEXT_F(MSG_FILAMENT_PARK_ENABLED), onDrawMenuItem, ParkHead); ADDMENUITEM(ICON_Park, GET_TEXT_F(MSG_FILAMENT_PARK_ENABLED), onDrawMenuItem, ParkHead);
@ -3416,8 +3416,8 @@ void Draw_Motion_Menu() {
if (ManualMesh == nullptr) ManualMesh = new MenuClass(); if (ManualMesh == nullptr) ManualMesh = new MenuClass();
if (CurrentMenu != ManualMesh) { if (CurrentMenu != ManualMesh) {
CurrentMenu = ManualMesh; CurrentMenu = ManualMesh;
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_MANUAL_MESH)); // TODO: Chinese, English "Manual Mesh Leveling" JPG SetMenuTitle({0}, GET_TEXT_F(MSG_MANUAL_MESH)); // TODO: Chinese, English "Manual Mesh Leveling" JPG
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(6);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
ADDMENUITEM(ICON_ManualMesh, GET_TEXT_F(MSG_LEVEL_BED), onDrawMenuItem, ManualMeshStart); ADDMENUITEM(ICON_ManualMesh, GET_TEXT_F(MSG_LEVEL_BED), onDrawMenuItem, ManualMeshStart);
MMeshMoveZItem = ADDMENUITEM_P(ICON_Zoffset, GET_TEXT_F(MSG_MOVE_Z), onDrawMMeshMoveZ, SetMMeshMoveZ, &current_position.z); MMeshMoveZItem = ADDMENUITEM_P(ICON_Zoffset, GET_TEXT_F(MSG_MOVE_Z), onDrawMMeshMoveZ, SetMMeshMoveZ, &current_position.z);
@ -3431,11 +3431,11 @@ void Draw_Motion_Menu() {
#if HAS_PREHEAT #if HAS_PREHEAT
void Draw_Preheat_Menu(frame_rect_t cn, frame_rect_t en, const __FlashStringHelper* fstr) { void Draw_Preheat_Menu(frame_rect_t cn, const __FlashStringHelper* fstr) {
checkkey = Menu; checkkey = Menu;
if (CurrentMenu != PreheatMenu) { if (CurrentMenu != PreheatMenu) {
CurrentMenu = PreheatMenu; CurrentMenu = PreheatMenu;
SetMenuTitle(cn, en, fstr); SetMenuTitle(cn, fstr);
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Temperature_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Temperature_Menu);
#if HAS_HOTEND #if HAS_HOTEND
@ -3457,13 +3457,13 @@ void Draw_Motion_Menu() {
void Draw_Preheat1_Menu() { void Draw_Preheat1_Menu() {
HMI_value.Preheat = 0; HMI_value.Preheat = 0;
if (PreheatMenu == nullptr) PreheatMenu = new MenuClass(); if (PreheatMenu == nullptr) PreheatMenu = new MenuClass();
Draw_Preheat_Menu({59, 16, 81, 14}, {56, 15, 85, 14}, F(PREHEAT_1_LABEL " Preheat Settings")); // TODO: English "PLA Settings" JPG Draw_Preheat_Menu({59, 16, 81, 14}, F(PREHEAT_1_LABEL " Preheat Settings")); // TODO: English "PLA Settings" JPG
} }
void Draw_Preheat2_Menu() { void Draw_Preheat2_Menu() {
HMI_value.Preheat = 1; HMI_value.Preheat = 1;
if (PreheatMenu == nullptr) PreheatMenu = new MenuClass(); if (PreheatMenu == nullptr) PreheatMenu = new MenuClass();
Draw_Preheat_Menu({142, 16, 82, 14}, {56, 15, 85, 14}, F(PREHEAT_2_LABEL " Preheat Settings")); // TODO: English "ABS Settings" JPG Draw_Preheat_Menu({142, 16, 82, 14}, F(PREHEAT_2_LABEL " Preheat Settings")); // TODO: English "ABS Settings" JPG
} }
#ifdef PREHEAT_3_LABEL #ifdef PREHEAT_3_LABEL
@ -3471,7 +3471,7 @@ void Draw_Motion_Menu() {
HMI_value.Preheat = 2; HMI_value.Preheat = 2;
if (PreheatMenu == nullptr) PreheatMenu = new MenuClass(); if (PreheatMenu == nullptr) PreheatMenu = new MenuClass();
#define PREHEAT_3_TITLE PREHEAT_3_LABEL " Preheat Set." #define PREHEAT_3_TITLE PREHEAT_3_LABEL " Preheat Set."
Draw_Preheat_Menu({0}, {0}, F(PREHEAT_3_TITLE)); // TODO: Chinese, English "Custom Preheat Settings" JPG Draw_Preheat_Menu({0}, F(PREHEAT_3_TITLE)); // TODO: Chinese, English "Custom Preheat Settings" JPG
} }
#endif #endif
@ -3482,7 +3482,7 @@ void Draw_Temperature_Menu() {
if (TemperatureMenu == nullptr) TemperatureMenu = new MenuClass(); if (TemperatureMenu == nullptr) TemperatureMenu = new MenuClass();
if (CurrentMenu != TemperatureMenu) { if (CurrentMenu != TemperatureMenu) {
CurrentMenu = TemperatureMenu; CurrentMenu = TemperatureMenu;
SetMenuTitle({236, 2, 28, 12}, {56, 15, 85, 14}, GET_TEXT_F(MSG_TEMPERATURE)); SetMenuTitle({236, 2, 28, 12}, GET_TEXT_F(MSG_TEMPERATURE));
DWINUI::MenuItemsPrepare(7); DWINUI::MenuItemsPrepare(7);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu);
#if HAS_HOTEND #if HAS_HOTEND
@ -3510,7 +3510,7 @@ void Draw_MaxSpeed_Menu() {
if (MaxSpeedMenu == nullptr) MaxSpeedMenu = new MenuClass(); if (MaxSpeedMenu == nullptr) MaxSpeedMenu = new MenuClass();
if (CurrentMenu != MaxSpeedMenu) { if (CurrentMenu != MaxSpeedMenu) {
CurrentMenu = MaxSpeedMenu; CurrentMenu = MaxSpeedMenu;
SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_MAXSPEED)); SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_MAXSPEED));
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu);
ADDMENUITEM_P(ICON_MaxSpeedX, GET_TEXT_F(MSG_MAXSPEED_X), onDrawMaxSpeedX, SetMaxSpeedX, &planner.settings.max_feedrate_mm_s[X_AXIS]); ADDMENUITEM_P(ICON_MaxSpeedX, GET_TEXT_F(MSG_MAXSPEED_X), onDrawMaxSpeedX, SetMaxSpeedX, &planner.settings.max_feedrate_mm_s[X_AXIS]);
@ -3528,7 +3528,7 @@ void Draw_MaxAccel_Menu() {
if (MaxAccelMenu == nullptr) MaxAccelMenu = new MenuClass(); if (MaxAccelMenu == nullptr) MaxAccelMenu = new MenuClass();
if (CurrentMenu != MaxAccelMenu) { if (CurrentMenu != MaxAccelMenu) {
CurrentMenu = MaxAccelMenu; CurrentMenu = MaxAccelMenu;
SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_ACCELERATION)); SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_ACCELERATION));
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu);
ADDMENUITEM_P(ICON_MaxAccX, GET_TEXT_F(MSG_AMAX_A), onDrawMaxAccelX, SetMaxAccelX, &planner.settings.max_acceleration_mm_per_s2[X_AXIS]); ADDMENUITEM_P(ICON_MaxAccX, GET_TEXT_F(MSG_AMAX_A), onDrawMaxAccelX, SetMaxAccelX, &planner.settings.max_acceleration_mm_per_s2[X_AXIS]);
@ -3547,7 +3547,7 @@ void Draw_MaxAccel_Menu() {
if (MaxJerkMenu == nullptr) MaxJerkMenu = new MenuClass(); if (MaxJerkMenu == nullptr) MaxJerkMenu = new MenuClass();
if (CurrentMenu != MaxJerkMenu) { if (CurrentMenu != MaxJerkMenu) {
CurrentMenu = MaxJerkMenu; CurrentMenu = MaxJerkMenu;
SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_JERK)); SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_JERK));
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu);
ADDMENUITEM_P(ICON_MaxSpeedJerkX, GET_TEXT_F(MSG_VA_JERK), onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk[X_AXIS]); ADDMENUITEM_P(ICON_MaxSpeedJerkX, GET_TEXT_F(MSG_VA_JERK), onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk[X_AXIS]);
@ -3566,7 +3566,7 @@ void Draw_Steps_Menu() {
if (StepsMenu == nullptr) StepsMenu = new MenuClass(); if (StepsMenu == nullptr) StepsMenu = new MenuClass();
if (CurrentMenu != StepsMenu) { if (CurrentMenu != StepsMenu) {
CurrentMenu = StepsMenu; CurrentMenu = StepsMenu;
SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_STEPS_PER_MM)); SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_STEPS_PER_MM));
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu);
ADDMENUITEM_P(ICON_StepX, GET_TEXT_F(MSG_A_STEPS), onDrawStepsX, SetStepsX, &planner.settings.axis_steps_per_mm[X_AXIS]); ADDMENUITEM_P(ICON_StepX, GET_TEXT_F(MSG_A_STEPS), onDrawStepsX, SetStepsX, &planner.settings.axis_steps_per_mm[X_AXIS]);

View File

@ -24,8 +24,8 @@
/** /**
* DWIN UI Enhanced implementation * DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo * Author: Miguel A. Risco-Castillo
* Version: 3.6.3 * Version: 3.7.1
* Date: 2021/09/08 * Date: 2021/11/09
*/ */
#include "../../../inc/MarlinConfigPre.h" #include "../../../inc/MarlinConfigPre.h"
@ -154,6 +154,7 @@ void HMI_SDCardUpdate();
// Other // Other
void Goto_PrintProcess(); void Goto_PrintProcess();
void Goto_Main_Menu(); void Goto_Main_Menu();
void Goto_InfoMenu();
void Draw_Select_Highlight(const bool sel); void Draw_Select_Highlight(const bool sel);
void Draw_Status_Area(const bool with_update); // Status Area void Draw_Status_Area(const bool with_update); // Status Area
void Draw_Main_Area(); // Redraw main area; void Draw_Main_Area(); // Redraw main area;

View File

@ -23,8 +23,8 @@
/** /**
* DWIN UI Enhanced implementation * DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo * Author: Miguel A. Risco-Castillo
* Version: 3.6.3 * Version: 3.7.1
* Date: 2021/09/08 * Date: 2021/11/09
*/ */
#include "../../../inc/MarlinConfigPre.h" #include "../../../inc/MarlinConfigPre.h"

View File

@ -24,8 +24,8 @@
/** /**
* DWIN UI Enhanced implementation * DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo * Author: Miguel A. Risco-Castillo
* Version: 3.6.3 * Version: 3.7.1
* Date: 2021/09/08 * Date: 2021/11/09
*/ */
#include "../common/dwin_api.h" #include "../common/dwin_api.h"
@ -48,13 +48,6 @@ inline void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, FSTR_P title)
// x/y: Screen paste point // 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 DWIN_Frame_AreaCopy(uint8_t cacheID, 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
// cacheID: virtual area number
// 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);
// Copy area from current virtual display area to current screen // Copy area from current virtual display area to current screen
// xStart/yStart: Upper-left of virtual area // xStart/yStart: Upper-left of virtual area
// xEnd/yEnd: Lower-right of virtual area // xEnd/yEnd: Lower-right of virtual area

View File

@ -23,8 +23,8 @@
/** /**
* DWIN UI Enhanced implementation * DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo * Author: Miguel A. Risco-Castillo
* Version: 3.6.3 * Version: 3.7.1
* Date: 2021/09/08 * Date: 2021/11/09
*/ */
#include "../../../inc/MarlinConfigPre.h" #include "../../../inc/MarlinConfigPre.h"
@ -38,8 +38,8 @@
//#define DEBUG_OUT 1 //#define DEBUG_OUT 1
#include "../../../core/debug_out.h" #include "../../../core/debug_out.h"
uint8_t MenuItemTotal = 0; int8_t MenuItemTotal = 0;
uint8_t MenuItemCount = 0; int8_t MenuItemCount = 0;
MenuItemClass** MenuItems = nullptr; MenuItemClass** MenuItems = nullptr;
MenuClass *CurrentMenu = nullptr; MenuClass *CurrentMenu = nullptr;
MenuClass *PreviousMenu = nullptr; MenuClass *PreviousMenu = nullptr;
@ -50,8 +50,8 @@ uint16_t DWINUI::textcolor = Def_Text_Color;
uint16_t DWINUI::backcolor = Def_Background_Color; uint16_t DWINUI::backcolor = Def_Background_Color;
uint8_t DWINUI::font = font8x16; uint8_t DWINUI::font = font8x16;
void (*DWINUI::onCursorErase)(uint8_t line)=nullptr; void (*DWINUI::onCursorErase)(const int8_t line)=nullptr;
void (*DWINUI::onCursorDraw)(uint8_t line)=nullptr; void (*DWINUI::onCursorDraw)(const int8_t line)=nullptr;
void (*DWINUI::onTitleDraw)(TitleClass* title)=nullptr; void (*DWINUI::onTitleDraw)(TitleClass* title)=nullptr;
void (*DWINUI::onMenuDraw)(MenuClass* menu)=nullptr; void (*DWINUI::onMenuDraw)(MenuClass* menu)=nullptr;
@ -304,14 +304,14 @@ void DWINUI::ClearMenuArea() {
void DWINUI::MenuItemsClear() { void DWINUI::MenuItemsClear() {
if (MenuItems == nullptr) return; if (MenuItems == nullptr) return;
for (uint8_t i = 0; i < MenuItemCount; i++) delete MenuItems[i]; for (int8_t i = 0; i < MenuItemCount; i++) delete MenuItems[i];
delete[] MenuItems; delete[] MenuItems;
MenuItems = nullptr; MenuItems = nullptr;
MenuItemCount = 0; MenuItemCount = 0;
MenuItemTotal = 0; MenuItemTotal = 0;
} }
void DWINUI::MenuItemsPrepare(uint8_t totalitems) { void DWINUI::MenuItemsPrepare(int8_t totalitems) {
MenuItemsClear(); MenuItemsClear();
MenuItemTotal = totalitems; MenuItemTotal = totalitems;
MenuItems = new MenuItemClass*[totalitems]; MenuItems = new MenuItemClass*[totalitems];
@ -379,7 +379,7 @@ MenuClass::MenuClass() {
void MenuClass::draw() { void MenuClass::draw() {
MenuTitle.draw(); MenuTitle.draw();
if (DWINUI::onMenuDraw != nullptr) (*DWINUI::onMenuDraw)(this); if (DWINUI::onMenuDraw != nullptr) (*DWINUI::onMenuDraw)(this);
for (uint8_t i = 0; i < MenuItemCount; i++) for (int8_t i = 0; i < MenuItemCount; i++)
MenuItems[i]->draw(i - topline); MenuItems[i]->draw(i - topline);
if (DWINUI::onCursorDraw != nullptr) DWINUI::onCursorDraw(line()); if (DWINUI::onCursorDraw != nullptr) DWINUI::onCursorDraw(line());
DWIN_UpdateLCD(); DWIN_UpdateLCD();

View File

@ -24,11 +24,10 @@
/** /**
* DWIN UI Enhanced implementation * DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo * Author: Miguel A. Risco-Castillo
* Version: 3.6.3 * Version: 3.7.1
* Date: 2021/09/08 * Date: 2021/11/09
*/ */
#include "../../../core/types.h"
#include "dwin_lcd.h" #include "dwin_lcd.h"
#include "../common/dwin_set.h" #include "../common/dwin_set.h"
#include "../common/dwin_font.h" #include "../common/dwin_font.h"
@ -138,7 +137,7 @@ extern TitleClass Title;
class MenuItemClass { class MenuItemClass {
protected: protected:
public: public:
uint8_t pos = 0; int8_t pos = 0;
uint8_t icon = 0; uint8_t icon = 0;
char caption[32] = ""; char caption[32] = "";
uint8_t frameid = 0; uint8_t frameid = 0;
@ -185,8 +184,8 @@ namespace DWINUI {
extern uint16_t backcolor; extern uint16_t backcolor;
extern uint8_t font; extern uint8_t font;
extern void (*onCursorErase)(uint8_t line); extern void (*onCursorErase)(const int8_t line);
extern void (*onCursorDraw)(uint8_t line); extern void (*onCursorDraw)(const int8_t line);
extern void (*onTitleDraw)(TitleClass* title); extern void (*onTitleDraw)(TitleClass* title);
extern void (*onMenuDraw)(MenuClass* menu); extern void (*onMenuDraw)(MenuClass* menu);
@ -342,6 +341,12 @@ namespace DWINUI {
// rlimit: For draw less chars than string length use rlimit // rlimit: For draw less chars than string length use rlimit
void Draw_String(const char * const string, uint16_t rlimit = 0xFFFF); 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); 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);
}
inline void Draw_String(uint16_t color, FSTR_P string, uint16_t rlimit = 0xFFFF) {
Draw_String(color, FTOP(string), rlimit);
}
// Draw a string // Draw a string
// size: Font size // size: Font size
@ -353,25 +358,25 @@ namespace DWINUI {
DWIN_Draw_String(false, font, textcolor, backcolor, x, y, string); DWIN_Draw_String(false, font, textcolor, backcolor, x, y, string);
} }
inline void Draw_String(uint16_t x, uint16_t y, FSTR_P title) { inline void Draw_String(uint16_t x, uint16_t y, FSTR_P title) {
DWIN_Draw_String(false, font, textcolor, backcolor, x, y, (char *)title); DWIN_Draw_String(false, font, textcolor, backcolor, x, y, FTOP(title));
} }
inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) { inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) {
DWIN_Draw_String(false, font, color, backcolor, x, y, string); DWIN_Draw_String(false, font, color, backcolor, x, y, string);
} }
inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, FSTR_P title) { inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, FSTR_P title) {
DWIN_Draw_String(false, font, color, backcolor, x, y, (char *)title); DWIN_Draw_String(false, font, color, backcolor, x, y, title);
} }
inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
DWIN_Draw_String(true, font, color, bgcolor, x, y, string); DWIN_Draw_String(true, font, color, bgcolor, x, y, string);
} }
inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) {
DWIN_Draw_String(true, font, color, bgcolor, x, y, (char *)title); DWIN_Draw_String(true, font, color, bgcolor, x, y, title);
} }
inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
DWIN_Draw_String(true, size, color, bgcolor, x, y, string); DWIN_Draw_String(true, size, color, bgcolor, x, y, string);
} }
inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) {
DWIN_Draw_String(true, size, color, bgcolor, x, y, (char *)title); DWIN_Draw_String(true, size, color, bgcolor, x, y, title);
} }
// Draw a centered string using DWIN_WIDTH // Draw a centered string using DWIN_WIDTH
@ -382,8 +387,8 @@ namespace DWINUI {
// y: Upper coordinate of the string // y: Upper coordinate of the string
// *string: The string // *string: The string
void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string); void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string);
inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P title) { inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) {
Draw_CenteredString(bShow, size, color, bColor, y, (char *)title); Draw_CenteredString(bShow, size, color, bColor, y, FTOP(string));
} }
inline void Draw_CenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) { inline void Draw_CenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) {
Draw_CenteredString(true, font, color, bcolor, y, string); Draw_CenteredString(true, font, color, bcolor, y, string);
@ -392,19 +397,19 @@ namespace DWINUI {
Draw_CenteredString(false, size, color, backcolor, y, string); Draw_CenteredString(false, size, color, backcolor, y, string);
} }
inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, FSTR_P title) { inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, FSTR_P title) {
Draw_CenteredString(false, size, color, backcolor, y, (char *)title); Draw_CenteredString(false, size, color, backcolor, y, title);
} }
inline void Draw_CenteredString(uint16_t color, uint16_t y, const char * const string) { inline void Draw_CenteredString(uint16_t color, uint16_t y, const char * const string) {
Draw_CenteredString(false, font, color, backcolor, y, string); Draw_CenteredString(false, font, color, backcolor, y, string);
} }
inline void Draw_CenteredString(uint16_t color, uint16_t y, FSTR_P title) { inline void Draw_CenteredString(uint16_t color, uint16_t y, FSTR_P title) {
Draw_CenteredString(false, font, color, backcolor, y, (char *)title); Draw_CenteredString(false, font, color, backcolor, y, title);
} }
inline void Draw_CenteredString(uint16_t y, const char * const string) { inline void Draw_CenteredString(uint16_t y, const char * const string) {
Draw_CenteredString(false, font, textcolor, backcolor, y, string); Draw_CenteredString(false, font, textcolor, backcolor, y, string);
} }
inline void Draw_CenteredString(uint16_t y, FSTR_P title) { inline void Draw_CenteredString(uint16_t y, FSTR_P title) {
Draw_CenteredString(false, font, textcolor, backcolor, y, (char *)title); Draw_CenteredString(false, font, textcolor, backcolor, y, title);
} }
// Draw a circle // Draw a circle
@ -477,7 +482,7 @@ namespace DWINUI {
void MenuItemsClear(); void MenuItemsClear();
// Prepare MenuItems array // Prepare MenuItems array
void MenuItemsPrepare(uint8_t totalitems); void MenuItemsPrepare(int8_t totalitems);
// Add elements to the MenuItems array // Add elements to the MenuItems array
MenuItemClass* MenuItemsAdd(MenuItemClass* menuitem); MenuItemClass* MenuItemsAdd(MenuItemClass* menuitem);

View File

@ -1,8 +1,8 @@
/** /**
* DWIN Mesh Viewer * DWIN Mesh Viewer
* Author: Miguel A. Risco-Castillo * Author: Miguel A. Risco-Castillo
* version: 2.5 * version: 3.8.1
* Date: 2021/09/27 * Date: 2021/11/06
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as * it under the terms of the GNU Lesser General Public License as
@ -35,13 +35,15 @@
MeshViewerClass MeshViewer; MeshViewerClass MeshViewer;
void MeshViewerClass::Draw() { void MeshViewerClass::Draw() {
const int8_t mx = 30, my = 30; // Margins const int8_t mx = 25, my = 25; // Margins
const int16_t stx = (DWIN_WIDTH - 2 * mx) / (GRID_MAX_POINTS_X - 1), // Steps const int16_t stx = (DWIN_WIDTH - 2 * mx) / (GRID_MAX_POINTS_X - 1), // Steps
sty = (DWIN_WIDTH - 2 * my) / (GRID_MAX_POINTS_Y - 1); sty = (DWIN_WIDTH - 2 * my) / (GRID_MAX_POINTS_Y - 1);
int8_t zmesh[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y], maxz =-127, minz = 127; const int8_t rmax = _MIN(mx - 2, stx / 2);
const int8_t rmin = 7;
int16_t zmesh[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y], maxz =-32000, minz = 32000;
#define px(xp) (mx + (xp) * stx) #define px(xp) (mx + (xp) * stx)
#define py(yp) (30 + DWIN_WIDTH - my - (yp) * sty) #define py(yp) (30 + DWIN_WIDTH - my - (yp) * sty)
#define rm(z) ((((z) - minz) * 10 / _MAX(1, (maxz - minz))) + 10) #define rm(z) ((z - minz) * (rmax - rmin) / _MAX(1, (maxz - minz)) + rmin)
#define DrawMeshValue(xp, yp, zv) DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(xp) - 12, py(yp) - 6, zv) #define DrawMeshValue(xp, yp, zv) DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(xp) - 12, py(yp) - 6, zv)
#define DrawMeshHLine(yp) DWIN_Draw_HLine(HMI_data.SplitLine_Color, px(0), py(yp), DWIN_WIDTH - 2 * mx) #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) #define DrawMeshVLine(xp) DWIN_Draw_VLine(HMI_data.SplitLine_Color, px(xp), py(GRID_MAX_POINTS_Y - 1), DWIN_WIDTH - 2 * my)
@ -61,8 +63,33 @@ void MeshViewerClass::Draw() {
watchdog_refresh(); watchdog_refresh();
LOOP_L_N(x, GRID_MAX_POINTS_X) { LOOP_L_N(x, GRID_MAX_POINTS_X) {
uint16_t color = DWINUI::RainbowInt(zmesh[x][y], _MIN(-5, minz), _MAX(5, maxz)); uint16_t color = DWINUI::RainbowInt(zmesh[x][y], _MIN(-5, minz), _MAX(5, maxz));
DWINUI::Draw_FillCircle(color, px(x), py(y), rm(zmesh[x][y])); uint8_t radius = rm(zmesh[x][y]);
DrawMeshValue(x, y, Z_VALUES(x,y)); DWINUI::Draw_FillCircle(color, px(x), py(y), radius);
if (GRID_MAX_POINTS_X < 9)
DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(x) - 12, py(y) - 6, Z_VALUES(x,y));
else {
char str_1[9];
str_1[0] = 0;
switch (zmesh[x][y]) {
case -999 ... -100:
DWINUI::Draw_Signed_Float(font6x12, 1, 1, px(x) - 12, py(y) - 6, Z_VALUES(x,y));
break;
case -99 ... -1:
sprintf_P(str_1, PSTR("-.%02i"), -zmesh[x][y]);
break;
case 0:
DWIN_Draw_String(false, font6x12, DWINUI::textcolor, DWINUI::backcolor, px(x) - 4, py(y) - 6, "0");;
break;
case 1 ... 99:
sprintf_P(str_1, PSTR(".%02i"), zmesh[x][y]);
break;
case 100 ... 999:
DWINUI::Draw_Signed_Float(font6x12, 1, 1, px(x) - 12, py(y) - 6, Z_VALUES(x,y));
break;
}
if (str_1[0])
DWIN_Draw_String(false, font6x12, DWINUI::textcolor, DWINUI::backcolor, px(x) - 12, py(y) - 6, str_1);
}
} }
} }
char str_1[6], str_2[6] = ""; char str_1[6], str_2[6] = "";

View File

@ -1,8 +1,8 @@
/** /**
* DWIN Mesh Viewer * DWIN Mesh Viewer
* Author: Miguel A. Risco-Castillo * Author: Miguel A. Risco-Castillo
* version: 2.5 * Version: 3.8.1
* Date: 2021/09/27 * Date: 2021/11/06
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as * it under the terms of the GNU Lesser General Public License as

View File

@ -3044,8 +3044,6 @@ void MarlinSettings::reset() {
postprocess(); postprocess();
DEBUG_ECHO_MSG("Hardcoded Default Settings Loaded"); DEBUG_ECHO_MSG("Hardcoded Default Settings Loaded");
TERN_(EXTENSIBLE_UI, ExtUI::onFactoryReset());
} }
#if DISABLED(DISABLE_M503) #if DISABLED(DISABLE_M503)

View File

@ -3750,8 +3750,9 @@ void Temperature::isr() {
HMI_flag.heat_flag = 0; HMI_flag.heat_flag = 0;
duration_t elapsed = print_job_timer.duration(); // print timer duration_t elapsed = print_job_timer.duration(); // print timer
dwin_heat_time = elapsed.value; dwin_heat_time = elapsed.value;
#endif #else
ui.reset_status(); ui.reset_status();
#endif
TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onHeatingDone()); TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onHeatingDone());
return true; return true;
} }