From 241c06218822d63e47710acfa6885351fe495bc5 Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Sun, 26 Mar 2023 10:46:55 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Prevent=20divide-by-zero=20in=20?= =?UTF-8?q?calc=5Ftimer=5Finterval=20(#25557)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/stepper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 5c0034a5f9..f7436e51d5 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -2094,7 +2094,8 @@ hal_timer_t Stepper::calc_timer_interval(uint32_t step_rate) { #ifdef CPU_32_BIT - return uint32_t(STEPPER_TIMER_RATE) / step_rate; // A fast processor can just do integer division + // A fast processor can just do integer division + return step_rate ? uint32_t(STEPPER_TIMER_RATE) / step_rate : HAL_TIMER_TYPE_MAX; #else