🐛 Prevent divide-by-zero in calc_timer_interval (#25557)

This commit is contained in:
tombrazier 2023-03-26 10:46:55 +01:00 committed by GitHub
parent 24a9a66f0a
commit 241c062188
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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