From 043df75a3509252534b96d4a97d1ce0d928d44ac Mon Sep 17 00:00:00 2001 From: Leoric Date: Fri, 26 Mar 2021 18:37:11 +0300 Subject: [PATCH 1/7] monitoring when idle --- .../lcd/extui/lib/mks_ui/draw_ready_print.cpp | 94 ++++++++++++++++++- .../lcd/extui/lib/mks_ui/draw_ready_print.h | 5 + 2 files changed, 96 insertions(+), 3 deletions(-) diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp index 7554f746cacb..30fc0106e6fc 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp @@ -44,6 +44,15 @@ extern lv_group_t* g; static lv_obj_t *scr; +static lv_obj_t *labelExt1, *labelExt1Target, *labelFan; + +TERN_(HAS_MULTI_EXTRUDER, static lv_obj_t *labelExt2); +TERN_(HAS_MULTI_EXTRUDER, static lv_obj_t *labelExt2Target); + +#if HAS_HEATED_BED + static lv_obj_t *labelBed, *labelBedTarget; +#endif + #if ENABLED(MKS_TEST) uint8_t curent_disp_ui = 0; #endif @@ -174,9 +183,88 @@ void lv_draw_ready_print() { } else { - lv_big_button_create(scr, "F:/bmp_tool.bin", main_menu.tool, 20, 90, event_handler, ID_TOOL); - lv_big_button_create(scr, "F:/bmp_set.bin", main_menu.set, 180, 90, event_handler, ID_SET); - lv_big_button_create(scr, "F:/bmp_printing.bin", main_menu.print, 340, 90, event_handler, ID_PRINT); + lv_big_button_create(scr, "F:/bmp_tool.bin", main_menu.tool, 20, 180, event_handler, ID_TOOL); + lv_big_button_create(scr, "F:/bmp_set.bin", main_menu.set, 180, 180, event_handler, ID_SET); + lv_big_button_create(scr, "F:/bmp_printing.bin", main_menu.print, 340, 180, event_handler, ID_PRINT); + + // Monitoring + #if 1 + lv_obj_t *buttonExt1 = lv_img_create(scr, NULL); + #if HAS_MULTI_EXTRUDER + lv_obj_t *buttonExt2 = lv_img_create(scr, NULL); + #endif + #if HAS_HEATED_BED + lv_obj_t *buttonBedstate = lv_img_create(scr, NULL); + #endif + lv_obj_t *buttonFanstate = lv_img_create(scr, NULL); + + lv_img_set_src(buttonExt1, "F:/bmp_ext1_state.bin"); + #if HAS_MULTI_EXTRUDER + lv_img_set_src(buttonExt2, "F:/bmp_ext2_state.bin"); + #endif + #if HAS_HEATED_BED + lv_img_set_src(buttonBedstate, "F:/bmp_bed_state.bin"); + #endif + + lv_img_set_src(buttonFanstate, "F:/bmp_fan_state.bin"); + + lv_obj_set_pos(buttonExt1, 55, ICON_POS_Y); + + #if HAS_MULTI_EXTRUDER + lv_obj_set_pos(buttonExt2, 55, ICON_POS_Y + SECOND_EXT_MOD_Y); + #endif + + #if HAS_HEATED_BED + lv_obj_set_pos(buttonBedstate, 210, ICON_POS_Y); + #endif + + lv_obj_set_pos(buttonFanstate, 380, ICON_POS_Y); + + + labelExt1 = lv_label_create(scr, 55, LABEL_MOD_Y, nullptr); + labelExt1Target = lv_label_create(scr, 55, LABEL_MOD_Y, nullptr); + + #if HAS_MULTI_EXTRUDER + labelExt2 = lv_label_create(scr, 55, LABEL_MOD_Y + SECOND_EXT_MOD_Y, nullptr); + labelExt2Target = lv_label_create(scr, 55, LABEL_MOD_Y + SECOND_EXT_MOD_Y, nullptr); + #endif + + #if HAS_HEATED_BED + labelBed = lv_label_create(scr, 210, LABEL_MOD_Y, nullptr); + labelBedTarget = lv_label_create(scr, 210, LABEL_MOD_Y, nullptr); + #endif + + labelFan = lv_label_create(scr, 380, 80, nullptr); + + sprintf_P(buf, PSTR("%d"), (int)thermalManager.degHotend(0)); + lv_label_set_text(labelExt1, buf); + lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); + sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(0)); + lv_label_set_text(labelExt1Target, buf); + lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y); + #if HAS_MULTI_EXTRUDER + sprintf_P(buf, PSTR("%d"), (int)thermalManager.degHotend(1)); + lv_label_set_text(labelExt2, buf); + lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); + sprintf_P(buf, PSTR("-> %d"), int)thermalManager.degTargetHotend(1)); + lv_label_set_text(labelExt2Target, buf); + lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y); + #endif + + #if HAS_HEATED_BED + sprintf_P(buf, PSTR("%d"), (int)thermalManager.degBed()); + lv_label_set_text(labelBed, buf); + lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); + sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetBed()); + lv_label_set_text(labelBedTarget, buf); + lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y); + #endif + + sprintf_P(buf, PSTR("%d%%"), thermalManager.fanPercent(thermalManager.fan_speed[0])); + lv_label_set_text(labelFan, buf); + lv_obj_align(labelFan, buttonFanstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); + + #endif // if 1 } #if ENABLED(TOUCH_SCREEN_CALIBRATION) diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.h index a3cfd6766578..8569d28a1585 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.h @@ -25,6 +25,11 @@ extern "C" { /* C-declarations for C++ */ #endif +#define ICON_POS_Y 38 +#define TARGET_LABEL_MOD_Y -36 +#define LABEL_MOD_Y 30 +#define SECOND_EXT_MOD_Y 100 + extern void lv_draw_ready_print(); extern void mks_disp_test(); extern void disp_Limit_ok(); From f1bb28f927edf3edcf98de7c610f301e8d5c3834 Mon Sep 17 00:00:00 2001 From: Leoric Date: Fri, 26 Mar 2021 18:35:55 +0300 Subject: [PATCH 2/7] monitoring when printing --- Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp | 2 +- Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp | 6 +++--- Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp index e9e501ae5f06..70c57f4af884 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp @@ -222,7 +222,7 @@ void disp_bed_temp() { } void disp_fan_speed() { - sprintf_P(public_buf_l, PSTR("%3d"), thermalManager.fan_speed[0]); + sprintf_P(public_buf_l, PSTR("%d%%"), thermalManager.fanPercent(thermalManager.fan_speed[0])); lv_label_set_text(labelFan, public_buf_l); } 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 7caae5cd3add..20b7d5f60603 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 @@ -815,9 +815,9 @@ void disp_language_init() { wifi_menu.disconnected = WIFI_DISCONNECTED_TEXT; wifi_menu.exception = WIFI_EXCEPTION_TEXT; - printing_menu.temp1 = TEXT_VALUE; - printing_menu.temp2 = TEXT_VALUE; - printing_menu.bed_temp = TEXT_VALUE; + printing_menu.temp1 = TEXT_VALUE_TARGET; + printing_menu.temp2 = TEXT_VALUE_TARGET; + printing_menu.bed_temp = TEXT_VALUE_TARGET; filament_menu.stat_temp = TEXT_VALUE; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h b/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h index 82d3e18f74ea..cd19317c581f 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h @@ -748,6 +748,7 @@ extern eeprom_def eeprom_menu; /*****************************************/ // #define TEXT_VALUE "%d/%d" +#define TEXT_VALUE_TARGET "%d -> %d" #define TEXT_VALUE_T ": %d℃" #define TEXT_VALUE_mm ": %dmm" From a13d58343401d924e93f61c69e33adf835cba92b Mon Sep 17 00:00:00 2001 From: Leoric Date: Fri, 26 Mar 2021 18:43:00 +0300 Subject: [PATCH 3/7] swap OK and Cancel on LVGL_UI --- Marlin/Configuration.h | 1 + Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.h | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index c9c83f9bb624..5eff899c5018 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2526,6 +2526,7 @@ #if ENABLED(TFT_LVGL_UI) //#define MKS_WIFI_MODULE // MKS WiFi module + //#define SWAP_OK_CANCEL // swap 'Confirm' and 'Cancel' buttons #endif /** diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.h index c43a79a1418b..9c405b27ce2c 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.h @@ -73,10 +73,14 @@ enum { DIALOG_WIFI_CONFIG_TIPS, DIALOG_TRANSFER_NO_DEVICE }; - -#define BTN_OK_X 100 +#ifdef SWAP_OK_CANCEL + #define BTN_OK_X 280 + #define BTN_CANCEL_X 100 +#else + #define BTN_OK_X 100 + #define BTN_CANCEL_X 280 +#endif #define BTN_OK_Y 180 -#define BTN_CANCEL_X 280 #define BTN_CANCEL_Y 180 extern void lv_draw_dialog(uint8_t type); From 688228f8e81454afff63573db38944b77ba9c6f8 Mon Sep 17 00:00:00 2001 From: Leoric Date: Fri, 26 Mar 2021 20:07:46 +0300 Subject: [PATCH 4/7] fix typo --- Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp index 30fc0106e6fc..54edf2e1952c 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp @@ -246,7 +246,7 @@ void lv_draw_ready_print() { sprintf_P(buf, PSTR("%d"), (int)thermalManager.degHotend(1)); lv_label_set_text(labelExt2, buf); lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); - sprintf_P(buf, PSTR("-> %d"), int)thermalManager.degTargetHotend(1)); + sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(1)); lv_label_set_text(labelExt2Target, buf); lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y); #endif From 8ffa79be95fcd00c34cf182ce73dfd9439682430 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 26 Mar 2021 15:20:27 -0500 Subject: [PATCH 5/7] misc cleanup --- Marlin/Configuration.h | 2 +- .../src/lcd/extui/lib/mks_ui/draw_dialog.cpp | 5 + Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.h | 9 - .../lcd/extui/lib/mks_ui/draw_ready_print.cpp | 269 +++++++++--------- .../lcd/extui/lib/mks_ui/draw_ready_print.h | 5 - .../lcd/extui/lib/mks_ui/tft_multi_language.h | 2 +- 6 files changed, 136 insertions(+), 156 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 5eff899c5018..2084cf915fae 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2526,7 +2526,7 @@ #if ENABLED(TFT_LVGL_UI) //#define MKS_WIFI_MODULE // MKS WiFi module - //#define SWAP_OK_CANCEL // swap 'Confirm' and 'Cancel' buttons + //#define SWAP_OK_CANCEL // Swap the positions of the 'Confirm' and 'Cancel' buttons #endif /** diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp index 3fed4cc38533..9acf78375829 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp @@ -65,6 +65,11 @@ extern uint32_t upload_time; extern uint32_t upload_size; extern bool temps_update_flag; +#define BTN_OK_X TERN_(SWAP_OK_CANCEL, 280, 100) +#define BTN_CANCEL_X TERN_(SWAP_OK_CANCEL, 100, 280) +#define BTN_OK_Y 180 +#define BTN_CANCEL_Y 180 + static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; if (DIALOG_IS(TYPE_PRINT_FILE)) { diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.h index 9c405b27ce2c..38f5fa0635f2 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.h @@ -73,15 +73,6 @@ enum { DIALOG_WIFI_CONFIG_TIPS, DIALOG_TRANSFER_NO_DEVICE }; -#ifdef SWAP_OK_CANCEL - #define BTN_OK_X 280 - #define BTN_CANCEL_X 100 -#else - #define BTN_OK_X 100 - #define BTN_CANCEL_X 280 -#endif -#define BTN_OK_Y 180 -#define BTN_CANCEL_Y 180 extern void lv_draw_dialog(uint8_t type); extern void lv_clear_dialog(); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp index 54edf2e1952c..580691e999ed 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp @@ -42,12 +42,18 @@ #include +#define ICON_POS_Y 38 +#define TARGET_LABEL_MOD_Y -36 +#define LABEL_MOD_Y 30 +#define SECOND_EXT_MOD_Y 100 + extern lv_group_t* g; static lv_obj_t *scr; static lv_obj_t *labelExt1, *labelExt1Target, *labelFan; -TERN_(HAS_MULTI_EXTRUDER, static lv_obj_t *labelExt2); -TERN_(HAS_MULTI_EXTRUDER, static lv_obj_t *labelExt2Target); +#if HAS_MULTI_EXTRUDER + static lv_obj_t *labelExt2, *labelExt2Target; +#endif #if HAS_HEATED_BED static lv_obj_t *labelBed, *labelBedTarget; @@ -57,26 +63,15 @@ TERN_(HAS_MULTI_EXTRUDER, static lv_obj_t *labelExt2Target); uint8_t curent_disp_ui = 0; #endif -enum { - ID_TOOL = 1, - ID_SET, - ID_PRINT -}; +enum { ID_TOOL = 1, ID_SET, ID_PRINT }; static void event_handler(lv_obj_t *obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; lv_clear_ready_print(); - switch (obj->mks_obj_id) { - case ID_TOOL: - lv_draw_tool(); - break; - case ID_SET: - lv_draw_set(); - break; - case ID_PRINT: - lv_draw_print_file(); - break; + case ID_TOOL: lv_draw_tool(); break; + case ID_SET: lv_draw_set(); break; + case ID_PRINT: lv_draw_print_file(); break; } } @@ -107,14 +102,14 @@ void disp_det_error() { lv_obj_t *e1, *e2, *e3, *bed; void mks_disp_test() { char buf[30] = {0}; - sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.degHotend(0)); + sprintf_P(buf, PSTR("e1:%d"), thermalManager.degHotend(0)); lv_label_set_text(e1, buf); #if HAS_MULTI_HOTEND - sprintf_P(buf, PSTR("e2:%d"), (int)thermalManager.degHotend(1)); + sprintf_P(buf, PSTR("e2:%d"), thermalManager.degHotend(1)); lv_label_set_text(e2, buf); #endif #if HAS_HEATED_BED - sprintf_P(buf, PSTR("bed:%d"), (int)thermalManager.temp_bed.celsius); + sprintf_P(buf, PSTR("bed:%d"), thermalManager.degBed()); lv_label_set_text(bed, buf); #endif } @@ -139,132 +134,126 @@ void lv_draw_ready_print() { lv_obj_align(label_tool, buttonTool, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); } - #if 1 - e1 = lv_label_create_empty(scr); - lv_obj_set_pos(e1, 20, 20); - sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.degHotend(0)); - lv_label_set_text(e1, buf); - #if HAS_MULTI_HOTEND - e2 = lv_label_create_empty(scr); - lv_obj_set_pos(e2, 20, 45); - sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.degHotend(1)); - lv_label_set_text(e2, buf); - #endif - - #if HAS_HEATED_BED - bed = lv_label_create_empty(scr); - lv_obj_set_pos(bed, 20, 95); - sprintf_P(buf, PSTR("bed: %d"), (int)thermalManager.temp_bed.celsius); - lv_label_set_text(bed, buf); - #endif - - limit_info = lv_label_create_empty(scr); - - lv_style_copy(&limit_style, &lv_style_scr); - limit_style.body.main_color.full = 0x0000; - limit_style.body.grad_color.full = 0x0000; - limit_style.text.color.full = 0xffff; - lv_obj_set_style(limit_info, &limit_style); - - lv_obj_set_pos(limit_info, 20, 120); - lv_label_set_text(limit_info, " "); - - det_info = lv_label_create_empty(scr); - - lv_style_copy(&det_style, &lv_style_scr); - det_style.body.main_color.full = 0x0000; - det_style.body.grad_color.full = 0x0000; - det_style.text.color.full = 0xffff; - lv_obj_set_style(det_info, &det_style); - - lv_obj_set_pos(det_info, 20, 145); - lv_label_set_text(det_info, " "); - #endif // if 1 - + e1 = lv_label_create_empty(scr); + lv_obj_set_pos(e1, 20, 20); + sprintf_P(buf, PSTR("e1: %d"), thermalManager.degHotend(0)); + lv_label_set_text(e1, buf); + + #if HAS_MULTI_HOTEND + e2 = lv_label_create_empty(scr); + lv_obj_set_pos(e2, 20, 45); + sprintf_P(buf, PSTR("e1: %d"), thermalManager.degHotend(1)); + lv_label_set_text(e2, buf); + #endif + + #if HAS_HEATED_BED + bed = lv_label_create_empty(scr); + lv_obj_set_pos(bed, 20, 95); + sprintf_P(buf, PSTR("bed: %d"), thermalManager.degBed()); + lv_label_set_text(bed, buf); + #endif + + limit_info = lv_label_create_empty(scr); + + lv_style_copy(&limit_style, &lv_style_scr); + limit_style.body.main_color.full = 0x0000; + limit_style.body.grad_color.full = 0x0000; + limit_style.text.color.full = 0xFFFF; + lv_obj_set_style(limit_info, &limit_style); + + lv_obj_set_pos(limit_info, 20, 120); + lv_label_set_text(limit_info, " "); + + det_info = lv_label_create_empty(scr); + + lv_style_copy(&det_style, &lv_style_scr); + det_style.body.main_color.full = 0x0000; + det_style.body.grad_color.full = 0x0000; + det_style.text.color.full = 0xFFFF; + lv_obj_set_style(det_info, &det_style); + + lv_obj_set_pos(det_info, 20, 145); + lv_label_set_text(det_info, " "); } else { lv_big_button_create(scr, "F:/bmp_tool.bin", main_menu.tool, 20, 180, event_handler, ID_TOOL); lv_big_button_create(scr, "F:/bmp_set.bin", main_menu.set, 180, 180, event_handler, ID_SET); lv_big_button_create(scr, "F:/bmp_printing.bin", main_menu.print, 340, 180, event_handler, ID_PRINT); - + // Monitoring - #if 1 - lv_obj_t *buttonExt1 = lv_img_create(scr, NULL); - #if HAS_MULTI_EXTRUDER - lv_obj_t *buttonExt2 = lv_img_create(scr, NULL); - #endif - #if HAS_HEATED_BED - lv_obj_t *buttonBedstate = lv_img_create(scr, NULL); - #endif - lv_obj_t *buttonFanstate = lv_img_create(scr, NULL); - - lv_img_set_src(buttonExt1, "F:/bmp_ext1_state.bin"); - #if HAS_MULTI_EXTRUDER - lv_img_set_src(buttonExt2, "F:/bmp_ext2_state.bin"); - #endif - #if HAS_HEATED_BED - lv_img_set_src(buttonBedstate, "F:/bmp_bed_state.bin"); - #endif - - lv_img_set_src(buttonFanstate, "F:/bmp_fan_state.bin"); - - lv_obj_set_pos(buttonExt1, 55, ICON_POS_Y); - - #if HAS_MULTI_EXTRUDER - lv_obj_set_pos(buttonExt2, 55, ICON_POS_Y + SECOND_EXT_MOD_Y); - #endif - - #if HAS_HEATED_BED - lv_obj_set_pos(buttonBedstate, 210, ICON_POS_Y); - #endif - - lv_obj_set_pos(buttonFanstate, 380, ICON_POS_Y); - - - labelExt1 = lv_label_create(scr, 55, LABEL_MOD_Y, nullptr); - labelExt1Target = lv_label_create(scr, 55, LABEL_MOD_Y, nullptr); - - #if HAS_MULTI_EXTRUDER - labelExt2 = lv_label_create(scr, 55, LABEL_MOD_Y + SECOND_EXT_MOD_Y, nullptr); - labelExt2Target = lv_label_create(scr, 55, LABEL_MOD_Y + SECOND_EXT_MOD_Y, nullptr); - #endif - - #if HAS_HEATED_BED - labelBed = lv_label_create(scr, 210, LABEL_MOD_Y, nullptr); - labelBedTarget = lv_label_create(scr, 210, LABEL_MOD_Y, nullptr); - #endif - - labelFan = lv_label_create(scr, 380, 80, nullptr); - - sprintf_P(buf, PSTR("%d"), (int)thermalManager.degHotend(0)); - lv_label_set_text(labelExt1, buf); - lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); - sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(0)); - lv_label_set_text(labelExt1Target, buf); - lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y); - #if HAS_MULTI_EXTRUDER - sprintf_P(buf, PSTR("%d"), (int)thermalManager.degHotend(1)); - lv_label_set_text(labelExt2, buf); - lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); - sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(1)); - lv_label_set_text(labelExt2Target, buf); - lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y); - #endif - - #if HAS_HEATED_BED - sprintf_P(buf, PSTR("%d"), (int)thermalManager.degBed()); - lv_label_set_text(labelBed, buf); - lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); - sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetBed()); - lv_label_set_text(labelBedTarget, buf); - lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y); - #endif - - sprintf_P(buf, PSTR("%d%%"), thermalManager.fanPercent(thermalManager.fan_speed[0])); - lv_label_set_text(labelFan, buf); - lv_obj_align(labelFan, buttonFanstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); - - #endif // if 1 + lv_obj_t *buttonExt1 = lv_img_create(scr, NULL); + #if HAS_MULTI_EXTRUDER + lv_obj_t *buttonExt2 = lv_img_create(scr, NULL); + #endif + #if HAS_HEATED_BED + lv_obj_t *buttonBedstate = lv_img_create(scr, NULL); + #endif + lv_obj_t *buttonFanstate = lv_img_create(scr, NULL); + + lv_img_set_src(buttonExt1, "F:/bmp_ext1_state.bin"); + #if HAS_MULTI_EXTRUDER + lv_img_set_src(buttonExt2, "F:/bmp_ext2_state.bin"); + #endif + #if HAS_HEATED_BED + lv_img_set_src(buttonBedstate, "F:/bmp_bed_state.bin"); + #endif + lv_img_set_src(buttonFanstate, "F:/bmp_fan_state.bin"); + + lv_obj_set_pos(buttonExt1, 55, ICON_POS_Y); + + #if HAS_MULTI_EXTRUDER + lv_obj_set_pos(buttonExt2, 55, ICON_POS_Y + SECOND_EXT_MOD_Y); + #endif + + #if HAS_HEATED_BED + lv_obj_set_pos(buttonBedstate, 210, ICON_POS_Y); + #endif + + lv_obj_set_pos(buttonFanstate, 380, ICON_POS_Y); + + labelExt1 = lv_label_create(scr, 55, LABEL_MOD_Y, nullptr); + labelExt1Target = lv_label_create(scr, 55, LABEL_MOD_Y, nullptr); + + #if HAS_MULTI_EXTRUDER + labelExt2 = lv_label_create(scr, 55, LABEL_MOD_Y + SECOND_EXT_MOD_Y, nullptr); + labelExt2Target = lv_label_create(scr, 55, LABEL_MOD_Y + SECOND_EXT_MOD_Y, nullptr); + #endif + + #if HAS_HEATED_BED + labelBed = lv_label_create(scr, 210, LABEL_MOD_Y, nullptr); + labelBedTarget = lv_label_create(scr, 210, LABEL_MOD_Y, nullptr); + #endif + + labelFan = lv_label_create(scr, 380, 80, nullptr); + + sprintf_P(buf, PSTR("%d"), thermalManager.degHotend(0)); + lv_label_set_text(labelExt1, buf); + lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); + sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(0)); + lv_label_set_text(labelExt1Target, buf); + lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y); + + #if HAS_MULTI_EXTRUDER + sprintf_P(buf, PSTR("%d"), thermalManager.degHotend(1)); + lv_label_set_text(labelExt2, buf); + lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); + sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(1)); + lv_label_set_text(labelExt2Target, buf); + lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y); + #endif + + #if HAS_HEATED_BED + sprintf_P(buf, PSTR("%d"), thermalManager.degBed()); + lv_label_set_text(labelBed, buf); + lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); + sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetBed()); + lv_label_set_text(labelBedTarget, buf); + lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y); + #endif + + sprintf_P(buf, PSTR("%d%%"), thermalManager.fanPercent(thermalManager.fan_speed[0])); + lv_label_set_text(labelFan, buf); + lv_obj_align(labelFan, buttonFanstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y); } #if ENABLED(TOUCH_SCREEN_CALIBRATION) diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.h index 8569d28a1585..a3cfd6766578 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.h @@ -25,11 +25,6 @@ extern "C" { /* C-declarations for C++ */ #endif -#define ICON_POS_Y 38 -#define TARGET_LABEL_MOD_Y -36 -#define LABEL_MOD_Y 30 -#define SECOND_EXT_MOD_Y 100 - extern void lv_draw_ready_print(); extern void mks_disp_test(); extern void disp_Limit_ok(); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h b/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h index cd19317c581f..61c46a648fbb 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h @@ -748,7 +748,7 @@ extern eeprom_def eeprom_menu; /*****************************************/ // #define TEXT_VALUE "%d/%d" -#define TEXT_VALUE_TARGET "%d -> %d" +#define TEXT_VALUE_TARGET "%d -> %d" #define TEXT_VALUE_T ": %d℃" #define TEXT_VALUE_mm ": %dmm" From 93bde6b3e7895839f6ee9a4794092f14b571ce1a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 26 Mar 2021 15:32:11 -0500 Subject: [PATCH 6/7] etc. --- Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp | 4 ++-- Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp index 9acf78375829..929b0fc01031 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp @@ -65,8 +65,8 @@ extern uint32_t upload_time; extern uint32_t upload_size; extern bool temps_update_flag; -#define BTN_OK_X TERN_(SWAP_OK_CANCEL, 280, 100) -#define BTN_CANCEL_X TERN_(SWAP_OK_CANCEL, 100, 280) +#define BTN_OK_X TERN(SWAP_OK_CANCEL, 280, 100) +#define BTN_CANCEL_X TERN(SWAP_OK_CANCEL, 100, 280) #define BTN_OK_Y 180 #define BTN_CANCEL_Y 180 diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp index 580691e999ed..acdfa24f1b81 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp @@ -200,15 +200,12 @@ void lv_draw_ready_print() { lv_img_set_src(buttonFanstate, "F:/bmp_fan_state.bin"); lv_obj_set_pos(buttonExt1, 55, ICON_POS_Y); - #if HAS_MULTI_EXTRUDER lv_obj_set_pos(buttonExt2, 55, ICON_POS_Y + SECOND_EXT_MOD_Y); #endif - #if HAS_HEATED_BED lv_obj_set_pos(buttonBedstate, 210, ICON_POS_Y); #endif - lv_obj_set_pos(buttonFanstate, 380, ICON_POS_Y); labelExt1 = lv_label_create(scr, 55, LABEL_MOD_Y, nullptr); From 217778cfec0450ee7709a484c78dea7c8b753574 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 26 Mar 2021 15:35:54 -0500 Subject: [PATCH 7/7] invert --- Marlin/Configuration.h | 1 - Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 2084cf915fae..c9c83f9bb624 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2526,7 +2526,6 @@ #if ENABLED(TFT_LVGL_UI) //#define MKS_WIFI_MODULE // MKS WiFi module - //#define SWAP_OK_CANCEL // Swap the positions of the 'Confirm' and 'Cancel' buttons #endif /** diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp index 929b0fc01031..c4ae6e221d55 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp @@ -65,8 +65,10 @@ extern uint32_t upload_time; extern uint32_t upload_size; extern bool temps_update_flag; -#define BTN_OK_X TERN(SWAP_OK_CANCEL, 280, 100) -#define BTN_CANCEL_X TERN(SWAP_OK_CANCEL, 100, 280) +//#define CANCEL_ON_RIGHT // Put 'Cancel' on the right (as it was before) + +#define BTN_OK_X TERN(CANCEL_ON_RIGHT, 100, 280) +#define BTN_CANCEL_X TERN(CANCEL_ON_RIGHT, 280, 100) #define BTN_OK_Y 180 #define BTN_CANCEL_Y 180