From 0e61b4a98240848c00e99b2c7007cfbe00bf65ce Mon Sep 17 00:00:00 2001 From: Sola <42537573+solawc@users.noreply.github.com> Date: Wed, 3 Mar 2021 10:58:42 +0800 Subject: [PATCH] Fix MKS H43 compile (#21240) --- .../lcd/extui/lib/dgus/mks/DGUSScreenHandler.cpp | 16 ++++++++++++---- .../lcd/extui/lib/dgus/mks/DGUSScreenHandler.h | 2 ++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Marlin/src/lcd/extui/lib/dgus/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/lib/dgus/mks/DGUSScreenHandler.cpp index 6cbc534110..bdd702b1d7 100644 --- a/Marlin/src/lcd/extui/lib/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/lib/dgus/mks/DGUSScreenHandler.cpp @@ -49,12 +49,18 @@ #include "../../../../../feature/powerloss.h" #endif +#if ENABLED(SDSUPPORT) + static ExtUI::FileList filelist; +#endif + bool DGUSAutoTurnOff = false; uint8_t DGUSLanguageSwitch = 0; // Switch language for MKS DGUS // endianness swap uint32_t swap32(const uint32_t value) { return (value & 0x000000FFU) << 24U | (value & 0x0000FF00U) << 8U | (value & 0x00FF0000U) >> 8U | (value & 0xFF000000U) >> 24U; } +#if 0 + void DGUSScreenHandler::sendinfoscreen_ch_mks(const uint16_t* line1, const uint16_t* line2, const uint16_t* line3, const uint16_t* line4) { dgusdisplay.WriteVariable(VP_MSGSTR1, line1, 32, true); dgusdisplay.WriteVariable(VP_MSGSTR2, line2, 32, true); @@ -76,6 +82,8 @@ void DGUSScreenHandler::sendinfoscreen_mks(const void* line1, const void* line2, DGUSScreenHandler::sendinfoscreen_ch_mks((uint16_t *)line1, (uint16_t *)line2, (uint16_t *)line3, (uint16_t *)line4); } +#endif + void DGUSScreenHandler::DGUSLCD_SendFanToDisplay(DGUS_VP_Variable &var) { if (var.memadr) { //DEBUG_ECHOPAIR(" DGUS_LCD_SendWordValueToDisplay ", var.VP); @@ -256,7 +264,7 @@ void DGUSScreenHandler::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) { void DGUSScreenHandler::SDPrintingFinished() { if (DGUSAutoTurnOff) { - while (queue.length) queue.advance(); + while(!queue.ring_buffer.empty()) queue.advance(); gcode.process_subcommands_now_P(PSTR("M81")); } GotoScreen(MKSLCD_SCREEN_PrintDone); @@ -786,7 +794,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { DEBUG_ECHOLNPAIR("QUEUE LEN:", queue.length); - if (!print_job_timer.isPaused() && queue.length >= BUFSIZE) + if (!print_job_timer.isPaused() && queue.ring_buffer.full(1)) return; char axiscode; @@ -1778,7 +1786,7 @@ void DGUSScreenHandler::DGUS_LanguageDisplay(uint8_t var) { dgusdisplay.WriteVariable(VP_PrintAcc_Dis, PrintAcc_buf_en, 32, true); const char FAN_Speed_buf_en[] = "FAN_Speed"; - dgusdisplay.WriteVariable(VP_FAN_Speed_Dis, FAN_Speed_buf_en, 32, true); + dgusdisplay.WriteVariable(VP_Fan_Speed_Dis, FAN_Speed_buf_en, 32, true); const char Printing_buf_en[] = "Printing"; dgusdisplay.WriteVariable(VP_Printing_Dis, Printing_buf_en, 32, true); @@ -2033,7 +2041,7 @@ void DGUSScreenHandler::DGUS_LanguageDisplay(uint8_t var) { dgusdisplay.WriteVariable(VP_PrintAcc_Dis, PrintAcc_buf_ch, 16, true); const uint16_t FAN_Speed_buf_ch[] = { 0xE7B7, 0xC8C9, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_FAN_Speed_Dis, FAN_Speed_buf_ch, 16, true); + dgusdisplay.WriteVariable(VP_Fan_Speed_Dis, FAN_Speed_buf_ch, 16, true); const uint16_t Printing_buf_ch[] = { 0xF2B4, 0xA1D3, 0xD0D6, 0x2000 }; dgusdisplay.WriteVariable(VP_Printing_Dis, Printing_buf_ch, 16, true); diff --git a/Marlin/src/lcd/extui/lib/dgus/mks/DGUSScreenHandler.h b/Marlin/src/lcd/extui/lib/dgus/mks/DGUSScreenHandler.h index 4d6e985d84..15e232e413 100644 --- a/Marlin/src/lcd/extui/lib/dgus/mks/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/lib/dgus/mks/DGUSScreenHandler.h @@ -41,9 +41,11 @@ public: static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); + #if 0 static void sendinfoscreen_ch_mks(const uint16_t* line1, const uint16_t* line2, const uint16_t* line3, const uint16_t* line4); static void sendinfoscreen_en_mks(const char* line1, const char* line2, const char* line3, const char* line4) ; static void sendinfoscreen_mks(const void* line1, const void* line2, const void* line3, const void* line4,uint16_t language); + #endif // "M117" Message -- msg is a RAM ptr. static void setstatusmessage(const char* msg);