Skip to content

Commit

Permalink
🐛 Prevent divide-by-zero in calc_timer_interval (#25557)
Browse files Browse the repository at this point in the history
  • Loading branch information
tombrazier authored and thinkyhead committed Apr 10, 2023
1 parent 0fb8371 commit 646da4d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Marlin/src/module/stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 646da4d

Please sign in to comment.