From d5e9b25a3121724556ce231967c3e1069afa126b Mon Sep 17 00:00:00 2001 From: EvilGremlin <22657714+EvilGremlin@users.noreply.github.com> Date: Tue, 30 Aug 2022 02:52:02 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20back=20button=20(#24694)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_post.h | 4 ---- Marlin/src/lcd/menu/menu_item.h | 2 +- Marlin/src/lcd/menu/menu_main.cpp | 29 ++++++++++++++++++----------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 8375ac661c..010cb79330 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -3769,10 +3769,6 @@ #define HAS_ROTARY_ENCODER 1 #endif -#if DISABLED(DISABLE_ENCODER) && ANY(HAS_ROTARY_ENCODER, HAS_ADC_BUTTONS) && ANY(TFT_CLASSIC_UI, TFT_COLOR_UI) - #define HAS_BACK_ITEM 1 -#endif - #if PIN_EXISTS(SAFE_POWER) && DISABLED(DISABLE_DRIVER_SAFE_POWER_PROTECT) #define HAS_DRIVER_SAFE_POWER_PROTECT 1 #endif diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index 7c81e3dd39..f6b406a15d 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -402,7 +402,7 @@ class MenuItem_bool : public MenuEditItemBase { // Predefined menu item types // -#if HAS_BACK_ITEM +#if DISABLED(DISABLE_ENCODER) #define BACK_ITEM_F(FLABEL) MENU_ITEM_F(back, FLABEL) #define BACK_ITEM(LABEL) MENU_ITEM(back, LABEL) #else diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index bd16703885..8c8c4758b7 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -222,6 +222,16 @@ void menu_configuration(); #endif // CUSTOM_MENU_MAIN +#if ENABLED(ADVANCED_PAUSE_FEATURE) + // This menu item is last with an encoder. Otherwise, somewhere in the middle. + #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES) + #define FILAMENT_CHANGE_ITEM() YESNO_ITEM(MSG_FILAMENTCHANGE, menu_change_filament, nullptr, \ + GET_TEXT_F(MSG_FILAMENTCHANGE), (const char *)nullptr, F("?")) + #else + #define FILAMENT_CHANGE_ITEM() SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament) + #endif +#endif + void menu_main() { const bool busy = printingIsActive() #if ENABLED(SDSUPPORT) @@ -317,6 +327,10 @@ void menu_main() { SUBMENU(MSG_MOTION, menu_motion); } + #if BOTH(ADVANCED_PAUSE_FEATURE, DISABLE_ENCODER) + FILAMENT_CHANGE_ITEM(); + #endif + #if HAS_CUTTER SUBMENU(MSG_CUTTER(MENU), STICKY_SCREEN(menu_spindle_laser)); #endif @@ -325,17 +339,6 @@ void menu_main() { SUBMENU(MSG_TEMPERATURE, menu_temperature); #endif - #if ENABLED(ADVANCED_PAUSE_FEATURE) - #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES) - YESNO_ITEM(MSG_FILAMENTCHANGE, - menu_change_filament, nullptr, - GET_TEXT_F(MSG_FILAMENTCHANGE), (const char *)nullptr, F("?") - ); - #else - SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament); - #endif - #endif - #if HAS_POWER_MONITOR SUBMENU(MSG_POWER_MONITOR, menu_power_monitor); #endif @@ -458,6 +461,10 @@ void menu_main() { }); #endif + #if ENABLED(ADVANCED_PAUSE_FEATURE) && DISABLED(DISABLE_ENCODER) + FILAMENT_CHANGE_ITEM(); + #endif + END_MENU(); }