From 10d855cb2130d44dd90079ea6812d560c0562c38 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 4 Feb 2019 06:36:21 -0600 Subject: [PATCH] Sanity check USER_GCODE formatting --- Marlin/src/inc/SanityCheck.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 258c5a344f..a18ad3dc92 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2024,6 +2024,29 @@ static_assert(sanity_arr_3[0] > 0 && sanity_arr_3[1] > 0 && sanity_arr_3[2] > 0 #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."); + #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."); + #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."); + #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."); + #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."); + #endif +#endif + #if ENABLED(BACKLASH_COMPENSATION) && IS_CORE #error "BACKLASH_COMPENSATION is incompatible with CORE kinematics." #endif