From 34308368c02bb4137a45fa8cb996c6d4399cf845 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 13 Apr 2017 06:25:43 -0500 Subject: [PATCH] Sanity check per-axis settings for size --- Marlin/SanityCheck.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index b2e271aa1..b38c6ffee 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -1074,3 +1074,16 @@ static_assert(1 >= 0 #endif , "Please select no more than one LCD controller option." ); + +/** + * Require 4 or more elements in per-axis initializers + */ +constexpr float sanity_arr_1[] = DEFAULT_AXIS_STEPS_PER_UNIT, + sanity_arr_2[] = DEFAULT_MAX_FEEDRATE, + sanity_arr_3[] = DEFAULT_MAX_ACCELERATION; +static_assert(COUNT(sanity_arr_1) >= XYZE, "DEFAULT_AXIS_STEPS_PER_UNIT requires 4 (or more) elements."); +static_assert(COUNT(sanity_arr_2) >= XYZE, "DEFAULT_MAX_FEEDRATE requires 4 (or more) elements."); +static_assert(COUNT(sanity_arr_3) >= XYZE, "DEFAULT_MAX_ACCELERATION requires 4 (or more) elements."); +static_assert(COUNT(sanity_arr_1) <= XYZE_N, "DEFAULT_AXIS_STEPS_PER_UNIT has too many elements."); +static_assert(COUNT(sanity_arr_2) <= XYZE_N, "DEFAULT_MAX_FEEDRATE has too many elements."); +static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too many elements.");