Skip to content

Commit

Permalink
MKS H43 fix, cleanup (#21500)
Browse files Browse the repository at this point in the history
Followup to #21485
  • Loading branch information
solawc authored and thinkyhead committed Apr 29, 2021
1 parent 82e6a2e commit 47a1326
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/lib/dgus/DGUSScreenHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
9 changes: 6 additions & 3 deletions Marlin/src/lcd/extui/lib/dgus/mks/DGUSDisplayDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/extui/lib/dgus/mks/DGUSDisplayDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
7 changes: 6 additions & 1 deletion Marlin/src/lcd/extui/lib/dgus/mks/DGUSScreenHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions Marlin/src/lcd/extui/lib/dgus/mks/DGUSScreenHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,14 @@ class DGUSScreenHandler {
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.
Expand All @@ -183,6 +184,8 @@ class DGUSScreenHandler {
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.
Expand Down

0 comments on commit 47a1326

Please sign in to comment.