From 31bae024ccd1fff8977de512b422e6b5dc1b612b Mon Sep 17 00:00:00 2001 From: alexgrach <gav@bmstu.ru> Date: Fri, 3 Feb 2023 14:05:24 +0300 Subject: [PATCH 1/4] Stop print button instead of SD while printing --- Marlin/src/lcd/tft/touch.cpp | 7 +++++++ Marlin/src/lcd/tft/touch.h | 1 + Marlin/src/lcd/tft/ui_320x240.cpp | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index 6c81ebefcda7..0bfe76b3c74a 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -233,6 +233,13 @@ void Touch::touch(touch_control_t *control) { MenuItem_int3::action(GET_TEXT_F(MSG_FLOW_N), &planner.flow_percentage[MenuItemBase::itemIndex], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); #endif break; + case STOP: + ui.goto_screen([]{ + MenuItem_confirm::select_screen( GET_TEXT_F(MSG_BUTTON_STOP), + GET_TEXT_F(MSG_BACK), ui.abort_print, ui.goto_previous_screen, + GET_TEXT_F(MSG_STOP_PRINT), FSTR_P(nullptr), FPSTR("?") ); + }); + break; #if ENABLED(AUTO_BED_LEVELING_UBL) case UBL: hold(control, UBL_REPEAT_DELAY); ui.encoderPosition += control->data; break; diff --git a/Marlin/src/lcd/tft/touch.h b/Marlin/src/lcd/tft/touch.h index fd5d9fd73737..bebd9d01e36a 100644 --- a/Marlin/src/lcd/tft/touch.h +++ b/Marlin/src/lcd/tft/touch.h @@ -65,6 +65,7 @@ enum TouchControlType : uint16_t { FLOWRATE, UBL, MOVE_AXIS, + STOP, BUTTON, }; diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index 76cce4dad14e..583fe8f44b24 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -450,7 +450,10 @@ void MarlinUI::draw_status_screen() { ); #if ENABLED(SDSUPPORT) const bool cm = card.isMounted(), pa = printingIsActive(); - add_control(0, TERN(TFT_COLOR_UI_PORTRAIT, 210, 130), menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, cm && pa ? COLOR_BUSY : COLOR_CONTROL_DISABLED); + if (cm && pa) + add_control(0, TERN(TFT_COLOR_UI_PORTRAIT, 210, 130), STOP, imgCancel, true, COLOR_CONTROL_CANCEL); + else + add_control(0, TERN(TFT_COLOR_UI_PORTRAIT, 210, 130), menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, COLOR_CONTROL_DISABLED); #endif } // (sublime) #endif // TOUCH_SCREEN From de256fc997bde26243a4064d49c804b5483bc673 Mon Sep 17 00:00:00 2001 From: alexgrach <gav@bmstu.ru> Date: Fri, 3 Feb 2023 23:16:05 +0300 Subject: [PATCH 2/4] Select screen icons align symmetrical --- Marlin/src/lcd/tft/ui_320x240.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index 583fe8f44b24..7562d10d083f 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -552,8 +552,8 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); } #if ENABLED(TOUCH_SCREEN) - if (no) add_control(TERN(TFT_COLOR_UI_PORTRAIT, 32, 48), TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL); - if (yes) add_control(TERN(TFT_COLOR_UI_PORTRAIT, 172, 208), TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM)); + if (no) add_control(TERN(TFT_COLOR_UI_PORTRAIT, 16, 48), TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL); + if (yes) add_control(TERN(TFT_COLOR_UI_PORTRAIT, 160, 208), TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM)); #endif } From e2b0c14a2a67e6797a39f9b8160bcaaf60eccada Mon Sep 17 00:00:00 2001 From: Scott Lahteine <thinkyhead@users.noreply.github.com> Date: Tue, 14 Feb 2023 22:12:28 -0600 Subject: [PATCH 3/4] cleanup --- Marlin/src/lcd/tft/touch.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index 0bfe76b3c74a..77082db0d7d6 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -233,12 +233,12 @@ void Touch::touch(touch_control_t *control) { MenuItem_int3::action(GET_TEXT_F(MSG_FLOW_N), &planner.flow_percentage[MenuItemBase::itemIndex], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); #endif break; - case STOP: + case STOP: ui.goto_screen([]{ - MenuItem_confirm::select_screen( GET_TEXT_F(MSG_BUTTON_STOP), + MenuItem_confirm::select_screen(GET_TEXT_F(MSG_BUTTON_STOP), GET_TEXT_F(MSG_BACK), ui.abort_print, ui.goto_previous_screen, - GET_TEXT_F(MSG_STOP_PRINT), FSTR_P(nullptr), FPSTR("?") ); - }); + GET_TEXT_F(MSG_STOP_PRINT), FSTR_P(nullptr), FPSTR("?")); + }); break; #if ENABLED(AUTO_BED_LEVELING_UBL) From f73652b7ceb9697356d0a62170f923b494686337 Mon Sep 17 00:00:00 2001 From: Scott Lahteine <thinkyhead@users.noreply.github.com> Date: Wed, 15 Feb 2023 00:17:10 -0600 Subject: [PATCH 4/4] 480x320 and 1024x600 --- Marlin/src/lcd/tft/ui_1024x600.cpp | 5 ++++- Marlin/src/lcd/tft/ui_320x240.cpp | 2 +- Marlin/src/lcd/tft/ui_480x320.cpp | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Marlin/src/lcd/tft/ui_1024x600.cpp b/Marlin/src/lcd/tft/ui_1024x600.cpp index 771f12d89897..6b628bc4cf42 100644 --- a/Marlin/src/lcd/tft/ui_1024x600.cpp +++ b/Marlin/src/lcd/tft/ui_1024x600.cpp @@ -328,7 +328,10 @@ void MarlinUI::draw_status_screen() { add_control(900, y, menu_main, imgSettings); #if ENABLED(SDSUPPORT) const bool cm = card.isMounted(), pa = printingIsActive(); - add_control(12, y, menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, cm && pa ? COLOR_BUSY : COLOR_CONTROL_DISABLED); + if (cm && pa) + add_control(12, y, STOP, imgCancel, true, COLOR_CONTROL_CANCEL); + else + add_control(12, y, menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, COLOR_CONTROL_DISABLED); #endif #endif diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index 7562d10d083f..e8bec7e1a7ac 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -455,7 +455,7 @@ void MarlinUI::draw_status_screen() { else add_control(0, TERN(TFT_COLOR_UI_PORTRAIT, 210, 130), menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, COLOR_CONTROL_DISABLED); #endif - } // (sublime) + } #endif // TOUCH_SCREEN } diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index c4395460d569..54762da671a7 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -322,7 +322,10 @@ void MarlinUI::draw_status_screen() { add_control(404, y, menu_main, imgSettings); #if ENABLED(SDSUPPORT) const bool cm = card.isMounted(), pa = printingIsActive(); - add_control(12, y, menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, cm && pa ? COLOR_BUSY : COLOR_CONTROL_DISABLED); + if (cm && pa) + add_control(12, y, STOP, imgCancel, true, COLOR_CONTROL_CANCEL); + else + add_control(12, y, menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, COLOR_CONTROL_DISABLED); #endif #endif