MKS H43 fix, cleanup (#21485)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
parent
bfdd1f4662
commit
4d17613050
|
@ -2373,7 +2373,11 @@
|
|||
//#define DGUS_LCD_UI_ORIGIN
|
||||
//#define DGUS_LCD_UI_FYSETC
|
||||
//#define DGUS_LCD_UI_HIPRECY
|
||||
//#define DGUS_LCD_UI_MKS
|
||||
|
||||
// #define DGUS_LCD_UI_MKS
|
||||
#if ENABLED(DGUS_LCD_UI_MKS)
|
||||
#define USE_MKS_GREEN_UI
|
||||
#endif
|
||||
|
||||
//
|
||||
// Touch-screen LCD for Malyan M200/M300 printers
|
||||
|
|
|
@ -102,6 +102,9 @@ extern DefaultSerial1 USBSerial;
|
|||
#else
|
||||
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||
#endif
|
||||
#if HAS_DGUS_LCD
|
||||
#define SERIAL_GET_TX_BUFFER_FREE() MSerial0.available()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
|
|
|
@ -62,9 +62,11 @@ void DGUSDisplay::InitDisplay() {
|
|||
#define LCD_BAUDRATE 115200
|
||||
#endif
|
||||
LCD_SERIAL.begin(LCD_BAUDRATE);
|
||||
#if BOTH(DGUS_LCD_UI_MKS, POWER_LOSS_RECOVERY)
|
||||
if (!recovery.valid()) delay(LOGO_TIME_DELAY);
|
||||
#endif
|
||||
|
||||
if (TERN1(POWER_LOSS_RECOVERY, !recovery.valid())) { // If no Power-Loss Recovery is needed...
|
||||
TERN_(DGUS_LCD_UI_MKS, delay(LOGO_TIME_DELAY)); // Show the logo for a little while
|
||||
}
|
||||
|
||||
RequestScreen(TERN(SHOW_BOOTSCREEN, DGUSLCD_SCREEN_BOOT, DGUSLCD_SCREEN_MAIN));
|
||||
}
|
||||
|
||||
|
|
|
@ -43,58 +43,45 @@
|
|||
uint16_t distanceToMove = 10;
|
||||
#endif
|
||||
|
||||
uint16_t distanceMove = 1;
|
||||
uint16_t manualMoveStep = 1;
|
||||
float distanceFilament = 10;
|
||||
uint16_t FilamentSpeed = 25;
|
||||
float ZOffset_distance = 0.1;
|
||||
float mesh_adj_distance = 0.1;
|
||||
float mesh_adj_distance = 0.01;
|
||||
float Z_distance = 0.1;
|
||||
|
||||
int16_t level_1_x_point = 20;
|
||||
int16_t level_1_y_point = 20;
|
||||
//struct { uint16_t h, m, s; } dgus_time;
|
||||
|
||||
int16_t level_2_x_point = 20;
|
||||
int16_t level_2_y_point = 20;
|
||||
//
|
||||
// Persistent settings
|
||||
//
|
||||
xy_int_t mks_corner_offsets[5]; // Initialized by settings.load()
|
||||
xyz_int_t mks_park_pos; // Initialized by settings.load()
|
||||
celsius_t mks_min_extrusion_temp; // Initialized by settings.load()
|
||||
|
||||
int16_t level_3_x_point = 20;
|
||||
int16_t level_3_y_point = 20;
|
||||
|
||||
int16_t level_4_x_point = 20;
|
||||
int16_t level_4_y_point = 20;
|
||||
int16_t level_5_x_point = X_MAX_POS / 2;
|
||||
int16_t level_5_y_point = Y_MAX_POS / 2;
|
||||
|
||||
uint16_t tim_h;
|
||||
uint16_t tim_m;
|
||||
uint16_t tim_s;
|
||||
|
||||
uint16_t x_park_pos = 20;
|
||||
uint16_t y_park_pos = 20;
|
||||
uint16_t z_park_pos = 10;
|
||||
void MKS_reset_settings() {
|
||||
constexpr xy_int_t init_dgus_level_offsets[5] = {
|
||||
{ 20, 20 }, { 20, 20 },
|
||||
{ 20, 20 }, { 20, 20 },
|
||||
{ X_CENTER, Y_CENTER }
|
||||
};
|
||||
mks_language_index = 0;
|
||||
COPY(mks_corner_offsets, init_dgus_level_offsets);
|
||||
mks_park_pos.set(20, 20, 10);
|
||||
mks_min_extrusion_temp = 0;
|
||||
}
|
||||
|
||||
xyz_pos_t position_before_pause;
|
||||
|
||||
void MKS_pause_print_move() {
|
||||
queue.exhaust();
|
||||
position_before_pause = current_position;
|
||||
do_blocking_move_to(X_MIN_POS + x_park_pos, Y_MIN_POS + y_park_pos, current_position.z + z_park_pos);
|
||||
do_blocking_move_to(X_MIN_POS + mks_park_pos.x, Y_MIN_POS + mks_park_pos.y, current_position.z + mks_park_pos.z);
|
||||
}
|
||||
|
||||
void MKS_resume_print_move() { do_blocking_move_to(position_before_pause); }
|
||||
|
||||
uint16_t min_ex_temp = 0;
|
||||
|
||||
float z_offset_add = 0;
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
uint16_t tmc_x_step = 0;
|
||||
uint16_t tmc_y_step = 0;
|
||||
uint16_t tmc_z_step = 0;
|
||||
#else
|
||||
uint16_t tmc_x_step = 0;
|
||||
uint16_t tmc_y_step = 0;
|
||||
uint16_t tmc_z_step = 0;
|
||||
#endif
|
||||
xyz_int_t tmc_step; // = { 0, 0, 0 }
|
||||
|
||||
uint16_t lcd_default_light = 50;
|
||||
|
||||
|
@ -525,7 +512,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
|||
VPHELPER(VP_Y_HOME, nullptr, &ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_Z_HOME, nullptr, &ScreenHandler.HandleManualMove, nullptr),
|
||||
|
||||
VPHELPER(VP_MOVE_DISTANCE, &distanceMove, &ScreenHandler.GetManualMovestep, nullptr),
|
||||
VPHELPER(VP_MOVE_DISTANCE, &manualMoveStep, &ScreenHandler.GetManualMovestep, nullptr),
|
||||
|
||||
VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, &ScreenHandler.HandleManualMove, nullptr),
|
||||
VPHELPER(VP_LEVEL_POINT, nullptr, &ScreenHandler.ManualAssistLeveling, nullptr),
|
||||
|
@ -567,7 +554,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
|||
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
||||
VPHELPER(VP_LOAD_Filament, nullptr, &ScreenHandler.MKS_FilamentLoad, nullptr),
|
||||
VPHELPER(VP_UNLOAD_Filament, nullptr, &ScreenHandler.MKS_FilamentUnLoad, nullptr),
|
||||
VPHELPER(VP_Filament_distance, &distanceFilament, &ScreenHandler.GetManualFilament, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_Filament_distance, &distanceFilament, &ScreenHandler.GetManualFilament, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
|
||||
VPHELPER(VP_Filament_speed, &FilamentSpeed, &ScreenHandler.GetManualFilamentSpeed, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
#endif
|
||||
#endif
|
||||
|
@ -623,16 +610,16 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
|||
VPHELPER(VP_ZPos, ¤t_position.z, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
|
||||
|
||||
// Level Point Set
|
||||
VPHELPER(VP_Level_Point_One_X, &level_1_x_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_One_Y, &level_1_y_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Two_X, &level_2_x_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Two_Y, &level_2_y_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Three_X, &level_3_x_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Three_Y, &level_3_y_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Four_X, &level_4_x_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Four_Y, &level_4_y_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Five_X, &level_5_x_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Five_Y, &level_5_y_point, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_One_X, &mks_corner_offsets[0].x, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_One_Y, &mks_corner_offsets[0].y, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Two_X, &mks_corner_offsets[1].x, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Two_Y, &mks_corner_offsets[1].y, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Three_X, &mks_corner_offsets[2].x, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Three_Y, &mks_corner_offsets[2].y, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Four_X, &mks_corner_offsets[3].x, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Four_Y, &mks_corner_offsets[3].y, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Five_X, &mks_corner_offsets[4].x, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Level_Point_Five_Y, &mks_corner_offsets[4].y, ScreenHandler.HandleChangeLevelPoint_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
// Print Progress
|
||||
VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay),
|
||||
|
@ -679,20 +666,20 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
|||
VPHELPER(VP_T_F_SPEED, (uint16_t *)&planner.settings.min_travel_feedrate_mm_s, ScreenHandler.HandleMin_T_F_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>),
|
||||
VPHELPER(VP_ACC_SPEED, (uint16_t *)&planner.settings.acceleration, ScreenHandler.HandleAccChange_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
VPHELPER(VP_X_PARK_POS, &x_park_pos, ScreenHandler.GetParkPos_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Y_PARK_POS, &y_park_pos, ScreenHandler.GetParkPos_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Z_PARK_POS, &z_park_pos, ScreenHandler.GetParkPos_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_X_PARK_POS, &mks_park_pos.x, ScreenHandler.GetParkPos_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Y_PARK_POS, &mks_park_pos.y, ScreenHandler.GetParkPos_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_Z_PARK_POS, &mks_park_pos.z, ScreenHandler.GetParkPos_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
VPHELPER(VP_MIN_EX_T, &thermalManager.extrude_min_temp, ScreenHandler.HandleGetExMinTemp_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING) // TMC SENSORLESS Setting
|
||||
#if AXIS_HAS_STEALTHCHOP(X)
|
||||
VPHELPER(VP_TMC_X_STEP, &tmc_x_step, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue),
|
||||
VPHELPER(VP_TMC_X_STEP, &tmc_step.x, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue),
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Y)
|
||||
VPHELPER(VP_TMC_Y_STEP, &tmc_y_step, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue),
|
||||
VPHELPER(VP_TMC_Y_STEP, &tmc_step.y, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue),
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Z)
|
||||
VPHELPER(VP_TMC_Z_STEP, &tmc_z_step, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue),
|
||||
VPHELPER(VP_TMC_Z_STEP, &tmc_step.z, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "../DGUSDisplayDef.h"
|
||||
|
||||
#define USE_MKS_GREEN_UI
|
||||
//#define DGUS_MKS_RUNOUT_SENSOR
|
||||
|
||||
#define LOGO_TIME_DELAY TERN(USE_MKS_GREEN_UI, 8000, 1500)
|
||||
|
@ -36,43 +35,27 @@
|
|||
|
||||
#define MKS_FINSH
|
||||
|
||||
extern uint16_t distanceMove;
|
||||
extern uint16_t manualMoveStep;
|
||||
extern float distanceFilament;
|
||||
extern uint16_t FilamentSpeed;
|
||||
extern float ZOffset_distance;
|
||||
extern float mesh_adj_distance;
|
||||
extern float Z_distance;
|
||||
|
||||
extern int16_t level_1_x_point;
|
||||
extern int16_t level_1_y_point;
|
||||
extern int16_t level_2_x_point;
|
||||
extern int16_t level_2_y_point;
|
||||
extern int16_t level_3_x_point;
|
||||
extern int16_t level_3_y_point;
|
||||
extern int16_t level_4_x_point;
|
||||
extern int16_t level_4_y_point;
|
||||
extern int16_t level_5_x_point;
|
||||
extern int16_t level_5_y_point;
|
||||
//extern struct { uint16_t h, m, s; } dgus_time;
|
||||
|
||||
extern uint16_t tim_h;
|
||||
extern uint16_t tim_m;
|
||||
extern uint16_t tim_s;
|
||||
extern xy_int_t mks_corner_offsets[5];
|
||||
extern xyz_int_t mks_park_pos;
|
||||
extern celsius_t mks_min_extrusion_temp;
|
||||
|
||||
extern uint16_t x_park_pos;
|
||||
extern uint16_t y_park_pos;
|
||||
extern uint16_t z_park_pos;
|
||||
void MKS_reset_settings(); // Restore persistent settings to defaults
|
||||
|
||||
extern xyz_pos_t position_before_pause;
|
||||
void MKS_pause_print_move();
|
||||
void MKS_resume_print_move();
|
||||
|
||||
extern uint16_t min_ex_temp;
|
||||
|
||||
extern float z_offset_add;
|
||||
|
||||
extern uint16_t tmc_x_step;
|
||||
extern uint16_t tmc_y_step;
|
||||
extern uint16_t tmc_z_step;
|
||||
xyz_int_t tmc_step;
|
||||
|
||||
extern uint16_t lcd_default_light;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#endif
|
||||
|
||||
bool DGUSAutoTurnOff = false;
|
||||
uint8_t DGUSLanguageSwitch = 0; // Switch language for MKS DGUS
|
||||
uint8_t mks_language_index; // Initialized by settings.load()
|
||||
|
||||
// endianness swap
|
||||
uint32_t swap32(const uint32_t value) { return (value & 0x000000FFU) << 24U | (value & 0x0000FF00U) << 8U | (value & 0x00FF0000U) >> 8U | (value & 0xFF000000U) >> 24U; }
|
||||
|
@ -125,11 +125,11 @@ void DGUSScreenHandler::DGUSLCD_SendGbkToDisplay(DGUS_VP_Variable &var) {
|
|||
}
|
||||
|
||||
void DGUSScreenHandler::DGUSLCD_SendStringToDisplay_Language_MKS(DGUS_VP_Variable &var) {
|
||||
if (DGUSLanguageSwitch == MKS_English) {
|
||||
if (mks_language_index == MKS_English) {
|
||||
char *tmp = (char*) var.memadr;
|
||||
dgusdisplay.WriteVariable(var.VP, tmp, var.size, true);
|
||||
}
|
||||
else if (DGUSLanguageSwitch == MKS_SimpleChinese) {
|
||||
else if (mks_language_index == MKS_SimpleChinese) {
|
||||
uint16_t *tmp = (uint16_t *)var.memadr;
|
||||
dgusdisplay.WriteVariable(var.VP, tmp, var.size, true);
|
||||
}
|
||||
|
@ -138,15 +138,15 @@ void DGUSScreenHandler::DGUSLCD_SendStringToDisplay_Language_MKS(DGUS_VP_Variabl
|
|||
void DGUSScreenHandler::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) {
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
#if AXIS_HAS_STEALTHCHOP(X)
|
||||
tmc_x_step = stepperX.homing_threshold();
|
||||
tmc_step.x = stepperX.homing_threshold();
|
||||
dgusdisplay.WriteVariable(var.VP, *(int16_t*)var.memadr);
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Y)
|
||||
tmc_y_step = stepperY.homing_threshold();
|
||||
tmc_step.y = stepperY.homing_threshold();
|
||||
dgusdisplay.WriteVariable(var.VP, *(int16_t*)var.memadr);
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Z)
|
||||
tmc_z_step = stepperZ.homing_threshold();
|
||||
tmc_step.z = stepperZ.homing_threshold();
|
||||
dgusdisplay.WriteVariable(var.VP, *(int16_t*)var.memadr);
|
||||
#endif
|
||||
#endif
|
||||
|
@ -329,7 +329,7 @@ void DGUSScreenHandler::ZoffsetConfirm(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
}
|
||||
|
||||
void DGUSScreenHandler::GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("ctrl turn off\n");
|
||||
DEBUG_ECHOLNPGM("GetTurnOffCtrl\n");
|
||||
const uint16_t value = swap16(*(uint16_t *)val_ptr);
|
||||
switch (value) {
|
||||
case 0 ... 1: DGUSAutoTurnOff = (bool)value; break;
|
||||
|
@ -338,15 +338,15 @@ void DGUSScreenHandler::GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
}
|
||||
|
||||
void DGUSScreenHandler::GetMinExtrudeTemp(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("MinExtrudeTempChange DistanceChange");
|
||||
DEBUG_ECHOLNPGM("GetMinExtrudeTemp");
|
||||
const uint16_t value = swap16(*(uint16_t *)val_ptr);
|
||||
thermalManager.extrude_min_temp = value;
|
||||
min_ex_temp = value;
|
||||
mks_min_extrusion_temp = value;
|
||||
settings.save();
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::GetZoffsetDistance(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("Zoffset DistanceChange");
|
||||
DEBUG_ECHOLNPGM("GetZoffsetDistance");
|
||||
const uint16_t value = swap16(*(uint16_t *)val_ptr);
|
||||
float val_distance = 0;
|
||||
switch (value) {
|
||||
|
@ -360,7 +360,7 @@ void DGUSScreenHandler::GetZoffsetDistance(DGUS_VP_Variable &var, void *val_ptr)
|
|||
}
|
||||
|
||||
void DGUSScreenHandler::GetManualMovestep(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("\nMove DistanceChange");
|
||||
DEBUG_ECHOLNPGM("\nGetManualMovestep");
|
||||
*(uint16_t *)var.memadr = swap16(*(uint16_t *)val_ptr);
|
||||
}
|
||||
|
||||
|
@ -414,14 +414,14 @@ void DGUSScreenHandler::LanguageChange_MKS(DGUS_VP_Variable &var, void *val_ptr)
|
|||
switch (lag_flag) {
|
||||
case MKS_SimpleChinese:
|
||||
DGUS_LanguageDisplay(MKS_SimpleChinese);
|
||||
DGUSLanguageSwitch = MKS_SimpleChinese;
|
||||
mks_language_index = MKS_SimpleChinese;
|
||||
dgusdisplay.MKS_WriteVariable(VP_LANGUAGE_CHANGE1, MKS_Language_Choose);
|
||||
dgusdisplay.MKS_WriteVariable(VP_LANGUAGE_CHANGE2, MKS_Language_NoChoose);
|
||||
settings.save();
|
||||
break;
|
||||
case MKS_English:
|
||||
DGUS_LanguageDisplay(MKS_English);
|
||||
DGUSLanguageSwitch = MKS_English;
|
||||
mks_language_index = MKS_English;
|
||||
dgusdisplay.MKS_WriteVariable(VP_LANGUAGE_CHANGE1, MKS_Language_NoChoose);
|
||||
dgusdisplay.MKS_WriteVariable(VP_LANGUAGE_CHANGE2, MKS_Language_Choose);
|
||||
settings.save();
|
||||
|
@ -454,11 +454,11 @@ void DGUSScreenHandler::Level_Ctrl_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
|
||||
mesh_point_count = GRID_MAX_POINTS;
|
||||
|
||||
if (DGUSLanguageSwitch == MKS_English) {
|
||||
if (mks_language_index == MKS_English) {
|
||||
const char level_buf_en[] = "Start Level";
|
||||
dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_en, 32, true);
|
||||
}
|
||||
else if (DGUSLanguageSwitch == MKS_SimpleChinese) {
|
||||
else if (mks_language_index == MKS_SimpleChinese) {
|
||||
const uint16_t level_buf_ch[] = {0xAABF, 0xBCCA, 0xF7B5, 0xBDC6, 0x2000};
|
||||
dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_ch, 32, true);
|
||||
}
|
||||
|
@ -532,15 +532,17 @@ void DGUSScreenHandler::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
break;
|
||||
|
||||
case 2:
|
||||
if (mesh_point_count == GRID_MAX_POINTS) { // 第1个点
|
||||
if (mesh_point_count == GRID_MAX_POINTS) { // The first point
|
||||
|
||||
queue.enqueue_now_P(PSTR("G28"));
|
||||
queue.enqueue_now_P(PSTR("G29S1"));
|
||||
mesh_point_count--;
|
||||
|
||||
if (DGUSLanguageSwitch == MKS_English) {
|
||||
if (mks_language_index == MKS_English) {
|
||||
const char level_buf_en1[] = "Next Point";
|
||||
dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_en1, 32, true);
|
||||
}
|
||||
else if (DGUSLanguageSwitch == MKS_SimpleChinese) {
|
||||
else if (mks_language_index == MKS_SimpleChinese) {
|
||||
const uint16_t level_buf_ch1[] = {0xC2CF, 0xBBD2, 0xE3B5, 0x2000};
|
||||
dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_ch1, 32, true);
|
||||
}
|
||||
|
@ -548,11 +550,11 @@ void DGUSScreenHandler::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
else if (mesh_point_count > 1) { // 倒数第二个点
|
||||
queue.enqueue_now_P(PSTR("G29S2"));
|
||||
mesh_point_count--;
|
||||
if (DGUSLanguageSwitch == MKS_English) {
|
||||
if (mks_language_index == MKS_English) {
|
||||
const char level_buf_en2[] = "Next Point";
|
||||
dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_en2, 32, true);
|
||||
}
|
||||
else if (DGUSLanguageSwitch == MKS_SimpleChinese) {
|
||||
else if (mks_language_index == MKS_SimpleChinese) {
|
||||
const uint16_t level_buf_ch2[] = {0xC2CF, 0xBBD2, 0xE3B5, 0x2000};
|
||||
dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_ch2, 32, true);
|
||||
}
|
||||
|
@ -560,11 +562,11 @@ void DGUSScreenHandler::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
else if (mesh_point_count == 1) {
|
||||
queue.enqueue_now_P(PSTR("G29S2"));
|
||||
mesh_point_count--;
|
||||
if (DGUSLanguageSwitch == MKS_English) {
|
||||
if (mks_language_index == MKS_English) {
|
||||
const char level_buf_en2[] = "Level Finsh";
|
||||
dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_en2, 32, true);
|
||||
}
|
||||
else if (DGUSLanguageSwitch == MKS_SimpleChinese) {
|
||||
else if (mks_language_index == MKS_SimpleChinese) {
|
||||
const uint16_t level_buf_ch2[] = {0xF7B5, 0xBDC6, 0xEACD, 0xC9B3, 0x2000};
|
||||
dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_ch2, 32, true);
|
||||
}
|
||||
|
@ -597,85 +599,52 @@ void DGUSScreenHandler::LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
void DGUSScreenHandler::ManualAssistLeveling(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
const int16_t point_value = swap16(*(uint16_t *)val_ptr);
|
||||
|
||||
int16_t level_x_pos, level_y_pos;
|
||||
char buf_level[32] = {0};
|
||||
unsigned int level_speed = 1500;
|
||||
// Insist on leveling first time at this screen
|
||||
static bool first_level_flag = false;
|
||||
|
||||
if (!first_level_flag)
|
||||
if (!first_level_flag || point_value == 0x0001) {
|
||||
queue.enqueue_now_P(G28_STR);
|
||||
first_level_flag = true;
|
||||
}
|
||||
|
||||
constexpr uint16_t level_speed = 1500;
|
||||
|
||||
auto enqueue_corner_move = [](int16_t lx, int16_t ly, uint16_t fr) {
|
||||
char buf_level[32];
|
||||
sprintf_P(buf_level, "G0X%dY%dF%d", lx, ly, fr);
|
||||
queue.enqueue_one_now(buf_level);
|
||||
};
|
||||
|
||||
if (WITHIN(point_value, 0x0001, 0x0005))
|
||||
queue.enqueue_now_P(PSTR("G1Z10"));
|
||||
|
||||
switch (point_value) {
|
||||
case 0x0001:
|
||||
if (first_level_flag)
|
||||
queue.enqueue_now_P(G28_STR);
|
||||
queue.enqueue_now_P(PSTR("G1 Z10"));
|
||||
//level_x_pos = X_MIN_POS + 20;
|
||||
//level_y_pos = Y_MIN_POS + 20;
|
||||
level_x_pos = X_MIN_POS + abs(level_1_x_point);
|
||||
level_y_pos = Y_MIN_POS + abs(level_1_y_point);
|
||||
|
||||
memset(buf_level, 0, sizeof(buf_level));
|
||||
sprintf_P(buf_level, "G0 X%d Y%d F%d", level_x_pos, level_y_pos, level_speed);
|
||||
queue.enqueue_one_now(buf_level);
|
||||
queue.enqueue_now_P(PSTR("G28 Z"));
|
||||
enqueue_corner_move(X_MIN_POS + abs(mks_corner_offsets[0].x),
|
||||
Y_MIN_POS + abs(mks_corner_offsets[0].y), level_speed);
|
||||
queue.enqueue_now_P(PSTR("G28Z"));
|
||||
break;
|
||||
case 0x0002:
|
||||
queue.enqueue_now_P(PSTR("G1 Z10"));
|
||||
|
||||
//level_x_pos = X_MAX_POS - 20;
|
||||
//level_y_pos = Y_MIN_POS + 20;
|
||||
|
||||
level_x_pos = X_MAX_POS - abs(level_2_x_point);
|
||||
level_y_pos = Y_MIN_POS + abs(level_2_y_point);
|
||||
|
||||
sprintf_P(buf_level, "G0 X%d Y%d F%d", level_x_pos, level_y_pos, level_speed);
|
||||
queue.enqueue_one_now(buf_level);
|
||||
//queue.enqueue_now_P(PSTR("G28Z"));
|
||||
queue.enqueue_now_P(PSTR("G1 Z-10"));
|
||||
enqueue_corner_move(X_MAX_POS - abs(mks_corner_offsets[1].x),
|
||||
Y_MIN_POS + abs(mks_corner_offsets[1].y), level_speed);
|
||||
break;
|
||||
case 0x0003:
|
||||
queue.enqueue_now_P(PSTR("G1 Z10"));
|
||||
|
||||
//level_x_pos = X_MAX_POS - 20;
|
||||
//level_y_pos = Y_MAX_POS - 20;
|
||||
|
||||
level_x_pos = X_MAX_POS - abs(level_3_x_point);
|
||||
level_y_pos = Y_MAX_POS - abs(level_3_y_point);
|
||||
|
||||
sprintf_P(buf_level, "G0 X%d Y%d F%d", level_x_pos, level_y_pos, level_speed);
|
||||
queue.enqueue_one_now(buf_level);
|
||||
//sprintf_P(buf_level, PSTR("G28 Z"));
|
||||
queue.enqueue_now_P(PSTR("G1 Z-10"));
|
||||
enqueue_corner_move(X_MAX_POS - abs(mks_corner_offsets[2].x),
|
||||
Y_MAX_POS - abs(mks_corner_offsets[2].y), level_speed);
|
||||
break;
|
||||
case 0x0004:
|
||||
queue.enqueue_now_P(PSTR("G1 Z10"));
|
||||
|
||||
//level_x_pos = X_MIN_POS + 20;
|
||||
//level_y_pos = Y_MAX_POS - 20;
|
||||
level_x_pos = X_MIN_POS + abs(level_4_x_point);
|
||||
level_y_pos = Y_MAX_POS - abs(level_4_y_point);
|
||||
|
||||
sprintf_P(buf_level, "G0 X%d Y%d F%d", level_x_pos, level_y_pos, level_speed);
|
||||
queue.enqueue_one_now(buf_level);
|
||||
//sprintf_P(buf_level, PSTR("G28 Z"));
|
||||
queue.enqueue_now_P(PSTR("G1 Z-10"));
|
||||
enqueue_corner_move(X_MIN_POS + abs(mks_corner_offsets[3].x),
|
||||
Y_MAX_POS - abs(mks_corner_offsets[3].y), level_speed);
|
||||
break;
|
||||
case 0x0005:
|
||||
queue.enqueue_now_P(PSTR("G1 Z10"));
|
||||
//level_x_pos = (uint16_t)(X_MAX_POS / 2);
|
||||
//level_y_pos = (uint16_t)(Y_MAX_POS / 2);
|
||||
level_x_pos = abs(level_5_x_point);
|
||||
level_y_pos = abs(level_5_y_point);
|
||||
|
||||
sprintf_P(buf_level, "G0 X%d Y%d F%d", level_x_pos, level_y_pos, level_speed);
|
||||
queue.enqueue_one_now(buf_level);
|
||||
queue.enqueue_now_P(PSTR("G1 Z-10"));
|
||||
enqueue_corner_move(abs(mks_corner_offsets[4].x),
|
||||
abs(mks_corner_offsets[4].y), level_speed);
|
||||
break;
|
||||
}
|
||||
|
||||
// Only once
|
||||
first_level_flag = true;
|
||||
if (WITHIN(point_value, 0x0002, 0x0005)) {
|
||||
//queue.enqueue_now_P(PSTR("G28Z"));
|
||||
queue.enqueue_now_P(PSTR("G1Z-10"));
|
||||
}
|
||||
}
|
||||
|
||||
#define mks_min(a, b) ((a) < (b)) ? (a) : (b)
|
||||
|
@ -691,7 +660,7 @@ void DGUSScreenHandler::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
#if AXIS_HAS_STEALTHCHOP(X)
|
||||
stepperX.homing_threshold(mks_min(tmc_value, 255));
|
||||
settings.save();
|
||||
//tmc_x_step = stepperX.homing_threshold();
|
||||
//tmc_step.x = stepperX.homing_threshold();
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
|
@ -700,7 +669,7 @@ void DGUSScreenHandler::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
#if AXIS_HAS_STEALTHCHOP(Y)
|
||||
stepperY.homing_threshold(mks_min(tmc_value, 255));
|
||||
settings.save();
|
||||
//tmc_y_step = stepperY.homing_threshold();
|
||||
//tmc_step.y = stepperY.homing_threshold();
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
|
@ -709,7 +678,7 @@ void DGUSScreenHandler::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
#if AXIS_HAS_STEALTHCHOP(Z)
|
||||
stepperZ.homing_threshold(mks_min(tmc_value, 255));
|
||||
settings.save();
|
||||
//tmc_z_step = stepperZ.homing_threshold();
|
||||
//tmc_step.z = stepperZ.homing_threshold();
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
|
@ -767,13 +736,13 @@ void DGUSScreenHandler::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
}
|
||||
#if USE_SENSORLESS
|
||||
#if AXIS_HAS_STEALTHCHOP(X)
|
||||
tmc_x_step = stepperX.homing_threshold();
|
||||
tmc_step.x = stepperX.homing_threshold();
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Y)
|
||||
tmc_y_step = stepperY.homing_threshold();
|
||||
tmc_step.y = stepperY.homing_threshold();
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Z)
|
||||
tmc_z_step = stepperZ.homing_threshold();
|
||||
tmc_step.z = stepperZ.homing_threshold();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -784,9 +753,9 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
int16_t movevalue = swap16(*(uint16_t*)val_ptr);
|
||||
|
||||
// Choose Move distance
|
||||
if (distanceMove == 0x01) distanceMove = 10;
|
||||
else if (distanceMove == 0x02) distanceMove = 100;
|
||||
else if (distanceMove == 0x03) distanceMove = 1000;
|
||||
if (manualMoveStep == 0x01) manualMoveStep = 10;
|
||||
else if (manualMoveStep == 0x02) manualMoveStep = 100;
|
||||
else if (manualMoveStep == 0x03) manualMoveStep = 1000;
|
||||
|
||||
DEBUG_ECHOLNPAIR("QUEUE LEN:", queue.length);
|
||||
|
||||
|
@ -853,8 +822,8 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
DEBUG_ECHOPAIR("movevalue = ", movevalue);
|
||||
if (movevalue != 0 && movevalue != 5) { // get move distance
|
||||
switch (movevalue) {
|
||||
case 0x0001: movevalue = distanceMove; break;
|
||||
case 0x0002: movevalue = -distanceMove; break;
|
||||
case 0x0001: movevalue = manualMoveStep; break;
|
||||
case 0x0002: movevalue = -manualMoveStep; break;
|
||||
default: movevalue = 0; break;
|
||||
}
|
||||
}
|
||||
|
@ -929,16 +898,16 @@ void DGUSScreenHandler::GetParkPos_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
|||
const int16_t value_pos = swap16(*(int16_t*)val_ptr);
|
||||
|
||||
switch (var.VP) {
|
||||
case VP_X_PARK_POS: x_park_pos = value_pos; break;
|
||||
case VP_Y_PARK_POS: y_park_pos = value_pos; break;
|
||||
case VP_Z_PARK_POS: z_park_pos = value_pos; break;
|
||||
case VP_X_PARK_POS: mks_park_pos.x = value_pos; break;
|
||||
case VP_Y_PARK_POS: mks_park_pos.y = value_pos; break;
|
||||
case VP_Z_PARK_POS: mks_park_pos.z = value_pos; break;
|
||||
default: break;
|
||||
}
|
||||
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleChangeLevelPoint_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleStepPerMMChanged");
|
||||
DEBUG_ECHOLNPGM("HandleChangeLevelPoint_MKS");
|
||||
|
||||
const int16_t value_raw = swap16(*(int16_t*)val_ptr);
|
||||
DEBUG_ECHOLNPAIR_F("value_raw:", value_raw);
|
||||
|
@ -950,7 +919,7 @@ void DGUSScreenHandler::HandleChangeLevelPoint_MKS(DGUS_VP_Variable &var, void *
|
|||
}
|
||||
|
||||
void DGUSScreenHandler::HandleStepPerMMChanged_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleStepPerMMChanged");
|
||||
DEBUG_ECHOLNPGM("HandleStepPerMMChanged_MKS");
|
||||
|
||||
const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
||||
const float value = (float)value_raw;
|
||||
|
@ -972,7 +941,7 @@ void DGUSScreenHandler::HandleStepPerMMChanged_MKS(DGUS_VP_Variable &var, void *
|
|||
}
|
||||
|
||||
void DGUSScreenHandler::HandleStepPerMMExtruderChanged_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleStepPerMMExtruderChanged");
|
||||
DEBUG_ECHOLNPGM("HandleStepPerMMExtruderChanged_MKS");
|
||||
|
||||
const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
||||
const float value = (float)value_raw;
|
||||
|
@ -1019,7 +988,7 @@ void DGUSScreenHandler::HandleMaxSpeedChange_MKS(DGUS_VP_Variable &var, void *va
|
|||
}
|
||||
|
||||
void DGUSScreenHandler::HandleExtruderMaxSpeedChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleMaxSpeedChange_MKS");
|
||||
DEBUG_ECHOLNPGM("HandleExtruderMaxSpeedChange_MKS");
|
||||
|
||||
const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
||||
const float value = (float)value_raw;
|
||||
|
@ -1044,7 +1013,7 @@ void DGUSScreenHandler::HandleExtruderMaxSpeedChange_MKS(DGUS_VP_Variable &var,
|
|||
}
|
||||
|
||||
void DGUSScreenHandler::HandleMaxAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleMaxSpeedChange_MKS");
|
||||
DEBUG_ECHOLNPGM("HandleMaxAccChange_MKS");
|
||||
|
||||
const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
||||
const float value = (float)value_raw;
|
||||
|
@ -1066,7 +1035,7 @@ void DGUSScreenHandler::HandleMaxAccChange_MKS(DGUS_VP_Variable &var, void *val_
|
|||
}
|
||||
|
||||
void DGUSScreenHandler::HandleExtruderAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleMaxSpeedChange_MKS");
|
||||
DEBUG_ECHOLNPGM("HandleExtruderAccChange_MKS");
|
||||
|
||||
uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
||||
DEBUG_ECHOLNPAIR("value_raw:", value_raw);
|
||||
|
@ -1199,7 +1168,7 @@ void DGUSScreenHandler::HandleGetExMinTemp_MKS(DGUS_VP_Variable &var, void *val_
|
|||
#endif // BABYSTEPPING
|
||||
|
||||
void DGUSScreenHandler::GetManualFilament(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleGetFilament");
|
||||
DEBUG_ECHOLNPGM("GetManualFilament");
|
||||
|
||||
uint16_t value_len = swap16(*(uint16_t*)val_ptr);
|
||||
|
||||
|
@ -1212,7 +1181,7 @@ void DGUSScreenHandler::GetManualFilament(DGUS_VP_Variable &var, void *val_ptr)
|
|||
}
|
||||
|
||||
void DGUSScreenHandler::GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleGetFilamentSpeed");
|
||||
DEBUG_ECHOLNPGM("GetManualFilamentSpeed");
|
||||
|
||||
uint16_t value_len = swap16(*(uint16_t*)val_ptr);
|
||||
|
||||
|
@ -1225,8 +1194,10 @@ void DGUSScreenHandler::GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_
|
|||
|
||||
void DGUSScreenHandler::MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_ptr, const int filamentDir) {
|
||||
#if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
|
||||
char buf[40];
|
||||
uint8_t swap_tool = 0;
|
||||
#endif
|
||||
|
||||
#if HAS_HOTEND
|
||||
uint8_t hotend_too_cold = 0;
|
||||
#endif
|
||||
|
@ -1234,13 +1205,19 @@ void DGUSScreenHandler::MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_
|
|||
if (!print_job_timer.isPaused() && !queue.ring_buffer.empty())
|
||||
return;
|
||||
|
||||
char buf[40];
|
||||
const uint16_t val_t = swap16(*(uint16_t*)val_ptr);
|
||||
switch (val_t) {
|
||||
default: break;
|
||||
case 0:
|
||||
#if HAS_HOTEND
|
||||
if (thermalManager.tooColdToExtrude(0)) hotend_too_cold = 1; else swap_tool = 1;
|
||||
if (thermalManager.tooColdToExtrude(0)) {
|
||||
hotend_too_cold = 1;
|
||||
}
|
||||
else {
|
||||
#if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
|
||||
swap_tool = 2;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 1:
|
||||
|
@ -1273,12 +1250,12 @@ void DGUSScreenHandler::MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_
|
|||
}
|
||||
|
||||
void DGUSScreenHandler::MKS_FilamentLoad(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("Load Filament");
|
||||
DEBUG_ECHOLNPGM("MKS_FilamentLoad");
|
||||
MKS_FilamentLoadUnload(var, val_ptr, 1);
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("UnLoad Filament");
|
||||
DEBUG_ECHOLNPGM("MKS_FilamentUnLoad");
|
||||
MKS_FilamentLoadUnload(var, val_ptr, -1);
|
||||
}
|
||||
|
||||
|
@ -1403,7 +1380,7 @@ bool DGUSScreenHandler::loop() {
|
|||
|
||||
if (language_times != 0) {
|
||||
LanguagePInit();
|
||||
DGUS_LanguageDisplay(DGUSLanguageSwitch);
|
||||
DGUS_LanguageDisplay(mks_language_index);
|
||||
language_times--;
|
||||
}
|
||||
|
||||
|
@ -1413,18 +1390,18 @@ bool DGUSScreenHandler::loop() {
|
|||
booted = true;
|
||||
#if USE_SENSORLESS
|
||||
#if AXIS_HAS_STEALTHCHOP(X)
|
||||
tmc_x_step = stepperX.homing_threshold();
|
||||
tmc_step.x = stepperX.homing_threshold();
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Y)
|
||||
tmc_y_step = stepperY.homing_threshold();
|
||||
tmc_step.y = stepperY.homing_threshold();
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Z)
|
||||
tmc_z_step = stepperZ.homing_threshold();
|
||||
tmc_step.z = stepperZ.homing_threshold();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (min_ex_temp != 0)
|
||||
thermalManager.extrude_min_temp = min_ex_temp;
|
||||
if (mks_min_extrusion_temp != 0)
|
||||
thermalManager.extrude_min_temp = mks_min_extrusion_temp;
|
||||
|
||||
DGUS_ExtrudeLoadInit();
|
||||
|
||||
|
@ -1446,7 +1423,7 @@ bool DGUSScreenHandler::loop() {
|
|||
}
|
||||
|
||||
void DGUSScreenHandler::LanguagePInit() {
|
||||
switch (DGUSLanguageSwitch) {
|
||||
switch (mks_language_index) {
|
||||
case MKS_SimpleChinese:
|
||||
dgusdisplay.MKS_WriteVariable(VP_LANGUAGE_CHANGE1, MKS_Language_Choose);
|
||||
dgusdisplay.MKS_WriteVariable(VP_LANGUAGE_CHANGE2, MKS_Language_NoChoose);
|
||||
|
@ -1705,10 +1682,10 @@ void DGUSScreenHandler::DGUS_LanguageDisplay(uint8_t var) {
|
|||
const char Printing_buf_en[] = "Printing";
|
||||
dgusdisplay.WriteVariable(VP_Printing_Dis, Printing_buf_en, 32, true);
|
||||
|
||||
const char Info_EEPROM_1_buf_en[] = "Store setting?";
|
||||
const char Info_EEPROM_1_buf_en[] = "Store setting?";
|
||||
dgusdisplay.WriteVariable(VP_Info_EEPROM_1_Dis, Info_EEPROM_1_buf_en, 32, true);
|
||||
|
||||
const char Info_EEPROM_2_buf_en[] = "Revert setting?";
|
||||
const char Info_EEPROM_2_buf_en[] = "Revert setting?";
|
||||
dgusdisplay.WriteVariable(VP_Info_EEPROM_2_Dis, Info_EEPROM_2_buf_en, 32, true);
|
||||
|
||||
const char Info_PrinfFinsh_1_buf_en[] = "Print Done";
|
||||
|
@ -1963,7 +1940,7 @@ void DGUSScreenHandler::DGUS_LanguageDisplay(uint8_t var) {
|
|||
const uint16_t Info_EEPROM_1_buf_ch[] = { 0xC7CA, 0xF1B7, 0xA3B1, 0xE6B4, 0xE8C9, 0xC3D6, 0xBFA3, 0x2000 };
|
||||
dgusdisplay.WriteVariable(VP_Info_EEPROM_1_Dis, Info_EEPROM_1_buf_ch, 32, true);
|
||||
|
||||
const uint16_t Info_EEPROM_2_buf_ch[] = { 0xC7CA, 0xF1B7, 0xD6BB, 0xB4B8, 0xF6B3, 0xA7B3, 0xE8C9, 0xC3D6, 0x2000 };
|
||||
const uint16_t Info_EEPROM_2_buf_ch[] = { 0xC7CA, 0xF1B7, 0xD6BB, 0xB4B8, 0xF6B3, 0xA7B3, 0xE8C9, 0xC3D6, 0xBFA3, 0x2000 };
|
||||
dgusdisplay.WriteVariable(VP_Info_EEPROM_2_Dis, Info_EEPROM_2_buf_ch, 32, true);
|
||||
|
||||
const uint16_t TMC_X_Step_buf_ch[] = { 0x2058, 0xE9C1, 0xF4C3, 0xC8B6, 0x2000 };
|
||||
|
|
|
@ -158,13 +158,13 @@ public:
|
|||
static void GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#endif
|
||||
|
||||
// File touched.
|
||||
static void DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr);
|
||||
#if ENABLED(SDSUPPORT)
|
||||
// Callback for VP "Display wants to change screen when there is a SD card"
|
||||
static void ScreenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// Scroll buttons on the file listing screen.
|
||||
static void DGUSLCD_SD_ScrollFilelist(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// File touched.
|
||||
static void DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// start print after confirmation received.
|
||||
static void DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr);
|
||||
// User hit the pause, resume or abort button.
|
||||
|
@ -301,7 +301,7 @@ private:
|
|||
|
||||
#define MKS_SimpleChinese 0
|
||||
#define MKS_English 1
|
||||
extern uint8_t DGUSLanguageSwitch;
|
||||
extern uint8_t mks_language_index;
|
||||
extern bool DGUSAutoTurnOff;
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
|
|
|
@ -153,6 +153,11 @@
|
|||
#include "../libs/buzzer.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(DGUS_LCD_UI_MKS)
|
||||
#include "../lcd/extui/lib/dgus/DGUSScreenHandler.h"
|
||||
#include "../lcd/extui/lib/dgus/DGUSDisplayDef.h"
|
||||
#endif
|
||||
|
||||
#pragma pack(push, 1) // No padding between variables
|
||||
|
||||
#if HAS_ETHERNET
|
||||
|
@ -461,6 +466,16 @@ typedef struct SettingsDataStruct {
|
|||
bool buzzer_enabled;
|
||||
#endif
|
||||
|
||||
//
|
||||
// MKS UI controller
|
||||
//
|
||||
#if ENABLED(DGUS_LCD_UI_MKS)
|
||||
uint8_t mks_language_index; // Display Language
|
||||
xy_int_t mks_corner_offsets[5]; // Bed Tramming
|
||||
xyz_int_t mks_park_pos; // Custom Parking (without NOZZLE_PARK)
|
||||
celsius_t mks_min_extrusion_temp; // Min E Temp (shadow M302 value)
|
||||
#endif
|
||||
|
||||
#if HAS_MULTI_LANGUAGE
|
||||
uint8_t ui_language; // M414 S
|
||||
#endif
|
||||
|
@ -1402,6 +1417,16 @@ void MarlinSettings::postprocess() {
|
|||
EEPROM_WRITE(ui.buzzer_enabled);
|
||||
#endif
|
||||
|
||||
//
|
||||
// MKS UI controller
|
||||
//
|
||||
#if ENABLED(DGUS_LCD_UI_MKS)
|
||||
EEPROM_WRITE(mks_language_index);
|
||||
EEPROM_WRITE(mks_corner_offsets);
|
||||
EEPROM_WRITE(mks_park_pos);
|
||||
EEPROM_WRITE(mks_min_extrusion_temp);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Selected LCD language
|
||||
//
|
||||
|
@ -2302,6 +2327,17 @@ void MarlinSettings::postprocess() {
|
|||
EEPROM_READ(ui.buzzer_enabled);
|
||||
#endif
|
||||
|
||||
//
|
||||
// MKS UI controller
|
||||
//
|
||||
#if ENABLED(DGUS_LCD_UI_MKS)
|
||||
_FIELD_TEST(mks_language_index);
|
||||
EEPROM_READ(mks_language_index);
|
||||
EEPROM_READ(mks_corner_offsets);
|
||||
EEPROM_READ(mks_park_pos);
|
||||
EEPROM_READ(mks_min_extrusion_temp);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Selected LCD language
|
||||
//
|
||||
|
@ -2967,6 +3003,11 @@ void MarlinSettings::reset() {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// MKS UI controller
|
||||
//
|
||||
TERN_(DGUS_LCD_UI_MKS, MKS_reset_settings());
|
||||
|
||||
postprocess();
|
||||
|
||||
DEBUG_ECHO_START();
|
||||
|
|
Loading…
Reference in a new issue