Skip to content

Commit

Permalink
🐛 Prevent divide-by-zero in calc_timer_interval (MarlinFirmware#25557)
Browse files Browse the repository at this point in the history
  • Loading branch information
tombrazier authored and EvilGremlin committed Apr 8, 2023
1 parent 8d224be commit 5f0707c
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 5f0707c

Please sign in to comment.