diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index ba56862d5d..398a5da3a4 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -3272,29 +3272,54 @@ #endif /** - * User-defined menu items that execute custom GCode + * Custom Main and Configuration Menu items that execute user-defined G-Code */ -//#define CUSTOM_USER_MENUS -#if ENABLED(CUSTOM_USER_MENUS) - //#define CUSTOM_USER_MENU_TITLE "Custom Commands" - #define USER_SCRIPT_DONE "M117 User Script Done" - #define USER_SCRIPT_AUDIBLE_FEEDBACK - //#define USER_SCRIPT_RETURN // Return to status screen after a script +// Custom Menus, Main Menu +//#define CUSTOM_MENUS_MAIN +#if ENABLED(CUSTOM_MENUS_MAIN) + //#define CUSTOM_MENUS_MAIN_TITLE "Custom Commands" + #define CUSTOM_MENUS_MAIN_SCRIPT_DONE "M117 User Script Done" + #define CUSTOM_MENUS_MAIN_SCRIPT_AUDIBLE_FEEDBACK + //#define CUSTOM_MENUS_MAIN_SCRIPT_RETURN // Return to status screen after a script - #define USER_DESC_1 "Home & UBL Info" - #define USER_GCODE_1 "G28\nG29 W" + #define CUSTOM_MENU_MAIN_DESC_1 "Home & UBL Info" + #define CUSTOM_MENU_MAIN_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL - #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) + #define CUSTOM_MENU_MAIN_DESC_2 "Preheat for " PREHEAT_1_LABEL + #define CUSTOM_MENU_MAIN_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL - #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) + //#define CUSTOM_MENU_MAIN_DESC_3 "Preheat for " PREHEAT_2_LABEL + //#define CUSTOM_MENU_MAIN_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) - #define USER_DESC_4 "Heat Bed/Home/Level" - #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" + //#define CUSTOM_MENU_MAIN_DESC_4 "Heat Bed/Home/Level" + //#define CUSTOM_MENU_MAIN_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" - #define USER_DESC_5 "Home & Info" - #define USER_GCODE_5 "G28\nM503" + //#define CUSTOM_MENU_MAIN_DESC_5 "Home & Info" + //#define CUSTOM_MENU_MAIN_GCODE_5 "G28\nM503" +#endif + +// Custom Menus, Configuration Menu +//#define CUSTOM_MENUS_CONFIGURATION +#if ENABLED(CUSTOM_MENUS_CONFIGURATION) + //#define CUSTOM_MENUS_CONFIGURATION_TITLE "Custom Commands" + #define CUSTOM_MENUS_CONFIGURATION_SCRIPT_DONE "M117 Wireless Script Done" + #define CUSTOM_MENUS_CONFIGURATION_SCRIPT_AUDIBLE_FEEDBACK + //#define CUSTOM_MENUS_CONFIGURATION_SCRIPT_RETURN // Return to status screen after a script + + #define CUSTOM_MENU_CONFIGURATION_DESC_1 "Wifi ON" + #define CUSTOM_MENU_CONFIGURATION_GCODE_1 "M118 [ESP110] WIFI-STA pwd=12345678" + + #define CUSTOM_MENU_CONFIGURATION_DESC_2 "Bluetooth ON" + #define CUSTOM_MENU_CONFIGURATION_GCODE_2 "M118 [ESP110] BT pwd=12345678" + + //#define CUSTOM_MENU_CONFIGURATION_DESC_3 "Radio OFF" + //#define CUSTOM_MENU_CONFIGURATION_GCODE_3 "M118 [ESP110] OFF pwd=12345678" + + //#define CUSTOM_MENU_CONFIGURATION_DESC_4 "Wifi ????" + //#define CUSTOM_MENU_CONFIGURATION_GCODE_4 "M118 ????" + + //#define CUSTOM_MENU_CONFIGURATION_DESC_5 "Wifi ????" + //#define CUSTOM_MENU_CONFIGURATION_GCODE_5 "M118 ????" #endif /** diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 3762d40c53..905292d962 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2825,106 +2825,209 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2) #error "GCODE_MACROS_SLOTS must be a number from 1 to 10." #endif -#if ENABLED(CUSTOM_USER_MENUS) - #ifdef USER_GCODE_1 - constexpr char _chr1 = USER_GCODE_1[strlen(USER_GCODE_1) - 1]; - static_assert(_chr1 != '\n' && _chr1 != '\r', "USER_GCODE_1 cannot have a newline at the end. Please remove it."); +#if ENABLED(CUSTOM_MENUS_MAIN) + #ifdef CUSTOM_MENU_MAIN_GCODE_1 + constexpr char chr1 = CUSTOM_MENU_MAIN_GCODE_1[strlen(CUSTOM_MENU_MAIN_GCODE_1) - 1]; + static_assert(chr1 != '\n' && chr1 != '\r', "CUSTOM_MENU_MAIN_GCODE_1 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_2 - constexpr char _chr2 = USER_GCODE_2[strlen(USER_GCODE_2) - 1]; - static_assert(_chr2 != '\n' && _chr2 != '\r', "USER_GCODE_2 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_2 + constexpr char chr2 = CUSTOM_MENU_MAIN_GCODE_2[strlen(CUSTOM_MENU_MAIN_GCODE_2) - 1]; + static_assert(chr2 != '\n' && chr2 != '\r', "CUSTOM_MENU_MAIN_GCODE_2 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_3 - constexpr char _chr3 = USER_GCODE_3[strlen(USER_GCODE_3) - 1]; - static_assert(_chr3 != '\n' && _chr3 != '\r', "USER_GCODE_3 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_3 + constexpr char chr3 = CUSTOM_MENU_MAIN_GCODE_3[strlen(CUSTOM_MENU_MAIN_GCODE_3) - 1]; + static_assert(chr3 != '\n' && chr3 != '\r', "CUSTOM_MENU_MAIN_GCODE_3 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_4 - constexpr char _chr4 = USER_GCODE_4[strlen(USER_GCODE_4) - 1]; - static_assert(_chr4 != '\n' && _chr4 != '\r', "USER_GCODE_4 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_4 + constexpr char chr4 = CUSTOM_MENU_MAIN_GCODE_4[strlen(CUSTOM_MENU_MAIN_GCODE_4) - 1]; + static_assert(chr4 != '\n' && chr4 != '\r', "CUSTOM_MENU_MAIN_GCODE_4 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_5 - constexpr char _chr5 = USER_GCODE_5[strlen(USER_GCODE_5) - 1]; - static_assert(_chr5 != '\n' && _chr5 != '\r', "USER_GCODE_5 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_5 + constexpr char chr5 = CUSTOM_MENU_MAIN_GCODE_5[strlen(CUSTOM_MENU_MAIN_GCODE_5) - 1]; + static_assert(chr5 != '\n' && chr5 != '\r', "CUSTOM_MENU_MAIN_GCODE_5 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_6 - constexpr char _chr6 = USER_GCODE_6[strlen(USER_GCODE_6) - 1]; - static_assert(_chr6 != '\n' && _chr6 != '\r', "USER_GCODE_6 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_6 + constexpr char chr6 = CUSTOM_MENU_MAIN_GCODE_6[strlen(CUSTOM_MENU_MAIN_GCODE_6) - 1]; + static_assert(chr6 != '\n' && chr6 != '\r', "CUSTOM_MENU_MAIN_GCODE_6 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_7 - constexpr char _chr7 = USER_GCODE_7[strlen(USER_GCODE_7) - 1]; - static_assert(_chr7 != '\n' && _chr7 != '\r', "USER_GCODE_7 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_7 + constexpr char chr7 = CUSTOM_MENU_MAIN_GCODE_7[strlen(CUSTOM_MENU_MAIN_GCODE_7) - 1]; + static_assert(chr7 != '\n' && chr7 != '\r', "CUSTOM_MENU_MAIN_GCODE_7 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_8 - constexpr char _chr8 = USER_GCODE_8[strlen(USER_GCODE_8) - 1]; - static_assert(_chr8 != '\n' && _chr8 != '\r', "USER_GCODE_8 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_8 + constexpr char chr8 = CUSTOM_MENU_MAIN_GCODE_8[strlen(CUSTOM_MENU_MAIN_GCODE_8) - 1]; + static_assert(chr8 != '\n' && chr8 != '\r', "CUSTOM_MENU_MAIN_GCODE_8 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_9 - constexpr char _chr9 = USER_GCODE_9[strlen(USER_GCODE_9) - 1]; - static_assert(_chr9 != '\n' && _chr9 != '\r', "USER_GCODE_9 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_9 + constexpr char chr9 = CUSTOM_MENU_MAIN_GCODE_9[strlen(CUSTOM_MENU_MAIN_GCODE_9) - 1]; + static_assert(chr9 != '\n' && chr9 != '\r', "CUSTOM_MENU_MAIN_GCODE_9 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_10 - constexpr char _chr10 = USER_GCODE_10[strlen(USER_GCODE_10) - 1]; - static_assert(_chr10 != '\n' && _chr10 != '\r', "USER_GCODE_10 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_10 + constexpr char chr10 = CUSTOM_MENU_MAIN_GCODE_10[strlen(CUSTOM_MENU_MAIN_GCODE_10) - 1]; + static_assert(chr10 != '\n' && chr10 != '\r', "CUSTOM_MENU_MAIN_GCODE_10 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_11 - constexpr char _chr11 = USER_GCODE_11[strlen(USER_GCODE_11) - 1]; - static_assert(_chr11 != '\n' && _chr11 != '\r', "USER_GCODE_11 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_11 + constexpr char chr11 = CUSTOM_MENU_MAIN_GCODE_11[strlen(CUSTOM_MENU_MAIN_GCODE_11) - 1]; + static_assert(chr11 != '\n' && chr11 != '\r', "CUSTOM_MENU_MAIN_GCODE_11 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_12 - constexpr char _chr12 = USER_GCODE_12[strlen(USER_GCODE_12) - 1]; - static_assert(_chr12 != '\n' && _chr12 != '\r', "USER_GCODE_12 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_12 + constexpr char chr12 = CUSTOM_MENU_MAIN_GCODE_12[strlen(CUSTOM_MENU_MAIN_GCODE_12) - 1]; + static_assert(chr12 != '\n' && chr12 != '\r', "CUSTOM_MENU_MAIN_GCODE_12 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_13 - constexpr char _chr13 = USER_GCODE_13[strlen(USER_GCODE_13) - 1]; - static_assert(_chr13 != '\n' && _chr13 != '\r', "USER_GCODE_13 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_13 + constexpr char chr13 = CUSTOM_MENU_MAIN_GCODE_13[strlen(CUSTOM_MENU_MAIN_GCODE_13) - 1]; + static_assert(chr13 != '\n' && chr13 != '\r', "CUSTOM_MENU_MAIN_GCODE_13 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_14 - constexpr char _chr14 = USER_GCODE_14[strlen(USER_GCODE_14) - 1]; - static_assert(_chr14 != '\n' && _chr14 != '\r', "USER_GCODE_14 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_14 + constexpr char chr14 = CUSTOM_MENU_MAIN_GCODE_14[strlen(CUSTOM_MENU_MAIN_GCODE_14) - 1]; + static_assert(chr14 != '\n' && chr14 != '\r', "CUSTOM_MENU_MAIN_GCODE_14 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_15 - constexpr char _chr15 = USER_GCODE_15[strlen(USER_GCODE_15) - 1]; - static_assert(_chr15 != '\n' && _chr15 != '\r', "USER_GCODE_15 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_15 + constexpr char chr15 = CUSTOM_MENU_MAIN_GCODE_15[strlen(CUSTOM_MENU_MAIN_GCODE_15) - 1]; + static_assert(chr15 != '\n' && chr15 != '\r', "CUSTOM_MENU_MAIN_GCODE_15 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_16 - constexpr char _chr16 = USER_GCODE_16[strlen(USER_GCODE_16) - 1]; - static_assert(_chr16 != '\n' && _chr16 != '\r', "USER_GCODE_16 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_16 + constexpr char chr16 = CUSTOM_MENU_MAIN_GCODE_16[strlen(CUSTOM_MENU_MAIN_GCODE_16) - 1]; + static_assert(chr16 != '\n' && chr16 != '\r', "CUSTOM_MENU_MAIN_GCODE_16 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_17 - constexpr char _chr17 = USER_GCODE_17[strlen(USER_GCODE_17) - 1]; - static_assert(_chr17 != '\n' && _chr17 != '\r', "USER_GCODE_17 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_17 + constexpr char chr17 = CUSTOM_MENU_MAIN_GCODE_17[strlen(CUSTOM_MENU_MAIN_GCODE_17) - 1]; + static_assert(chr17 != '\n' && chr17 != '\r', "CUSTOM_MENU_MAIN_GCODE_17 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_18 - constexpr char _chr18 = USER_GCODE_18[strlen(USER_GCODE_18) - 1]; - static_assert(_chr18 != '\n' && _chr18 != '\r', "USER_GCODE_18 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_18 + constexpr char chr18 = CUSTOM_MENU_MAIN_GCODE_18[strlen(CUSTOM_MENU_MAIN_GCODE_18) - 1]; + static_assert(chr18 != '\n' && chr18 != '\r', "CUSTOM_MENU_MAIN_GCODE_18 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_19 - constexpr char _chr19 = USER_GCODE_19[strlen(USER_GCODE_19) - 1]; - static_assert(_chr19 != '\n' && _chr19 != '\r', "USER_GCODE_19 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_19 + constexpr char chr19 = CUSTOM_MENU_MAIN_GCODE_19[strlen(CUSTOM_MENU_MAIN_GCODE_19) - 1]; + static_assert(chr19 != '\n' && chr19 != '\r', "CUSTOM_MENU_MAIN_GCODE_19 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_20 - constexpr char _chr20 = USER_GCODE_20[strlen(USER_GCODE_20) - 1]; - static_assert(_chr20 != '\n' && _chr20 != '\r', "USER_GCODE_20 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_20 + constexpr char chr20 = CUSTOM_MENU_MAIN_GCODE_20[strlen(CUSTOM_MENU_MAIN_GCODE_20) - 1]; + static_assert(chr20 != '\n' && chr20 != '\r', "CUSTOM_MENU_MAIN_GCODE_20 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_21 - constexpr char _chr21 = USER_GCODE_21[strlen(USER_GCODE_21) - 1]; - static_assert(_chr21 != '\n' && _chr21 != '\r', "USER_GCODE_21 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_21 + constexpr char chr21 = CUSTOM_MENU_MAIN_GCODE_21[strlen(CUSTOM_MENU_MAIN_GCODE_21) - 1]; + static_assert(chr21 != '\n' && chr21 != '\r', "CUSTOM_MENU_MAIN_GCODE_21 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_22 - constexpr char _chr22 = USER_GCODE_22[strlen(USER_GCODE_22) - 1]; - static_assert(_chr22 != '\n' && _chr22 != '\r', "USER_GCODE_22 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_22 + constexpr char chr22 = CUSTOM_MENU_MAIN_GCODE_22[strlen(CUSTOM_MENU_MAIN_GCODE_22) - 1]; + static_assert(chr22 != '\n' && chr22 != '\r', "CUSTOM_MENU_MAIN_GCODE_22 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_23 - constexpr char _chr23 = USER_GCODE_23[strlen(USER_GCODE_23) - 1]; - static_assert(_chr23 != '\n' && _chr23 != '\r', "USER_GCODE_23 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_23 + constexpr char chr23 = CUSTOM_MENU_MAIN_GCODE_23[strlen(CUSTOM_MENU_MAIN_GCODE_23) - 1]; + static_assert(chr23 != '\n' && chr23 != '\r', "CUSTOM_MENU_MAIN_GCODE_23 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_24 - constexpr char _chr24 = USER_GCODE_24[strlen(USER_GCODE_24) - 1]; - static_assert(_chr24 != '\n' && _chr24 != '\r', "USER_GCODE_24 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_24 + constexpr char chr24 = CUSTOM_MENU_MAIN_GCODE_24[strlen(CUSTOM_MENU_MAIN_GCODE_24) - 1]; + static_assert(chr24 != '\n' && chr24 != '\r', "CUSTOM_MENU_MAIN_GCODE_24 cannot have a newline at the end. Please remove it."); #endif - #ifdef USER_GCODE_25 - constexpr char _chr25 = USER_GCODE_25[strlen(USER_GCODE_25) - 1]; - static_assert(_chr25 != '\n' && _chr25 != '\r', "USER_GCODE_25 cannot have a newline at the end. Please remove it."); + #ifdef CUSTOM_MENU_MAIN_GCODE_25 + constexpr char chr25 = CUSTOM_MENU_MAIN_GCODE_25[strlen(CUSTOM_MENU_MAIN_GCODE_25) - 1]; + static_assert(chr25 != '\n' && chr25 != '\r', "CUSTOM_MENU_MAIN_GCODE_25 cannot have a newline at the end. Please remove it."); + #endif +#endif + +#if ENABLED(CUSTOM_MENUS_CONFIGURATION) + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_1 + constexpr char _chr1 = CUSTOM_MENU_CONFIGURATION_GCODE_1[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_1) - 1]; + static_assert(_chr1 != '\n' && _chr1 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_1 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_2 + constexpr char _chr2 = CUSTOM_MENU_CONFIGURATION_GCODE_2[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_2) - 1]; + static_assert(_chr2 != '\n' && _chr2 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_2 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_3 + constexpr char _chr3 = CUSTOM_MENU_CONFIGURATION_GCODE_3[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_3) - 1]; + static_assert(_chr3 != '\n' && _chr3 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_3 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_4 + constexpr char _chr4 = CUSTOM_MENU_CONFIGURATION_GCODE_4[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_4) - 1]; + static_assert(_chr4 != '\n' && _chr4 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_4 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_5 + constexpr char _chr5 = CUSTOM_MENU_CONFIGURATION_GCODE_5[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_5) - 1]; + static_assert(_chr5 != '\n' && _chr5 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_5 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_6 + constexpr char _chr6 = CUSTOM_MENU_CONFIGURATION_GCODE_6[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_6) - 1]; + static_assert(_chr6 != '\n' && _chr6 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_6 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_7 + constexpr char _chr7 = CUSTOM_MENU_CONFIGURATION_GCODE_7[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_7) - 1]; + static_assert(_chr7 != '\n' && _chr7 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_7 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_8 + constexpr char _chr8 = CUSTOM_MENU_CONFIGURATION_GCODE_8[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_8) - 1]; + static_assert(_chr8 != '\n' && _chr8 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_8 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_9 + constexpr char _chr9 = CUSTOM_MENU_CONFIGURATION_GCODE_9[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_9) - 1]; + static_assert(_chr9 != '\n' && _chr9 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_9 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_10 + constexpr char _chr10 = CUSTOM_MENU_CONFIGURATION_GCODE_10[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_10) - 1]; + static_assert(_chr10 != '\n' && _chr10 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_10 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_11 + constexpr char _chr11 = CUSTOM_MENU_CONFIGURATION_GCODE_11[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_11) - 1]; + static_assert(_chr11 != '\n' && _chr11 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_11 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_12 + constexpr char _chr12 = CUSTOM_MENU_CONFIGURATION_GCODE_12[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_12) - 1]; + static_assert(_chr12 != '\n' && _chr12 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_12 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_13 + constexpr char _chr13 = CUSTOM_MENU_CONFIGURATION_GCODE_13[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_13) - 1]; + static_assert(_chr13 != '\n' && _chr13 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_13 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_14 + constexpr char _chr14 = CUSTOM_MENU_CONFIGURATION_GCODE_14[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_14) - 1]; + static_assert(_chr14 != '\n' && _chr14 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_14 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_15 + constexpr char _chr15 = CUSTOM_MENU_CONFIGURATION_GCODE_15[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_15) - 1]; + static_assert(_chr15 != '\n' && _chr15 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_15 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_16 + constexpr char _chr16 = CUSTOM_MENU_CONFIGURATION_GCODE_16[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_16) - 1]; + static_assert(_chr16 != '\n' && _chr16 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_16 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_17 + constexpr char _chr17 = CUSTOM_MENU_CONFIGURATION_GCODE_17[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_17) - 1]; + static_assert(_chr17 != '\n' && _chr17 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_17 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_18 + constexpr char _chr18 = CUSTOM_MENU_CONFIGURATION_GCODE_18[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_18) - 1]; + static_assert(_chr18 != '\n' && _chr18 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_18 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_19 + constexpr char _chr19 = CUSTOM_MENU_CONFIGURATION_GCODE_19[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_19) - 1]; + static_assert(_chr19 != '\n' && _chr19 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_19 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_20 + constexpr char _chr20 = CUSTOM_MENU_CONFIGURATION_GCODE_20[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_20) - 1]; + static_assert(_chr20 != '\n' && _chr20 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_20 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_21 + constexpr char _chr21 = CUSTOM_MENU_CONFIGURATION_GCODE_21[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_21) - 1]; + static_assert(_chr21 != '\n' && _chr21 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_21 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_22 + constexpr char _chr22 = CUSTOM_MENU_CONFIGURATION_GCODE_22[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_22) - 1]; + static_assert(_chr22 != '\n' && _chr22 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_22 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_23 + constexpr char _chr23 = CUSTOM_MENU_CONFIGURATION_GCODE_23[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_23) - 1]; + static_assert(_chr23 != '\n' && _chr23 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_23 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_24 + constexpr char _chr24 = CUSTOM_MENU_CONFIGURATION_GCODE_24[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_24) - 1]; + static_assert(_chr24 != '\n' && _chr24 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_24 cannot have a newline at the end. Please remove it."); + #endif + #ifdef CUSTOM_MENU_CONFIGURATION_GCODE_25 + constexpr char _chr25 = CUSTOM_MENU_CONFIGURATION_GCODE_25[strlen(CUSTOM_MENU_CONFIGURATION_GCODE_25) - 1]; + static_assert(_chr25 != '\n' && _chr25 != '\r', "CUSTOM_MENU_CONFIGURATION_GCODE_25 cannot have a newline at the end. Please remove it."); #endif #endif diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index ffaaf2e02a..87c80cae00 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -133,7 +133,8 @@ namespace Language_en { PROGMEM Language_Str MSG_MESH_X = _UxGT("Index X"); PROGMEM Language_Str MSG_MESH_Y = _UxGT("Index Y"); PROGMEM Language_Str MSG_MESH_EDIT_Z = _UxGT("Z Value"); - PROGMEM Language_Str MSG_USER_MENU = _UxGT("Custom Commands"); + PROGMEM Language_Str MSG_CUSTOM_MENUS_MAIN = _UxGT("Custom Commands"); + PROGMEM Language_Str MSG_CUSTOM_MENUS_CONFIGURATION = _UxGT("Custom Commands"); PROGMEM Language_Str MSG_M48_TEST = _UxGT("M48 Probe Test"); PROGMEM Language_Str MSG_M48_POINT = _UxGT("M48 Point"); PROGMEM Language_Str MSG_M48_OUT_OF_BOUNDS = _UxGT("Probe out of bounds"); diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index f667242bc1..2b570abf7e 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -341,6 +341,10 @@ void menu_configuration() { START_MENU(); BACK_ITEM(MSG_MAIN); + #if ENABLED(CUSTOM_MENUS_CONFIGURATION) + void custom_menus_configuration(); + #endif + // // Debug Menu when certain options are enabled // @@ -348,6 +352,14 @@ void menu_configuration() { SUBMENU(MSG_DEBUG_MENU, menu_debug); #endif + #if ENABLED(CUSTOM_MENUS_CONFIGURATION) + #ifdef CUSTOM_MENUS_CONFIGURATION_TITLE + SUBMENU_P(PSTR(CUSTOM_MENUS_CONFIGURATION_TITLE), custom_menus_configuration); + #else + SUBMENU(MSG_CUSTOM_MENUS_CONFIGURATION, custom_menus_configuration); + #endif + #endif + SUBMENU(MSG_ADVANCED_SETTINGS, menu_advanced_settings); #if ENABLED(BABYSTEP_ZPROBE_OFFSET) diff --git a/Marlin/src/lcd/menu/menu_custom.cpp b/Marlin/src/lcd/menu/menu_custom.cpp index 7c54ec6e26..a16073eb20 100644 --- a/Marlin/src/lcd/menu/menu_custom.cpp +++ b/Marlin/src/lcd/menu/menu_custom.cpp @@ -21,109 +21,212 @@ */ // -// Custom User Menu +// Custom Menus // #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_LCD_MENU, CUSTOM_USER_MENUS) +#if HAS_LCD_MENU && ( ENABLED(CUSTOM_MENUS_MAIN) || ENABLED(CUSTOM_MENUS_CONFIGURATION) ) #include "menu_item.h" #include "../../gcode/queue.h" -#ifdef USER_SCRIPT_DONE - #define _DONE_SCRIPT "\n" USER_SCRIPT_DONE +#ifdef CUSTOM_MENU_MAIN_SCRIPT_DONE + #define _DONE_SCRIPT "\n" CUSTOM_MENU_MAIN_SCRIPT_DONE #else #define _DONE_SCRIPT "" #endif -void _lcd_user_gcode(PGM_P const cmd) { +#ifdef CUSTOM_MENUS_CONFIGURATION_SCRIPT_DONE + #define _DONE_SCRIPT "\n" CUSTOM_MENUS_CONFIGURATION_SCRIPT_DONE +#else + #define _DONE_SCRIPT "" +#endif + +void _lcd_custom_menu_main_gcode(PGM_P const cmd) { queue.inject_P(cmd); - TERN_(USER_SCRIPT_AUDIBLE_FEEDBACK, ui.completion_feedback()); - TERN_(USER_SCRIPT_RETURN, ui.return_to_status()); + #if ENABLED(CUSTOM_MENU_MAIN_SCRIPT_AUDIBLE_FEEDBACK) && HAS_BUZZER + ui.completion_feedback(); + #endif + #if ENABLED(CUSTOM_MENU_MAIN_SCRIPT_RETURN) + ui.return_to_status(); + #endif } -void menu_user() { +void _lcd_custom_menus_configuration_gcode(PGM_P const cmd) { + queue.inject_P(cmd); + #if ENABLED(CUSTOM_MENUS_CONFIGURATION_SCRIPT_AUDIBLE_FEEDBACK) && HAS_BUZZER + ui.completion_feedback(); + #endif + #if ENABLED(CUSTOM_MENUS_CONFIGURATION_SCRIPT_RETURN) + ui.return_to_status(); + #endif +} + +void custom_menus_main() { START_MENU(); BACK_ITEM(MSG_MAIN); - #define HAS_USER_ITEM(N) (defined(USER_DESC_##N) && defined(USER_GCODE_##N)) - #define USER_ITEM(N) ACTION_ITEM_P(PSTR(USER_DESC_##N), []{ _lcd_user_gcode(PSTR(USER_GCODE_##N _DONE_SCRIPT)); }); - #if HAS_USER_ITEM(1) - USER_ITEM(1); + #define HAS_CUSTOM_MENU_ITEM(N) (defined(CUSTOM_MENU_MAIN_DESC_##N) && defined(CUSTOM_MENU_MAIN_GCODE_##N)) + #define CUSTOM_MENU_ITEM(N) ACTION_ITEM_P(PSTR(CUSTOM_MENU_MAIN_DESC_##N), []{ _lcd_custom_menu_main_gcode(PSTR(CUSTOM_MENU_MAIN_GCODE_##N _DONE_SCRIPT)); }); + #if HAS_CUSTOM_MENU_ITEM(1) + CUSTOM_MENU_ITEM(1); #endif - #if HAS_USER_ITEM(2) - USER_ITEM(2); + #if HAS_CUSTOM_MENU_ITEM(2) + CUSTOM_MENU_ITEM(2); #endif - #if HAS_USER_ITEM(3) - USER_ITEM(3); + #if HAS_CUSTOM_MENU_ITEM(3) + CUSTOM_MENU_ITEM(3); #endif - #if HAS_USER_ITEM(4) - USER_ITEM(4); + #if HAS_CUSTOM_MENU_ITEM(4) + CUSTOM_MENU_ITEM(4); #endif - #if HAS_USER_ITEM(5) - USER_ITEM(5); + #if HAS_CUSTOM_MENU_ITEM(5) + CUSTOM_MENU_ITEM(5); #endif - #if HAS_USER_ITEM(6) - USER_ITEM(6); + #if HAS_CUSTOM_MENU_ITEM(6) + CUSTOM_MENU_ITEM(6); #endif - #if HAS_USER_ITEM(7) - USER_ITEM(7); + #if HAS_CUSTOM_MENU_ITEM(7) + CUSTOM_MENU_ITEM(7); #endif - #if HAS_USER_ITEM(8) - USER_ITEM(8); + #if HAS_CUSTOM_MENU_ITEM(8) + CUSTOM_MENU_ITEM(8); #endif - #if HAS_USER_ITEM(9) - USER_ITEM(9); + #if HAS_CUSTOM_MENU_ITEM(9) + CUSTOM_MENU_ITEM(9); #endif - #if HAS_USER_ITEM(10) - USER_ITEM(10); + #if HAS_CUSTOM_MENU_ITEM(10) + CUSTOM_MENU_ITEM(10); #endif - #if HAS_USER_ITEM(11) - USER_ITEM(11); + #if HAS_CUSTOM_MENU_ITEM(11) + CUSTOM_MENU_ITEM(11); #endif - #if HAS_USER_ITEM(12) - USER_ITEM(12); + #if HAS_CUSTOM_MENU_ITEM(12) + CUSTOM_MENU_ITEM(12); #endif - #if HAS_USER_ITEM(13) - USER_ITEM(13); + #if HAS_CUSTOM_MENU_ITEM(13) + CUSTOM_MENU_ITEM(13); #endif - #if HAS_USER_ITEM(14) - USER_ITEM(14); + #if HAS_CUSTOM_MENU_ITEM(14) + CUSTOM_MENU_ITEM(14); #endif - #if HAS_USER_ITEM(15) - USER_ITEM(15); + #if HAS_CUSTOM_MENU_ITEM(15) + CUSTOM_MENU_ITEM(15); #endif - #if HAS_USER_ITEM(16) - USER_ITEM(16); + #if HAS_CUSTOM_MENU_ITEM(16) + CUSTOM_MENU_ITEM(16); #endif - #if HAS_USER_ITEM(17) - USER_ITEM(17); + #if HAS_CUSTOM_MENU_ITEM(17) + CUSTOM_MENU_ITEM(17); #endif - #if HAS_USER_ITEM(18) - USER_ITEM(18); + #if HAS_CUSTOM_MENU_ITEM(18) + CUSTOM_MENU_ITEM(18); #endif - #if HAS_USER_ITEM(19) - USER_ITEM(19); + #if HAS_CUSTOM_MENU_ITEM(19) + CUSTOM_MENU_ITEM(19); #endif - #if HAS_USER_ITEM(20) - USER_ITEM(20); + #if HAS_CUSTOM_MENU_ITEM(20) + CUSTOM_MENU_ITEM(20); #endif - #if HAS_USER_ITEM(21) - USER_ITEM(21); + #if HAS_CUSTOM_MENU_ITEM(21) + CUSTOM_MENU_ITEM(21); #endif - #if HAS_USER_ITEM(22) - USER_ITEM(22); + #if HAS_CUSTOM_MENU_ITEM(22) + CUSTOM_MENU_ITEM(22); #endif - #if HAS_USER_ITEM(23) - USER_ITEM(23); + #if HAS_CUSTOM_MENU_ITEM(23) + CUSTOM_MENU_ITEM(23); #endif - #if HAS_USER_ITEM(24) - USER_ITEM(24); + #if HAS_CUSTOM_MENU_ITEM(24) + CUSTOM_MENU_ITEM(24); #endif - #if HAS_USER_ITEM(25) - USER_ITEM(25); + #if HAS_CUSTOM_MENU_ITEM(25) + CUSTOM_MENU_ITEM(25); #endif END_MENU(); } -#endif // HAS_LCD_MENU && CUSTOM_USER_MENUS +void custom_menus_configuration() { + START_MENU(); + BACK_ITEM(MSG_MAIN); + #define HAS_CUSTOM_MENU_ITEM(N) (defined(CUSTOM_MENU_CONFIGURATION_DESC_##N) && defined(CUSTOM_MENU_CONFIGURATION_GCODE_##N)) + #define CUSTOM_MENU_ITEM(N) ACTION_ITEM_P(PSTR(CUSTOM_MENU_CONFIGURATION_DESC_##N), []{ _lcd_custom_menus_configuration_gcode(PSTR(CUSTOM_MENU_CONFIGURATION_GCODE_##N _DONE_SCRIPT)); }); // *********************** + #if HAS_CUSTOM_MENU_ITEM(1) + CUSTOM_MENU_ITEM(1); + #endif + #if HAS_CUSTOM_MENU_ITEM(2) + CUSTOM_MENU_ITEM(2); + #endif + #if HAS_CUSTOM_MENU_ITEM(3) + CUSTOM_MENU_ITEM(3); + #endif + #if HAS_CUSTOM_MENU_ITEM(4) + CUSTOM_MENU_ITEM(4); + #endif + #if HAS_CUSTOM_MENU_ITEM(5) + CUSTOM_MENU_ITEM(5); + #endif + #if HAS_CUSTOM_MENU_ITEM(6) + CUSTOM_MENU_ITEM(6); + #endif + #if HAS_CUSTOM_MENU_ITEM(7) + CUSTOM_MENU_ITEM(7); + #endif + #if HAS_CUSTOM_MENU_ITEM(8) + CUSTOM_MENU_ITEM(8); + #endif + #if HAS_CUSTOM_MENU_ITEM(9) + CUSTOM_MENU_ITEM(9); + #endif + #if HAS_CUSTOM_MENU_ITEM(10) + CUSTOM_MENU_ITEM(10); + #endif + #if HAS_CUSTOM_MENU_ITEM(11) + CUSTOM_MENU_ITEM(11); + #endif + #if HAS_CUSTOM_MENU_ITEM(12) + CUSTOM_MENU_ITEM(12); + #endif + #if HAS_CUSTOM_MENU_ITEM(13) + CUSTOM_MENU_ITEM(13); + #endif + #if HAS_CUSTOM_MENU_ITEM(14) + CUSTOM_MENU_ITEM(14); + #endif + #if HAS_CUSTOM_MENU_ITEM(15) + CUSTOM_MENU_ITEM(15); + #endif + #if HAS_CUSTOM_MENU_ITEM(16) + CUSTOM_MENU_ITEM(16); + #endif + #if HAS_CUSTOM_MENU_ITEM(17) + CUSTOM_MENU_ITEM(17); + #endif + #if HAS_CUSTOM_MENU_ITEM(18) + CUSTOM_MENU_ITEM(18); + #endif + #if HAS_CUSTOM_MENU_ITEM(19) + CUSTOM_MENU_ITEM(19); + #endif + #if HAS_CUSTOM_MENU_ITEM(20) + CUSTOM_MENU_ITEM(20); + #endif + #if HAS_CUSTOM_MENU_ITEM(21) + CUSTOM_MENU_ITEM(21); + #endif + #if HAS_CUSTOM_MENU_ITEM(22) + CUSTOM_MENU_ITEM(22); + #endif + #if HAS_CUSTOM_MENU_ITEM(23) + CUSTOM_MENU_ITEM(23); + #endif + #if HAS_CUSTOM_MENU_ITEM(24) + CUSTOM_MENU_ITEM(24); + #endif + #if HAS_CUSTOM_MENU_ITEM(25) + CUSTOM_MENU_ITEM(25); + #endif + END_MENU(); +} + +#endif // HAS_LCD_MENU && ( CUSTOM_MENUS_MAIN || CUSTOM_MENUS_CONFIGURATION ) diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index 992303b791..da85e4ee03 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -64,8 +64,8 @@ void menu_motion(); void menu_temperature(); void menu_configuration(); -#if ENABLED(CUSTOM_USER_MENUS) - void menu_user(); +#if ENABLED(CUSTOM_MENUS_MAIN) + void custom_menus_main(); #endif #if HAS_POWER_MONITOR @@ -191,11 +191,11 @@ void menu_main() { SUBMENU(MSG_CONFIGURATION, menu_configuration); - #if ENABLED(CUSTOM_USER_MENUS) - #ifdef CUSTOM_USER_MENU_TITLE - SUBMENU_P(PSTR(CUSTOM_USER_MENU_TITLE), menu_user); + #if ENABLED(CUSTOM_MENUS_MAIN) + #ifdef CUSTOM_MENUS_MAIN_TITLE + SUBMENU_P(PSTR(CUSTOM_MENUS_MAIN_TITLE), custom_menus_main); #else - SUBMENU(MSG_USER_MENU, menu_user); + SUBMENU(MSG_CUSTOM_MENUS_MAIN, custom_menus_main); #endif #endif