🚸 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_(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
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);

View file

@ -23,8 +23,8 @@
/**
* DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo
* Version: 3.6.3
* Date: 2021/09/10
* Version: 3.7.1
* Date: 2021/11/09
*/
#include "../../../inc/MarlinConfigPre.h"
@ -142,7 +142,7 @@ HMI_data_t HMI_data;
millis_t dwin_heat_time = 0;
uint8_t checkkey = MainMenu, last_checkkey = MainMenu;
uint8_t checkkey = 255, last_checkkey = MainMenu;
enum SelectItem : uint8_t {
PAGE_PRINT = 0,
@ -386,15 +386,15 @@ void ICON_Stop() {
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);
}
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);
}
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);
Draw_Menu_Cursor(newline);
}
@ -577,6 +577,7 @@ void Popup_window_PauseOrStop() {
DWINUI::Draw_Icon(ICON_Cancel_E, 146, 280);
}
Draw_Select_Highlight(true);
DWIN_UpdateLCD();
}
#if HAS_HOTEND || HAS_HEATED_BED
@ -607,7 +608,6 @@ void Popup_window_PauseOrStop() {
}
}
}
#endif
void Draw_Print_Labels() {
@ -671,6 +671,7 @@ void Draw_PrintProcess() {
}
void Goto_PrintProcess() {
if (checkkey == PrintProcess) return;
checkkey = PrintProcess;
Draw_PrintProcess();
}
@ -712,6 +713,7 @@ void Draw_Main_Menu() {
}
void Goto_Main_Menu() {
if (checkkey == MainMenu) return;
checkkey = MainMenu;
DWIN_StatusChanged();
Draw_Main_Menu();
@ -1157,10 +1159,10 @@ void HMI_MainMenu() {
case PAGE_INFO_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
checkkey = Info;
Draw_Info_Menu();
last_checkkey = MainMenu;
Goto_InfoMenu();
#endif
break;
}
@ -1245,7 +1247,7 @@ void HMI_SelectFile() {
}
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
if (select_file.now == 0) {
if (select_file.now == 0) { // Back
select_page.set(PAGE_PRINT);
Goto_Main_Menu();
}
@ -1441,7 +1443,6 @@ void Draw_Main_Area() {
void HMI_ReturnScreen() {
checkkey = last_checkkey;
Draw_Main_Area();
DWIN_UpdateLCD();
return;
}
@ -2161,7 +2162,7 @@ void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS
void SetMoveZto0() {
char cmd[48] = "";
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)
dtostrf(0, 1, 1, str_1),
dtostrf(0, 1, 1, str_2)
@ -2344,7 +2345,7 @@ void LevBed(uint8_t point) {
float xpos = 0, ypos = 0, zval = 0;
float margin = PROBING_MARGIN;
#else
#define fmt "M420 S0\nG28O\nG90\nG0 Z5 F300\nG0 X%i Y%i F5000\nG0 Z0 F300"
#define fmt "M420S0\nG28O\nG90\nG0Z5F300\nG0X%iY%iF5000\nG0Z0F300"
int16_t xpos = 0, ypos = 0;
int16_t margin = 30;
#endif
@ -2400,7 +2401,7 @@ void LevBedC () { LevBed(4); }
void ManualMeshStart(){
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();
#ifdef MANUAL_PROBE_START_Z
const uint8_t line = CurrentMenu->line(MMeshMoveZItem->pos);
@ -2425,7 +2426,7 @@ void LevBedC () { LevBed(4); }
void ManualMeshSave(){
LCD_MESSAGE(MSG_UBL_STORAGE_MESH_MENU);
queue.inject(F("M211 S1\nM500"));
queue.inject(F("M211S1\nM500"));
}
#endif // MESH_BED_LEVELING
@ -2741,7 +2742,7 @@ void onDrawSteps(MenuItemClass* menuitem, int8_t line) {
#if ENABLED(MESH_BED_LEVELING)
void onDrawMMeshMoveZ(MenuItemClass* menuitem, int8_t line) {
if (HMI_IsChinese()) menuitem->SetFrame(1, 160, 118, 209, 132);
onDrawPFloatMenu(menuitem, line);
onDrawPFloat2Menu(menuitem, line);
}
#endif
@ -3027,11 +3028,11 @@ void HMI_SetIntNoDraw() {
// Set an integer pointer variable using the encoder
void HMI_SetPInt() {
int8_t val = HMI_GetInt(HMI_value.MinValue, HMI_value.MaxValue);
if (!val) return;
else if (val == 2) { // Apply
*HMI_value.P_Int = HMI_value.Value;
if (HMI_value.Apply != nullptr) HMI_value.Apply();
} else if (HMI_value.LiveUpdate != nullptr) HMI_value.LiveUpdate();
switch (val) {
case 0: return;
case 1: if (HMI_value.LiveUpdate != nullptr) HMI_value.LiveUpdate(); break;
case 2: *HMI_value.P_Int = HMI_value.Value; if (HMI_value.Apply != nullptr) HMI_value.Apply(); break;
}
}
// Get a scaled float value using the encoder
@ -3071,17 +3072,16 @@ void HMI_SetFloat() {
// Set a scaled float pointer variable using the encoder
void HMI_SetPFloat() {
const int8_t val = HMI_GetFloat(HMI_value.dp, HMI_value.MinValue, HMI_value.MaxValue);
if (!val) return;
if (val == 2) { // Apply
*HMI_value.P_Float = HMI_value.Value / POW(10, HMI_value.dp);
if (HMI_value.Apply != nullptr) HMI_value.Apply();
switch (val) {
case 0: return;
case 1: if (HMI_value.LiveUpdate != nullptr) HMI_value.LiveUpdate(); break;
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 ======================================================
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))
CurrentMenu->MenuTitle.SetFrame(cn.x, cn.y, cn.w, cn.h);
else
@ -3093,7 +3093,7 @@ void Draw_Prepare_Menu() {
if (PrepareMenu == nullptr) PrepareMenu = new MenuClass();
if (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);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu);
#if ENABLED(ADVANCED_PAUSE_FEATURE)
@ -3134,7 +3134,7 @@ void Draw_LevBedCorners_Menu() {
if (LevBedMenu == nullptr) LevBedMenu = new MenuClass();
if (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);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
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 (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);
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);
@ -3173,8 +3173,8 @@ void Draw_AdvancedSettings_Menu() {
if (AdvancedSettings == nullptr) AdvancedSettings = new MenuClass();
if (CurrentMenu != AdvancedSettings) {
CurrentMenu = AdvancedSettings;
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_ADVANCED_SETTINGS)); // TODO: Chinese, English "Advanced Settings" JPG
DWINUI::MenuItemsPrepare(11);
SetMenuTitle({0}, GET_TEXT_F(MSG_ADVANCED_SETTINGS)); // TODO: Chinese, English "Advanced Settings" JPG
DWINUI::MenuItemsPrepare(12);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu);
#if HAS_HOME_OFFSET
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 (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);
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);
@ -3234,7 +3234,7 @@ void Draw_Move_Menu() {
if (HomeOffMenu == nullptr) HomeOffMenu = new MenuClass();
if (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);
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]);
@ -3251,7 +3251,7 @@ void Draw_Move_Menu() {
if (ProbeSetMenu == nullptr) ProbeSetMenu = new MenuClass();
if (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);
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);
@ -3295,7 +3295,7 @@ void Draw_SelectColors_Menu() {
if (SelectColorMenu == nullptr) SelectColorMenu = new MenuClass();
if (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);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu);
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 (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);
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);
@ -3343,7 +3343,7 @@ void Draw_Tune_Menu() {
if (TuneMenu == nullptr) TuneMenu = new MenuClass();
if (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);
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);
@ -3376,7 +3376,7 @@ void Draw_Motion_Menu() {
if (MotionMenu == nullptr) MotionMenu = new MenuClass();
if (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);
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);
@ -3396,7 +3396,7 @@ void Draw_Motion_Menu() {
if (FilamentMenu == nullptr) FilamentMenu = new MenuClass();
if (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);
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);
@ -3416,8 +3416,8 @@ void Draw_Motion_Menu() {
if (ManualMesh == nullptr) ManualMesh = new MenuClass();
if (CurrentMenu != ManualMesh) {
CurrentMenu = ManualMesh;
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_MANUAL_MESH)); // TODO: Chinese, English "Manual Mesh Leveling" JPG
DWINUI::MenuItemsPrepare(5);
SetMenuTitle({0}, GET_TEXT_F(MSG_MANUAL_MESH)); // TODO: Chinese, English "Manual Mesh Leveling" JPG
DWINUI::MenuItemsPrepare(6);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
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);
@ -3431,11 +3431,11 @@ void Draw_Motion_Menu() {
#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;
if (CurrentMenu != PreheatMenu) {
CurrentMenu = PreheatMenu;
SetMenuTitle(cn, en, fstr);
SetMenuTitle(cn, fstr);
DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Temperature_Menu);
#if HAS_HOTEND
@ -3457,13 +3457,13 @@ void Draw_Motion_Menu() {
void Draw_Preheat1_Menu() {
HMI_value.Preheat = 0;
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() {
HMI_value.Preheat = 1;
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
@ -3471,7 +3471,7 @@ void Draw_Motion_Menu() {
HMI_value.Preheat = 2;
if (PreheatMenu == nullptr) PreheatMenu = new MenuClass();
#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
@ -3482,7 +3482,7 @@ void Draw_Temperature_Menu() {
if (TemperatureMenu == nullptr) TemperatureMenu = new MenuClass();
if (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);
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu);
#if HAS_HOTEND
@ -3510,7 +3510,7 @@ void Draw_MaxSpeed_Menu() {
if (MaxSpeedMenu == nullptr) MaxSpeedMenu = new MenuClass();
if (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);
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]);
@ -3528,7 +3528,7 @@ void Draw_MaxAccel_Menu() {
if (MaxAccelMenu == nullptr) MaxAccelMenu = new MenuClass();
if (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);
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]);
@ -3547,7 +3547,7 @@ void Draw_MaxAccel_Menu() {
if (MaxJerkMenu == nullptr) MaxJerkMenu = new MenuClass();
if (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);
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]);
@ -3566,7 +3566,7 @@ void Draw_Steps_Menu() {
if (StepsMenu == nullptr) StepsMenu = new MenuClass();
if (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);
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]);

View file

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

View file

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

View file

@ -24,8 +24,8 @@
/**
* DWIN UI Enhanced implementation
* Author: Miguel A. Risco-Castillo
* Version: 3.6.3
* Date: 2021/09/08
* Version: 3.7.1
* Date: 2021/11/09
*/
#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
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
// xStart/yStart: Upper-left of virtual area
// xEnd/yEnd: Lower-right of virtual area

View file

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

View file

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

View file

@ -1,8 +1,8 @@
/**
* DWIN Mesh Viewer
* Author: Miguel A. Risco-Castillo
* version: 2.5
* Date: 2021/09/27
* version: 3.8.1
* Date: 2021/11/06
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
@ -35,13 +35,15 @@
MeshViewerClass MeshViewer;
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
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 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 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)
@ -61,8 +63,33 @@ void MeshViewerClass::Draw() {
watchdog_refresh();
LOOP_L_N(x, GRID_MAX_POINTS_X) {
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]));
DrawMeshValue(x, y, Z_VALUES(x,y));
uint8_t radius = rm(zmesh[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] = "";

View file

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

View file

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

View file

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