Browse Source

Sanity check USER_GCODE formatting

Scott Lahteine 5 years ago
parent
commit
10d855cb21
1 changed files with 23 additions and 0 deletions
  1. 23
    0
      Marlin/src/inc/SanityCheck.h

+ 23
- 0
Marlin/src/inc/SanityCheck.h View File

@@ -2024,6 +2024,29 @@ static_assert(sanity_arr_3[0] > 0 && sanity_arr_3[1] > 0 && sanity_arr_3[2] > 0
2024 2024
   #error "GCODE_MACROS_SLOTS must be a number from 1 to 10."
2025 2025
 #endif
2026 2026
 
2027
+#if ENABLED(CUSTOM_USER_MENUS)
2028
+  #ifdef USER_GCODE_1
2029
+    constexpr char _chr1 = USER_GCODE_1[strlen(USER_GCODE_1) - 1];
2030
+    static_assert(_chr1 != '\n' && _chr1 != '\r', "USER_GCODE_1 cannot have a newline at the end. Please remove it.");
2031
+  #endif
2032
+  #ifdef USER_GCODE_2
2033
+    constexpr char _chr2 = USER_GCODE_2[strlen(USER_GCODE_2) - 1];
2034
+    static_assert(_chr2 != '\n' && _chr2 != '\r', "USER_GCODE_2 cannot have a newline at the end. Please remove it.");
2035
+  #endif
2036
+  #ifdef USER_GCODE_3
2037
+    constexpr char _chr3 = USER_GCODE_3[strlen(USER_GCODE_3) - 1];
2038
+    static_assert(_chr3 != '\n' && _chr3 != '\r', "USER_GCODE_3 cannot have a newline at the end. Please remove it.");
2039
+  #endif
2040
+  #ifdef USER_GCODE_4
2041
+    constexpr char _chr4 = USER_GCODE_4[strlen(USER_GCODE_4) - 1];
2042
+    static_assert(_chr4 != '\n' && _chr4 != '\r', "USER_GCODE_4 cannot have a newline at the end. Please remove it.");
2043
+  #endif
2044
+  #ifdef USER_GCODE_5
2045
+    constexpr char _chr5 = USER_GCODE_5[strlen(USER_GCODE_5) - 1];
2046
+    static_assert(_chr5 != '\n' && _chr5 != '\r', "USER_GCODE_5 cannot have a newline at the end. Please remove it.");
2047
+  #endif
2048
+#endif
2049
+
2027 2050
 #if ENABLED(BACKLASH_COMPENSATION) && IS_CORE
2028 2051
   #error "BACKLASH_COMPENSATION is incompatible with CORE kinematics."
2029 2052
 #endif

Loading…
Cancel
Save