From 12a39450b061b2dc735378d55a140f721f47eeae Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 14 Jan 2021 00:43:47 -0600 Subject: [PATCH] MKS prelim. cleanup (2) --- .../lcd/extui/lib/mks_ui/draw_extrusion.cpp | 10 +--- .../extui/lib/mks_ui/printer_operation.cpp | 8 +-- .../extui/lib/mks_ui/tft_multi_language.cpp | 56 +++++-------------- 3 files changed, 19 insertions(+), 55 deletions(-) diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp index 2fdd2c3f2c..b9af6d33a8 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp @@ -55,20 +55,16 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { switch (obj->mks_obj_id) { case ID_E_ADD: if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= EXTRUDE_MINTEMP) { - queue.enqueue_now_P(PSTR("G91")); - sprintf_P((char *)public_buf_l, PSTR("G1 E%d F%d"), uiCfg.extruStep, 60 * uiCfg.extruSpeed); - queue.enqueue_one_now(public_buf_l); - queue.enqueue_now_P(PSTR("G90")); + sprintf_P((char *)public_buf_l, PSTR("G91\nG1 E%d F%d\nG90"), uiCfg.extruStep, 60 * uiCfg.extruSpeed); + queue.inject(public_buf_l); extrudeAmount += uiCfg.extruStep; disp_extru_amount(); } break; case ID_E_DEC: if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= EXTRUDE_MINTEMP) { - queue.enqueue_now_P(PSTR("G91")); - sprintf_P((char *)public_buf_l, PSTR("G1 E%d F%d"), 0 - uiCfg.extruStep, 60 * uiCfg.extruSpeed); + sprintf_P((char *)public_buf_l, PSTR("G91\nG1 E%d F%d\nG90"), 0 - uiCfg.extruStep, 60 * uiCfg.extruSpeed); queue.enqueue_one_now(public_buf_l); - queue.enqueue_now_P(PSTR("G90")); extrudeAmount -= uiCfg.extruStep; disp_extru_amount(); } diff --git a/Marlin/src/lcd/extui/lib/mks_ui/printer_operation.cpp b/Marlin/src/lcd/extui/lib/mks_ui/printer_operation.cpp index 61168fe0ec..4467df59d9 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/printer_operation.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/printer_operation.cpp @@ -59,10 +59,8 @@ void printer_state_polling() { uiCfg.current_z_position_bak = current_position.z; if (gCfgItems.pausePosZ != (float)-1) { - gcode.process_subcommands_now_P(PSTR("G91")); - sprintf_P(public_buf_l, PSTR("G1 Z%.1f"), gCfgItems.pausePosZ); + sprintf_P(public_buf_l, PSTR("G91\nG1 Z%.1f\nG90"), gCfgItems.pausePosZ); gcode.process_subcommands_now(public_buf_l); - gcode.process_subcommands_now_P(PSTR("G90")); } if (gCfgItems.pausePosX != (float)-1 && gCfgItems.pausePosY != (float)-1) { sprintf_P(public_buf_l, PSTR("G1 X%.1f Y%.1f"), gCfgItems.pausePosX, gCfgItems.pausePosY); @@ -128,10 +126,8 @@ void printer_state_polling() { gcode.process_subcommands_now(public_buf_m); if (gCfgItems.pause_reprint && gCfgItems.pausePosZ != -1.0f) { - gcode.process_subcommands_now_P(PSTR("G91")); - sprintf_P(public_buf_l, PSTR("G1 Z-%.1f"), gCfgItems.pausePosZ); + sprintf_P(public_buf_l, PSTR("G91\nG1 Z-%.1f\nG90"), gCfgItems.pausePosZ); gcode.process_subcommands_now(public_buf_l); - gcode.process_subcommands_now_P(PSTR("G90")); } #endif uiCfg.print_state = WORKING; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp b/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp index 0401faeebd..7db5e80561 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp @@ -945,27 +945,13 @@ void disp_language_init() { filesys_menu.usb_sys = U_DISK_TEXT_CN; // more_menu.title = TITLE_MORE_CN; - #if ENABLED(USER_CMD_1_ENABLE) - more_menu.custom1 = MORE_CUSTOM1_TEXT_CN; - #endif - #if ENABLED(USER_CMD_2_ENABLE) - more_menu.custom2 = MORE_CUSTOM2_TEXT_CN; - #endif - #if ENABLED(USER_CMD_3_ENABLE) - more_menu.custom3 = MORE_CUSTOM3_TEXT_CN; - #endif - #if ENABLED(USER_CMD_4_ENABLE) - more_menu.custom4 = MORE_CUSTOM4_TEXT_CN; - #endif - #if ENABLED(USER_CMD_5_ENABLE) - more_menu.custom5 = MORE_CUSTOM5_TEXT_CN; - #endif - #if ENABLED(USER_CMD_6_ENABLE) - more_menu.custom6 = MORE_CUSTOM6_TEXT_CN; - #endif - #if ENABLED(USER_CMD_7_ENABLE) - more_menu.custom7 = MORE_CUSTOM7_TEXT_CN; - #endif + TERN_(USER_CMD_1_ENABLE, more_menu.custom1 = MORE_CUSTOM1_TEXT_CN); + TERN_(USER_CMD_2_ENABLE, more_menu.custom2 = MORE_CUSTOM2_TEXT_CN); + TERN_(USER_CMD_3_ENABLE, more_menu.custom3 = MORE_CUSTOM3_TEXT_CN); + TERN_(USER_CMD_4_ENABLE, more_menu.custom4 = MORE_CUSTOM4_TEXT_CN); + TERN_(USER_CMD_5_ENABLE, more_menu.custom5 = MORE_CUSTOM5_TEXT_CN); + TERN_(USER_CMD_6_ENABLE, more_menu.custom6 = MORE_CUSTOM6_TEXT_CN); + TERN_(USER_CMD_7_ENABLE, more_menu.custom7 = MORE_CUSTOM7_TEXT_CN); // WIFI wifi_menu.title = WIFI_TEXT; wifi_menu.cloud = CLOUD_TEXT_CN; @@ -1191,27 +1177,13 @@ void disp_language_init() { filesys_menu.usb_sys = U_DISK_TEXT_T_CN; // more_menu.title = TITLE_MORE_T_CN; - #if ENABLED(USER_CMD_1_ENABLE) - more_menu.custom1 = MORE_CUSTOM1_TEXT_T_CN; - #endif - #if ENABLED(USER_CMD_2_ENABLE) - more_menu.custom2 = MORE_CUSTOM2_TEXT_T_CN; - #endif - #if ENABLED(USER_CMD_3_ENABLE) - more_menu.custom3 = MORE_CUSTOM3_TEXT_T_CN; - #endif - #if ENABLED(USER_CMD_4_ENABLE) - more_menu.custom4 = MORE_CUSTOM4_TEXT_T_CN; - #endif - #if ENABLED(USER_CMD_5_ENABLE) - more_menu.custom5 = MORE_CUSTOM5_TEXT_T_CN; - #endif - #if ENABLED(USER_CMD_6_ENABLE) - more_menu.custom6 = MORE_CUSTOM6_TEXT_T_CN; - #endif - #if ENABLED(USER_CMD_7_ENABLE) - more_menu.custom7 = MORE_CUSTOM7_TEXT_T_CN; - #endif + TERN_(USER_CMD_1_ENABLE, more_menu.custom1 = MORE_CUSTOM1_TEXT_T_CN); + TERN_(USER_CMD_2_ENABLE, more_menu.custom2 = MORE_CUSTOM2_TEXT_T_CN); + TERN_(USER_CMD_3_ENABLE, more_menu.custom3 = MORE_CUSTOM3_TEXT_T_CN); + TERN_(USER_CMD_4_ENABLE, more_menu.custom4 = MORE_CUSTOM4_TEXT_T_CN); + TERN_(USER_CMD_5_ENABLE, more_menu.custom5 = MORE_CUSTOM5_TEXT_T_CN); + TERN_(USER_CMD_6_ENABLE, more_menu.custom6 = MORE_CUSTOM6_TEXT_T_CN); + TERN_(USER_CMD_7_ENABLE, more_menu.custom7 = MORE_CUSTOM7_TEXT_T_CN); // WIFI wifi_menu.title = WIFI_TEXT; wifi_menu.cloud = CLOUD_TEXT_T_CN;