1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-27 13:56:24 +00:00

MKS H43 fix, cleanup (#21500)

Followup to #21485
This commit is contained in:
Sola 2021-04-02 08:19:22 +08:00 committed by Scott Lahteine
parent 82e6a2ed62
commit 47a13263f6
6 changed files with 21 additions and 10 deletions

View File

@ -2374,7 +2374,7 @@
//#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

View File

@ -176,6 +176,7 @@ void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) {
#if HAS_PID_HEATING
void DGUSScreenHandler::DGUSLCD_SendTemperaturePID(DGUS_VP_Variable &var) {
float value = *(float *)var.memadr;
value /= 10;
float valuesend = 0;
switch (var.VP) {
default: return;
@ -343,7 +344,6 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var)
SetupConfirmAction(nullptr);
GotoScreen(DGUSLCD_SCREEN_POPUP);
}
#endif // SDSUPPORT
void DGUSScreenHandler::ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr) {

View File

@ -44,7 +44,7 @@
#endif
uint16_t manualMoveStep = 1;
float distanceFilament = 10;
uint16_t distanceFilament = 10;
uint16_t FilamentSpeed = 25;
float ZOffset_distance = 0.1;
float mesh_adj_distance = 0.01;
@ -554,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_SendFloatAsLongValueToDisplay<0>),
VPHELPER(VP_Filament_distance, &distanceFilament, &ScreenHandler.GetManualFilament, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_Filament_speed, &FilamentSpeed, &ScreenHandler.GetManualFilamentSpeed, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
#endif
#endif
@ -733,8 +733,9 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
// SDCard File listing
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr),
#if ENABLED(SDSUPPORT)
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr),
VPHELPER(VP_SD_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr),
VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, nullptr),
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
@ -759,6 +760,8 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
VPHELPER(VP_OFFSET_Y, &probe.offset.y, ScreenHandler.GetOffsetValue,ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
VPHELPER(VP_OFFSET_Z, &probe.offset.z, ScreenHandler.GetOffsetValue,ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
#endif
#else
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.PrintReturn, nullptr),
#endif
#if ENABLED(DGUS_UI_WAITING)

View File

@ -36,7 +36,7 @@
#define MKS_FINSH
extern uint16_t manualMoveStep;
extern float distanceFilament;
extern uint16_t distanceFilament;
extern uint16_t FilamentSpeed;
extern float ZOffset_distance;
extern float mesh_adj_distance;
@ -55,7 +55,7 @@ void MKS_resume_print_move();
extern float z_offset_add;
xyz_int_t tmc_step;
extern xyz_int_t tmc_step;
extern uint16_t lcd_default_light;

View File

@ -270,6 +270,11 @@ void DGUSScreenHandler::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) {
GotoScreen(MKSLCD_SCREEN_PrintDone);
}
#else
void DGUSScreenHandler::PrintReturn(DGUS_VP_Variable& var, void *val_ptr) {
uint16_t value = swap16(*(uint16_t*)val_ptr);
if (value == 0x0F) GotoScreen(DGUSLCD_SCREEN_MAIN);
}
#endif // SDSUPPORT
void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) {
@ -1215,7 +1220,7 @@ void DGUSScreenHandler::MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_
}
else {
#if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
swap_tool = 2;
swap_tool = 1;
#endif
}
#endif

View File

@ -158,13 +158,14 @@ 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.
@ -183,6 +184,8 @@ public:
static void SDCardError();
// Marlin informed us about SD print completion.
static void SDPrintingFinished();
#else
static void PrintReturn(DGUS_VP_Variable &var, void *val_ptr);
#endif
// OK Button the Confirm screen.