MKS H43 fix, cleanup (#21500)

Followup to #21485
This commit is contained in:
Sola 2021-04-02 08:19:22 +08:00 committed by GitHub
parent 45c1432946
commit 6747d350a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 10 deletions

View file

@ -2374,7 +2374,7 @@
//#define DGUS_LCD_UI_FYSETC //#define DGUS_LCD_UI_FYSETC
//#define DGUS_LCD_UI_HIPRECY //#define DGUS_LCD_UI_HIPRECY
// #define DGUS_LCD_UI_MKS //#define DGUS_LCD_UI_MKS
#if ENABLED(DGUS_LCD_UI_MKS) #if ENABLED(DGUS_LCD_UI_MKS)
#define USE_MKS_GREEN_UI #define USE_MKS_GREEN_UI
#endif #endif

View file

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

View file

@ -44,7 +44,7 @@
#endif #endif
uint16_t manualMoveStep = 1; uint16_t manualMoveStep = 1;
float distanceFilament = 10; uint16_t distanceFilament = 10;
uint16_t FilamentSpeed = 25; uint16_t FilamentSpeed = 25;
float ZOffset_distance = 0.1; float ZOffset_distance = 0.1;
float mesh_adj_distance = 0.01; float mesh_adj_distance = 0.01;
@ -554,7 +554,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD) #if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
VPHELPER(VP_LOAD_Filament, nullptr, &ScreenHandler.MKS_FilamentLoad, nullptr), VPHELPER(VP_LOAD_Filament, nullptr, &ScreenHandler.MKS_FilamentLoad, nullptr),
VPHELPER(VP_UNLOAD_Filament, nullptr, &ScreenHandler.MKS_FilamentUnLoad, 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), VPHELPER(VP_Filament_speed, &FilamentSpeed, &ScreenHandler.GetManualFilamentSpeed, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
#endif #endif
#endif #endif
@ -733,8 +733,9 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
// SDCard File listing // SDCard File listing
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr),
#if ENABLED(SDSUPPORT) #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_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr),
VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, 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), 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_Y, &probe.offset.y, ScreenHandler.GetOffsetValue,ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
VPHELPER(VP_OFFSET_Z, &probe.offset.z, ScreenHandler.GetOffsetValue,ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), VPHELPER(VP_OFFSET_Z, &probe.offset.z, ScreenHandler.GetOffsetValue,ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
#endif #endif
#else
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.PrintReturn, nullptr),
#endif #endif
#if ENABLED(DGUS_UI_WAITING) #if ENABLED(DGUS_UI_WAITING)

View file

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

View file

@ -270,6 +270,11 @@ void DGUSScreenHandler::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) {
GotoScreen(MKSLCD_SCREEN_PrintDone); 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 #endif // SDSUPPORT
void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) { 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 { else {
#if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE) #if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
swap_tool = 2; swap_tool = 1;
#endif #endif
} }
#endif #endif

View file

@ -158,13 +158,14 @@ public:
static void GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr); static void GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr);
#endif #endif
// File touched.
static void DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr);
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
// Callback for VP "Display wants to change screen when there is a SD card" // Callback for VP "Display wants to change screen when there is a SD card"
static void ScreenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr); static void ScreenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr);
// Scroll buttons on the file listing screen. // Scroll buttons on the file listing screen.
static void DGUSLCD_SD_ScrollFilelist(DGUS_VP_Variable &var, void *val_ptr); 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. // start print after confirmation received.
static void DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr); static void DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr);
// User hit the pause, resume or abort button. // User hit the pause, resume or abort button.
@ -183,6 +184,8 @@ public:
static void SDCardError(); static void SDCardError();
// Marlin informed us about SD print completion. // Marlin informed us about SD print completion.
static void SDPrintingFinished(); static void SDPrintingFinished();
#else
static void PrintReturn(DGUS_VP_Variable &var, void *val_ptr);
#endif #endif
// OK Button the Confirm screen. // OK Button the Confirm screen.