From eec95d6fb744703acdbc2cd93a3aa908fab1875e Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Tue, 13 Jul 2021 19:40:00 +0200 Subject: [PATCH] Motion: add assertions for stepTimerQuantum --- src/modules/motion.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/motion.h b/src/modules/motion.h index 301a4c9..7a864e1 100644 --- a/src/modules/motion.h +++ b/src/modules/motion.h @@ -14,6 +14,12 @@ using pulse_gen::pos_t; using pulse_gen::st_timer_t; using pulse_gen::steps_t; +// Check for configuration invariants +static_assert( + (1. / (F_CPU / config::stepTimerFrequencyDivider) * config::stepTimerQuantum) + < (1. / config::maxStepFrequency / 2), + "stepTimerQuantum must be smaller than the maximal stepping frequency interval"); + /// Main axis enumeration enum Axis : uint8_t { Pulley,